Repository navigation
fix(taskrunner): steer the in-band host-deny notice before every reject - #15372
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 2f7d060 Description read[DESCRIPTION-READ] efa042c53bfdcc959f45a6394c9384c337f0d657e1b971376e7cb0a9ad470fd6 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 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 Verify the "red on base: 22 failed / 7 passed" claim by running What this change shipsInventory (9 items) — 8 justifiedIntent: a FIX — the task runner's host refusals read to the model as "User denied tool execution", so unattended runs abandon calls nobody objected to (slice 3 of #5403; slices 1–2 are on base in
Checks run: [FIRST-PRINCIPLES-REVIEWED] 2f7d060 Description read[DESCRIPTION-READ] f135081e9ed53f006cdc1297ea39b2e2f7dd6dcb63c4a185f18bdb41ffd833d9 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsOne model-facing notice states a cause that is false on a reachable branch; nothing blocks. FINDING — src/kiro_crew/task_executor.py:88 — [OPUS-REVIEWED] 2f7d060 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
c783801 to
bb6a8c7
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approved: PR Readiness passed on this head, no open change requests.
bb6a8c7 to
e3bc78e
Compare
A host deny on the task runner still handed the model kiro-cli's fixed "User denied tool execution". task_executor now denies through one funnel (_reject_and_log) whose required cause= keyword is the per-site verdict: a DENY_CAUSE_* name steers llm_helpers._steer_host_deny before the reject, None is the explicit not-a-host-deny (the interactive handler's no, the mid-stream compaction teardown) and stays bare. task_planner's two decomposition denies audit, steer, then reject. SEL row first everywhere. Fixes the task_executor/task_planner slice of #5403.
e3bc78e to
2f7d060
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approved: PR Readiness green on this head, merges cleanly into current main, no outstanding blocking review.
Problem / Motivation
Goal: A tool call the task runner refuses on the HOST's behalf is explained to the model as a host deny, never as "user denied".
Slice 3 of #5403. On the task runner (
task_executor.pystep turns,task_planner.pydecomposition turn) every host deny -- a PreToolUse hook block, a stored-hookdeny, the unattended run's deny-by-default, the planning phase's no-hook-store deny -- went straight toreject_tool, so the model read kiro-cli's fixed"User denied tool execution"for a refusal the person never made, and abandoned or routed around a call nobody objected to. Slice 1 (#14141,llm_helpers) and slice 2 (#15083, the messaging surfaces) already steer the shared in-band notice before their rejects; the task runner did not.Why it matters
Autonomous projects and cron-launched runs are exactly the surfaces with no human watching. A model told "the user denied this" in an unattended run has nobody to ask, so it silently drops the step or works around the policy -- and the transcript looks like a model that gave up, not a host that refused.
Not a goal
eval/*,subagent*,dashboard/handlers/*,auto_improvement/spine/agent_runner.py) -- later slices; the issue stays open.permission_pre_tool_block's one block string into "delivered deny" vs "gate fault" causes (hooks.pyis unchanged; the chat runner steers the sameBLOCKED:strings aspolicy).Falseprovenances (a human's Deny vs the dashboard prompt expiring): the callback returns a bare bool on every surface, and slice 1 records the same result as the one allowlisted user rejection._refusal_noticesfallback): the steer is the mechanism, the continuation a dashboard-only fallback.What changed (motivation → approach → change)
Symptom → cause: four
reject_tool(sites on the task runner answered the wire with nothing steered first, so the only explanation the model ever saw was the harness's generic string.Approach: reuse the shared helper rather than build a fourth notice.
llm_helpers._steer_host_deny(redact, forward todeny_notice.steer_refusal_notice, answer the wire through an orphan reject if cancelled mid-steer) is whatchannel.pyalready reuses; the cancellation shape here is the same (a timed step turn on a shared ACP pipe). The cause vocabulary is the existing one -- no newDENY_CAUSE_*.Change, per site (enumerated;
test_taskrunner_deny_notice.pyfails on a site missing from this list):task_executor.py-- ONE funnel,_reject_and_log, now with a REQUIRED keywordcause: str | None. ADENY_CAUSE_*name steers before the reject;Noneis the explicit "not a host deny" and stays bare. There is no default to inherit the wrong answer from. The stored-hookTOOL_DENYsite, which rejected inline, now goes through the funnel with its exact SEL row shape (outcome="denied",error="hook_deny") via newoutcome/errorkwargs, so the module has exactly one wire reject.spec_hook_deny)policychat_runner._reject_hook_blockedsteers the same stringsTOOL_DENY(hook_deny)policytool_result.reasonheadless_no_authorization)surface_policyinteractive_rejected)Nonecontext_overflow)Nonecompact(); there is no continuing turn for a notice to correct)task_planner.py-- two inline sites, audit → steer → reject:TOOL_DENYduring decompositionpolicyhook_result.reasonno_hook_store)surface_policysurface_policy(notpolicy) for the two deny-by-default sites because the policy notice appends class remediation keyed off the reason and the model's own title; on a surface where nothing can approve the call, naming a sanctioned command would be a second wall (same reasoning as slice 1's reject-all / read-only sites).Audit order: the SEL row is now written BEFORE the steer and the reject at every site (previously
_reject_and_logrejected first, then logged). The steer is one more bounded await on the ACP pipe; a backend that stops reading stdin cancels the coroutine at the turn deadline, and a row sequenced after the awaits would never be written. This is the rule every other deny surface already follows (test_deny_audit_first,test_llm_helpers_deny_notice,test_messaging_deny_notice).Docs:
docs/system-specs/common/injected-messages.mdgains the task-runner paragraph under the in-band deny notice section, with the per-site table above.Backwards compatibility
Compatible:
_reject_and_logis module-private (no external caller:git grep "_reject_and_log("outsidetask_executor.pyfinds onlySubagentManager's unrelated method of the same name). Every SEL row keeps itsoutcome/error/metadatashape; only its position moves (before the wire). A backend withoutsupports_refusal_steerbehaves exactly as before:steer_refusal_noticereturns""and the reject runs.Tests
test/test_taskrunner_deny_notice.py(new, 29 tests; red onorigin/main@6d54165-- 22 failed / 7 passed, the 7 being the no-notice negatives; mutation-checked: 11 mutants, every one killed -- steer dropped, reject-before-steer, audit-after-steer, headless cause flipped topolicy, interactive rejection steered, compaction teardown steered,causegiven a default, hook reason dropped, planner steer dropped, planner cause flipped, planner audit-after-steer):execute_task/decomposewith a provider double recording steer/reject ORDER: hook deny (hook's reason, policy wording), spec-gate block, unreadable-spec block, headless deny (surface wording, no remediation line), decomposition hook deny, decomposition no-hook-store; interactive rejection and compaction teardown send NO notice; backend without the capability only rejects; a raising steer still rejects; agent-authored text is redacted before it reaches the model; the SEL row lands before the steer with its original shape.task_executor.pyhas exactly one.reject_tool(and it is the funnel; the funnel audits → steers → rejects;causeis keyword-only with no default; every_reject_and_log(call matches exactly one enumerated fingerprint; host sites namecause=DENY_CAUSE_*and areason=; user/teardown sites saycause=None; exactly one user rejection is allowlisted;task_planner.py's two rejects are each preceded by the steer with the audit before it; both modules usellm_helpers._steer_host_denyitself.Neighbouring files run locally by path and green:
test_taskrunner_autoapprove.py,test_task_planner_decompose_gate.py,test_llm_helpers_deny_notice.py.Manual verification
N/A — unit coverage sufficient: the behaviour is the order of three awaits on a provider (audit, steer, reject) and the notice text, both asserted directly against the real
execute_task/decomposeloops with a recording double.Screenshots / video
N/A — backend only, no user-visible frontend surface.
Related Issues
Fixes the task_executor/task_planner slice of #5403 (the issue stays open for the remaining surfaces). Follows #14141 (slice 1) and #15083 (slice 2).
Pattern harvest
Rule candidate: lint
Pattern: a
reject_tool(on a host-deny path not preceded by the shared steer; every surface now carries a source-walking guard, and a repo-wide one (every.reject_tool(insrc/kiro_creweither steers first, is inside a steer helper's orphan path, or is on an enumerated user/teardown allowlist) would close the class once the last #5403 slices land.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)