Skip to content

feat(agy): support hot model switching without process restart - #3889

Open
vansin wants to merge 1 commit into
mainfrom
feat/agy-hot-model-switch
Open

vansin wants to merge 1 commit into
mainfrom
feat/agy-hot-model-switch

Conversation

@vansin

@vansin vansin commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

antigravity-acp (agy) spawns agy acp per turn and calls session/set_model(MODEL) before each prompt, so switching models does not require exiting/restarting agent-node (which previously caused a 12–60s outage and dropped the in-process agySessionId).

  • agent-node:
    • computeApplyMode classifies model-only patches on antigravity-* / agy runtimes as hot (mixed model + flags or channels stay restart).
    • processConfigUpdate hot path updates in-memory MODEL, clears stale agyEffectiveModel / agyModelSource, writes config.json atomically (with .prev), acks applied, and immediately pushes report_status so Hub/App reflect the new model without waiting for the next periodic heartbeat.
    • Advertises agy_hot_model_capable: true in config_snapshot and records real agyEffectiveModel / agyModelSource on turn completion.
  • commhub-server:
    • Preserves agy_hot_model_capable in report_status config_snapshot Zod schema (tools/list byte margins remain >340 B under all ceilings).
    • Exposes agy_hot_model_capable on GET /api/nodes and GET /api/nodes/:id/config.
    • Classifies antigravity model-only updates as apply_mode: "hot" only when the node explicitly advertises agy_hot_model_capable: true, preserving restart semantics and warnings for older nodes.

Verification

  • agent-node: bun test src/runtime/config-apply.test.ts + npm run build (pass)
  • server: bun test src/config-apply-validate.test.ts src/agy-catalog-projection.test.ts src/tool-audience-http.test.ts src/config-apply-sec1.test.ts src/build-commit-report-http.test.ts (168 pass, 0 fail; tools/list byte margins: node 356 B, user 727 B, all 342 B)

Antigravity (agy) spawns `agy acp` per turn and calls `session/set_model(MODEL)`
before each prompt, so a model-only config update does not require restarting
agent-node (which previously dropped the node for 12-60s and cleared the
in-process agySessionId).

- agent-node: classify antigravity model-only patches as `hot`, update `MODEL`
  in place, clear stale `agyEffectiveModel`, ack applied immediately, push an
  immediate `report_status` heartbeat, advertise `agy_hot_model_capable: true`,
  and record `agyEffectiveModel` / `agyModelSource` on turn completion.
- commhub-server: preserve `agy_hot_model_capable` in `report_status` schema,
  expose it on `/api/nodes` and `/api/nodes/:id/config`, and classify
  antigravity model-only updates as `apply_mode: "hot"` only when the node
  explicitly advertises `agy_hot_model_capable: true` (older nodes keep
  `restart` semantics and warnings).

Diff-Shape: +157/-18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T11:42:18.280000Z 7225097 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant