Repository navigation
fix(subagent): stop the injection notice contradicting its own reason - #14286
Conversation
`_injection_notice_outcome`'s completed branch asserts "result delivery timed
out", but only two of the six `notify_injection_failed` call sites pass a
timeout. `slack/gateway.py` sends "provider dead after prompt-busy retries",
"ACP process died", a raw `str(exception)` from a failed injection turn, and
the last injection-failure reason after the attempt cap — and the notice prints
that reason on the line directly above the outcome line, so the message
contradicts itself:
Agent `a1` ❌ ACP process died
Task: ...
The agent finished but result delivery timed out.
The reader is an LLM deciding whether to retry, so the wrong mechanism is not
cosmetic.
State only the outcome and leave the cause to `reason`, which already carries
it. A real timeout loses nothing: its callers say so in `reason`, and the old
copy said "timed out" twice.
Residual named by the reviewer on merged #5900. Spec updated in the same commit
per AGENTS.md.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: leonlaiyc <276034861+leonlaiyc@users.noreply.github.com>
|
Intent: Make the completed-branch subagent injection notice state only the outcome, so it stops asserting "result delivery timed out" one line above a non-timeout reason. The cause already lives in |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 3c161b7 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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 (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS One stale sibling of the old copy survives: The defect is derived, not asserted: What this change shipsInventory (5 items) — 5 justifiedIntent: FIX — stop the completed-branch injection notice claiming a timeout that contradicts the reason printed above it.
[FIRST-PRINCIPLES-REVIEWED] 3c161b7 |
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsNothing blocks — two advisory findings on the new copy's premise. FINDING — src/kiro_crew/subagent.py:2066 — the docstring's premise (" FINDING — test/test_subagent_coverage.py:1637 — the new pin's comment claims [OPUS-REVIEWED] 3c161b7 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
self-added: no
|
|
self-added: no
|
bolichen97
left a comment
There was a problem hiding this comment.
Read the full diff. Required gate PR Readiness green on the current head, no blocking reviews. Approving.
Replaces #6002 by @leonlaiyc — reopened in-repo so the fork PR's checks can reach
passed. The author's commit is cherry-picked unchanged;@leonlaiycis credited asCo-authored-by.Problem / Motivation
When a subagent finishes but its result cannot be handed back, the notice tells the reader "The agent finished but result delivery timed out." — even when nothing timed out. Four of the six
notify_injection_failedcall sites pass a different reason (a dead provider, a died ACP process, a raw exception string, the last injection-failure reason after the attempt cap), and the notice prints that reason on the line right above the outcome line. So the message contradicts itself:Why it matters
The reader is an LLM deciding whether to retry. A wrong mechanism is not cosmetic: "timed out" invites a retry that the real cause (a dead process) does not warrant. #5900 made every other terminal branch outcome-aware and left exactly this one residual.
What changed (motivation → approach → change)
The completed-branch line in
_injection_notice_outcome(src/kiro_crew/subagent.py) asserted a timeout the record does not know. The fix states only the outcome and leaves the cause toreason, which every caller already sets. The line now reads "The agent finished, but its result could not be delivered." A real timeout loses nothing: its callers still say "timed out" inreason. The spec (docs/system-specs/common/injected-messages.md) and the function docstring are updated to record that this line names no mechanism.Backwards compatibility
Compatible: this changes only the human/LLM-facing wording of one terminal notice. No field, type, or contract that main accepts changes.
Tests
test/test_subagent_coverage.pygains cases that lock the completed-branch notice to a mechanism-free outcome string and assert it no longer says "timed out" when the reason is not a timeout, alongside the existing per-branch coverage.Manual verification
N/A — unit coverage sufficient.
_injection_notice_outcomeis a pure function of the record and is unit-tested per branch.Related Issues
no linked issue: residual named by a reviewer on merged #5900, not a tracked issue.
Pattern harvest
Not generalizable: a one-off wording contradiction in a single terminal branch that #5900's sweep missed; no rule class generalizes from it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)