Repository navigation
fix(acp): bound the tool-call liveness map and warn on kas vocabulary drift - #20260
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS One thing to confirm: after an eviction, a wedged turn waits out the full tool-stall window, never the faster stale probe. That cost is accepted in Not justified as shipped
What this change shipsInventory (9 items) — 8 justifiedIntent: keep per-turn tool-call memory bounded on every harness, and tell KAS operators when their kiro-cli release was never checked against the tool-name tables. FIX (Closes #18627).
[FIRST-PRINCIPLES-REVIEWED] 97b1b1c Description read[DESCRIPTION-READ] 779c99aa5aa83033a11bc00e15a6f1b9d068d363457501c2214b75ca3f00be65 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merging, check that a turn which goes past 256 calls is meant to lose stale-probe detection for the rest of that turn and wait out the full tool-stall window. [DESIGN-REVIEWED] 97b1b1c Description read[DESCRIPTION-READ] 0c477595dd412545e23e8688ba54a41a885a731eb22145db67eaed85ea5aaca8 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
ad367a8 to
86b91ec
Compare
|
|
|
|
86b91ec to
05f7b22
Compare
|
|
|
|
05f7b22 to
4ecf2aa
Compare
|
|
|
|
|
|
|
72faeca to
5450fe8
Compare
5450fe8 to
436dad5
Compare
|
|
|
|
… drift The in-flight tool tracker and the handle's output-seen set kept one row per tool call with no terminal result for the whole turn, each row holding the backend's title, command, tool and server names and raw toolCallId at full length. The tracker takes a row cap (the provenance caches' count bound), the state cuts its strings at construction keeping a long command's tail so the stall hint still finds its redirect, an over-long id is held as its digest, and the stale clock stays disarmed after an eviction so a live call is never cancel-probed. The kas backend logs once per kiro-cli release at session start when the installed binary is not one the KAS tool-name tables were verified on, the same comparison the doctor row makes. Closes #18627
436dad5 to
97b1b1c
Compare
|
|
mbriones98
left a comment
There was a problem hiding this comment.
Checks green and PR Readiness passed at 97b1b1c; non-feature change.
Problem / Motivation
Goal: A turn's memory for in-flight tool calls stays bounded on every harness, and a kas session says at start when its kiro-cli is one the tool-name tables were never checked on.
Two bounds were taken out of #17280 to keep that PR to the kas tool-name fix. Without them:
InFlightToolTrackerand the handle's_tool_output_seenset keep one row per tool call with no terminal result yet, for the whole turn. A backend that sends many distincttool_callframes and never reports their results grows these rows for the turn, and each row keeps the backend'stitle,command,tool_name,mcp_server_nameand rawtoolCallIdat full length.kirocrew doctorsays so, and an operator who never runs it does not see it.Why it matters
Memory per turn is bounded only by the transport frame cap today, on every harness. And an operator who relies on kiro-cli-spelled denies on the kas backend can be on an unverified release without ever being told.
Not a goal
What changed (motivation → approach → change)
Every row the liveness bookkeeping holds is bounded, and so is the number of rows, on both transports: the session handle's attribution map (
acp/liveness.pyfor the state and tracker,acp/session_handle.pyfor the stale-clock reading) and theAcpClient's open-call set (InFlightIdSet). The shared key and count bound live inacp/_dispatch.pybeside the provenance caches' bounds they are named from.MAX_ACTIVE_TOOL_CALLS(the provenance caches' count bound, 256); at the cap the oldest row goes, the call just dispatched is always kept, and every eviction is countedtitle,tool_name,mcp_server_namecommand, and the git editor hint built from it> fileredirect still reaches the stall hinttoolCallIdsha256:prefix is digested too, so no raw id can equal another call's key_tool_output_seenAfter an eviction the turn is treated as still having a tool in flight until its clear: an emptied map does not prove that nothing runs, so the stale clock does not cancel-probe a call whose row was evicted; the turn is judged as an opaque tool in flight and ends, if it wedges, by the tool-stall recovery after the full build-scale window (
acp-client.mdrecords this). The overflow is said once per turn: the next turn's reset warns with the bound and how many rows were dropped. The sub-agent's tracker keeps no bound (its runtime emits one call at a time).The KAS harness (
acp/harness/kas.py, inresolve_spawn) logs once per kiro-cli release when it spawns the relay and the pinned binary's--versionis not among the releases the KAS tool-name tables were verified on. It is the same comparison and the same reading as thekirocrew doctorrow (kas_vocabulary_driftinplatform/tool_names.py; KAS reports noagentInfo.versionon the wire); the doctor row (cli_doctor.py) and the fixture note name the spawn-time warning as the second reader ofverified_kiro_cli_versions. The process keeps the one release it last warned for, so the warning repeats only when the release changes. It lives on the harness and nowhere shared, so the Kiro path gains no conditional. The version parser (mcp_hot_reload.py) bounds each component to nine digits for every caller, so a harness-written version can never reachint()past CPython's digit limit.Backwards compatibility
Compatible: every bound is above what a real turn produces (a turn does not hold 256 unfinished calls; a release string is a dozen characters), so nothing that works today reads differently. The drift warning is one log line.
Removes nothing: the change adds bounds and a log line; no path, record, key or function goes away.
Tests
test_acp_liveness.py: the tracker evicts the oldest atmax_callsand keeps the new call judged; a re-dispatch under a held id evicts nothing;evictedresets onclear; an unbounded tracker never evicts.test_stale_watchdog_rearm.py: through the handle, the map holdsMAX_ACTIVE_TOOL_CALLSrows and the call in flight; every retained field is bounded (title,command, names, key, and the editor hint retained beside the row); the output-seen set takes only a call the map holds; the cmdline match fragment never spans the retention cut; a long id is popped by its terminal under the same digest; the output-seen set is pruned at the cap; after an eviction an empty map does not arm the stale clock; a non-string result id does not crash the turn; a bounded command keeps the redirectextract_log_redirect_targetreads.test_tool_call_classification.py: the kas drift warning fires once per release, the warned release is one slot and a changed release warns again, the measured release and an unknown version stay silent, the KAS spawn hands the pinned binary's probe to the warning (and still resolves when the probe cannot answer), and by source the warning lives on the KAS harness with nothing of it on the shared runtime.test_stale_watchdog_rearm.py(key): a raw id spelling another call's digest key gets its own row, so its terminal pops only itself; evictions are counted and said once at the turn reset; theAcpClientset is bounded under the same key and count, counts its evictions, and keeps the tool clock armed after one.test_mcp_hot_reload.py: a major or minor past nine digits is no version, an over-long patch is dropped rather than raised, nine-digit components still parse.Determinism proof for the 18 new/changed node ids: 20 runs at
-n0, 10 runs at-n 4 --dist loadgroup --max-worker-restart=2withtest/test_tool_names.pyandtest/test_acp_runtime.pyas co-tenants, and one shuffled-order run (seed 8465), all green.Manual verification
N/A — unit coverage sufficient: both bounds and the warning are exercised through the handle and runtime code paths the tests drive; the only live-only piece, the
--versionprobe, is the same readerkirocrew doctoralready uses.Related Issues
Closes #18627
Pattern harvest
Rule candidate: review-prompt
Pattern: a per-turn map keyed by a backend-authored id, holding backend-authored strings, with no count or width bound
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)