Repository navigation
Conversation
Stop defaulting spec.sessionId to metadata.uid inside CreateTask so one-off tasks write an empty AX_SESSION_FILE. Launchers use an empty AX_SESSION_FILE to distinguish one-off tasks from multi-turn sessions. In agentexecutor/images#30 / google#31, ax-antigravity deletes the remote Gemini API environment on exit only when AX_SESSION_FILE is empty; defaulting spec.sessionId to metadata.uid meant every server-created task looked like a named session and kept its remote environment alive forever. Reverses the server-side default introduced from google#542 / google#587. Callers that want durable session state or lineage grouping (such as multi-turn antigravity or agy runs) should set spec.sessionId explicitly. Changes: - internal/server/server.go: stop defaulting task.Spec.SessionId in CreateTask and simplify taskSpecMatchesExisting to direct proto.Equal comparison (dropping the clone + UID patch shim). - pkg/apis/v1alpha1/task.proto (and regenerated task.pb.go): update the session_id field comment. - internal/apivalidation/task.go, runner/launcher.go: update comments. - docs/manifests.md, docs/local_installer.md: document optional empty default. - internal/server/server_test.go: update the lifecycle check and add TestServer_TaskSessionID covering omitted/explicit sessionId and QUEUED retry immutability checks. - test/e2e/promote_test.go: set an explicit spec.sessionId in promoteManifest so TestE2E_Promote keeps asserting non-empty sessionId preservation across ax promote. Verification: - make verify (buf format/lint/generate, go mod tidy, go fmt, golangci-lint: 0 issues) - go build -o /dev/null ./cmd/ax ./cmd/ax-server ./cmd/ax-runner - go test -c -o /dev/null ./test/e2e - go test -count=1 ./... (pass; postgres store tests skip locally without AX_TEST_POSTGRES_URL) - go test -race -count=1 ./internal/server/... ./cmd/ax/... ./runner/... ./pkg/apis/v1alpha1/... ./internal/apivalidation/...
rakyll
reviewed
Nov 25, 2026
| - **`spec.goal.text`** is an optional natural-language description of the task's objective, delivered as part of the task metadata. | ||
| - **`spec.retry`** configures retry limits and backoff (`maxRetries >= 0`, non-negative `initialBackoff` and `maxBackoff` with `initialBackoff <= maxBackoff`, and `backoffMultiplier >= 1.0` when set). *Not available yet: ax-server rejects `spec.retry` until task retries are wired.* | ||
| - **`spec.sessionId`** groups related tasks or multi-turn runs under one correlation ID. When omitted, `CreateTask` defaults it to the server-assigned `metadata.uid`. | ||
| - **`spec.sessionId`** is an optional correlation ID for grouping related tasks or multi-turn runs. When omitted, it stays empty. |
Member
There was a problem hiding this comment.
Shouldn't we generate a UUID instead of allowing an empty one. It's better to have a non-empty session_id.
Collaborator
Author
There was a problem hiding this comment.
Agreed, keeping session_id non-empty is better and main already defaults it to metadata.uid (a generated UUID) with docs and test coverage. Closing this out and I'll handle remote environment cleanup on the agentexecutor/images side instead (deleting the self-hosted environment after each turn while keeping last_interaction_id saved for follow-up turns).
mayawang
added a commit
to agentexecutor/images
that referenced
this pull request
Nov 25, 2026
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
added a commit
to agentexecutor/images
that referenced
this pull request
Nov 25, 2026
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.
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.
Stop defaulting
spec.sessionIdtometadata.uidinCreateTaskso one-off tasks write an emptyAX_SESSION_FILE.Motivation
Launchers read
AX_SESSION_FILEto tell one-off tasks apart from multi-turn sessions. Inagentexecutor/images#30(and#31),ax-antigravityonly deletes the remote Gemini API environment on exit whenAX_SESSION_FILEis empty. Becauseax-serverdefaultedspec.sessionIdtometadata.uid, every server-created task passed a non-emptyAX_SESSION_FILEand left its remote environment behind after finishing.This changes the default added in #587 (from #542).
metadata.uidstill uniquely identifies each task; callers that want durable session state or lineage grouping setspec.sessionIdexplicitly.Changes
internal/server/server.go: remove thetask.Spec.SessionId = task.Metadata.Uiddefaulting inCreateTask, and simplifytaskSpecMatchesExistingto a nil-safeproto.Equalcheck.pkg/apis/v1alpha1/task.protoandpkg/apis/v1alpha1/task.pb.go: update thesession_idcomment (regenerated viamake verify; no descriptor/field changes).internal/apivalidation/task.go,runner/launcher.go,docs/manifests.md,docs/local_installer.md: update comments and docs to notespec.sessionIdstays empty when omitted.internal/server/server_test.go: assert omittedsessionIdstays empty in the lifecycle test and addTestServer_TaskSessionIDcovering omitted/explicit values andQUEUEDretry immutability mismatches.test/e2e/promote_test.go: set an explicitsessionIdinpromoteManifestsoTestE2E_Promotekeeps verifying non-emptysessionIdpreservation acrossax promote.Impact check
QUEUEDretry across upgrade: dropping the UID shim intaskSpecMatchesExistingmeans aQUEUEDtask created by an olderax-server(with defaultedsessionId == metadata.uid) will reject a retry that omitssessionIdwithFailedPrecondition.agentexecutor/images(antigravity/): emptyAX_SESSION_FILEkeeps per-task state under<workspace>/.axand deletes the remote environment on exit; non-empty retains it under<workspace>/.ax/sessions/<id>.agentexecutor/images(agents/antigravity): emptyAX_SESSION_FILEskips symlinking~/.gemini/antigravity-cliinto/workspace/.ax/sessions/<id>.hack/hero-demo/task-starter.yamlalready setssessionId: hero-demo-session.ax describe task/ax promote:ax describealready hides emptysessionId;ax promotecopiestask.Specverbatim.agentexecutor/studio: already falls back totask:<name>whensessionIdis empty.Follow-up note for
agentexecutor/images: once this merges, remove the note about server-sidespec.sessionIddefaulting inantigravity/README.md.Verification
Note: Postgres store integration tests skip locally when
AX_TEST_POSTGRES_URLis unset and run in CI againstpostgres:17-alpine.