Repository navigation
fix(context): skip a declared file:// resource that does not exist - #18278
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS A maintainer should confirm this PR may reverse #10586's recorded rule that "a missing declared source still refuses", and the two tests that pinned it. [DESIGN-REVIEWED] bbe8288 Description read[DESCRIPTION-READ] 87a31c24dc31dd5aaf8a816dbe340ed831596eda8b65bfab7bc207685575bfe0 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: |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The skip is the fix. The added "DECLARED RESOURCES NOT FOUND" core note goes beyond the kiro-cli parity the Goal asks for, and its only support is symmetry. Not justified as shipped
What this change shipsInventory (5 items) — 3 justifiedIntent: let a session whose template declares a missing
[FIRST-PRINCIPLES-REVIEWED] bbe8288 Description read[DESCRIPTION-READ] 16819bc3a25360e5f495219380b6962d6e6832bb13367c5f85b2c7202debaa68 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: |
4922fa9 to
bbe8288
Compare
|
|
|
|
|
|
|
Maintainer decision: I'm overriding the #10586 rule that a declared-but-missing essential resource refuses the session. Rationale: three independent reporters on 0.8.0.9 (custom AIM agent templates declaring Keeping the omission note (First Principles CONCERN rebutted): without it the agent can't tell an intentionally empty template from a resource that failed to arrive. Reviewed at head bbe8288. |
CrysisDeu
left a comment
There was a problem hiding this comment.
Approving at bbe8288. Read the full diff plus the owning spec; nothing blocking. Non-blocking notes, worth a follow-up or a quick fix before merge:
- [MINOR] src/kiro_crew/member_essential_context.py:901 (
_resource_paths) vs :393-416 (_matches) -- the same optionalmissingparameter has opposite defaults in two adjacent functions._matches(missing=None)keeps main's behaviour (absent literal reaches_readand refuses), which is the fail-closed default the author's rebuttal to the First Principles lane relies on; but_resource_paths(missing=None)substitutes a throwaway list (absent = [] if missing is None else missing) and SKIPS silently. That is howprojected_resource_documents(:857, passes nomissing) gets the intended no-note skip, so the behaviour is deliberate, but the rebuttal ("a caller that does not opt in keeps main's behaviour") is only true one level down. Either haveprojected_resource_documentspass its own list explicitly and let_resource_pathsforwardmissingunchanged (soNonemeans "refuse" everywhere), or say in_resource_paths' docstring thatNonehere means "skip without recording". Clarity only; no security effect either way since skipping reads nothing. - [NIT] src/kiro_crew/member_essential_context.py:352 (
_is_absent) --if not path.is_relative_to(admitted_root): return Falseis unreachable from the only caller:_matchesalready raises on absolute patterns and..components (:334-337) and buildspath = admitted_root / pattern. Harmless belt-and-braces; a one-word "defensive" in the docstring avoids a reader hunting for the case that reaches it. - [NIT] test/test_member_essential_context.py
test_absent_managed_literal_resource_still_refuses-- writes underconfig_dir() / "workspace"; relies on the suite'sKIROCREW_HOMEisolation rather thantmp_path. Consistent with existing tests in the file, but worth keeping in mind per testing-conventions (host-state tests).
Problem / Motivation
Goal: A session whose agent template declares a
file://resource that does not exist starts normally, the way kiro-cli itself treats that template, instead of being refused.Three reporters on 0.8.0.9 hit a refused session with
Essential source .../AGENTS.md: missing, unreadable, or outside the admitted document root. One uses an AIM template (AmazonBuilderCoreAIAgents, Atlas) that declaresfile://AGENTS.md, and their workspace has noAGENTS.md. Another's subagent fails on.../subagent_<id>/README.md, because subagents start in an empty folder.Why it matters
Every turn of an affected agent is refused, and nothing the user configured is wrong: kiro-cli loads the same template and skips the missing file. AIM-installed templates hit this out of the box, and subagents of any template that declares a project file hit it on every spawn.
Not a goal
AGENTS.md/SOUL.mdscan (fix(members): read member sources on a home reached through a symlink #16263).What changed (motivation → approach → change)
The essential-context reader refused the whole session when a declared literal
file://resource was simply absent. kiro-cli skips such a resource, so Crew refused sessions kiro-cli would have run.The root cause is in
member_essential_context.py._matchesreturnedroot / patternfor a glob-free pattern without checking it exists, and_readturned the missing file into a session-wide refusal. A new probe,_is_absent, answers "absent" only when it lstats root-first, finds a missing component and meets no link on the way. A link, a managed-state path, an out-of-root path or a path whose lstat fails for any other reason is still handed to_read, which refuses it as before.An absent declared resource is now skipped. The snapshot carries one
essential-context#missing-skipped:<template>note naming the skipped files, like the existing#omitted,#managed-skippedand#linked-skippednotes, and the note is marked core so budget fitting cannot drop it. The KAS projection (projected_resource_documents) skips the absent file without a note, matching what KAS loads natively.This reverses the rule #10586 recorded in
docs/system-specs/modules/memory-skills-hooks.md("A missing declared source still refuses"). That sentence is rewritten to describe the skip, the note and the cases that still refuse. #18269 is the evidence that the old rule refuses sessions kiro-cli runs.Backwards compatibility
Compatible: a refusal becomes a skip only for a declared literal file that does not exist; every input main accepts loads the same documents, and nothing main refuses for a link, permission, managed-state or containment reason is admitted.
Reader: src/kiro_crew/context_assembly/member.py:documents_for_member -- chat|cron|subagent|crew page -- an absent declared file now yields a note instead of a raised
MemberEssentialContextError;test_absent_declared_literal_resource_is_skipped_with_a_noteReader: src/kiro_crew/acp/runtime.py:projected_resource_documents -- subagent|chat -- an absent file adds no projected document;
test_projected_resources_skip_an_absent_file_in_an_empty_cwdReader: src/kiro_crew/acp/harness/kiro.py:kiro_launch_documents -- chat|subagent -- reads through
documents_for_member, and itsnative_onlyread carries no note; asserted intest_absent_declared_literal_resource_is_skipped_with_a_noteTests
In
test/test_member_essential_context.py:test_absent_declared_literal_resource_is_skipped_with_a_note: missingAGENTS.mdand nestednotes/README.md→ the session builds, one note names both files, the note is core, andnative_onlycarries no note.test_present_declared_resources_add_no_missing_note: no note when nothing is missing.test_projected_resources_skip_an_absent_file_in_an_empty_cwd: the subagent case through the KAS projection.test_declared_literal_link_still_refuses(dangling leaf, leaf linking outside, dangling parent directory),test_declared_literal_outside_the_root_still_refuses_when_absent,test_declared_literal_unreadable_file_still_refuses,test_declared_literal_under_an_unsearchable_directory_still_refuses,test_absent_managed_literal_resource_still_refuses.Two existing tests used deletion to mean "refused source" and now use a present non-regular source (a directory):
test_unreadable_declared_source_still_refuses_on_warm_hitintest/test_essential_delivery.pyandtest_a_refused_declared_source_still_refuses_when_the_envelope_is_over_budget.test/link_screen_sites.pyrecords_is_absentas a link-refusing site; it never traverses a link, so it needs no hold.Mutation checks:
_is_absent, the dangling-parent case fails.Manual verification
N/A — unit coverage sufficient: the change is confined to one pure reader, and the tests drive the same
build_messagepath the refused sessions took.Related Issues
Closes #18269
Pattern harvest
Rule candidate: review-prompt
Pattern: a glob-free "pattern" branch returns a path unconditionally while the glob branch treats no-match as valid, so a missing literal escalates into a hard failure.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)