Skip to content

fix(context): send opted-out kiro chats their project steering once - #14539

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
unstablebrainiac:fix/member-opt-out-declared-steering
Oct 10, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
unstablebrainiac:fix/member-opt-out-declared-steering

Conversation

@unstablebrainiac

@unstablebrainiac unstablebrainiac commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

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 declares file://.kiro/steering/**/*.md, so kiro-cli keeps loading that tree, and the folder sends it again.

_build_v2_essentials also defaults provider_type to 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

  • Changing what an inheriting workspace receives.
  • Changing which harnesses honour the opt-out.
  • Rewriting any resource in a user-authored agent spec.

What changed (motivation → approach → change)

A plain kiro chat in a workspace that sets chat.disableInheritingDefaultResources now 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.py and context_assembly/inclusion.py hand the record's paths to the folder-steering collector through its existing delivered_sources parameter, 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 alias set_mode sent, or the projection's alias for the agent when no set_mode ran.

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_essentials defaults provider_type to None, meaning "harness unknown": a caller that omits it is not treated as kiro-cli, so it keeps inheriting. build_message and build_session_context also default the harness to None and pass it to _build_v2_essentials as 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 on main, passes the harness of the session it just started, so its kiro-cli members honor the opt-out as on main, and a member served by KAS keeps inheriting, as it does through the other member runners. The specs modules/providers.md and modules/memory-skills-hooks.md state 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 on main. 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 whose set_mode sent a different alias gets no record even when the runtime's current view has since swung back to the recorded one, and one whose set_mode sent 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.py and test/test_worker_agent.py: _activate_mode_bracketed returns the alias its set_mode sent, 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_message and build_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.py also 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 the None harness 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 main and 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 on main, 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 .json file counted toward the budget and was dropped like a markdown one; an inclusion: manual steering 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:

Request Declared files on disk Context entries kiro-cli sent
1 x.md (MARKER-XOLD), y.md (MARKER-YYY) x.md MARKER-XOLD, y.md MARKER-YYY
2 x.md edited to MARKER-XNEW, y.md deleted x.md MARKER-XNEW

The default v2 engine and v1 gave the same result; v3 does not accept the --agent flag 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@unstablebrainiac
unstablebrainiac requested a review from a team as a code owner September 27, 2026 22:19
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 27, 2026
@unstablebrainiac

This comment has been minimized.

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 27, 2026
@unstablebrainiac
unstablebrainiac force-pushed the fix/member-opt-out-declared-steering branch from 026048a to 79c12b6 Compare September 27, 2026 22:27
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — 🟡 CONCERNS

Design-level review of 47c8a0c202723218d5d99cf524a0fd33c79facec via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • The "twice but never zero" promise depends on kiro-cli internals. The folder now skips a guide because "kiro-cli re-reads its declared resources for every request" and drops files past "three bytes per token". That budget was measured on 2.26.1 to 2.29.0, and the 128,000-byte bound (_LAUNCH_RECORD_MAX_BYTES) is a quarter of it. If a later kiro-cli keeps a launch copy, shrinks its budget or lists a smaller window, an opted-out chat loses a recorded guide completely, and nothing in-product shows it. That is the opposite of the fail-safe the spec text claims. One revert fixes it, so this is not a BLOCK.
    Clears when: a test or startup check pins the kiro-cli behaviour the skip relies on (for example, the record is kept only on a known range of agent_version_from_init versions and is empty otherwise), so an untested kiro-cli falls back to sending duplicates.

Suggestions

  • Run the fit check and alias check once where the folder decides what to skip, in _folder_steering_delivery_snapshot, instead of splitting them across AcpRuntime._copy_native_launch_sources, the native_context_documents_fit partial on the handle and the session_provider property. One place to decide means the create, resume and compaction paths cannot drift apart.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 47c8a0c202723218d5d99cf524a0fd33c79facec via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 47c8a0c

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of 47c8a0c202723218d5d99cf524a0fd33c79facec via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

Changing the harness default to None changes nothing in production, by the description's own account, and _spawned_harness repeats the existing providers.acp.provider_label.

Not justified as shipped

  • Item 5 — inherited: the description says "No production caller gets a different prompt that way". It also had to patch crew_runner just to keep main's behaviour. The only harm it removes is for callers that do not exist yet.
    Subtraction: keep provider_type: str = PROVIDER_ACP / "acp" in build_message, build_session_context and _build_v2_essentials, and drop the None branch in _folder_steering_delivery_snapshot.
    Clears when: someone names a production caller that leaves out provider_type and gets a wrong prompt on base.
  • Item 6 — duplicate of src/kiro_crew/providers/acp.py:provider_label: the new _spawned_harness(provider) returns context_provider.context_provider_type, and that property is just provider_label(self). One caller already uses the existing helper for this job: subagent_manager/run.py:2510 (grepped provider_type=).
    Subtraction: delete _spawned_harness and pass provider_type=provider_label(provider).
    Clears when: _spawned_harness is deleted.

What this change ships

Inventory (7 items) — 5 justified

Intent: in a workspace that opts out of kiro-cli's default resources, a plain kiro chat gets each project steering guide once. FIX.

  1. An opted-out plain kiro chat no longer gets its declared steering guides twice, at session start or after compaction — justified
  2. No guide is skipped while the declared files total more than 128,000 bytes, checked again on each read — justified
  3. The skip applies only on the agent view the record was taken from — justified
  4. A resumed session now carries the launch record too — justified
  5. A caller that names no harness is no longer treated as kiro-cli — inherited
  6. Auto-improvement members pass their session's harness — duplicate of providers.acp.provider_label
  7. A warning is logged when the launch record cannot be taken — justified

[FIRST-PRINCIPLES-REVIEWED] 47c8a0c

Description read

[DESCRIPTION-READ] 98ba34b84eecfe0a1ee56f91f3fb8ecfed6cac686d3343c4c42e6f9148e3d625

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 47c8a0c202723218d5d99cf524a0fd33c79facec via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 47c8a0c

@unstablebrainiac
unstablebrainiac force-pushed the fix/member-opt-out-declared-steering branch from 79c12b6 to b02fac7 Compare September 28, 2026 04:07
@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac
unstablebrainiac force-pushed the fix/member-opt-out-declared-steering branch 2 times, most recently from 6191e67 to 160995d Compare September 28, 2026 05:05
@unstablebrainiac

This comment has been minimized.

@unstablebrainiac
unstablebrainiac force-pushed the fix/member-opt-out-declared-steering branch from 160995d to eadaa0f Compare September 28, 2026 05:11
@unstablebrainiac

This comment has been minimized.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 28, 2026
@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@unstablebrainiac

This comment has been minimized.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision 47c8a0c202723218d5d99cf524a0fd33c79facec touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@iamwhatever

Copy link
Copy Markdown
Contributor

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

@unstablebrainiac

Copy link
Copy Markdown
Contributor Author

@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:

kiro-cli loads declared files Version record (this PR) Path-only plus the budget check
when the agent starts, as documented an edited guide's new text comes through the folder, beside kiro-cli's launch copy the chat keeps an edited guide's launch text, and a guide added under a declared glob never arrives
on every request, as measured an edited guide arrives twice an edited guide arrives once

The member path. delivered_sources matches on path because it covers documents the member envelope renders itself in the same pass. For the copies kiro-cli loads, main compares bodies: member.py L743-L757 blanks a body only while it equals kiro-cli's launch read (kiro_launch_documents, taken at spawn). This PR applies that test to plain chats. The version stamps go one step further: a save that empties and rewrites a file around kiro-cli's launch read can leave kiro-cli an empty copy that a text test cannot see. Path-only would have plain chats trust the per-request re-read, which member chats do not.

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.

provider_type and the shim. Separable from the dedup. The launch record reaches the folder only from the serving provider, which names its own harness (context.py L3244-L3249), so the skip does not depend on the default. The flip is the Goal's second half: an unnamed caller is no longer assumed to run on kiro-cli, so its member essentials ignore kiro-cli's opt-out and the folder stops skipping the steering trees as kiro-cli-delivered. No production caller's prompt changes; the three that name no harness are listed in #14539 (comment).

Two calls for a maintainer: the version record or path-only plus the budget check, and keeping or dropping the provider_type flip with its shim. The next push implements the pick.

@iamwhatever

Copy link
Copy Markdown
Contributor

This PR stops a plain kiro chat in a chat.disableInheritingDefaultResources workspace from getting project steering twice. It does this with a version-stamped launch record of the guides kiro-cli loads, which the folder-steering collector then skips. It also flips _build_v2_essentials' default provider_type to None. Head 7b1ff16 is unchanged since my earlier hold. Since then the author answered on this head with a clear table comparing the version record against path-only dedup under both kiro-cli loading behaviours, and showed that the provider_type flip is separable, so that part of my request is addressed. The deciding question is still open, and the author has put it to a maintainer explicitly: keep the version-stamp design or move to path-only dedup plus the budget check, and keep or drop the provider_type flip and its crew_runner.py shim. Three lane items (Design span a38cc01e1aa0 and 4e043691336e on the 128,000-byte bound and version gating, GPT span 0026cc4096ba) are marked needs-a-decision, and no maintainer has ruled. Checks are green and the PR is mergeable. Note that auto-merge is armed, so one approval would land it before that ruling, and approvers should be aware. Holding until a maintainer picks the design. — crew-pr-reviewer

@iamwhatever

Copy link
Copy Markdown
Contributor

This stops a plain kiro chat in a workspace with chat.disableInheritingDefaultResources from getting its project steering twice, and it defaults an unnamed harness to inheriting. The harness default change (provider_type=None, plus the crew_runner naming its session's harness) is small and justified. The dedup is not. It ships a launch record with file-version stamps, a 2s settle window, a re-read at session start, view-alias matching, a Windows gate and a measured 128,000-byte kiro-cli budget, across runtime.py, member_essential_context.py, folder_steering.py and the context assembly code (~650 production lines). The author's own measurements say kiro-cli 2.26.1 and 2.27.0 re-read declared files on every request. Under that evidence the stamp machinery guards a case nobody has observed, and the existing path-based delivered_sources skip in collect_folder_steering (already used by members) would cover the goal. The Design and First Principles lanes say the same. Three current dispositions are explicitly needs a maintainer decision (whether to keep the bound across kiro-cli versions, version-gate it, or accept the size-race gap). The head is from late September, so it should also be rebased and re-run. I am holding for that maintainer ruling. My recommendation is to shrink to the path-based skip plus the harness default. — crew-pr-reviewer

@unstablebrainiac

Copy link
Copy Markdown
Contributor Author

@iamwhatever Rebased onto main 3fd144b as 7c71519: main's #18462 added an import beside this PR's in acp/runtime.py, and both are kept. Its CI round has started. 63c9914 was itself a rebase, pushed Oct 9 on 50239ff. The September date is the commit's author date, which a rebase keeps.

Two points from my last reply still stand:

  • The case the record guards is kiro-cli's documented behavior. The current agent reference still says file resources "are loaded directly into the agent's context when the agent starts" (File resources). Only 2.26.1 and 2.27.0 were measured, and KiroCrew pins no kiro-cli version.
  • Members do not trust a path for kiro-cli's copies. delivered_sources skips documents the member envelope renders itself in the same pass. For kiro-cli's launch copies, main compares bodies: member.py L743-L757.

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 Dropping resource ... total resource budget exceeded), and a path skip would leave each dropped guide with zero deliveries. So the three needs-a-decision items apply to path-only as well.

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.

@iamwhatever

Copy link
Copy Markdown
Contributor

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 _build_v2_essentials to an unknown harness. I read the description and the lane verdicts on head 7c71519. Holding because I am not confident the mechanism matches how kiro-cli loads resources. The Design and First Principles CONCERNS on this head both note that the diff's own comment says kiro-cli re-reads declared resources on every request. If so, an edited guide still arrives twice, and most of the stamp machinery guards a staleness that does not exist. A path-only skip through the existing delivered_sources would be much smaller. Neither concern has a disposition for the current head. The change is also about 600 production lines across context assembly and the ACP runtime. Please show from a kiro-cli trace whether declared resources are frozen at launch or re-read per request, then cut the mechanism to match. — crew-pr-reviewer

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.
@unstablebrainiac

Copy link
Copy Markdown
Contributor Author

Trace on kiro-cli 2.29.0 over ACP (kiro-cli acp --agent, the launch the kiro harness uses), read from kiro-cli's own debug log of each outgoing model request (KIRO_LOG_LEVEL=debug, sending request request_args=...), context entries only:

Request Declared files on disk Context entries kiro-cli sent
1 x.md (MARKER-XOLD), y.md (MARKER-YYY) x.md MARKER-XOLD, y.md MARKER-YYY
2 x.md edited to MARKER-XNEW, y.md deleted x.md MARKER-XNEW

The v1 engine gives the same result; v3 refuses --agent, which the kiro harness always passes. 2.26.1 and 2.27.0 measured the same earlier. Declared resources are re-read for every request; nothing is frozen at launch.

47c8a0c cuts the mechanism to match:

  • The launch record holds paths only: the projected view's declared markdown files, with no body read. The folder skips those paths through the existing delivered_sources, and folder_steering.py is back to main.
  • Removed: the per-file version stamps, the 2-second settle window, the session-start re-read and record pruning, the body comparison, the Windows gate and the teardown wrapped around the copy.
  • Kept: the 128,000-byte bound, checked at launch and on every read of the record, because kiro-cli drops whole declared files past three bytes per token of the model window and a larger record could name a guide kiro-cli never sent; the launch-view check, because another view of the agent can declare fewer guides; the provider_type=None default with its crew_runner shim.
  • Source diff: 424 changed lines, down from 615.

This is the path-only skip the Design and First Principles concerns on 7c71519 asked for. The description carries the trace under Manual verification.

@iamwhatever

Copy link
Copy Markdown
Contributor

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 iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants