Repository navigation
fix(agy): delete self-hosted environment at end of every turn - #33
Merged
Merged
Conversation
Follow up on google/ax#760 discussion: keep ax-server's non-empty spec.sessionId default (metadata.uid) and stop skipping deleteEnvironment when AX_SESSION_FILE is non-empty. Each turn now deletes its ephemeral remote self-hosted environment on exit and drops the environment key from disk while preserving last_interaction_id and done digest under <workspace>/.ax/sessions/<id>/managed-agent.json so follow-up turns continue via previous_interaction_id. Mid-interaction suspends (exit 143) and transient poll errors keep the live environment and pending state intact so resume still reattaches. Verification: - ./scripts/verify/boilerplate.sh (pass) - cd agy && gofmt -l . (clean) - cd agy && go vet ./... (clean) - cd agy && go test -race -count=1 ./... (all unit tests pass; 19.851s) - Live two-turn check against Gemini API (GEMINI_API_KEY + gemini-api v0.5.0 on PATH, AX_SESSION_FILE set): Turn 1 created env 51bfd12c-44b4-4955-bfc3-37ccbd8554c9 and deleted it on exit (0 remaining self-hosted envs, mode 0600 state with last_interaction_id only and no environment key); Turn 2 created fresh env 352f219a-e0f4-476d-81d7-86d090f2dce4, chained via previous_interaction_id, recalled the in-memory codeword CEDAR-88, and deleted its env on exit (0 remaining self-hosted envs). Reproduce: build ./agy, set GEMINI_API_KEY and AX_SESSION_FILE, run two sequential turns in the same workspace, and check `gemini-api environments list --mode self_hosted` and `managed-agent.json` after each turn.
mayawang
force-pushed
the
fix/antigravity-cleanup-env-on-finish
branch
from
November 25, 2026 04:59
3cfbd98 to
c97809c
Compare
mayawang
marked this pull request as ready for review
November 25, 2026 04:59
Collaborator
Author
|
Rebased onto
Marking ready for review. |
rakyll
approved these changes
Nov 25, 2026
mayawang
added a commit
that referenced
this pull request
Nov 25, 2026
Update agy-cli to match the google/ax runner, launcher, and data-plane output changes (supersedes draft #29 after #34): - agy-cli/Dockerfile: install the launcher at /usr/local/bin/ax-launcher (google/ax#734) and symlink /usr/local/bin/ax-harness -> ax-launcher for v0.4.0-rc.1 compatibility. - agy-cli/verify_image.sh: fail if either ax-runner (google/ax#677) or ax-task-runner is present, and require both /usr/local/bin/ax-launcher and /usr/local/bin/ax-harness. - agy-cli/ax-harness and .github/workflows/agy-cli.yaml: update comments, ax-launcher stderr prefixes, and workflow step title. - agy-cli/README.md: update ax-task-runner -> ax-runner, ax-harness -> ax-launcher (with compatibility symlink note), and status.outcome.output -> <workspace>/.ax/output (google/ax#756). Leaves agy/ untouched so #33 stays conflict-free. Verification: - ./scripts/verify/boilerplate.sh (pass) - bash -n agy-cli/ax-harness agy-cli/verify_image.sh agy-cli/test_harness.sh (pass) - ./agy-cli/test_harness.sh (ALL AX-HARNESS TESTS PASSED) - ./fakes/mock-gemini/selftest.sh (ALL MOCK GEMINI SELFTEST CHECKS PASSED) - python3 -c "import yaml; yaml.safe_load(open('.github/workflows/agy-cli.yaml'))" (pass) - Mocked docker verification of ./agy-cli/verify_image.sh (runtime/bundled pass; rejects ax-runner, ax-task-runner, missing ax-launcher, missing ax-harness) - (cd agy && go vet ./... && go test -race -count=1 ./...) (pass) - Note: local docker build skipped (no Docker socket in this environment); covered by the agy-cli and Release Images dry-run PR workflows.
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.
Follow-up to google/ax#760 (closed in favor of keeping
ax-server's non-emptyspec.sessionIddefault).What changed
agy/main.go(finish): Always delete the ephemeral remote self-hosted environment when a turn completes or exits with an error, and drop the cachedenvironment.Keyfrom disk. WhenAX_SESSION_FILEis set, retainlast_interaction_idand thedonedigest under<workspace>/.ax/sessions/<id>/managed-agent.jsonso follow-up turns continue fromprevious_interaction_id. Mid-interaction suspends (exit 143) and transient poll errors keep the live environment andpendingstate intact to reattach on resume.agy/README.md: Document the per-turn environment lifecycle and note that the environment key stays on disk only while an interaction is in flight.agy/main_test.go: UpdateTestSessionandTestRequiresActionClearsPendingAndDeletesEnvto verify remote environments are deleted after each turn while preservinglast_interaction_idfor subsequent turns.Verification
./scripts/verify/boilerplate.sh(pass)cd agy && gofmt -l .(clean)cd agy && go vet ./...(clean)cd agy && go test -race -count=1 ./...(all unit tests pass against the fake Gemini API,19.9s)GEMINI_API_KEY+gemini-apiv0.5.0,AX_SESSION_FILEset): Turn 1 created and deleted51bfd12c-44b4-4955-bfc3-37ccbd8554c9, writingmanaged-agent.json(0600) withlast_interaction_idonly (environmentomitted). Turn 2 created a fresh environment (352f219a-e0f4-476d-81d7-86d090f2dce4), chained viaprevious_interaction_id, recalled the in-memory codewordCEDAR-88, and deleted its environment on exit (0leftover remote environments after each turn).