Repository navigation
Conversation
A cron run in which no tool call was approved and none was blocked by the security gate recorded last_status ok, even when every call was refused by a governance profile, by the agent spec's PreToolUse hook, or by a rejected or timed-out approval. _GateTally kept only a count of those calls, and _apply_gate_verdict called record_success() for them. _GateTally now keeps each such call's title and first reason line, and a new none_approved property marks a run with no approved call, no security block and at least one other refusal. _apply_gate_verdict records that run as error without moving either counter, so a delete_after_run one-shot is kept and auto-paused. refusal_summary() names up to three of the calls with their refusal text, or "not approved", and _annotate_partial_block puts the same reason in front of the delivered result. The reason does not use the partial-block wording, so the Schedule page shows the run as Error.
c71f327 to
1fa7eee
Compare
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix adds the missing arm to the shared verdict, leaves the counters alone, and the doc table changes in the same commit. Notes
[DESIGN-REVIEWED] 1fa7eee Description read[DESCRIPTION-READ] a981ae8e670f35206193ae361680a8a60a710332490b270e7f265fd0dcf21dcc 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 |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix is at mechanism level, issue #35101 is its provenance, and the reversed Inventory (6 items) — 6 justifiedIntent: make a cron run in which nothing ran (every call refused outside the security gate) stop showing as a success. FIX.
[FIRST-PRINCIPLES-REVIEWED] 1fa7eee Description read[DESCRIPTION-READ] 9da034103f16f626d85bfe1dffe38e2f2a61d700be2edba0c408c7fec87cb7d6 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
[operator: bolichen97] Continuing this in #37604; thanks for the start. |
Code change approver recommendation: ApproveWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. The PR adds a
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
Problem / Motivation
A cron agent run recorded
last_status: okwhen no tool call was approved and none was security-blocked.This happened when every call was refused by a governance profile, by the agent spec's PreToolUse hook, or by a rejected or timed-out approval.
_GateTally.notekept only a count of those calls._apply_gate_verdictthen calledrecord_success(), because neitherall_blockednorpartially_blockedwas true.The Schedule page showed a run that did nothing as a success.
Goal: a cron run with no approved call, no security block and at least one other refusal records
errorand names the refused calls, without moving either failure counter.Why it matters
A daily job whose agent spec carries PreToolUse hooks, run under a profile that turns hooks off, had every call refused.
Each run still showed
ok, so nothing told the user the job had stopped working.Not a goal
ok.on_tool_gatecallback shape or the failure counter rules.What changed
src/kiro_crew/slack/gateway_runtime/cron_verdict.py:_GateTallykeeps each unresolved call's title and first reason line inunresolved_calls. A newnone_approvedproperty marks the new case.refusal_summary()names up to three such calls with their reason, or "not approved", under the headnone of N tool call(s) ran, all refused or not approved:._annotate_partial_blockprefixes the delivered result for this case too. The class and function docstrings describe the new case.src/kiro_crew/slack/gateway_runtime/runtime_charge.py:_apply_gate_verdictrecordsnone_approvedruns aserrorwith the summary aslast_error, and moves neither counter. Its docstring lists four outcomes.docs/system-specs/modules/learn-cron-dashboard.md: the gate-verdict table gains the no-approved row, the arm count reads four, a paragraph describes the new arm, and the Partial paragraph lists thenone of N ...reason among those that keep Error.test/test_cron_refusal_status.py: the harness passes an optional reason toon_tool_gate.test_an_unapproved_run_is_not_a_failurenow assertslast_status == "error"and keeps its counter and pause asserts. A newTestUnapprovedRunclass and one scheduler test cover the new arm and the unchanged ones.Tests
Proof: PROVEN test/test_cron_refusal_status.py::test_an_unapproved_run_is_not_a_failure, test/test_cron_refusal_status.py::TestUnapprovedRun::test_a_run_with_no_approved_call_records_error[unapproved], test/test_cron_refusal_status.py::TestUnapprovedRun::test_a_run_with_no_approved_call_records_error[policy-deny], test/test_cron_refusal_status.py::TestUnapprovedRun::test_a_run_with_no_approved_call_records_error[spec-hook], test/test_cron_refusal_status.py::TestUnapprovedRun::test_a_run_with_no_approved_call_records_error[mixed] (head 1fa7eee)
test_an_unapproved_run_is_not_a_failure: a timed-out approval run recordserrorand never auto-pauses after five runs.TestUnapprovedRun::test_a_run_with_no_approved_call_records_error: an unapproved, apolicy_deny, aspec_hookand a mixed run each recorderrorwith no failure counted.TestUnapprovedRun::test_it_spends_no_failure_budget: five such runs leave the job unpaused and enabled.TestUnapprovedRun::test_it_does_not_reset_a_failure_streak: such a run after two blocked runs keepsconsecutive_failuresat 2.TestUnapprovedRun::test_the_reason_names_each_call_with_its_refusal_text:last_errornames each call with the first line of its reason, or "not approved".TestUnapprovedRun::test_the_reason_names_at_most_three: six refused calls are counted, three are named, and the reason stays within 500 characters.TestUnapprovedRun::test_the_schedule_page_shows_it_as_error_not_partial: the reason does not match the Partial pattern inbackendPhrases.json.TestUnapprovedRun::test_the_notification_names_the_refused_calls: the delivered body opens with the same reason aslast_errorand keeps the model's prose.TestUnapprovedRun::test_it_reaches_the_sequential_path: anagent_sequencerun gets the same status, reason and banner.TestUnapprovedRun::test_one_approved_call_keeps_the_run_ok: an approved call beside an unapproved one staysokwith no banner.TestUnapprovedRun::test_a_tool_free_run_stays_ok: a run with no tool call staysok.TestSchedulerContract::test_an_unapproved_one_shot_is_kept_and_auto_paused: adelete_after_runone-shot with only a policy denial is kept, auto-paused and disabled, with no failure counted.Sibling sweep
Swept: every reader of
_GateTally,refusal_summary(),_annotate_partial_blockand_apply_gate_verdict, and every place that turns a cron run'slast_statusinto a pause or a badge.Sibling: src/kiro_crew/slack/gateway_runtime/cron_verdict.py -- changed here
Sibling: src/kiro_crew/slack/gateway_runtime/runtime_charge.py -- changed here
Sibling: src/kiro_crew/slack/gateway_runtime/cron_turn.py -- not affected -- both agent paths call the shared
_annotate_partial_blockand_apply_gate_verdict, so they pick up the new arm unchangedSibling: src/kiro_crew/slack/gateway_runtime/cron_failure.py -- not affected -- it alerts after a counted failure and the new arm counts none
Sibling: src/kiro_crew/cron_service/execution.py -- not affected --
auto_pause_failed_one_shotalready keeps and pauses anydelete_after_runrun whose status iserrorSibling: website/src/utils/cronPartlyBlocked.ts -- not affected -- the new reason does not match its Partial pattern, so the run shows as Error
Sibling: src/kiro_crew/llm_helpers_parts/turn_stream.py -- not affected --
on_tool_gatekeeps its four-argument shape and already passes the reasonPattern harvest
Not generalizable: the gap is one missing branch in a single verdict function whose arms are all listed in one table.
Closes #35101