Repository navigation
Restart notice: tell the model agy's "server restart" notice is about nothing of the client's - #36
Merged
Merged
Conversation
… nothing of the client's agy adds a SYSTEM_MESSAGE step, "[Notice] All your subagents and background tasks have been stopped due to server restart. ...", the first time a session gets a prompt in an agy process other than the one that last ran it: session/resume or session/load, whether the old process closed the session first or not (agy 1.5.20 measured locally, 1.5.22 in production). The same process going on, or closing and resuming in the same process, adds none. The bridge resumes in a new process whenever the old one was evicted (a full AGY_BRIDGE_MAX_PROCS pool, IDLE_MS) or its host restarted; on jun the 14 resumed turns of one ZCode conversation carried the 14 notices, to the second, and the 11 turns on a kept process none. The model took it for the client's own subagents and dispatched them again. agy has no flag, capability or _meta that turns it off, and closing the session first does not avoid it. With agy's own tools turned off, agy runs no subagent or background task in a bridged session, so the notice is never about anything that ran. The bridge's AGENTS.md now says so and tells the model not to restart, re-dispatch or mention anything for it. Left out with AGY_BRIDGE_ALLOW_AGY_TOOLS=1, where agy's background tasks really stop. agy reads AGENTS.md again when it resumes in a new process, so sessions opened before this take it too; their first resume after it reads uncached once (cachedReadTokens ~7.7k -> 0), then stays cached. patch-e2e: a conversation evicted by another (MAX_PROCS=1) resumes in a new agy whose AGENTS.md has the note (fails on the code before this change), and not with AGY_BRIDGE_ALLOW_AGY_TOOLS=1. swap-agy-cli.sh counts 6 markers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
ZCode users on
agy-cli/gemini-4-neonandagy-cli/claude-opus-5-5saw this every few turns and dispatched their subagents again:It is a
SYSTEM_MESSAGEstep agy itself adds. Neither the client nor the gateway sends it.When agy adds it
Measured with real agy 1.5.20:
session/closethensession/resumein the same processsession/resume(old one SIGTERMed, as the bridge does)session/resume(old one didsession/closefirst)session/loadIn production (jun, agy 1.5.22), conversation
7e43187dhad 14session_newresumed:truebridge events and 14 notices, each pair in the same second. The 11 turns that stayed on their process had none. The processes are replaced afterAGY_BRIDGE_MAX_PROCSLRU eviction orIDLE_MS.Fix (fallback)
agy has no flag, capability or
_metathat turns the notice off, and a graceful close doesn't avoid it. With agy's own tools turned off, a bridged session never runs a subagent or background task of agy's own, so the notice is never true here. The bridge's workspaceAGENTS.mdnow says so and tells the model not to restart, re-dispatch or mention anything because of it. The line is left out withAGY_BRIDGE_ALLOW_AGY_TOOLS=1, where agy's tasks really stop.Limits:
AGENTS.mdon a resume in a new process, so existing sessions pick the note up. Their first resume after the upgrade reads uncached once (cachedReadTokenswent from ~7.7k to 0), then the cache holds again.Tests
fork/patch-e2e.mjs: a conversation evicted by another one (AGY_BRIDGE_MAX_PROCS=1) resumes in a new agy, and that agy'sAGENTS.mdcarries the note. This test fails on the code before this change. WithAGY_BRIDGE_ALLOW_AGY_TOOLS=1the note is absent.fork/fork.sh testlocally: patch-e2e 18/18 pass. Upstreambun testhas 3 failures; the pristine upstream snapshot fails the same 3 in the same environment, so they are environmental (re2-pattern-unitGo toolchain,catalog).fork/swap-agy-cli.shnow counts 6 patch markers.🤖 Generated with Claude Code