df7d7ae0a5086ccbaaa4b9d95591f37d5264e2cf
58
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fc941f6e1c |
agy-cli: Codex's GPT-5 lines go reworded in a user's turn too (0.1.53)
pocoxliu on X (tweet 2121731813270077946) gets 429s from agy-cli under Codex and Claude Code and put it down to unslimmed system and MCP prompts. It is content, not size (#1151: a neutral system prompt of the same 66,622 characters went through). Since 11-14 Antigravity also turns away Codex's two GPT-5 lines ("You are Codex, (a coding) agent based on GPT-5") in a user's turn; magpie's cloak and the antigravity plugin ( |
||
|
|
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. |
||
|
|
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
|
||
|
|
9126c46f97 |
agy-cli: no stub descriptions; a low level's room goes to tools and contracts (#1140)
tungloong's real run of agy-cli 0.1.49 with 131 tools: the schemas alone
took ~37 KB, the level stopped at 10, and 373 of 382 property texts went
as 9-10 byte stubs ("The fil…") that spent ~10 KB on their keys, while
the tools' own descriptions got 25 bytes and show_view's contract 110.
With more tools the level stopped at 1-6 and never reached the bare
branch, which would have zeroed the contracts too.
A cut description now goes whole or, cut, with at least MIN_TEXT (24)
bytes; anything shorter is dropped. When the highest level leaves an
ordinary property under that, ordinary properties keep only texts short
enough to go whole, and a second search gives the room to the tools'
own descriptions and the contracts' (the old bare(top) branch is gone).
Run (mote): packages/agy-cli bun test 21 pass (each test file in its
own bun process); bun scripts/check.mjs agy-cli ok. On a 131-tool
fixture shaped like the report (~285 B of schema per tool), 0.1.49
gave field "field…", tool "tool_0 does the t…"; now no field stubs, tool
"tool_0 does the thing it says.…" and a longer contract. Broken by
hand: the new tests on 0.1.49's tool-budget.mjs go red (field_0:
"field…" at 131 tools, stubs at 180).
Not tried: real agy with the reporter's 131 tools.
|
||
|
|
1c3c58be56 |
agy-cli 0.1.49: a session opened before a line was reworded is not resumed (#1151)
A parked session was keyed on the client's instructions as written. agy keeps the instructions a session was opened with, so a Codex conversation parked under 0.1.47 (whose "You are a coding agent running in the Codex CLI" line went to agy as written, and was turned away) was resumed after 0.1.48 began rewording that line, and every turn on it went on getting 429 for up to the 6h resume window. jx407 found this on #1151. The parked hash is now taken over the instructions as agy is sent them (outgoing: the turned-away lines reworded), with the same clock and billing stripping as before. When the rewording changes, the parked session is not taken and a new one is opened; when it doesn't, it resumes as before. Run (WSL magpie-desktop, from the repo root, HOME a temp dir): - packages/agy-cli `bun test`: 21 pass, 0 fail. - node --test test/conversation-key.mjs: 34 pass, including the new "#1151: a parked session is keyed on the instructions as agy was sent them". Broken by hand: with park/takeParked hashing instructionsIdentity again, the new test fails (33 pass, 1 fail). Not tried: a real agy session parked under 0.1.47 and resumed under this version. |
||
|
|
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.
|
||
|
|
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.
|
||
|
|
6646797e15 |
agy-cli 0.1.46: a catalog over agy's tool budget keeps every tool (#1140)
Since #989 every client tool is listed always-loaded, so all of them go into agy's customization budget: 20,000 tokens counted as ceil(UTF-8 bytes / 3). Past it, agy drops whole tools, the largest first, and with tools: [] the model has no other way to reach them. tungloong's 131-tool catalog (~25,000 tokens) lost bash and 12 Paper tools. Proc.listTools() now hands agy the catalog through fitTools (tool-budget.mjs), aiming at 18,000 tokens to leave agy room for its name prefix and serialization: - within the budget, the catalog goes as it is (the same array); - else $schema, title and examples come out where they are keywords (a property named "title" is the client's and stays); - else every description is capped at the highest level L that fits, found by binary search: a property's at L bytes, a tool's own at 2.5L, a contract property's (an object with no properties, or tool-schema's Variants/Accepts anyOf text) at 11L. A cut drops a trailing Examples block first, ends on a sentence or a whole code point, and adds "…"; - at L = 0 the properties' descriptions go and the room left goes to the tools' own. Names, property names, types, enum, const, required, items, anyOf and bounds are never touched, and this.tools / toolsSignature stay as the client sent them. The trimmed list is kept per catalog. Run (WSL magpie-desktop, temp HOME; mote was at load 178 and mica's disk is full): bun test 21 pass; node --test conversation-key, step-usage, usage-settlement, repeat-batch, compat, tool-schema, catalog, tool-budget, steer-in-session, windows-nc: 198 pass, 0 fail; bun scripts/check.mjs agy-cli ok; npm pack --dry-run ships tool-budget.mjs. With main's index.mjs the new bridge test fails (31,690 tokens reach agy). Not tried with a real agy: the budget and its counting are the reporter's reading of agy 1.5.8, not checked here. |
||
|
|
6e0cecb2a0 |
agy-cli 0.1.45: a tool result's image goes to agy as a prompt image, not an offloaded file (distinceeeee on X)
Report: on agy-cli 0.1.43 with agy 1.5.8, when OpenCode's read tool
returns a screenshot, agy writes the image to
.system_generated/steps/N/media_0.jpg. The model never sees the image and
keeps re-reading files.
Cause: the bridge answered agy's MCP tools/call with the image as MCP
image content. agy offloads MCP images to a file, and its model only gets
"Image read successfully [Resource offloaded to file://…]". There are no
image tokens, so it loops trying to get the image back.
Fix: when agy supports prompt images and a tool result carries an image,
the result takes the steer-in-session path. The MCP call is answered with
its text plus a line saying the image follows. The image goes in the next
session/prompt as an ACP image block, in the same session, so it reaches
the model as an image. withoutAnswered keeps an answered result's images
in the prompt and drops the rest. If steering fails, the existing replay
fallback already sends tool_result images as prompt images. An agy
without image support keeps the old MCP path.
Run:
- Real agy 1.5.8 (macOS), sandbox HOME and sandbox keychain,
gemini-3.8-flash-high, through a harness that drives the plugin's fetch
with an OpenCode-style read tool:
- origin/main: shot.jpg and term.png each looped through 8 reads
without an answer.
- This change: 1 read each. shot.jpg was answered correctly
("PLUM-7342 ORBIT", red circle, blue square, green triangle).
term.png was answered correctly twice (all five terminal lines,
including "TOKEN: ZEBRA-5519", and the yellow rectangle).
- WSL magpie-desktop (Ubuntu 24.04), bun 1.4.2, temp HOME:
- packages/agy-cli `bun test`: 21 pass, 0 fail.
- `node test/smoke.mjs`: ALL OK (347 checks).
- `bun scripts/check.mjs agy-cli`: ok.
- Broken by hand: smoke.mjs with origin/main's index.mjs fails exactly
the two image checks this change adds or rewrites (2 FAILURES of 347).
Not tried:
- Gemini 4 Carbon: not offered to the test account.
- Real agy on Linux, and a real OpenCode front end.
- stream:true against real agy (the harness is non-streaming; smoke
covers SSE).
|
||
|
|
dac9726736 |
agy-cli 0.1.44: a turn keeps only its current request body, and tool-result images are hashed in the history key (#1137)
A Codex tool loop with view_image screenshots grew the plugin host to 0.5-1.5 GiB after GC, so magpie recycled it every ~10 minutes and the mid-turn conversation restarted without its tool outputs (tungloong's report). - Turn.registerResponse drops the previous step's body and contentSnapshot. Only the current step's are read again (a late prompt's estimate); the usage reducer reads settled/usage only. - historyKey keys a tool_result image by mimeType + sha256, as it already keys a user's image, instead of copying its base64 into the key on every comparison. Old data: a conversation parked before the update with an image inside a tool result has a history hash taken over the raw bytes, so it starts a new agy session once instead of resuming. Others are unchanged. Run (mote, sandbox HOME): node --test conversation-key, step-usage, usage-settlement, repeat-batch, compat: 128 pass. bun test: 21 pass. scripts/check.mjs ok. Broken by hand: with origin/main's index.mjs both new tests in conversation-key.mjs fail (2 of 33). Not tried: a real Codex Desktop screenshot loop; heap size not measured. |
||
|
|
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.
|
||
|
|
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. |
||
|
|
5bb4194140 |
antigravity 0.1.12, agy-cli 0.1.41, antigravity-cloak 0.1.7: turned-away lines go reworded (#1118)
Since 11-14 Google's check reads past invisible characters: a system
prompt with Claude Code's billing line and Agent SDK line, broken up with
two U+200B in every word as the cloak sent them, was turned away 5 of 5
with the bare 429 "Resource has been exhausted". Claude Desktop's Code
tab through magpie to Antigravity failed every turn (hc295971796 and
daoche_wuzui on X, 11-14).
Each line Google turns away now goes reworded instead, as plain words:
- the x-anthropic-billing-header line is left out (to its line's end);
a system part or message holding only it is dropped;
- "built on Anthropic's Claude Agent SDK" -> "built on the Claude Agent
SDK by Anthropic";
- Codex's "based on GPT-5" -> "built on GPT-5";
- Hermes' "created by Nous Research" -> "built by Nous Research";
- omp's RFC "keywords" -> "key words" (as before).
A copy an older magpie or cloak broke up (U+200B, U+2060, soft hyphen,
in or between words) is matched and reworded as the line. The Code tab's
main line ("You are Claude Code, Anthropic's official CLI for Claude,
running within the Claude Agent SDK.") passes as written and is kept.
antigravity-cloak gains a saidAs {phrase: replacement} option; extraWords
still breaks words up and the README says it no longer gets past
Google.
Run:
- real Antigravity account, sandbox HOME, gemini-3.8-flash, 10
sequential requests each through packages/antigravity at this head:
Code tab main prompt as Claude Desktop sends it (billing + main line +
rest) 10/10 200; Agent SDK subagent line 10/10; an old two-U+200B
copy 10/10; Codex GPT-5 10/10; Hermes' earlier persona 10/10; omp's
RFC line 10/10. Each rewording alone was first tried 5/5 against the
zero-width break, which went 0/5.
- wsl-run, HOME=$(mktemp -d) bun test (whole repo) before the last test
fixes: 8735 pass, 19 skip, 3 fail, all three in these packages' own
tests still expecting zero-width; after fixing them,
bun test packages/antigravity packages/agy-cli packages/antigravity-cloak:
133 pass, 0 fail.
Broken by hand: the three packages' source files from origin/main with
these tests: 19 fail (shape, cloak parity, smoke, every cases.json case).
Not tried: agy-cli against the real agy binary (smoke runs a fake agy);
models other than gemini-3.8-flash.
|
||
|
|
4170d0e816 |
antigravity 0.1.11, agy-cli 0.1.40, antigravity-cloak 0.1.6: omp's RFC 2119 line goes as "key words", in any white space
eric_li8983 (X, 11-14): oh-my-pi on Windows with an Antigravity account got
"Antigravity answered 429 to this system prompt" for omp's first line,
"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL."
Two causes, both seen on a real account on 11-14:
- Google's check reads the line in any case with any white space between
its words: wrapped with LF or CRLF, indented, a tab, two spaces or a
no-break space were all turned away, while the cloak matched only the
literal line, so those copies went out whole. Each turned-away line is
now matched with any run of white space (JavaScript's \s) between its
words, the same in antigravity, agy-cli's cloak.mjs and the
antigravity-cloak middleware; Codex's and Hermes' lines too.
- A zero-width-broken copy of omp's line was itself turned away now and
then (10 sequential requests each: two U+200B a word 3 bare 429s, one
after every character 3, U+2060 2, soft hyphen 1). omp's line now goes
as "RFC 2119 key words: …", RFC 2119's own term, with its white space
as it was. The hint says so.
Real account (sandbox HOME, copy of the live Antigravity account,
gemini-3.8-flash, sequential): the reworded plugin answered omp 18.20.0's
literal prompt 10/10, the full template 10/10, and the line wrapped after
"REQUIRED," 10/10. The zero-width version before it: lit 3, tmpl 1, w1 5
bare 429s in 12 each.
Run at 24c75a16's tree (rebased on
|
||
|
|
4f5d4138ad |
agy-cli 0.1.39: a new nc.exe build drops this runtime's older ones (#1097)
Each nc dir holds a whole Bun runtime (~115MB) and its key changes with mcp-server.mjs, so every plugin update left one in %TEMP% for the 7-day sweep (Hy1an measured it). Each dir now holds a `runtime` file naming the runtime that built it; a build removes the same runtime's other nc dirs at once. Another runtime's dirs (another install) and dirs from before the marker keep the week. A running nc.exe is locked, so its dir stays. Run: test/windows-nc.mjs 8/8 on WSL and on Windows 11 (xiaomi-gpu); bun test in packages/agy-cli 20/20 (WSL); check.mjs agy-cli ok. Broken by hand: 0.1.38's index.mjs fails the new test (and the two that now expect the marker). Not tried: a real update on Windows. Dirs 0.1.38 left have no marker, so they still go after a week. Reported-by: Hy1an |
||
|
|
67a5baaa1f |
agy-cli test: the sign-in check's upper bound has room on both sides (#1089)
"#1064 登录检查不为探测等太久" bounded authorize() at SLOW_MS + 3s + 1s, so a busy Windows box used up the 1s and went red 1 in 12. The fake session now answers after 60s, and the test asks that the probe session was started and that authorize() returned before half of that. The lower bound stays: a timer is only ever late. Run: WSL, node --test test/catalog.mjs 24/24; Windows 11 (xiaomi-gpu, Node 22), the #1064 tests 12 times, 0 red. Broken by hand: OFFERED_SIGNIN_WAIT_MS at 120s (authorize waits for the session) makes the test red, "登录检查等了会话(31524ms)". No package code changed, so no version bump. |
||
|
|
035a11cf88 |
agy-cli 0.1.38: a runtime under a non-ASCII folder still builds nc.exe (#1097)
On Windows, Bun's `build --compile` widens its own path byte by byte into UTF-16 before CopyFileW, so a magpie-bun.exe under a non-ASCII folder (a Chinese user name) fails with "failed to copy bun executable into temporary file: ENOENT". windowsNcDir then fell back to nc.cmd, which agy 1.5.x never runs, and no client tool reached the model. When process.execPath isn't ASCII, the build now runs a copy of the runtime in an ASCII-only folder (the temp dir, else %PUBLIC%, else %ProgramData%) and removes it after. nc.exe's cache key is still the real runtime's path. Run (mote, temp HOME, Bun 1.4.2): node --test test/windows-nc.mjs 7 pass; bun test in packages/agy-cli 20 pass; scripts/check.mjs agy-cli ok. Broken by hand: with main's index.mjs the new test fails. Windows 11 (xiaomi-gpu, Bun 1.4.2, real binaries): bun under a folder named with Chinese characters fails `build --compile` with the reporter's ENOENT. A non-ASCII cwd, server path or output path is fine, and the compiled exe runs from a non-ASCII folder; an 8.3 short path doesn't help. The plugin's own ensureShimDir, run by that bun: main gives nc.cmd, this change gives nc.exe in 614ms, which starts, and leaves no build dir or runtime copy behind. Not tried: agy itself against the new nc.exe on Windows, and Bun 1.4.4 (the reporter's); the code path read is the same in Bun's main source. Reported-by: Hy1an |
||
|
|
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). |
||
|
|
2e77e646c8 |
agy-cli 0.1.36: the last model list agy gave is served after a restart (#1086)
After a restart, models() handed out the static Gemini-only fallback until agy answered again. offeredFilter also hid every non-Gemini model until a session or probe told it what agy offers. So the first requests after a restart saw no Claude models. The bridge now keeps the last list agy gave, and the set it offered, in models.json beside the session state file. The file has one entry per agy path, is written under the state lock through temp-and-rename (mode 0600), and is trusted for 14 days. A half-written or invalid file, another agy path, or a stale entry all give the static fallback, as before. A saved list is not treated as an answer from this agy: the offered probe still waits for a real listing. Run (WSL magpie-desktop, Bun 1.4.2, Node 22): - bun test in packages/agy-cli: 20 pass. - node --test test/catalog.mjs: 24 pass. - bun scripts/check.mjs agy-cli: ok. Windows (xiaomi-gpu): node --test test/catalog.mjs 12 times, 11 green. The one red is the existing wall-clock test "#1064 登录检查不为探测等太久", filed as #1089. I haven't shown whether it is red on origin/main too. Broken by hand: readSavedCatalog returning null turns the new #1086 test red; skipping the offered restore turns it red too. Not tried: real agy on any OS; a restart with a real signed-in agy. Reported-by: yinbing-666 |
||
|
|
7bccaae910 |
agy-cli 0.1.35: a client tool's ide-tools permission request is allowed once (#1082)
Newer agy asks before an MCP call, and the bridge refused every session/request_permission, so each client tool failed with "user denied permission for mcp(ide-tools/exec_command)". A request whose title (or name) is exactly mcp(ide-tools/<tool>), mcp "ide-tools/<tool>", ide-tools/<tool> or mcp_ide-tools_<tool>, with <tool> among the tools the client declared, now gets allow_once. Those tools run in the client under its own permissions. agy's own tools (shell, edits, browser) are still denied, as is a title that only contains such a name somewhere (a shell command's text can be in its title), an undeclared tool and another server's tool. rawInput is never read. Run (WSL magpie-desktop, HOME=$(mktemp -d)): bun test in packages/agy-cli, 20 pass; bun scripts/check.mjs agy-cli ok. Broken by hand: with the allow branch off, smoke.mjs has 2 failures, the two #1082 allow checks. Not tried: a real agy that asks for MCP permission. The title agy sends for an MCP call isn't known from its strings, so the forms above come from its rule and error text; the reporter is asked to confirm. Reported-by: Saramanda9988 |
||
|
|
58221e6faa |
agy-cli: the smoke fake stops a turn whose ToolSearch failed (#1069)
The fake agy in smoke.mjs now returns when its old prompt's ToolSearch call comes back isError, instead of going on to its loaded-tool validator. Under a slow shutdown (Windows) that path logged unknownTool and failed "no call to the loaded tool reaches agy's validator in the old prompt". Fixture only; the bridge is unchanged. Run at 6946b93c: smoke.mjs ALL OK (337) 3 of 3 on Windows 11. With an 800ms pause injected before the bridge's process stop (WSL), the parent fails that check and this head passes it. CI test job green. Fixes #973. |
||
|
|
b40a853c20 |
agy-cli 0.1.34: agy isn't run in the background without a sign-in, so it stops opening the browser (JZGiVvkSOA75376 on X)
On Windows 11, a signed-out agy opened Google's sign-in page 235 times in one day. The usage refresh ran `agy` about every 3 minutes, and agy opens the browser through ShellExecuteW, so the BROWSER=open.cmd guard can't stop it. New signin.mjs reads agy's stored sign-in without running agy. agy keeps it through go-keyring, service "gemini" and user "antigravity": - macOS: `security find-generic-password`; - Windows: CredReadW from PowerShell, on the credential "gemini:antigravity". It reads only whether a sign-in is stored, whether it has a refresh token, and when the access token ends. The token itself never leaves the function; a hash tells one sign-in from the next. Setting GEMINI_API_KEY, GOOGLE_API_KEY, AGY_ADC_AUTH or GOOGLE_GENAI_USE_VERTEXAI means agy signs in some other way, so nothing is concluded from the keyring. AGY_BRIDGE_STORED_SIGNIN=skip turns the read off. An access token that has ended is not "needs sign-in". The owner's working agy has one that ended 11 hours ago and is renewed from its refresh token. agy counts as unable to sign in when: - no sign-in is stored; - the access token has ended and there is no refresh token; - or agy already failed on this stored sign-in: it said it needs a sign-in, or it hung with an ended token and printed nothing or sign-in talk, the way an agy waiting on its browser does. This holds until another sign-in is stored. What changes: - Usage: in those cases agy isn't run. The read says signIn "expired", and magpie shows the account's sign-in as expired. After the next good read it says "renewed", and magpie clears that. - Other usage failures wait 10 minutes before the next run, doubling up to 6 hours. Before, they ran again on every refresh. - The model listing (`agy models`) isn't run in the background in those cases either. The catalog it has stays. - Signing in from magpie skips the `agy models` probe and goes straight to magpie's own sign-in link. A finished sign-in clears what was marked dead. - A request answers 401 with X-Magpie-Sign-In: expired when no sign-in is stored. This uses the last read, so a request never waits for PowerShell. - `agy --version` hanging is never read as a sign-in wait. Run: - mote, rebased on |
||
|
|
00892c80e3 |
agy-cli 0.1.33: DSH's @-path paragraph goes reworded, as antigravity sends it (#1028) (LeeTengLong on X)
agy-cli's cloak.mjs copied only antigravity's TURNED_AWAY break-up (#980), not the REWORDED rewrite antigravity 0.1.7 added for #1028, so DeepSeek Harness's "Tokens prefixed with @ are paths…" paragraph reached agy word for word, the text that got gemini-4-argon answering fast, without thinking and shallow. cloak.mjs now carries REWORDED, reword and outgoing (reword after cloak), a copy of antigravity/index.mjs's, and every place agy-cli hands system text to agy uses outgoing: the session's systemPrompt.append, <external_system_instructions>, a later system/developer message and the notices beside a tool result. Only that exact paragraph changes; a prompt that merely mentions @ paths, and what the user wrote, go as written. instructionsIdentity still keys on the prompt as the client wrote it. The packages ship on their own, so the code is a copy; cloak.test.mjs holds it to antigravity's shape() output for each REWORDED entry and the samples. Run on mote (Bun 1.4.2, temp HOME): bun test packages/agy-cli packages/antigravity 118 pass 0 fail; bun scripts/check.mjs exit 0. Broken by hand: outgoing without reword turns 3 tests red (cloak.test.mjs 2, and smoke.mjs's #1028 session, external_system_instructions and later system message checks). Not tried: a real agy with a real Antigravity account and DSH; the rewording's effect rests on #1028's replays. No magpie min names agy-cli. Reported-by: LeeTengLong |
||
|
|
0135b7b0ea |
agy-cli 0.1.32: the first model list after warming has agy's Claude and GPT models (#1064)
On a signed-in agy, `agy models` takes about 4.4s and `agy acp`'s
session/new about 3s. provider.models() needed three calls before
claude-opus-5-5, claude-sonnet-5-5 and gpt-oss-120b showed up, and
OpenCode 2.x calls it once.
What changed:
- packages/agy-cli/index.mjs:
- The offered-model probe now starts in listAgyModels' .then, as soon as
a non-empty list arrives and a caller asked for probeOffered. It no
longer waits for the next models() call. A hung or failed `agy models`
still never spawns the probe.
- probeSignedIn reuses the `agy models` stdout it already has. The same
parser (parseAgyModels, split out of listAgyModels) fills
cachedModelCatalog, and the probe starts. Sign-in waits for the probe
for at most 3s.
- The offer (acpOfferedModels, acpOfferedKey, offeredProbeAt and any
in-flight probe) is forgotten when agyPath changes and after a new
sign-in finishes. A generation counter drops the answer of a probe
that started before the reset.
- provider.warming() returns a promise while a list or probe is still
running, and null when nothing is.
- scripts/opencode2.mjs, copied byte for byte to every
packages/*/opencode2.mjs: after the first background refresh, the
adapter awaits hooks.provider.warming() once, for at most 60s, and then
refreshes once more. It does not loop. Plugins without warming() behave
as before.
- Not done: the issue's on-disk catalog cache (point 3), skipped as asked.
Known gap: agy-cli has no `config` hook, so under OpenCode 2.x the adapter
lists no provider for it. refresh() returns before it calls
provider.models(), so the follow-up refresh can't add agy's models on 2.x
until agy-cli gets a config hook.
Tests: test/testkit.mjs's fake agy takes a sessionNewDelayMs. The new
tests in test/catalog.mjs set 1.5s on both `agy models` and session/new
and wait for state through warming(), with no fixed sleeps:
- On a slow cold start, the first models() after warming lists Claude and
GPT, from one probe spawn.
- authorize() on a signed-in agy fills the catalog, and the next models()
runs no second `agy models`.
- The sign-in wait is bounded: with a 6s session/new, sign-in returns in
about 4.5s.
- Changing agyPath probes again.
The hang test now awaits warming() before it counts acp spawns.
scripts/opencode2.test.mjs: the warming list is read a second time when
warming ends, and only once when nothing is warming.
Run on Linux (a separate test Mac was over its load limit):
- packages/agy-cli bun test: 17 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
- bun scripts/check.mjs (all packages): ok.
- Root bun test in a temp HOME: 8530 pass, 19 skip, 0 fail.
Broken by hand on Linux, each red, then restored green:
- No probe in the .then: the slow cold-start test.
- probeSignedIn drops the list: the authorize and bounded-wait tests.
- agyPath change keeps the old offer: the agyPath test.
- Unbounded sign-in wait: the bounded-wait test (7514ms).
- Probe also on a failed listing: the hang test.
- origin/main's index.mjs with the new tests: all four #1064 tests.
- Adapter reads the list once: the warming adapter test, and the
copy-identity check.
Not tried: a real agy (no Google sign-in, no network). The reset after
login.finish has no unit test of its own.
Reported-by: hiee3
|
||
|
|
753a61f85c |
agy-cli 0.1.31: wait for MCP commit before cancelling steered tool turns (#1061)
When a client steers a live tool turn, agy-cli now waits for agy to commit the MCP responses (a tool_call_update, the next generation, or the prompt ending; AGY_BRIDGE_MCP_COMMIT_WAIT_MS, default 5s) before sending session/cancel. Before, the cancel could beat the response, and agy recorded "Tool execution was canceled". A clean steer keeps SQLite step usage trusted, and an unpolled LONGTOOL result stays in the steered prompt. A steer in progress is not evicted or reclaimed, and a second steer gets 503. Reviewed at 01de2cc. Run on a separate test Mac (Bun 1.4.2, temp HOME): bun scripts/check.mjs agy-cli ok; bun test ./packages/agy-cli 17 pass. Broken by hand: with no commit wait, the smoke steer case, six steer-in-session groups and usage-settlement go red. Not tried by the reviewer: a real agy (the author's live run on agy 1.5.6 is in the PR). Co-authored-by: tungloong <tungloong@users.noreply.github.com> |
||
|
|
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 |
||
|
|
16b487fa8e | agy-cli 0.1.29: release the Gemini 4 Carbon limits (jinzheio on X) | ||
|
|
857d43a8c9 |
agy-cli 0.1.7: Gemini 4 Carbon (Ultra) gets its limits, 1M context and 262144 output (jinzheio on X)
Antigravity's fetchAvailableModels names Gemini 4 Carbon (id gemini-4-carbon,
"available to Ultra plan subscribers", maxTokens 1048576, maxOutputTokens
262144). agy-cli listed the model from `agy models` but gave it no limit, as
modelLimits knew only Argon and 3.8 Flash. Added the family with Google's own
numbers.
Run: bun test agy-cli.test.mjs (all pass) with HOME a temp dir. The new
catalog test is red on the old code (limit undefined) and green with the fix.
Real account: the owner's Antigravity account is free-tier and lists Carbon
as disabled ("Unavailable"); no Ultra account was available, so a Carbon
request was not sent. No region error from this machine (a gemini-3.8-flash
request through the live gateway answered).
Not tried: agy with an Ultra account; the reporter's region restriction.
|
||
|
|
a2e601dc21 |
agy-cli 0.1.28: tool schemas with $ref/allOf/oneOf reach the model with their fields (#1042)
Tool schemas that use $ref, allOf or oneOf now reach the model with all their fields (expandToolSchema).
Nullable unions are lowered to type:[X,"null"]. Inlining is capped by depth (counted only along $ref and allOf), by 8192 nodes and by 256 KiB. A tool with no schema gets a plain object. The ToolSearch fallback was dropped.
Run at 80d19737 merged with main
|
||
|
|
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 |
||
|
|
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 |
||
|
|
768eafd6dc |
agy-cli 0.1.25: nc.exe is built under magpie's renamed Bun too (tearicerice on X)
windowsNcBuild() accepted only a runtime named bun / bun.exe. magpie's plugin host runs the Bun it downloads as magpie-bun(.exe) (internal/plugin bunupdate.go magpieBun), so on Windows 0.1.24 always returned null and fell back to nc.cmd: the console window and conhost per `agy acp` MCP call stayed (#1047). The name now matches (magpie-)?bun(.exe). An opencode build, which reports a bun version but has no `build` command, and Node still get null. Run: node --test packages/agy-cli/test/windows-nc.mjs on mica, 6 of 6 pass. Broke by hand: the old regex puts the new magpie-bun.exe assertion red (1 of 6 fails). win-run on xiaomi-gpu: a copy of Bun renamed magpie-bun.exe, platform.mjs picked it, `build --compile --windows-hide-console` exited 0, nc.exe PE subsystem = 2 (GUI). Siblings: no other package checks a Bun basename (grep). Not tried: a real `agy acp` session on Windows. |
||
|
|
80d3a00ee3 |
agy-cli 0.1.24: no console window or leftover conhost on Windows (#1047)
agy dials --ide-mcp-port by running `nc` from PATH, and on Windows the
bridge's nc was nc.cmd: cmd.exe running mcp-server.mjs, two console
programs. When agy starts a console program with a console of its own
(CREATE_NEW_CONSOLE, or CREATE_NO_WINDOW), each dial gets a window or a
conhost.exe. Each session also made its own bin dir, and a host that
exited left its parked agy's cmd/bun children and its workspace dirs
behind.
- Under Bun (magpie's runtime), nc is now a GUI-subsystem nc.exe that
Bun builds from mcp-server.mjs on the user's own machine (`bun build
--compile --windows-hide-console`, ~0.3s on the test box). A GUI exe
gets no console under any creation flags, and it still talks over the
stdio pipes agy hands it. Nothing prebuilt ships. It lives in
%TEMP%\magpie-agy-bridge-nc-<hash of runtime, Bun version and server
source>, so every session and every later host reuses one build. A dir
no host has used for a week, or a half-done build dir older than an
hour, is swept. If the build fails, or the runtime isn't Bun (e.g.
opencode.exe), nc.cmd is used as before.
- At exit on Windows one `taskkill /T /F` ends every live agy with its
tree (cmd, nc). The workspace rm retries while the just-killed
processes let go of their cwd. Only a shim dir this host made is
removed; the shared nc.exe dir stays.
Run on Windows 11 (build 26200, xiaomi-gpu), Bun 1.4.2. A fake agy (Go)
answers ACP and dials `nc 127.0.0.1 <port>` 3 times per session, with
CreationFlags none, CREATE_NO_WINDOW or CREATE_NEW_CONSOLE. 4 sessions
per run, all 12 dials answered in every run below. conhost counts are
those under the host after 4 sessions, while agy is parked:
old, none: 5 conhost; agy 4, cmd 4, bun 4; 4 workspace dirs leaked
old, nowindow: 9 conhost (+2 per session); same leak
old, newconsole: 9 conhost (+2 per session); same leak
new, none / nowindow / newconsole: 5 conhost (the parked agy's own);
agy 4, nc.exe 4, no cmd, no bun; one magpie-agy-bridge-nc-<hash>
dir, nothing else left in TEMP after exit
new, idle eviction (3s): back to 1 conhost, no agy/nc left
new, host hard-killed: no agy/nc left; the 4 workspace dirs stay (no
code runs after a hard kill; the same on old, which also leaks its
bin dir)
old, DETACHED_PROCESS: the dial never answers (agy start times out),
so that isn't what the reported agy does.
The system-wide conhost count was 1 before and after every run.
Tests: test/windows-nc.mjs (6 tests, on any OS through the kit's
platform, execPath and versions overrides): the build command, the
shared dir built once and reused by a later host, no nc.cmd, the
nc.cmd fallback, the one-run tree kill at exit and which dirs it
removes.
Run at this tree on mica (Bun 1.4.2, temp HOME): bun test
packages/agy-cli 15 pass 0 fail; bun scripts/check.mjs exit 0.
On the Windows box: 14 pass, 1 fail. The red is smoke.mjs's "no call to
the loaded tool reaches agy's validator in the old prompt". It fails the
same way at origin/main
|
||
|
|
b64dfb91cb |
agy-cli 0.1.23: thinking is not counted twice on the SQLite path (#1032)
measuredUsage summed field 3 (output) and field 9 (thinking) of SQLite gen_metadata, but field 3 already carries the thinking, so the SQLite path billed thinking twice. Each step now counts max(output, thinking), as promptUsage does since #1023. Run at b3873f84 on mica (Bun, temp HOME): bun test packages/agy-cli 14 pass 0 fail; bun scripts/check.mjs exit 0. Broken by hand: putting back item.output + item.thinking turns 4 tests red, including the PR's new one. Not tried: a real Antigravity CLI session. |
||
|
|
b829a5541e |
agy-cli 0.1.22: thinking is not counted twice in billed output (#1023)
ACP's outputTokens already includes the thinking tokens, so `completion_tokens` is outputTokens again, not output + thinking. The totalTokens shape check compares against input + output (and input + cache + output), without thinking. Evidence (klarkxy, agy 1.5.4): for single-turn Flash and Carbon prompts, ACP's totalTokens equals input + output exactly (2322 + 4728 = 7050, 2316 + 9390 = 11706). Output minus thinking is 67 and 68 tokens, which matches the visible replies. The store's gen_metadata output (field 3) equals ACP's outputTokens, with thinking (field 9) below it. 0.1.19 sent 9389 and 18712, double-counting. Run at a0898318 merged onto origin/main (1199adda), on mica with a temp HOME: bun test packages/agy-cli gave 14 pass, 0 fail, and scripts/check.mjs exited 0. CI's test and on-npm jobs pass. Earlier, at d18f2346, putting `output + thinking` back by hand turned five tests red. Not tried: a live agy session here. Co-authored-by: klarkxy <klarkxy@users.noreply.github.com> |
||
|
|
52e31c4a1f |
agy-cli 0.1.21: text that names a notice tag it never closes is routed by who wrote it, not refused (PolarizingLight on X)
A tool turn answered with text beside the result that merely mentions a
notice tag it does not close ("<system-reminder", "<channel") threw "text
beside a live tool_result; send it after the tool response completes". In
a long Codex thread (ChatGPT desktop) that text comes from a developer
message magpie wraps in <system-reminder> whose own text quotes a reminder
tag (the wrapper then leaves a stray close tag), a hook's context, or the
user typing the tag. Now: a wrapped developer or system message is a
notice (broken up with cloak), a user's text steers and is replayed whole,
other roles ride as a notice. A notice that opens and is cut short
("<system-update>not a complete...") is still turned away.
Not found: a real failing request. magpie's logs on this Mac hold none, and
Codex's rollouts here hold no tag of this kind after a tool output, so the
exact bytes the reporter's thread carries are inferred, not seen.
Run: test/compat.mjs (new case red on 0.1.20, green now), agy-cli.test.mjs
whole on mote (12 pass). Broken by hand: old index.mjs makes the new case
fail. Not tried: a real ChatGPT desktop thread against agy-cli.
|
||
|
|
01eaa6dda4 |
agy-cli 0.1.20: each step's usage from agy's own store, and 1.5.1+ inputTokens read as uncached (#983)
agy 1.5.1+ reports ACP `inputTokens` as uncached prompt tokens only; `promptUsage()` tells the exclusive shape from the inclusive one by `totalTokens`, so cache reads are no longer clipped and the learned cache ratio no longer pins to 1.0. Each HTTP step of a multi-step tool loop is settled from agy's own per-call rows in `conversations/<id>.db` (`gen_metadata` on 1.5.1+, `steps` type 15 on 1.4.x-1.5.0) when they reconcile with ACP's total; same-generation tool continuations settle at 0, a cancelled or fallen-back turn stops trusting the store, and a clipped cold-start replay bounds its fallback estimate. The reader (`step-usage.mjs`) never opens a store read-write. Under Bun it opens with `SQLITE_OPEN_READONLY | SQLITE_OPEN_URI` (Bun's SQLite on Linux and Windows parses `file:` URIs only with that flag), finalizes statements and waits on no busy timeout. A checkpointed WAL store with no `-wal`/`-shm` is read through `?immutable=1` and gains no side files; if `-wal` appears during that read it is read again live. Store paths are resolved to absolute first, and Windows `\\?\` and UNC paths get their own `file:` form. On an uncheckpointed store the only file a reader touches is SQLite's `-shm` WAL index. Reviewed head 9054f47295d51d6f83f8585dd550312ebff8448a (base dba24067; merges cleanly onto main |
||
|
|
445f4143de |
Revert "agy-cli 0.1.19: tools with large schemas are shortened so agy keeps them in the model's function list (#989, klarkxy on X)"
This reverts commit
|
||
|
|
8e6c75b1e3 |
agy-cli 0.1.19: tools with large schemas are shortened so agy keeps them in the model's function list (#989, klarkxy on X)
agy lazy-loads MCP tools (McpToolConfig.EnableLazyLoad and a call_mcp_tool tool are in the 1.5.5 binary): a tool with a large declaration never reaches the model's function list and nothing says so. The reporter saw tools of about 691 tokens and up missing (bash, grep), 561 and below present. The exact cut-off is not in the binary. tool-budget.mjs fits each tool under 2000 characters (about 500 tokens; env AGY_BRIDGE_TOOL_BUDGET, 0 = off). Order of loss: default/examples/title, nested descriptions to 90 chars, the tool's description, nested descriptions, and last the largest optional parameters (never required ones). Each changed tool is logged on stderr as agy_bridge_tool_shrunk, with what was lost and stillOver when it cannot fit. Run (mica, HOME=$(mktemp -d)): bun test packages/agy-cli 14 pass, scripts/check.mjs ok. Broken by hand: without the fitTools call in the request path the smoke check goes red (5201 chars). Not tried: a real agy 1.5.x with Gemini 4 Carbon, so the 2000-character budget rests on the reporter's numbers. |
||
|
|
5341ac1e70 |
agy-cli 0.1.19: every client tool is listed always loaded, so agy no longer hides large ones from the model (#989)
agy loads an MCP tool on demand, outside the model's function list,
unless the server's tools/list marks it with
_meta {"antigravity/alwaysLoad": true} (agy's changelog, 1.3.5; the key is
in the 1.5.5 binary next to SplitEnabledToolsByEagerLazy and
McpServerSpec.force_all_tools_eager). The bridge's agent has tools: [],
so the model had no working way to load them: on klarkxy's 72-tool
catalog, tools from ~691 tokens up (bash, grep, task, ask_user) were
never offered while read, glob and write were. listTools now adds the
key to every tool it hands agy; the stored catalog and its signature
are unchanged.
Ran: wsl-run (magpie-desktop) with HOME=$(mktemp -d): bun test
packages/agy-cli (13 pass), bun scripts/check.mjs (ok), root bun test
(8207 pass, 19 skip, 0 fail) at base 017cd73e; after the rebase onto
|
||
|
|
c00c4b9f6c |
agy-cli: usage timeout tests wait on the children, not a duration (#950)
Cause: "simulated Windows timeouts kill the whole tree" ran fetchUsage
with a 600ms timeout that covers both children. On a loaded machine the
fake agy's start (bun startup plus its browser-guard spawnSync) can use
most of it, so the timeout fired before the report child had logged, or
before it was even spawned, and logs[1] was undefined
("undefined is not an object (evaluating 'logs[1].pid')"). The same
budget made its sibling "version/report hangs time out" read a log the
killed version child never wrote (ENOENT). After the kill, a fixed 20ms
(and 50ms in both descendant tests) stood in for the kernel and event
loop reaping a SIGKILLed child.
Fix, test-only:
- timedOut() records each spawned child's pid itself and doubles the
timeout (600ms up to 38.4s) until the timeout lands while the child
under test runs; the taskkill assertions use the spawned report pid.
- The "gone" checks poll: waitForPidExit with a 15s bound over the
spawned pids and every pid the fixture logged (the agy under cmd.exe
on Windows); waitForNotRunning polls ps for the two descendant tests.
- agy-cli.test.mjs runs each suite with bun's --timeout 120000: bun's
5s per-test default was the next fixed wait these tests hit under the
injected delay.
- The fake agy takes TEST_START_DELAY_MS to reproduce a slow start.
Injected: TEST_START_DELAY_MS=400 on the old test (WSL magpie-desktop)
-> the #950 test red with the logs[1].pid TypeError; =900 -> it and the
hang test red with ENOENT. With this change: 20/20 at 0, 400 and 900 on
WSL, 20/20 at 0 and 900 on mote (macOS), 17/17 (3 skipped) at 0 and 900
on xiaomi-gpu (Windows).
Ran: wsl-run 'export HOME=$(mktemp -d); bun test packages/agy-cli;
bun scripts/check.mjs' -> 13 pass, 0 fail; check.mjs all ok.
Not tried: the reaping race by itself (a SIGKILLed child still listed
after 20ms) wasn't injected; it is covered by polling, not reproduced.
No source change, so no version bump.
|
||
|
|
9ec696258d |
agy-cli 0.1.18: turned-away system lines are broken up before agy sends them, and a 429 to one is not a quota (#980)
Antigravity answers 429 "Resource has been exhausted" to a few system prompt lines whatever quota is left (Claude Code's billing line, the Claude Agent SDK, Codex's and Hermes Agent's identities, oh-my-pi's RFC 2119 line). The antigravity provider breaks them up with zero-width spaces (TURNED_AWAY / breakUp / cloak); agy-cli sent the client's system prompt to agy as written, and called the 429 an exhausted quota (rate_limit_error), so a client or routing group retried a prompt that fails every time. - cloak.mjs is a copy of antigravity's TURNED_AWAY, cloak and hint (the two-zero-width-space break-up of 11-11). Each package ships on its own, so cloak.test.mjs imports packages/antigravity's _internal and fails when the two give a different answer for any line or sample. - Every route the system text reaches agy is cloaked: the session's systemPrompt.append (session/new and session/resume), <external_system_instructions> when agy can't append, a later system or developer message in the turn or the replayed history (renderTurnMessageParts), and a system/developer notice delivered beside a tool result (extractToolResults). - What the bridge keys and hashes on is unchanged: proc.instructions, sameInstructions, instructionsIdentity, stripVolatileSystem and the session store keep the prompt as the client wrote it; cloak is applied only where the text is sent. User text is not touched. - #formatAgentError: a "code 429 ... Resource has been exhausted" with a turned-away line in the session's instructions is an invalid_request_error, "Antigravity answered 429 to this system prompt: <detail> — <hint>", with the antigravity provider's hint. Any other 429 stays rate_limit_error. - READMEs (en, zh) say so under the minimal-agent section. Run (wsl-run, magpie-desktop, HOME=$(mktemp -d), at |
||
|
|
18ce00e4ce |
agy-cli 0.1.17: a steer keeps the live agy session, so its prompt cache holds (ChrisJ_AI on X)
Reported by ChrisJ_AI on X: after 0.1.12, most turns show a normal cache ratio, but a steer / interrupt still reads 0% (303K input, 0% in his screenshot; agy's own session rows for the replay read 193K and 65.8K at 0% too, then 99% again). Cause: a user steer (text or an image beside a live tool_result, a rejected tool, a hook line) stopped the live agy session and replayed the round in a new session/new. A new session has no cache, so agy itself reported 0%. Now the bridge answers the pending MCP calls with the real results, cancels the step agy was starting, and sends only the steer as the next prompt of the same session (the answered tool results are not sent a second time). Falls back to the old replay when the session or history differs, tools grew, a result carries an image, a call is still unanswered, or the cancel does not settle. Run (WSL2 Ubuntu 24.04, Bun 1.4.2): bun test packages/agy-cli 11 of 11, smoke.mjs ALL OK; bun scripts/check.mjs agy-cli ok. smoke.mjs now asserts no new session/new (same convId, same init count), the steer text in the next prompt and the real result delivered to the MCP call, for the Esc, queued_command, standalone follow-up, text before/after the result, image, rejected tool, Skill and queued-suffix cases. Broken by hand: the same smoke.mjs against origin/main's index.mjs: 12 failures, all of those. Not tried: a real agy (signed out on this machine and in magpie's account store), so Google's cache after a steer is not measured; Windows (smoke is red there, #973); macOS. |
||
|
|
92e0417739 |
agy-cli 0.1.16: keep conversationKey stable across volatile openings (#947)
conversationKey stays stable when only agent-injected opening fields change (Claude Code's billing header, known clock lines in the system prompt or a <system-reminder>), so a continued chat keeps its agy session and its prompt cache. It hashes the whole stripped first message. A flattened, growing first message reuses the live session only when it continues the whole previous opening plus that session's reply on a line boundary, and then sends agy only the new tail. Closes #945. Reviewed head 56c845720026819781e198bada948cce9b926806 (one commit on main 9204c07; main |
||
|
|
dbd082f6d1 |
agy-cli 0.1.15: an array tool schema whose items live only on a sibling gets an items schema Gemini accepts (klarkxy #963)
Gemini refuses an array schema with no `items`. array-items.mjs infers the items from the schema around it, or adds a permissive items schema 8 levels deep, without narrowing what the client allowed; tuple `items` lists are left as they are, with a hint. Closes #962. Reviewed head c7d3e7b8 (on |
||
|
|
738fd501d7 |
agy-cli 0.1.14: tool schema patterns are turned into RE2 or dropped, so an ECMA-262 pattern no longer aborts the turn (klarkxy #946)
Tool input schemas' `pattern` and `patternProperties` keys are translated to RE2 (re2-pattern.mjs) before they reach agy; a pattern RE2 can't hold is dropped with a hint, and `additionalProperties: false` is lifted when every patternProperties key was dropped. Closes #944. Reviewed head 99093088 (on |
||
|
|
a0b1e49113 |
agy-cli 0.1.13: an image before a live tool_result counts as the user steering (klarkxy #965)
An image the user sends with no text before a live tool_result now marks the turn as steered, so it is replayed and the image stays off the MCP result. Reviewed head 7852e288 (on |
||
|
|
7869318d6a |
agy-cli 0.1.12: a tool step's estimated cache read stops at the step before it, so a new tool result is billed as input (#971 review)
0.1.11 (#971) estimated an uncalibrated first prompt's tool steps by summing every earlier settled step's whole window as the cached prefix. Each window already holds the steps before it, so the prefix was counted once per step: from the third step on, the step's whole window, the tool result just added included, came back as a cache read. In the review's probe (four Read calls, ACP reporting cachedReadTokens 0), step 4 billed 0 input and 34,456 read, and the steps claimed 56,608 cache-read tokens that ACP never reported. The prefix is now the largest earlier settled window (the step before), so each step reads that from the cache and bills what was added since. The step test that pinned the 100% clamp now checks that step 3's uncached input covers what was added after step 2, and that its read does not exceed step 2's window. Still an estimate until ACP reports. Run (WSL2 Ubuntu 24.04, Bun 1.4.2, temp HOME): bun test packages/agy-cli 8 of 8 pass; bun scripts/check.mjs agy-cli passes. Broken by hand: origin/main's index.mjs with the new test, node --test test/usage-settlement.mjs: 25 pass, 1 fail ("第三步未缓存 input 0 应覆盖 第二步之后新增的 32"). Restored, green. Not tried: Windows (main's smoke red there is #973), macOS (mote refused ssh), a real agy. |
||
|
|
73d2006444 |
agy-cli 0.1.11: sessions survive canonicalized tool input; a first prompt's tool steps count the settled prefix as cached (ChrisJ_AI on X, klarkxy #971)
Reported by ChrisJ_AI on X: Claude Code on an agy-cli model showed 268K-input turns
at 0% cache hit, turn after turn.
Two places dropped cache reuse; both are klarkxy's #971 (closes #970):
- a follow-up turn after the client filled defaults into historical
tool_use.input (Edit's replace_all) failed matchesHistory / takeParked, so
the live agy session was retired and the whole prefix replayed;
- tool steps of a fresh process's first prompt reported every token as a
cache miss until the prompt ended (no ratio learned yet).
Run at reviewed head 27245320 (win-run, xiaomi-gpu): node --test
test/usage-settlement.mjs 26/26 pass; the same file against c27ba5f7's
index.mjs fails tests 20, 21 and 24 (red on old code). bun test
packages/agy-cli: 7 of 8 pass, smoke.mjs 1 failure of 321 checks, the same
count on
|
||
|
|
c27ba5f700 |
agy-cli 0.1.6: every prompt's own cache reads set the ratio the next tool steps report (baranwang on X)
Tool steps estimate their cache reads from the last ratio the proc learned, and only a final, uncancelled response taught it, so a cancelled prompt left the next one's tool steps reporting every token as a cache miss. agy reports each prompt's cached reads, so recordPromptUsage now sets the ratio from them. Test: a cancelled prompt (390k of 520k cached) then a tool step reports 0.75. Red with the line off, green with it. Not captured from a real agy: the owner's agy is signed out on this machine and mote was down. A fresh conversation's first prompt still has no ratio until it ends. Ran node --test packages/agy-cli/test (2 reds on base too: cp-hook, version/report hangs), bun test packages/antigravity, scripts/check.mjs. |