Repository navigation
fix(acp): stop the shared effort overlay seeding new KAS sessions - #21376
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merging, check that a KAS slot's live effort pick survives a gateway restart through slot metadata alone, now that [DESIGN-REVIEWED] 216d0c0 Description read[DESCRIPTION-READ] 0c8848fac120473b14a92362fe8e6a3b5aa528522be25b9603ed1b93cea857d2 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that the What this change shipsInventory (7 items) — 7 justifiedIntent: a new KAS chat with no effort picked runs at the model's own default, not at a level another chat in the same project left in the shared
[FIRST-PRINCIPLES-REVIEWED] 216d0c0 Description read[DESCRIPTION-READ] 6fbc2ddeff1f3bb771bb6988f074a9aa56950a771aa9c22d3c2fbd487dddd286 That sha256 names the PR description this verdict read. Recompute it with |
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: |
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: |
|
|
|
Design punchline (head
|
chenmingwei23
left a comment
There was a problem hiding this comment.
Approved via bulk merge run: no failing checks on the current revision.
db1e8cb to
95e802b
Compare
95e802b to
eaa62f6
Compare
|
self-added: no
|
|
a8ce2f9 to
da41dde
Compare
|
Rebased onto main 9d088c8 (new head da41dde, still one commit). Conflicted file:
Nothing from main was dropped: a Real Adapter Contract: the red on a8ce2f9 was Local: 2,462 tests passed across the touched and adjacent files (effort, overlay, harness parity, capability sets, session bindings, spawn backend, backends vocabulary). |
da41dde to
aa3408e
Compare
KAS never opens <work_dir>/.kiro/settings/cli.json, yet provider construction read its effort keys back for every kiro-family session. The file is keyed by work dir, so the level one chat picked became the starting level of every later chat on that model in the project, while the composer still showed Default. Every effort read, write and clear of that file is now scoped to a new ACP_BACKENDS_EFFORT_OVERLAY set (kiro-cli only), the same shape as ACP_BACKENDS_TOOL_SEARCH_OVERLAY. A KAS slot keeps its own pick across a gateway restart through its slot metadata. The read-back was also how a level picked live reached a compaction restart or reset successor: the dashboard effort route retired the session's recorded override and left the file to carry the pick. It now records the picked level instead (record_effort_override), so the successor starts on the level the session runs on every harness. Fixes #21362
aa3408e to
216d0c0
Compare
|
Rebased onto main Conflicts. Both were one long table row where main and this PR edited different words. Each merged row keeps every edit from both sides.
Auto-merged, checked by hand: Local checks on the rebased commit: 20 related test files, 1325 passed / 5 skipped. On the final base, the touched tests plus parity, docs and facade tests: 910 passed. isort, flake8, mypy (changed src), scoped black, harness parity, comment history, line cap and docs-lint pass. |
kirodotdev#22056's ratchet recorded sites kirodotdev#21376 removed 75s later. Three claude captures from kirodotdev#21753 omit the agent_name kirodotdev#22064 then began requiring.
Problem / Motivation
Goal: A new chat with no reasoning effort picked runs at the model's own default, not at a level some other chat in the same project picked.
A new KAS chat on
claude-opus-5.5with nothing pinned (no slot pick, crew pin, role oragent.reasoning_effort) runs at whatever level the last chat in the same work dir picked, oftenmax, while the composer still shows "Default". The study in #21362 measuredmaxagainstmediumon one host: thinking step p50 6.2s → 9.1s and p99 34.6s → 73.0s, sidebar turn p50 42s → 100s, credits per turn p50 6.4 → 17.2.Why it matters
KAS is the default backend, so most installs are hit. One
maxpick in a project silently makes every later new chat in that project slower and dearer, and the UI says "Default", so nothing tells the user why. It is the top driver of the "mate thinks too much" reports.Not a goal
acp_backend=kiro) work-dir sharing. kiro-cli readscli.jsonitself, so that sharing is the engine's own design and stays as it is.cli.jsonfiles. KAS no longer reads them.What changed (motivation → approach → change)
New KAS chats now start at the model's own default. The shared
cli.jsoneffort keys are read, written and cleared only for kiro-cli, the one engine that reads that file. A level picked live still reaches the session's restart and reset successors.Why it happened:
<work_dir>/.kiro/settings/cli.jsonis shared by every session in a project. Provider construction read its effort keys back for every member ofACP_BACKENDS_KIRO_SLASH_COMMANDS, which includes KAS. KAS never opens the file, so the read-back was its only effect, and it handed one chat's pick to the next one.The fix: a new set,
ACP_BACKENDS_EFFORT_OVERLAY(kiro-cli only), gates every effort read, write and clear of that file. It has the same shape asACP_BACKENDS_TOOL_SEARCH_OVERLAY, which already keeps KAS out of the Tool Search keys of the same file.The read-back was also how a level picked live reached a compaction restart or a reset successor: the dashboard effort route retired the session's recorded override and left the file to carry the pick. The route now records the picked level on the session instead (
record_effort_overrideinsession_parts/claims.py, bound onSessionManagerinsrc/kiro_crew/session.py, replacingretire_effort_override; a level cleared to the default drops the record), soallocation_identitystarts the successor on the level the session runs. On kiro-cli that is the level the file already holds. On claude and codex, which read no file, a successor used to start at the default and now keeps the pick too._apply_effort_overlaychange_effortrollbackclear_effort, no default_effort_channelcli_jsonconfig_optionA KAS slot keeps its own pick across a gateway restart through its slot metadata (
metadata_codec._restore_model_fields, thenreasoning_effort_override). A session the dashboard does not start (cron, Slack, webhook) resolves its level from config (crew pin, role,agent.reasoning_effort) on every cold start. It can still take a live pick from a dashboard slot surfaced from its channel; that pick now reaches its successors, but a cold start from the channel side reads no dashboard slot, for effort as for the model.The set is registered where every set is: the disposition table in
agent_sdk/backends.py, theacp/types.pyandacp_backends.pyre-exports, andagent_sdk/backend_cards.py(off the card, with its reason). The providers, session, harness-parity and harness-onboarding specs say the same, and the comment indashboard/session_control_parts/model_switch.pynow names kiro-cli.Backwards compatibility
Compatible: nothing main accepts is refused, and on kiro-cli every read, write and clear of the file is unchanged.
SessionManager.retire_effort_overrideis replaced byrecord_effort_override; its one caller, the dashboard effort route, changes with it.KAS loses the file's read-back, write and clear. Every reader of a KAS session's effort, and of the removed method:
Reader: src/kiro_crew/providers/acp.py:AcpProvider.init -- chat -- a KAS slot's own pick arrives as effort_per_model, not from the file -- test_effort_overlay_readers.py::TestANewKasChatStartsAtTheModelDefault::test_a_level_the_slot_pinned_still_reaches_the_session
Reader: src/kiro_crew/dashboard/slot_persistence/metadata_codec.py:_restore_model_fields -- chat -- restores slot.reasoning_effort from slot metadata, never from cli.json -- test_slot_metadata_codec.py::test_every_field_a_purpose_reads_round_trips_and_every_other_is_left_alone
Reader: src/kiro_crew/dashboard/chat_api/slot_effort.py:api_chat_slot_reasoning_effort -- chat -- records the live pick on the session through record_effort_override -- test_chat_slot_reasoning_effort.py::TestChatSlotReasoningEffortLiveProvider::test_live_effort_capable_model_uses_change_effort_no_reset
Reader: src/kiro_crew/session_lifecycle_parts/parked_queue.py:allocation_identity -- chat -- a compaction or reset successor starts on the recorded live pick -- test_compaction_failure_pause.py::test_a_live_effort_pick_replaces_the_recorded_override
Reader: src/kiro_crew/config/loader.py:KiroCrewConfig.resolve_session_effort -- cron -- cron, Slack and webhook cold starts resolve from config, as before -- test_crew_reasoning_effort.py::TestFactoryAppliesTheCrewPin::test_crew_pin_reaches_the_provider_with_no_override_present
Reader: src/kiro_crew/providers/acp_model_effort.py:clear_effort -- chat -- still returns False so the handler resets, and the cold start reads no file -- test_effort_overlay_readers.py::TestKasLeavesTheSharedFileAlone::test_clearing_a_kas_level_asks_for_a_reset_and_leaves_the_file
Reader: src/kiro_crew/subagent_parts/model_choice.py:_effort_channel -- subagent -- a KAS spawn receipt names the effortLevel config option -- test_spawn_backend.py::TestEffortVerdict::test_the_applied_note_names_the_channel_the_backend_uses
Tests
test/test_effort_overlay_readers.py(new). A new KAS chat with another chat'smaxin the file resolves no level and pushes nothing. A slot's own pick still reaches KAS aseffortLevel. KAS writes no file, and a refused live change or a clear leaves another harness's entry in place. kiro-cli still reads the file back and writes its own level.test/test_compaction_failure_pause.py: a live pick replaces the recorded override, so the compaction successor starts on it; a live clear drops it.test/test_chat_slot_reasoning_effort.py: the live route records the picked level (""on a live clear), and records nothing on the deferred, reset and failed paths.test/test_spawn_backend.py: a KAS spawn receipt namesconfig option effortLevel.test/test_harness_parity.py: each overlay writer names its own reader set; both sets leave KAS out and sit inside the slash dialect.test/test_session_bindings.py: the member inventory namesrecord_effort_override.Red before: with the provider changes absent, 4 of the 7 reader tests fail; the headline is
assert {'claude-opus-5.5': 'max'} == {}. With the session and route changes absent, the 4 new record checks fail.Each guard put back to main's behaviour in a throwaway worktree, one at a time:
_apply_effort_overlaygated on the slash dialectchange_effortrollback clear on the slash dialectclear_effortclears for every kiro-family harness_effort_channelreportscli_jsonfor KASDeterminism, over the new and changed tests: 20 runs at
-n0; 10 at-n 4 --dist loadgroup --max-worker-restart=2besidetest_acp_kas_effort.pyandtest_acp_tool_search_wire.py; one shuffled order, seed 11662. All green.Local gates: black, isort, flake8, mypy (2777 files), comment-history, brand, harness-parity added-line gate, file-line cap, flake-pattern ratchet, repo semgrep rules, docs-lint. Related tests over 54 files: 4017 passed.
Manual verification
N/A — unit coverage sufficient: the leak lives in provider construction and the successor's level in the session record. The tests drive a real
AcpProvideron a temporary work dir with a realcli.json, and a realSessionManagercompaction restart. No live KAS session was started.Screenshots / video
N/A — no frontend file changes.
Related Issues
Fixes #21362
Pattern harvest
Rule candidate: review-prompt
Pattern: per-session state persisted in a scope many sessions share (a work dir, a project file) and read back as one session's own value
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)