Repository navigation
Linux VM: detached output, kept session logs, git in the guest, bundled Firecracker - #80
Merged
Merged
Conversation
…d; detached sessions keep their output after exit
…in the guest; docs: VM backends and the edit-in-VM, push-from-host design
# Conflicts: # CHANGELOG.md # scripts/pack.mjs
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the Linux/Firecracker
--vmproblems found when testing on the ThinkPad (Arch, kernel 7.2.5, Firecracker v1.17.0), and ships Firecracker with the Linux x64 package.What changed
--vmoutput was dropped.guestPtykept only oneonDatalistener. The worker registers two (the output log, then the quiet detector), so the second replaced the first, andoutput.logandgild attachstayed empty. It now keeps a list of listeners. Output that arrives before the first listener is held for it, and an exit that comes beforeonExitis replayed.VmChild.onExitdelegates to it, so a fast exit can't leave the session hanging. (src/isolation/session.ts,src/spawn-vm.ts)DetachedHost.cleanup()deletedsessions/<id>/output.log. The log is now kept as~/.gild/sessions/<id>.output.log:.1rotation is dropped.gild attach --watch <id>prints the kept log once the session has ended.gild stopcaller never sees them still there. This used to be a race; it showed up as a flake in the detach harness./workspace("detected dubious ownership"):mke2fs -dkeeps the host uid while the agent runs as root. The guest env now carriesGIT_CONFIG_COUNT/KEY_0/VALUE_0=safe.directory=/workspace(guestGitEnvironment). Doing it in the env needs no image rebuild and covers vz too.scripts/vendor-firecracker.mjs, run frombun run pack(so the releasepublishjob runs it), downloads v1.17.0 x86_64. It requires the tarball to match both the pin inscripts/firecracker.jsonand Firecracker's published.sha256.txt, and checks each extracted file's hash.bin/firecrackerin@gildforge/cli-linux-x64, withLICENSE,NOTICEandTHIRD-PARTYinvendor/firecracker/.packed-packages.mjschecks the packed hashes and the exec bit, and refusesbin/firecrackerin any other package.vm.firecrackerin isolation.json, then the binary next to the gild executable (defaultFirecracker), then PATH.--vmuses (Multipass on macOS and Windows by default, vz only with avmblock in isolation.json), the bundling, and the design. Firecracker guests have no network by default, so the agent edits in the VM and the host commits and pushes;.gitnever syncs back; Multipass differs because it pushes from inside.spawn --vmhelp, and CHANGELOG under 0.6.14. package.json is not bumped.Caching (AGENTS.md 7c): no server-rendered work here.
Evidence
Local gates, run on macOS from
.github/workflows:bun test --timeout 30000: 308 pass, 18 skip, 0 failbun run format:check: oknpx tsc --noEmit: okbun run pack:verified firecracker 1.17.0: linux-x64bun run test:install:verified npm pack: @gildforge/cli-linux-x64@0.6.13 (14 files), okbun run test:installed-pty: 105 passbun run test:install:revert: okClippy: not applicable (no Rust changed).
Revert proofs:
session.tsreverted: the two new guestPty tests fail (Expected "EARLY Linux (none) 5.10", Received ""; exit not replayed).detached session: stopfails withAssertionError: output not kept, and the prune test fails.guestGitEnvironmentdropped fromguestEnvironment: the guest env test fails.GIT_TEST_ASSUME_DIFFERENT_OWNER=1and passes with the env.Live on omarchy (x86_64, Firecracker via KVM). This branch's
packages/cli-linux-x64was copied over (bin/gild+bin/firecracker).~/.local/bin/firecrackerwas moved aside, and nothing was on PATH (which: no firecracker):/home/sami/Projects/vmtest/pkg/bin/firecracker --api-sock …, and serial.log showsRunning Firecracker v1.17.0.microVM ready in 216–246 ms (image 19–29 ms), ~0.5 s for a wholetruesession.spawn --detachreturns in 434 ms.output.logandattach --watchboth showedEARLYandLinux (none) 5.10.245+ … x86_64.lv1.output.log(0600) was kept, andgild attach --watch lv1printedEARLY … LATEplus[lv1 has ended; its output is kept in …].STATUS_OK,Switched to a new branch 'guest/test',COMMIT_OK, andgit logshowed the guest commit.firecracker.txtsynced to the host, and the guest.gitwas retained for recovery, as designed.Notes
https://releases.gild.gg/cli/v0.6.13/vm/manifest.jsonreturns HTTP 404, sogild spawn --vmon Linux 0.6.13 fails with "no image was published for this version". The live test used isolation.json pointing at the 0.6.11 image (same guest protocol).-claude