27 Commits
Author SHA1 Message Date
yetone 836f2e4e4c agy-cli 0.1.99: DSH's own notes beside a tool result no longer end the live session
seven_7cx on X (DSH + agy-cli on multi-step tool tasks): cache reads
jumping between 10-20 and 0, drop_live (history_mismatch, interrupted)
and session_new over and over, the history replayed each time, and the
model looping on tool calls.

Cause: DSH adds user-role notes of its own before a step (time-context's
"Time sampled while preparing turn N, step M" clock, the runtime-context
snapshot, the repeat-tool and plan-mode notes, tmux-context's location
reading, a finished background job's notice, the model-changed note).
Beside a live tool_result, inspectToolTurn took any such user text for
the user steering, so the step was "interrupted": the live session was
dropped and the whole history replayed in a new one, which put the
cache at 0 and the model back at the start of its task. The same notes
were already known as meta by isMetaOnlyUserText, but only for finding
a prompt, not here.

Fix: takeDshNotes lifts DSH's notes out of a user text in
inspectToolTurn and hands them on as context notices with the result;
isMetaOnlyUserText also knows the three newer ones.

Test (repeat-batch.mjs): a 9-step tool turn with one DSH note per step,
in the result's own message and in a message of its own. Red on 0.1.98
(the turn never ends; drop_live per step), green now; the session is
opened once and no drop_live is logged.

Run (mica/mote via mote-run, bun 1.4.2): repeat-batch.mjs 81 pass,
steer-in-session, conversation-key, dropped-call 50 pass, compat 13 pass.

Not tried: a real DSH session against a real agy account. history_mismatch
was not reproduced from DSH's shape; it was seen after a replay, and the
step notes were the only DSH-specific cause found by reading DSH's
plugins (dsh-time-context, dsh-tmux-context, dsh-tool-jobs, dsh-agent).
2026-11-19 22:52:38 +08:00
yetoneandifccod c18d87f743 agy-cli 0.1.95: agy's high-traffic ending is a 503, and 1.5.10's ban wording a 403
When Google had no capacity for the model, agy ended the reply with
"⚠ Our servers are experiencing high traffic right now, please try again
in a minute. (UNAVAILABLE (code 503): No capacity available for model …)".
The bridge passed it on as the whole reply, a 200, so nothing behind
magpie tried again. ifccod found this and patched it in their fork
(ifccod/opencode-agy-cli-auth, MIT, FORK.md "Busy ending"). Their code
is ported here: the ending is held and matched by its start, the way the
quota ending is, and it ends the turn as overloaded_error with status
503 (HTTP 503 without streaming). Retrying is allowed, and the account is
not rested.

agy 1.5.10 words a banned account's 403 without the
"PERMISSION_DENIED (code 403):" that 1.5.9 put in front. A real banned
account was probed over ACP on 11-18: the whole reply was that sentence,
end_turn, a 200. The bare sentence is now a marker, answered with the
same no-retry permission_error 403 as #1201.

Not taken from the fork: its video path. That path has agy's server-side
read_file open videos downloaded into a media folder added with
--add-dir, and it lets any gateway caller have agy read paths on the
host. It was not tried with a real account either, since the probe
account is banned.

Run (mica, HOME=$(mktemp -d), at 89df5a62+this diff):
- packages/agy-cli/test repeat-batch.mjs: 79 pass, 0 fail. usage.mjs
  (cp-hook preload): 44 pass.
- The new tests on the old index.mjs, by hand: 3 of the 4 fail (busy
  stream, busy non-stream 503, 1.5.10 ban). The quoting test passes on
  both, as it should.
- Root bun test: 9070 tests, 0 fail, 20 skip (487s).

Not tried: a real high-traffic ending; it is taken from ifccod's capture.

Co-authored-by: ifccod <102718410+ifccod@users.noreply.github.com>
2026-11-18 16:14:01 +08:00
yetone e38f4f39fe agy-cli 0.1.94: an ending with only thinking is asked again in the session, then is an error
fnckerpoi on X (magpie 0.1.4402, agy-cli 0.1.91, DSH 0.2.2-rc.3 through
billion-context, provider concurrency 1): "acp-proxy: the turn
degenerated again after the continuation nudge".

The words are billion-context's. Its plugin pipe calls a turn
"degenerate" when it ends cleanly (end_turn) with no tool call and no
answer text but did carry thinking; it then resends the request once
with a nudge appended, and when that comes back the same it ends the
stream with this error.

agy-cli handed such turns over. When a model call returns neither text
nor tool calls, agy writes "⚠ Model produced invalid output." (dropped
since 0.1.42, #1124) and calls the model again; when that call is empty
too, agy ends the prompt on end_turn with only thinking, and the bridge
sent it as a finished reply that said nothing. billion-context's nudge
then arrived as a new request whose history (no empty assistant turn)
no longer matched the session, so the bridge stopped agy and replayed
the whole conversation in a new session: the same context, cold, and
with concurrency 1 queued behind the other requests. It came back empty
again. Concurrency 1 adds the wait; it doesn't cause the empty reply.

- Turn tracks, since the turn began or its last tool call, whether the
  model said any non-blank text, thought, or hit agy's invalid-output
  retry. An end_turn (or no stop reason) with thinking or that retry and
  no text is an empty ending.
- #runTurn asks such an ending once more in the same session, as one
  more session/prompt of the same response, with neutral words that
  name nobody ("Your last reply was empty. Continue: …"). The client
  sees only the answer.
- Still empty, the turn ends with an AgentTurnError: "the model ended
  its reply twice with no text and no tool call (agy: Model produced
  invalid output); send the request again, or try another model". It is
  an error before any content, so magpie's gateway asks the next
  account, and agy's session is kept, so the same request sent again
  continues in it instead of a replay.
- A bare empty ending (no thinking either) and a max_tokens ending are
  passed through as before. One more ask per tool call, not per turn.
- README (zh, en): what happens to such a reply.

Run (mote, bun 1.4.2, HOME=$(mktemp -d)):
- test/repeat-batch.mjs: 75 pass. The four new tests against origin/main
  11e7afe5's index.mjs (AGY_BRIDGE_TEST_INDEX): the ask-again and the
  error-and-session-kept tests fail, the bare-empty and max_tokens ones
  pass on both. The #1124 case that expected a banner-only reply to end
  as an empty end_turn is removed: that was this bug.
- bun test ./packages/agy-cli (every suite and smoke.mjs): 41 pass,
  0 fail. bun scripts/check.mjs agy-cli: ok.

Not tried: a real Antigravity account. The owner's Google account is
refused (403, ToS) on agy turns and no other signed-in agy account was
found here, on mote or on mica. The empty ending was built from agy's
own banner bytes and its end_turn, not captured from a real empty
reply, and whether the model's empty call is Gemini's
MALFORMED_FUNCTION_CALL is not known. Not run under billion-context
itself.
2026-11-18 10:29:47 +08:00
yetone 34edf938da agy-cli: a 429 to the reworded prompt in the user turn is a rate limit, not a 400 (0.1.90)
HadStash on X (11-17, Google AI Ultra trial, agy-cli) got "agy bridge:
Antigravity answered 429 to this system prompt: RESOURCE_EXHAUSTED
(code 429)" as an Anthropic invalid_request_error, while the same account
works in the Antigravity client.

#formatAgentError called any bare 429 a prompt rejection when the RAW
client prompt has a line Antigravity turns away (turnsAway). Claude Code's
identity line is always there, so every 429 in a Claude Code session was
a 400 the client never retries and a gateway group doesn't treat as a
limit, even though what was sent was reworded (cloak.mjs) and sits in the
first user turn, the default since 11-15. Now that label is given only
when the instructions went in agy's session instructions
(AGY_BRIDGE_SYSTEM_APPEND=1), where the reworded prompt is still turned
away; in the user turn the 429 is a rate_limit_error (with the existing
"not a quota" note for the bare 429), so Claude Code retries it and a
group asks the next member. The turn still ends at agy's first 429
banner (Lmohn39), so nothing waits.

Real probes, account kumw95ya25, Code Assist direct (plug-raw), Claude
Code 2.1.326's captured prompt (SDK and CLI identity), 2 tries each:
- raw in system: refused 429 (gemini-3.8-flash)
- outgoing() in system: 429 2/2 on gemini-3.8-flash and claude-sonnet-4-6
- outgoing() in the user turn: 200 2/2 on both models
- user turn + Claude Code's 12 tools as function declarations: 200 2/2
Control prompt: 200 2/2.

Tests: repeat-batch's Lmohn39 test now runs the session-instructions
path (testkit's new `appendable`) for the 400 and the user-turn path
for the rate limit, Claude Code's identity line included; smoke's #980
case sets AGY_BRIDGE_SYSTEM_APPEND=1 and a new HadStash case checks the
user-turn 429. Broken by hand: against origin/main's index.mjs both are
red (repeat-batch 1 fail, smoke "BAD - HadStash ...").

Run on mote at this tree (HOME=$(mktemp -d)): bun scripts/check.mjs ok;
bun test 9040 pass, 1 fail: agy-cli test/usage.mjs "a hung sign-in with
an ended token is never restarted ..." at its 6s deadline, which is
#1191 (usage.mjs red on macOS under load, the failing tests change each
run; alone it went 5 of 41 red, other tests). Not this change: usage.mjs
doesn't reach #formatAgentError.

Not tried: the reporter's own account or agent (they don't say which;
the Anthropic-shaped error says a /v1/messages client). agy itself was
not run end to end: the Mac's agy account is disabled by Google, so the
probes went to Code Assist directly with agy-cli's cloak.mjs.
2026-11-17 23:38:34 +08:00
yetone afe4c08643 agy-cli 0.1.87: agy's Individual quota reached ending fails the turn as a rate limit
@Airan_FS on X (11-17): when an Antigravity account's own quota is used up,
agy ends the turn with "⚠ Individual quota reached. Please upgrade your
subscription to increase your limits. Resets in 1h18m40s." The bridge only
knew fixed ending lines, so this one went to the client as the model's
reply and magpie never asked the next account.

The bridge now holds a line starting "⚠ Individual quota reached" that
nothing follows, and ends the turn with a rate_limit_error carrying agy's
words and the reset ("agy bridge: Antigravity quota reached: Individual
quota reached. ... Resets in 1h18m40s."; HTTP 429 without streaming).
Words the model wrote before it still reach the client. A quote of the line
with more text after it stays text. magpie rests the account until the
reset it reads from the error (magpie's routing.go change in the same fix).

The words are from a user's report on discuss.ai.google.dev (limit
membingungkan) and @Airan_FS's tweet; the agy binary carries "individual
quota reached".

Run (mote, HOME=$(mktemp -d)): bun test agy-cli.test.mjs 20 pass, 0 fail;
node --test repeat-batch.mjs smoke.mjs 72 pass, 0 fail; bun scripts/check.mjs
ok.

Broken by hand: 0.1.86's index.mjs with these tests: three of the four new
tests fail (the ending alone, after partial text, non-stream 429); the
quoted-line test passes on both.

Not tried: a real agy account with its quota used up.
2026-11-17 03:56:04 +08:00
ump45nose 38233a569c agy-cli 0.1.86: agy starts with telemetry off (#1236)
The bridge passes --disable-telemetry when `agy acp --help` lists it, so
agy doesn't report the run to its vendor; AGY_BRIDGE_TELEMETRY=1 keeps
agy's own default. The flag is part of the spare's launch key. By
ump45nose (#896, PR #1236), landed on top of #1235 with only the version
line's conflict resolved.

The flag was checked in the agy binary on this Mac (strings:
"disable-telemetry", "--disable_telemetry").

Run (mote, HOME=$(mktemp -d)):
- At the PR head 0ead2594: bun test agy-cli.test.mjs 20 pass;
  node --test repeat-batch.mjs smoke.mjs 66 pass; check.mjs ok.
- At this tree (with #1235): bun test agy-cli.test.mjs 20 pass, 0 fail;
  repeat-batch.mjs + smoke.mjs 68 pass; check.mjs agy-cli ok.

Broken by hand: origin/main's index.mjs with the PR's tests: "#896: an agy
whose acp --help lists --disable-telemetry starts with telemetry off" and
smoke.mjs fail.

Not tried: a real agy acp run with the flag (the local agy account answers
403).

Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com>
2026-11-17 03:36:00 +08:00
ump45nose c52dd35bfa agy-cli 0.1.85: agy's output-cap notice never reaches the client (#1235)
agy's output-cap retry writes three lines of its own into the reply (the
cut-off notice, its instruction to continue, "Retries remaining: N"); the
bridge now drops them where they start a line, held across chunks, and
keeps a mid-line quote of them. By ump45nose (#892).

The three strings were checked against the agy binary on this Mac
(strings: "Your previous response was cut off because it exceeded the
output token limit", "Please continue from where you left off, keeping
your response shorter", "Retries remaining: %d" and "%d.").

Run at e95ee1d5 (mote, HOME=$(mktemp -d)):
- bun test agy-cli.test.mjs: 20 pass, 0 fail.
- node --test repeat-batch.mjs smoke.mjs: 66 pass.
- bun scripts/check.mjs agy-cli: ok.

Broken by hand: origin/main's index.mjs with this PR's tests: "#892:
agy's output-cap notice never reaches the client" fails.

Not tried: a real turn that hits agy's output cap (the local agy account
answers 403).
2026-11-17 03:33:14 +08:00
yetone 83a677177b agy-cli 0.1.81: agy's "Verification Required" is a 403 that says how to verify
kidgpt on X (Windows 11, Claude Code in VS Code, gemini-3.8-flash) got
the bare text "Verification Required" as the model's answer. agy 1.5.9
turns Google's 403 VALIDATION_REQUIRED into that line
(utils.CustomUserErrorMessageFromHTTPError, read from the binary) and
ends the turn with "\n⚠ Verification Required\n", which the bridge
didn't know, so it went out as a successful reply.

- The ending is a sixth agent-error marker. The turn fails as a no-retry
  403 permission_error (stream error event and HTTP 403 with
  x-should-retry: false, as #1201's banned account), in the words
  magpie's gateway reads as Google verification ("this Google account
  needs to be verified: open <link> in a browser"), so magpie rests the
  account as needing verification and shows the link.
- The link comes from agy's log for the turn (validation_link /
  validation_url, or the "in your browser to continue:" line) when there
  is one; otherwise the message says to open the Antigravity app or run
  agy signed in to the account.
- Sibling: agy's eligibility refusal for the same cause ("Please verify
  your account in your browser to continue:\n<url>", "Verification
  required. Please complete verification…", from
  AuthStatus.EligibilityError / IneligibilityFromResult) got the
  region/VPN advice and lost the URL in agyRefusal (models, sign-in
  probe). It now gets the same verify message with agy's link.
- A model quoting the line with more text after it keeps its text.

Run (mote, temp HOME): node --test test/repeat-batch.mjs test/usage.mjs
95 pass; bun test packages/agy-cli 37 pass 0 fail (smoke.mjs included);
bun scripts/check.mjs agy-cli ok. Windows (xiaomi-gpu, win-run):
repeat-batch, usage, windows-nc, platform 120 pass 0 fail.
Red on the old code: with origin/main's index.mjs and usage.mjs the two
new ending tests fail (a 200 reply) and the agyRefusal test gets the VPN
advice.
Not tried: a real account Google wants verified; the exact log line agy
writes for a VALIDATION_REQUIRED turn (the fixture follows Google's JSON
error's validation_url).
2026-11-16 23:04:00 +08:00
wjhauannn f6cf4512dd agy-cli 0.1.80: forked sessions and subagents are kept apart by x-magpie-session and x-magpie-subagent (#1217)
Derive a session scope from x-magpie-session (magpie's synthetic
magpie-<24hex> id ignored, capped at 128) and x-magpie-subagent (capped
at 64), from init.headers or a Request's headers, and key conversations,
live-session reuse, clientSeen and tool-result matching by it. A forked
session or a subagent carrying its parent's tool_use history no longer
collides with the parent's convKey or toolCalls (409 conflicting
duplicate result, lineage_fork superseding the parent's pending turn).
A body given only on a Request is read from it.

Contributed by @wjhauannn.

Run at 46fce29f (mote, macOS, HOME=$(mktemp -d)):
- node --test repeat-batch.mjs conversation-key.mjs: 97 pass, 0 fail.
- bun test packages/agy-cli: 37 pass, 0 fail. check.mjs agy-cli: ok.
- CI: test, bumped, on-npm green.

Broken by hand: origin/main's index.mjs with the new tests: 5 fail
(55, 56, 57, 59, 60).

Checked against magpie main: the gateway sets x-magpie-session
(sessionOf) and x-magpie-subagent (subOf) on plugin requests only. A
spare takes the scope through #assign on adopt.

Not tried: a real agy account with a forked Claude Code session.
2026-11-16 21:11:27 +08:00
zhou.han 9720caa468 agy-cli 0.1.78: a banned account's ending is a no-retry 403, not an answer (#1214)
agy 1.5.9 writes a banned account's "PERMISSION_DENIED (code 403): This
service has been disabled in this account for violation of Terms of
Service…" ending into the reply as text, and the bridge answered it as
an end_turn 200 (#1201). The exact ending is now one of the end-of-turn
markers (split across chunks too), agyRefusal names it, and it ends the
turn as permission_error 403 with no retry: x-should-retry: false on a
non-stream reply, status 403 + noRetry in a started stream's error
event. A generic PERMISSION_DENIED, or the sentence quoted mid-answer,
is not reclassified. By yetihan.

Run at the reviewed head f4e82352 (mica, temp HOME):
- node --test test/repeat-batch.mjs 54 pass; test/usage.mjs 36 pass.
- bun test packages/agy-cli 37 pass; bun scripts/check.mjs agy-cli ok.
Broken by hand: origin/main's index.mjs and usage.mjs with the new
tests: the two #1201 bridge tests and the agyRefusal test fail.

Not tried: a real banned account.
2026-11-16 17:27:10 +08:00
wjhauannn 37df65a3f1 agy-cli: a thinking+text assistant tail is accepted, the newest history turn outlasts an oversized first one, and a live drop logs its reason (#1202)
wjhauannn's PR, reviewed at 3b85727243488a64d90f25a2f28f5cc5c3b9b471:

- assistantTextOf skips thinking / redacted_thinking blocks, so a trailing
  assistant prefill carrying thinking + text is no longer a 400; thinking
  + tool_use is still refused.
- renderInitialPromptParts: when an oversized history[0] leaves no room
  for any later entry, history[0] is clipped so the newest history turn
  before <current_turn> is kept (clipped to the room left if needed).
- A live tool-turn drop logs a drop_live event with its reason
  (interrupted, image_result, history_mismatch, tools_grew, work_dir,
  instructions), and session_new records that reason, not no_live.

Run at the reviewed head cherry-picked onto origin/main 3d9ac97f (agy-cli
0.1.74, #1051), HOME=$(mktemp -d), mote: packages/agy-cli bun test 36
pass 0 fail; test/repeat-batch.mjs 51 pass 0 fail; bun scripts/check.mjs
agy-cli ok.

Broken by hand (mica): origin/main's index.mjs with the PR's tests: the
three new tests fail (A16 newest history turn, thinking+text tail,
drop_live reason), 48 pass.

The PR's version bump (0.1.74) is already on main; the release is the
next commit's 0.1.75.
2026-11-16 14:14:49 +08:00
yetone 3d9ac97f91 agy-cli 0.1.74: a turn the conversation went on without is replayed at once, not after two 409s (#1051)
NieiR's logs on #1051 (agy-cli 0.1.69, agy 1.5.9, OpenCode through a
routing group of google, devin, neko and agy-cli): agy-cli left a turn
detached with 5 pending calls at 13:51:47, the group served the next 16
requests on google and neko, and at 14:07:36 google's 429 failed back
to agy-cli with google's own tool round at the tail. None of those ids
were agy's, the held turn was neither stale nor expired, so the request
got 409 "no active MCP call matches these tool results" twice and was
replayed only at the third try (NO_PROGRESS_REPEAT_LIMIT).

movedOnVerdict counts such a turn as stale ("moved_on") on the first
request: its calls are pending, at least one of its calls is in the
client's history, and after the last of them comes an assistant tool
round whose ids don't have the bridge's shape (toolu_ + 24 hex). It is
asked in the unmatched-results path and again under the lock in
recoverStaleTurn, so the reclaim and replay are the existing ones.

Left as before: a sibling request that only leaves the turn's calls out
(a side request, a compaction fork) still gets 409 and needs three, as
smoke.mjs's "unmatched results alone cannot supersede" and A7 check; a
later round with ids of the bridge's shape is not taken as moving on.

Run (mote, HOME=$(mktemp -d)):
- packages/agy-cli bun test (all suites, smoke included): 36 pass,
  0 fail; repeat-batch.mjs alone: 48 pass.
- bun scripts/check.mjs agy-cli: ok.

Broken by hand: origin/main's index.mjs with the new tests: the moved-on
request answers 409 (the first new test fails); the own-shape test
passes on both.

Not tried: a real routing group failing over to real agy.
2026-11-16 13:37:11 +08:00
yetone 369643183f agy-cli 0.1.73: a batching call Hermes split into one call per entry is folded back (#1150)
NieiR traced a Hermes Agent turn (agy 1.5.9, chat/completions) that
ended in 409 "some tool results do not belong to the active response"
(#1150): agy called Hermes' batching tool once, tool_call({calls: [4]}),
and Hermes wrote it into its history as four tool_calls of one entry
each. The first kept the bridge's toolu_ id; the other three got
call_<hex> ids of Hermes' own, each with a result. Only the first
matched a bridge call, so the round was refused and Hermes gave up the
turn.

foldSplitCalls, run on the canonical body before anything reads it,
folds such a round back into the one agy made: the calls' array field
joined in order under the first (bridge) id, and their results joined
in order as that call's one result (an error only if every part was).
It folds only when a run of same-named calls opens with a bridge id
(toolu_ + 24 hex), every other id is not one, every input is an object
with the same single array field, and either every call has its result
or none has (a round still waiting). Two calls the bridge made itself
are never folded. README (zh, en) says so.

Not in this change: NieiR's second finding, that #selfPollCapped stays
off for a turn once any of its calls was seen by the client, so an
orphaned turn keeps generating every 150s until the 30-minute result
timeout. Left for its own commit.

Run (mote, HOME=$(mktemp -d)):
- packages/agy-cli bun test (all suites, smoke included): 36 pass,
  0 fail; repeat-batch.mjs alone: 46 pass.
- bun scripts/check.mjs agy-cli: ok.

Broken by hand: origin/main's index.mjs with the new tests: the split
round answers 409, as reported; the never-fold test passes on both.

Not tried: real Hermes Agent against real agy. The test drives the
bridge through its real entry points with a fake agy.
2026-11-16 12:57:58 +08:00
yetone b840915abc agy-cli 0.1.62: magpie's sign-in installs agy where there is none, and the plugin keeps that copy current (niuniu_8964 on X)
In magpie's Docker image there is no agy, so Sign in failed with "agy CLI
not found". The plugin now declares auth.cli (magpie 0.1.4246's hook,
engines.magpie raised to it): when agy isn't found, magpie's sign-in shows
"Installing Antigravity CLI…" and the plugin installs it the way Google's
install.sh does: the same manifest, the download checked against its
sha512, the antigravity binary taken out of the tarball, tried with
--version, then renamed into place. It goes into the data folder
($XDG_DATA_HOME/magpie-agy-cli/agy, ~/.local/share without it,
%LOCALAPPDATA% on Windows), which in the container is on /config, and is
searched last, so an agy the user installed wins. That copy is kept
current a minute after start and every 6 hours, only while it is the one
in use and not when AGY_CLI_DISABLE_AUTO_UPDATE is set.

Also: findAgy handed out a cached path to an agy removed since, so the
sign-in tried to spawn it (ENOENT) instead of installing it; and a write
loop left an error listener per wait (MaxListenersExceededWarning on the
260MB download).

Account code is unchanged.

Run, on mica: bun scripts/check.mjs ok; agy-cli bun test 34/34 under a
temp HOME (install.test.mjs: 10, against a local server). A6b red on the
old findAgy, green now.

Real use in magpie's Docker image (xiaomi-gpu, linux amd64), with magpie
0.1.4246's tree: `magpie plugin login agy-cli 1` and the browser UI's
POST /api/plugin-signin both installed agy 1.5.9 into
/config/data/magpie-agy-cli and went on to agy's Google link; it survived
a restart; agy.version set back to 1.5.0 was updated a minute after start.

Not tried: finishing the Google sign-in in the container, a real install
on macOS, Windows or musl.
2026-11-15 14:55:10 +08:00
yetone f7fc6641c5 agy-cli 0.1.55: with agy's sign-in in a file (no keyring, Docker), agy stays on its own folder (#1165)
0.1.54 (#1166) started agy acp with --gemini-dir pointing at a folder of
the bridge's own, which keeps the machine's skills out. That assumed agy's
Google sign-in lives in the system keyring. Where there is none (a Docker
container, Linux with no D-Bus session), agy keeps it in
~/.gemini/antigravity-cli/antigravity-oauth-token instead. The bridge's
folder had no sign-in, and every request failed "session/new failed:
Authentication required". shawn8888 reported it on #1165 from
ghcr.io/yetone/magpie with agy 1.5.9.

Now, when that file exists and AGY_BRIDGE_GEMINI_DIR names no folder, no
--gemini-dir is passed, and agy uses its own folder and sign-in.
--include-default-customizations=false is still passed. A folder the user
names is still used.

Run (mica, node --test test/repeat-batch.mjs test/usage-settlement.mjs,
temp HOME): 83 pass, 0 fail. bun scripts/check.mjs agy-cli: ok.
Broken by hand: without the file check, the new "#1165 … stays on that
folder" test fails (1 pass, 1 fail).

Not tried: a real Docker container with agy. The token file's path is
the one the reporter saw.
2026-11-15 09:46:03 +08:00
yetone 3238ab8518 agy-cli 0.1.54: agy runs in the bridge's own --gemini-dir, so the machine's skills stay out (#1166)
0.1.52 passed --include-default-customizations=false, but on Windows
(agy 1.5.9) agy still loaded all 120 of the reporter's skills: a 56,790 B
<skills> block in its gen_metadata, and task, shell and four more client
tools dropped over the 20,000-token budget. The reporter (kanzaki-chiya)
found that --gemini-dir pointed at an empty folder of the bridge's own
leaves the skills and global MCP servers out, with every client tool
listed and shell/task calls working end to end.

So when `agy acp --help` lists --gemini-dir, a turn's agy gets
<XDG_STATE_HOME or ~/.local/state>/magpie-agy-bridge/agy-home, made
before agy starts and kept across restarts so session/resume finds the
conversation. agy's Google sign-in is in the system keyring, not that
folder. Step usage reads the conversation DB from the same folder.
AGY_BRIDGE_GEMINI_DIR names another folder; "default" leaves agy on its
own ~/.gemini. The model probe and `agy models` are unchanged. One
`acp --help` per binary answers both flags.

What happens to old data: a session parked before this update was in
~/.gemini, so its resume fails once and falls back to session/new, as a
resume that fails does today.

Run on mote: node --test test/repeat-batch.mjs test/usage-settlement.mjs
(81 pass), bun test in packages/agy-cli (22 pass), bun scripts/check.mjs
agy-cli ok. test/smoke.mjs prints the same 29 BADs and crash at
origin/main df7d7ae0 as with this change (plugins#1070).
Real agy 1.5.9 on macOS, with the user's account: `agy acp --gemini-dir
<empty folder>` initialised, session/new listed the account's six
models, and the session's .db was written under
<folder>/antigravity-cli/conversations, not ~/.gemini.
Broken by hand: with step usage left on ~/.gemini, the new usage test
reads the machine folder's count (9999 != 1800).
Not tried: a real turn on Windows or Linux with this build; the
Windows result is the reporter's, with their own patch of 0.1.52.
2026-11-15 07:45:56 +08:00
yetone 57d1cc6a9f agy-cli: start agy without the machine's own skills when it can (#1166)
On Windows with agy 1.5.9, a session loaded 120 local skills from
~/.gemini/skills, ~/.gemini/config/skills and ~/.agents/skills although
the bridge agent says inheritCustomizations: false. Skills and the
client's MCP tools share agy's 20,000-token customization budget, so
agy dropped the six largest client tools (task, shell, …) and three
skills.

agy 1.5.9's acp takes --include-default-customizations (default true).
The bridge now passes --include-default-customizations=false when
`agy acp --help` lists the flag. An agy without it exits on an unknown
flag, so it is never passed blind. The answer is kept per binary (path,
mtime, size); a probe that errors or times out is asked again. The bare
`agy acp` model probe is unchanged. 0.1.52.

Run:
- bun test packages/agy-cli on mote (temp HOME): 21 pass, 0 fail;
  bun scripts/check.mjs agy-cli ok.
- the same on Windows (win-run, xiaomi-gpu): 21 pass, 0 fail.
- test/smoke.mjs alone with bun on mote: ALL OK (348 checks).
- real agy 1.5.9 on macOS: `agy acp --help` prints the flag on stderr
  (exit 0); a session started with the flag set to false runs.
Broken by hand: without the args.push in Proc.start, repeat-batch's
"#1166 … asked once" test and smoke's #1166 check go red.
Not tried: the reporter's Windows machine with its 120 skills. On this
Mac the default run sent no user skills to the model either, so it is
not shown here that the flag keeps them out; the reporter is asked to
confirm.
2026-11-15 06:43:07 +08:00
yetone 4a64252bd7 agy-cli 0.1.51: one opening sent to several models at once gets an agy each
swang20201 on X: Test models on an agy-cli account gave a check for the
first model and a cross for the other three. magpie's Test sends the same
"hi" opening to up to four models at once. agy-cli keys its agy process by
user, system and first message, not the model, so all four shared one key.
The first started a turn; the others found it unfinished and got 503
"agy bridge: this conversation still has an unfinished response". Not the
account's limits, and not the model ids.

Two changes:
- A fresh opening that finds the key's process busy with a turn for
  another model gets a process of its own (key + request id). The same
  model sent twice while the first runs is still refused as a resend, so
  smoke's "simultaneous startup allows only one live response" holds.
- acquireProc starts the turn (begin) inside the same locks, so a request
  waiting on them sees the earlier turn and is never handed a process
  about to be busy. The turn records its model.

Run:
- New test in test/repeat-batch.mjs, magpie's exact probe body to four
  models at once: red on origin/main 9126c46f (1 x 200, 3 x 503), green
  after.
- Broken by hand: with begin moved back outside the lock the new test is
  red again.
- packages/agy-cli bun test under a temp HOME on mote: 21/21, smoke
  included.
- Whole repo, HOME=$(mktemp -d) bun test and bun scripts/check.mjs on
  mica at this tree: 8849 pass, 0 fail (8869 tests, 617 files), check.mjs ok.
- Real agy 1.5.9 (agy acp), four models at once through the plugin:
  old code 1 x 200 + 3 x 503; this code 4 x 200 at 3.7, 6.0, 9.1 and
  11.2s, inside magpie's 20s test wait.

Not tried: the reporter's models (Gemini 4 Argon/Hydrogen, Claude 5.5).
The account used offers Gemini 3.8 Flash, Claude 4.6 and GPT-OSS only, so
the model id mapping wasn't checked against a list holding those ids.
2026-11-15 04:31:05 +08:00
yetone a617ecfd42 antigravity 0.1.16, agy-cli 0.1.48, cloak 0.1.9: cloak the system prompts Google refuses since 11-14 evening; agy-cli fails a refused turn at once
Since about 18:43 on 11-14 Google's Antigravity backend answers 429
RESOURCE_EXHAUSTED to requests whose system instruction holds certain
agents' identity lines, though the account has quota and the same
request with another prompt passes. Tried on a real account
(gemini-3-flash), each line alone in the system instruction:

- refused now: "You are Hermes Agent", Hermes' earlier persona
  "…an intelligent AI assistant created by Nous Research" (also as
  "You're …"), "You are OpenCode" / "You are opencode", Codex CLI's
  "You are a coding agent running in the Codex CLI", and pi's "You are
  a coding assistant running inside pi".
- pass as written: Codex GPT-6's prompt, Claude Code, Gemini CLI, Qwen
  Code, Cline, Kilo, goose, Amp, Droid, Kimi, Aider, Cursor.

The cloak in antigravity and agy-cli (and the antigravity-cloak
middleware) now rewords each refused line the smallest way that passes:
"You are" -> "You're" for Hermes, OpenCode and Codex CLI, "created by"
-> "built by" for Hermes' earlier persona, "running inside pi" ->
"running within pi". The hint shown with a refusal names the agent
(new pi, OpenCode and Codex CLI hints; Hermes' hint covers both
personas).

agy-cli (@Lmohn39, pi 1.5.0 via agy 1.5.9, hydrogen): when agy prints
its retry banner for a refused 429, agy-cli waited while agy retried
the same refused prompt without end, so pi hung. The turn now fails at
once with the 429 and the existing "this is not a quota" explanation,
the agy process is stopped and dropped from the pool. A 503 banner
still waits as before.

Run:
- root `bun test` with HOME=$(mktemp -d) on mica (mote was over its 18
  cores): 8820 pass, 20 skip, 0 fail, exit 0.
- real account through the patched loader, gemini-3-flash 5/5 each:
  pi 1.5.0's full default prompt (built from its dist/core/system-prompt.js),
  Hermes current and earlier personas, both OpenCode first lines, Codex
  CLI's prompt, Codex GPT-6's prompt. claude-sonnet-4-6: pi 5/5.

Broken by hand:
- the old agy-cli index.mjs makes the new Lmohn39 test red ("still
  waiting after 5s").
- dropping the pi line from TURNED_AWAY turns 6 cloak tests red.

Not tried: a real agy 1.5.9 turn on hydrogen showing the banner (the
banner's wording is the one agy-cli already matched); pi itself end to
end through agy-cli.
2026-11-14 21:40:22 +08:00
yetone 3db6dcfa85 agy-cli 0.1.47: agy 1.5.9's bare 429 ending fails the turn (#1151)
agy 1.5.9 ends a turn whose every retry got 429 with the upstream status
itself, "⚠ RESOURCE_EXHAUSTED (code 429): Resource has been exhausted
(e.g. check quota).", instead of "⚠ Agent execution terminated due to
error.". That line was not one of AGENT_ERROR_MARKERS, so the bridge sent
it to the client as the model's answer and ended the turn as a success
(jx407's Codex turns showed the error text as the reply).

It is now a marker like the others: held while it could still be one,
dropped when it ends the prompt, and the turn fails through #agentError
-> #formatAgentError as rate_limit_error ("Antigravity quota or rate limit
reached: RESOURCE_EXHAUSTED (code 429): ..."), or as the system-prompt
case when the cloak says the prompt turns away. Text after it, the model
quoting the line, keeps it as text, as for the other markers.

This fixes how the 429 is reported, not why Antigravity answered 429 to
the reporter's Codex requests; that is still open on #1151.

Run (WSL magpie-desktop, Node 22, Bun 1.4.2, HOME=$(mktemp -d)):
- packages/agy-cli `bun test`: 21 pass, 0 fail (agy-cli.test.mjs runs
  repeat-batch.mjs and the rest).
- node --test --test-name-pattern="1151|1136" test/repeat-batch.mjs:
  4/4 ok. With the new marker line deleted from index.mjs: the endings
  test goes red (1 fail), the quoting test stays green.
- bun scripts/check.mjs agy-cli, scripts/bumped.mjs origin/main: ok.
Not tried: a real agy 1.5.9 turn that ends in 429.
2026-11-14 20:56:03 +08:00
yetone 5613a1259a agy-cli 0.1.43: agy 1.5.8's attempt lines are dropped, and its network and credit endings fail the turn (#1136)
agy 1.5.8 writes each failed attempt of a model call into the reply
("\n⚠ API error (attempt N): request failed: … EOF"), then tries again in
the same turn, and when it gives up it ends with "⚠ There was a network
issue connecting to the server, please try again." or "⚠ Your AI credits
balance is too low to continue." instead of "Agent execution terminated
due to error.". The bridge passed all three through as the model's text,
and the endings as a 200 end_turn, so the gateway neither retried nor
switched accounts.

- dropRetryBanner drops an attempt line where it starts a line, with its
  leading and one trailing newline, the way #1124 drops "Model produced
  invalid output."; a line not ended yet is held (openBanner) until its
  newline, a tool call or the end of the turn. A mid-line quote is kept.
- The error markers are a list; the network and credit endings fail the
  turn like the old marker. The credit ending is a rate_limit_error.
- The error's detail falls back to the last attempt line's text, then the
  ending's own words, when agy's log has no executor error.
  lastAgentError also reads "Run: attempt N failed (…), retrying in",
  "CallWithRetry: …" and "inference connection failed…: …" lines.

Fixtures are the reporter's exact strings from their Codex rollout.

Run (mica): node --test test/repeat-batch.mjs 33 pass; agy-cli bun test
21 pass; scripts/check.mjs agy-cli ok. Broken by hand: with main's
index.mjs the attempt-banner and ending tests fail (2 of 3; the third is
the mid-line quote guard, green on both).
Not tried: a real agy 1.5.8 with a dropped connection; the log-line
patterns are from the issue's log excerpt, not a test.
2026-11-14 16:32:54 +08:00
yetone e0f2a4c2e9 agy-cli 0.1.42: agy's "Model produced invalid output." retry banner is dropped (#1124)
When the model's first call returns neither text nor tool calls, agy writes
"\n⚠ Model produced invalid output." into the reply and calls the model
again in the same turn. The bridge passed that banner on as the reply's
text, so Claude Code's prompt_suggestion took it as the suggestion.

Turn.pushText now drops the banner, with its leading newline and one
trailing newline, wherever it starts a line. A banner that ends a chunk is
held, so a newline in the next chunk goes with it, and it is dropped for
good when the text is flushed. The turn goes on: unlike agy's error
marker, it does not fail the prompt. The model quoting it mid-line keeps it.

Run on WSL (Bun, temp HOME):
- packages/agy-cli: bun test, 21 pass / 0 fail (repeat-batch 30 pass).
- bun scripts/check.mjs agy-cli: ok.
- Broken by hand: on the old index.mjs the new #1124 banner test is red.

Not tried: a real agy 1.5.8 empty-output retry; the banner bytes come from
the reporter's gateway log, and both with and without a trailing newline
are covered.
2026-11-14 13:30:22 +08:00
tungloong 592b716ac3 agy-cli 0.1.37: DeepSeek Harness's notes are not the loop's task; a trimmed loop keeps its whole user turn (#1093)
Reviewed at 56248465f. WSL (Bun 1.4.2, temp HOME): bun test in packages/agy-cli 20 pass (repeat-batch.mjs inside agy-cli.test.mjs), scripts/check.mjs agy-cli ok. With main's index.mjs, node --test test/repeat-batch.mjs fails 6 (19, 20, 21, 22, 24, 26). Open question, not blocking: a string-content message holding a runtime snapshot and the user's words reads as meta-only (affects only prompts trimmed past 112 KiB).
2026-11-13 19:49:31 +08:00
yetone 1a08f08817 agy-cli 0.1.30: a new agy session logs why the live one was not reused (#1058)
#1058: in one Claude Code conversation every request started a new agy
conversation, so Gemini 4 Carbon's cache read stayed at 0. The bridge
reuses a live session only when the conversation key, work dir,
instructions and history all match, and nothing said which one failed.

acquireProcLocked now writes one content-free stderr row per new
session ("[agy-bridge] {event: agy_bridge_session, action: session_new,
reason, conv, fresh, resumed, parked, history}"). reason is no_live (no
session under this conversation key), or for a live one that was
dropped: forced, dead, retiring, work_dir, instructions, history or
fresh_after_first. conv is the key's 12-char digest, so a key that
changes per request shows as a new conv each time. The rows have their
own 30/min budget, so they never crowd out the tool-state rows.
magpie writes plugin stderr into its log, so the reporter can send them.

Run (on a separate test Mac, temp HOME): bun scripts/check.mjs agy-cli
ok; packages/agy-cli bun test ./agy-cli.test.mjs 14 pass 0 fail;
test/repeat-batch.mjs 20 pass, test/conversation-key.mjs 31 pass.
Broken by hand: with the logSessionEvent call disabled, the new #1058
test fails.
Not tried: a real agy, or the reporter's Claude Code requests. This
does not fix the cache miss; it finds which check misses.

Reported-by: chrisjian
2026-11-13 02:40:04 +08:00
yetone 4b35c34c34 agy-cli 0.1.27: a replay that fits goes unclipped; Claude Code's notes are not the loop's task (#1055)
clipHistoryMessage ran on every history message before the room check,
so a 20 KiB block in a small replay still went as 4 KiB head and tail.
History is now rendered whole first, and blocks are clipped only when
that is over the room; from there the over-budget path is as before.

The #1053 task finder took the last user message with no tool_result,
so a standalone system reminder, interrupt marker or local-command
caveat could be pinned in place of the real prompt. isUserTask skips a
user message whose text is only such notes; an image or any other text
still counts.

Not changed: the 112 KiB default (the installed agy 1.5.5's strings
don't show a 192,000-byte limit), a lone tool_result after the omission
note (history is text; it carries its id), and the issue's redesign.

Run on a separate test Mac (Bun 1.4.2, temp HOME):
- test/repeat-batch.mjs: 19 pass, 0 fail (2 new; 17 pass 2 fail on 0.1.26).
- bun test packages/agy-cli: 15 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
Broken by hand, each 18 pass 1 fail, then restored: clipping always;
the meta check reduced to an empty test; the local-command strip
removed; the interrupt strip removed; the over-budget clip removed
(the A16 >128 KiB test goes red).
Not tried: a real agy.

Reported-by: hiee3
2026-11-12 22:19:39 +08:00
yetone bb3f68a47a agy-cli 0.1.26: a quoted error marker no longer ends the turn; a trimmed tool loop keeps its prompt (#1052, #1053)
#1052: Turn.pushText failed the turn at the first "⚠ Agent execution
terminated due to error." anywhere in the reply, so a model quoting it
(inline, in a code block) was cut off and reported as an agy error. agy's
own marker ends the prompt, so the marker is now held, and the turn fails
only when the prompt ends with it still held (Turn.endText, before the
agentError check). Text or a tool call after it sends it on as text.

#1053: when a replay went over the prompt budget mid tool loop,
renderInitialPromptParts kept only the opening message and the newest
history, and dropped the user prompt the loop works on. Now, when the
current turn carries tool_results, the latest user message without one is
kept too if it fits, in order, with an omission note per gap.

Not changed: #1052's retry banners (nothing shows them reaching the
client as message chunks) and #1051 (the supersede rule is deliberate,
covered by A15 and the lineage sibling test; evidence asked for).

Run on WSL (Bun 1.4.2, temp HOME):
- bun test packages/agy-cli: 15 pass, 0 fail.
- test/repeat-batch.mjs: 17 pass, 0 fail (3 new).
- bun scripts/check.mjs agy-cli: ok.
Broken by hand, each 16 pass 1 fail, then restored: the task prompt not
pinned; pushText back to the first-indexOf rule; turn.endText() removed.
Not tried: a real agy (no install, no Google endpoints).

Reported-by: hiee3
2026-11-12 21:47:42 +08:00
gitxmandgitxm 0f0c4ec68f agy-cli: Antigravity on the local agy CLI over ACP (#785)
New package `@magpie-community/opencode-agy-cli-auth` (provider `agy-cli`, `packages/agy-cli`). It serves Antigravity models through the user's installed `agy` CLI over ACP (`agy acp`) and uses agy's own Google sign-in. The plugin reads and writes no Google tokens.

The bridge is gitxm's. On top of it, after review:

- **ACP identity.** The client names itself (`opencode-agy-cli-auth` and its package version) instead of `zed`.
- **Catalog.**
  - Only what agy offers this client is listed: Gemini until a session says more, then the session's model option and `availableModels`.
  - Requests are still routed by everything `agy models` lists.
- **Prompt.** agy keeps its own system prompt by default. The minimal agent is opt-in with `AGY_BRIDGE_MINIMAL_AGENT=1`, and the README says what turning it on sends upstream.
- **Version check.** agy older than 1.4.12 is refused at the handshake. 1.4.12 is the oldest version the `nc` MCP bridge was checked on, and the README documents the bridge.
- **Auto-update.**
  - `AGY_CLI_DISABLE_AUTO_UPDATE` defaults to `true` only for the plugin's own agy processes.
  - A value the user set is passed on as written.
- **Docs.** The READMEs and the registry summary say how this differs from antigravity-acp (#87).
- **Tests.** The author's tests came over under `test/` with a fake agy (an ACP stdio server). Each suite runs in its own `bun test`, and a `mock.module` preload stands in for `node:child_process`.
- **Cleanup.** A duplicate, unreachable image branch in validateBody is gone.

Run at ae5eafb0 on mote (macOS) with HOME=$(mktemp -d):

- `bun test packages/agy-cli`: 7 pass. Per suite:
  - platform 14, compat 9, usage 20;
  - catalog 15, usage-settlement 18, repeat-batch 14;
  - smoke ALL OK (301 checks).
- `bun scripts/check.mjs`: all ok.
- Repo-wide `bun test`: 6792 pass, 0 fail (6812 tests, 492 files).

Broken by hand, and each went red:

- clientInfo set back to zed;
- the version check turned off;
- routing limited to the listed models;
- auto-update forced to true;
- the minimal agent on by default.

Not tried: a real agy, since mote has none, or a real Antigravity account.

Co-authored-by: gitxm <21175063+gitxm@users.noreply.github.com>
2026-11-07 20:14:45 +08:00