Repository navigation
fix(context): send opted-out kiro chats their project steering once - #14539
iamwhatever merged 1 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
026048a to
79c12b6
Compare
Design Review (Opus 5.5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Skipping recorded guides depends on undocumented kiro-cli behaviour, so a kiro-cli change would make guides vanish without notice instead of arriving twice. Watch
Suggestions
[DESIGN-REVIEWED] 47c8a0c Description read[DESCRIPTION-READ] 15434cfcc0481bde8df9c7552a2197550e577827c2aacefb8d7130af34296d40 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 (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
First Principles Review (Opus 5.5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Changing the harness default to Not justified as shipped
What this change shipsInventory (7 items) — 5 justifiedIntent: in a workspace that opts out of kiro-cli's default resources, a plain kiro chat gets each project steering guide once. FIX.
[FIRST-PRINCIPLES-REVIEWED] 47c8a0c Description read[DESCRIPTION-READ] 98ba34b84eecfe0a1ee56f91f3fb8ecfed6cac686d3343c4c42e6f9148e3d625 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
79c12b6 to
b02fac7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6191e67 to
160995d
Compare
This comment has been minimized.
This comment has been minimized.
160995d to
eadaa0f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
|
This PR stops a plain kiro chat in a workspace that sets chat.disableInheritingDefaultResources from getting project steering twice (once from kiro-cli, once from the folder). It does this with a launch-time record of the declared guides, with file-version stamps, a 2-second settle window, a re-check at session start and a 128,000-byte bound. I read the description, the production diff (runtime.py, folder_steering.py, member_essential_context.py, context.py) and the lane verdicts on head 7b1ff16. All checks are green and the PR is mergeable. The fix only goes partway to the root cause. The PR's own comment (member_essential_context.py, near _LAUNCH_RECORD_MAX_BYTES) and its manual run both say kiro-cli re-reads declared resources on every request. Yet folder_steering.py skips a guide only while its text equals the launch body. So any guide edited after launch gets duplicated again for the rest of the session. This fails safe (twice, never zero), but it is the same symptom the PR exists to remove. The Design and First Principles lanes raise exactly this on the current head and suggest path-based dedup through the existing delivered_sources plus the budget check. They also question the unrelated provider_type default flip and the crew_runner.py shim. The author's latest dispositions mark these "needs a maintainer decision" and are against older heads, with none for 7b1ff16. This is on hold until a maintainer decides between the stamp design and path-only dedup. That ruling decides whether about 600 production lines of mechanism coupled to kiro-cli 2.27 internals should land. Auto-merge is armed, so a human should look before approving. — crew-pr-reviewer |
|
@iamwhatever 7b1ff16 is a98fbde rebased onto main, its five conflicts resolved by keeping both sides, so the design and the earlier answers are unchanged. Here they are for this head. Version record or path-only. kiro-cli's agent reference says file resources "are loaded directly into the agent's context when the agent starts" (File resources). The manual runs found 2.26.1 and 2.27.0 re-reading them on every request instead. KiroCrew pins no kiro-cli version, so a design has to hold under both:
The member path. Coupling to 2.27. The 128,000-byte bound is the part built on measured kiro-cli numbers (three bytes per token), and path-only keeps it. What path-only adds is a dependence on the measured re-read: the table's first row is where it goes wrong.
Two calls for a maintainer: the version record or path-only plus the budget check, and keeping or dropping the |
|
This PR stops a plain kiro chat in a |
|
This stops a plain kiro chat in a workspace with |
|
@iamwhatever Rebased onto main 3fd144b as 7c71519: main's #18462 added an import beside this PR's in Two points from my last reply still stand:
Path-only still needs the budget check. On 2.26.1 and 2.27.0 kiro-cli drops whole declared files past its budget (it logs You call the harness default justified, so one call is left for a maintainer: the version record, or path-only plus the budget check. The next push builds the pick. |
|
This PR aims to stop an opted-out plain kiro chat from getting project steering twice. It records the guides kiro-cli loaded at launch, with per-file version stamps, a 2-second settle window, a session-start re-read and a 128,000-byte bound, and has the folder skip them while unchanged. It also defaults |
When a workspace sets chat.disableInheritingDefaultResources, a plain kiro chat's folder steering carries the steering trees kiro-cli stops loading. KiroCrew's shipped agent spec still declares file://.kiro/steering/**/*.md itself, so kiro-cli kept loading that tree, and a folder that also lists it sent those guides a second time. The runtime now records, for an opted-out non-member kiro session, the paths of the markdown documents the projected agent view declares: the exact view kiro-cli starts from. It reads no file body. kiro-cli re-reads its declared resources for every request (measured on 2.26.1, 2.27.0 and 2.29.0), so the folder skips a recorded path on the first render and after a compaction, and an edited guide reaches the model through kiro-cli's own read. A guide the record does not name, one created after launch among them, goes through the folder as before. The record applies only while the session activates the agent view it was taken from: the alias set_mode sent, or the projection's alias for the agent when no set_mode ran. Nothing is recorded while the files the view declares, whatever their extension, total more than 128,000 bytes on disk, checked at launch and each time the session's provider hands out the record: kiro-cli drops whole files once they pass three bytes per token of the model's context window, so a larger record could name a guide kiro-cli never sent. With no projected view or no record the folder sends everything, so a guide can arrive twice but never zero times. A record that cannot be taken is logged as a warning naming the agent and the error, escaped so a newline in a file name cannot start a new log line. _build_v2_essentials, build_message and build_session_context take provider_type as None by default, meaning not known to be kiro-cli. The entry points pass the named harness to the essentials builder as given, so a caller that names none keeps a private member inheriting, and the folder-steering dedup skips nothing for an unnamed harness. The auto-improvement crew runner, the one production caller that built member essentials without naming a harness, passes the harness of the session it started, so its kiro-cli members keep reading the opt-out.
|
Trace on kiro-cli 2.29.0 over ACP (
The v1 engine gives the same result; v3 refuses 47c8a0c cuts the mechanism to match:
This is the path-only skip the Design and First Principles concerns on 7c71519 asked for. The description carries the trace under Manual verification. |
|
This stops an opted-out workspace's plain kiro chat from getting project steering twice. At launch it records the steering paths the projected agent view declares, and the folder-steering collector skips them via delivered_sources. It also changes the _build_v2_essentials harness default from kiro-cli to None. The double delivery is real and the record-by-path approach targets it. HOLD for scope and confidence: +1709/-114 across 19 files (runtime.py, context.py, context_assembly, member_essential_context, crew_runner), with three whole-design CONCERNS and a Security Scope CONCERNS. The deciding risk is from Design on 47c8a0c. The skip relies on undocumented kiro-cli behaviour: re-reading declared resources every request, and a three-bytes-per-token budget measured on 2.26.1 to 2.29.0. A kiro-cli that caches a launch copy or shrinks its budget would make a recorded guide arrive zero times with no signal, which reverses the "twice but never zero" promise in the spec text. First Principles notes the None-harness default changes no production prompt by the description's own account, and _spawned_harness duplicates providers.acp.provider_label. A maintainer should rule on depending on kiro-cli internals, or the skip should be gated on a checked kiro-cli version or capability. Checks are green and base is main. — crew-pr-reviewer |
iamwhatever
left a comment
There was a problem hiding this comment.
This stops an opted-out workspace's plain kiro chat from getting project steering twice, and it fixes the root cause: kiro-cli loads the guides its agent view declares, and the folder used to send the same files again. On head 47c8a0c the author did what our earlier hold asked for. A kiro-cli 2.29.0 debug trace shows declared resources are re-read on every request, and the mechanism is now a path-only record fed through the existing delivered_sources, with the stamps, settle window and body compare removed. I read every production hunk in acp/runtime.py, session_provider.py, member_essential_context.py, context.py and context_assembly/, and tried to make a guide arrive zero times. The folder already skips inclusion: manual files, so recording them drops nothing. A path spelled differently from the collector's only causes a duplicate. A guide added after launch, a different set_mode view, a walk error, or declared files over 128,000 bytes (checked at launch and again whenever the record is handed out) all fall back to sending every guide. The only zero-delivery case left is a future kiro-cli whose resource budget falls below 128 KB, about a quarter of the smallest window measured today. I accept that margin. A version gate can come later if kiro-cli changes. Checks are green, base is main, no change request is open, and the First Principles nit (_spawned_harness repeats provider_label) is cosmetic. — crew-pr-reviewer (deep re-check)
Problem / Motivation
Goal: An opted-out workspace's plain kiro chat receives its project steering once, and a caller that names no harness keeps inheriting.
In a workspace that sets
chat.disableInheritingDefaultResources, a plain (non-member) kiro chat whose folder lists the project steering tree receives those guides twice. #14413 made the folder carry the trees kiro-cli stops loading under the opt-out. KiroCrew's shipped agent spec (config/defaults.json) still declaresfile://.kiro/steering/**/*.md, so kiro-cli keeps loading that tree, and the folder sends it again._build_v2_essentialsalso defaultsprovider_typeto kiro-cli, so a caller that omits it is treated as a kiro-cli session and reads the opt-out.Why it matters
Every duplicated guide costs context on every turn of an opted-out chat, and the opt-out exists to control exactly what that chat loads. The kiro-cli default makes the opt-out apply to a caller that never said it runs on kiro-cli.
Not a goal
What changed (motivation → approach → change)
A plain kiro chat in a workspace that sets
chat.disableInheritingDefaultResourcesnow receives each project steering guide once: kiro-cli loads what its agent spec declares, and the folder skips those same documents by path.When a non-member kiro session starts in an opted-out workspace, the runtime (
acp/runtime.py) records the path of each markdown document that the projected agent view (the agent spec as kiro-cli receives it) declares, and reads no file (member_essential_context.py). kiro-cli re-reads its declared resources for every request, so a recorded guide reaches the model through kiro-cli as the file reads at that request, edited or not.context.pyandcontext_assembly/inclusion.pyhand the record's paths to the folder-steering collector through its existingdelivered_sourcesparameter, which skips a recorded path before reading it, on the first render and after a compaction. A guide the record does not name, one created after launch among them, goes through the folder as before. The record applies only while the session activates the agent view it was taken from: the aliasset_modesent, or the projection's alias for the agent when noset_moderan.kiro-cli drops whole declared files once they pass three bytes per token of the model's window, so a large record could name a guide kiro-cli never sent. So no record is kept while the files the view declares total more than 128,000 bytes on disk, checked at launch and each time the session's provider hands out the record (
acp/session_provider.py). The folder sends every guide, so a guide can arrive twice but never zero times, with no projected view, no record or an unmeasurable declared file, on a session whose view is not the launch view, and once the declared files pass 128,000 bytes. A record that cannot be taken logs a warning naming the agent and the error. kiro-cli's own loading is unchanged, so a chat with no folder steering still gets the tree._build_v2_essentialsdefaultsprovider_typetoNone, meaning "harness unknown": a caller that omits it is not treated as kiro-cli, so it keeps inheriting.build_messageandbuild_session_contextalso default the harness toNoneand pass it to_build_v2_essentialsas given. The folder-steering dedup treats an unnamed harness the same way: it skips nothing, so the folder carries the steering trees whole. The auto-improvement crew runner (apps/builtins/auto_improvement/spine/crew_runner.py), the one production caller that named no harness onmain, passes the harness of the session it just started, so its kiro-cli members honor the opt-out as onmain, and a member served by KAS keeps inheriting, as it does through the other member runners. The specsmodules/providers.mdandmodules/memory-skills-hooks.mdstate both rules.Backwards compatibility
Compatible: inheriting workspaces, crew members and every agent spec are untouched. Apart from the duplicate guides this change removes from an opted-out kiro chat, a caller that names its harness, directly or through its context provider, gets the same prompt as on
main. For a caller that names no harness, a private member's essentials keep inheriting and the folder skips nothing, so a guide can arrive twice but never zero times. No production caller gets a different prompt that way: the dashboard chat, the only one that passes folder steering, always names its harness, and the three callers that name none build no member essentials for a model (the Slack heartbeat and the eval runner pass no member, and the profile validator never reads the opt-out). A session with no projected view behaves as today. An opted-out kiro chat whose declared files total more than 128,000 bytes gets a guide twice, as onmain. The total is checked at launch and each time the session's provider hands out the record, which is before every folder render at session start or after compaction. Between renders it is not watched: a declared file that grows, or a new file a declared glob picks up, can raise it past kiro-cli's budget mid-session, which takes about 362,000 bytes or more on the smallest window kiro-cli lists, and push a recorded guide out of kiro-cli's context until the next folder render. The skip relies on kiro-cli re-reading declared files for every request, which kiro-cli 2.26.1, 2.27.0 and 2.29.0 all do; a kiro-cli that kept a launch copy instead would show an edited recorded guide in its launch version, never drop it.Tests
test/test_acp_spawn_offload.py: an opted-out non-member kiro spawn records the projected view's declared paths and reads no body; an inheriting spawn and a member spawn record none of them (the member keeps its plan documents); a view whose declared files exceed the bound records nothing; a path walk error, an unreadable home or an unsearchable directory leaves the spawn running with no record and logs one warning, with the error escaped so a newline in a file name cannot start a new log line. A session resumed after a gateway restart carries the same record when its agent and working directory match. An edited, replaced or deleted guide stays recorded on the create path, since kiro-cli re-reads it. A changed, unreadable or missing agent view leaves every recorded guide to the folder, on both paths; a session whoseset_modesent a different alias gets no record even when the runtime's current view has since swung back to the recorded one, and one whoseset_modesent the recorded alias keeps it even when the view has since moved on. A spawn whose projection is replaced while it records still records the view it launched with. The session's provider re-checks the declared files' total each time it hands out the record, so it hands out nothing while they are past the bound and the record again once they fit.test/test_acp_set_mode_projection_fallback.py,test/test_native_skill_projection.pyandtest/test_worker_agent.py:_activate_mode_bracketedreturns the alias itsset_modesent, which is what the launch-record check compares against.test/test_member_essential_context.py: the launch record names the declared guides without reading one, spells them as the launch reader does, records nothing when the declared files total more than the size bound on disk (counting a non-markdown file the record never names and files that each fit the bound alone), adds nothing for a declared file that does not exist, does not count non-markdown matches against the reader's document limit, raises on a stat failure, and the fit check counts an unmeasurable file as too large.test/test_folder_steering_provider_dedup.py: with no folder steering the managed declaration stays and kiro-cli carries the tree; the folder skips a document recorded at launch by path, edited or not, fresh and after a compaction, and sends a guide created after launch; a record on another harness, or on a provider that names none, skips nothing; with no record the folder sends every document. A compaction render after the declared files outgrew the size bound sends every guide, where the same render under the bound skips the recorded one, and an ordinary turn never checks the declared files.test/test_member_essential_context.py: a caller that names no harness keeps inheriting under the opt-out, through_build_v2_essentials,build_messageandbuild_session_context; naming kiro-cli still reads the opt-out; an inheriting workspace's folder trees still arrive once.test/test_folder_steering_provider_dedup.pyalso pins that a plain chat naming no harness gets the trees through the folder.test/test_auto_improvement_members.py: the crew runner builds member essentials for the harness it started: kiro-cli for a kiro-cli session, KAS for a KAS session, and no harness for a value that is not a provider.test/test_native_skill_projection.py: a real projection for an opted-out workspace publishes an agent file whose resources match the view the launch record reads, and the launch record names the same paths for both.test/test_context_composition_contract.py: the pinned builder signatures carry theNoneharness default, and the folder renderer's patch-reach check passes the launch record through to the collector.The spawn-record, size-bound, view-check, walk-error, folder-skip and harness tests fail on
mainand pass with this change; the no-folder, no-record and inheriting-spawn cases pass on both and pin that nothing is dropped. The agent-file test pins an equivalence the projection already holds onmain, read through this change's launch record.Manual verification
Three live runs against a real kiro-cli in a scratch workspace that opts out. On 2026-09-30, kiro-cli 2.26.0: with Crew's own steering withheld, the model quoted a marker guide from
.kiro/steering/and placed it in kiro-cli's context entry for that file (details), so kiro-cli loads the declared tree under the opt-out. On 2026-10-02, kiro-cli 2.27.0 measured its resource budget: it kept 598,000 bytes of declared files and dropped a whole file at 602,000 on claude-haiku-4.5 (200,000 tokens), kept 490,000 and dropped one at 494,000 on deepseek-3.2 (164,000 tokens), and kept 962,000 on claude-sonnet-5 (1,000,000 tokens). A declared.jsonfile counted toward the budget and was dropped like a markdown one; aninclusion: manualsteering file did not count. On 2026-10-10, kiro-cli 2.29.0's own debug log of each outgoing model request (sending request request_args=...) showed when it reads declared files:x.md(MARKER-XOLD),y.md(MARKER-YYY)x.mdMARKER-XOLD,y.mdMARKER-YYYx.mdedited to MARKER-XNEW,y.mddeletedx.mdMARKER-XNEWThe default v2 engine and v1 gave the same result; v3 does not accept the
--agentflag the kiro harness always passes. 2.26.1 and 2.27.0 gave the same result earlier. kiro-cli re-reads declared resources for every request; nothing is frozen at launch. The tests drive the real runtime spawn path, projection, folder collector and member snapshot against temporary workspaces.Related Issues
no linked issue: follow-up to #14413, which merged before these review findings were fixed.
Pattern harvest
Rule candidate: review-prompt
Pattern: an "already delivered?" check must match how the consumer loads the artifact: when the consumer re-reads per request, the path is the check and any snapshot of content goes stale; measure the consumer before building the check.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)