Skip to content

fix(cron): report a restart-cut run and send call_tool args as written - #33905

Merged
bolichen97 merged 1 commit into
mainfrom
fix/sweep-g6-cron-runs-and-script-tools
Nov 10, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/sweep-g6-cron-runs-and-script-tools

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A cron run that a gateway stop or restart cuts short leaves a history row and its owner is told, and a script cron's ctx.call_tool() sends every argument exactly as the script wrote it or refuses the call by name.

This PR fixes two cron defects, reported together in #33831:

  1. A cron run cut by a gateway restart is never reported. A run in flight when the gateway stops or restarts is filed cancelled and is not retried, so a daily job loses that day. The history row is the only trace: no bell note, no channel or Slack message. The planned in-app restarts (the dashboard's Restart and update apply, the gateway's update restart, and Slack /kirocrew restart) never stop the cron service, so the run they cut leaves no history row at all and its in-flight marker stays behind. kirocrew restart gives no warning that it is about to interrupt a job.
  2. A script cron's ctx.call_tool() sends arguments the credential scrubber rewrote. ctx.call_tool() and kirocrew cron preview send the redacted copy of the arguments, and refuse only an argument that the redaction tag replaced whole. A Microsoft Graph message id, a SharePoint drive id or a CodeDeploy target (<region>:<account>:<application>:<group>:CD) loses part of its text, the server rejects an id the script never wrote, and the run still records success.

Why it matters

  • A daily or weekly job that a restart cuts skips that day and nobody is told. After an in-app restart or an update there is not even a history row, so the owner finds out only from the output that never came.
  • A script that passes an id from one tool call to the next fails on a corrupted value. The server's own error hides the cause, and the run shows success, so the owner has nothing to debug from.

Not a goal

  • Rerunning or catching up a run that a restart cut. It is still filed cancelled and runs again at its next scheduled time; this PR records it and tells the owner.
  • Stopping a script cron's sandboxed child process when it keeps running past the restart. This PR records and reports the cut run only.
  • Changing chat, display or log redaction, or the redaction rules themselves. Only the call_tool argument scan reads two of those rules differently.
  • A notice for a run the user cancelled or the reaper ended. The user asked for the first, and the timeout alert already covers the second.

What changed (motivation → approach → change)

A run that a restart cuts now leaves a history row and tells its owner, and a call_tool argument goes out byte-identical or the call is refused with the argument's path.

Defect Root cause Change
A restart-cut run is silent CronService.stop() filed the run cancelled and told no one. The planned in-app restarts end in an exec or a hard exit, so the gateway's _shutdown, where stop() runs, never ran for them stop() starts a notice for each run it cut and waits for them, at most 3 s. Each planned restart calls the new stop_cron_before_restart, bounded at 5 s
call_tool sends rewritten arguments _scanned_tool_args sent redact()'s output and refused only an argument the tag replaced whole The scan judges every string, keys included, and refuses any call it would change. Otherwise it sends the arguments as written

Restart-cut runs. The gateway's notice, _alert_cron_interrupted in slack/gateway_runtime/cron_failure.py, is set in cron_fire.py through the new CronService.set_interrupt_alert. It rings the bell with "Interrupted: the cron service stopped before this run finished." and when the job runs next: at its next scheduled time, or, on a cron expression, at once if Kiro Crew is back within the minute the run was due, because a stopped cron-expression run keeps the previous run's last_run_ts. The same text goes to the job's channel or DM by the failure alert's one-surface delivery. A silent job stays quiet, and nothing counts as a failure. In cron_service/service/, run_execution.py starts the notice as a cut run unwinds and service_lifecycle.py waits for it before stop() returns. The dashboard Restart and update apply (dashboard/handlers/updates_apply.py), the update restart (update_schedule.py) and Slack /kirocrew restart (slack/events_slash.py) stop the cron service after their last refusal and before they close sessions. A restart that refuses or defers leaves the scheduler running. kirocrew restart (cli_server_restart.py) prints the cron jobs a restart interrupts before it signals anything, worded as what a restart does so it stays true when the restart is then refused. Each job then gets the line its stored schedule supports (cron_service.readers.job_schedules_from_disk reads crons.json): a consumed delete_after_run one-shot, the kind cron add --at makes, does not run again and should be scheduled again; a one-shot that keeps its row runs at its set time, or at once if that has passed; a recurring job runs at its next scheduled time; a paused or unreadable job gets no promise. To keep update_schedule.py at the 1,600-line target, one comment and the module docstring's field list are reflowed.

call_tool arguments. _scanned_tool_args in cron_script_context.py judges each string alone and beside its key, and a refused call raises ValueError naming the path (args.items[0].id), never the value. Two rules that read identifiers as secrets stand down only where the value is positively an identifier: the bare-secret pass for a whole Graph item id or b! drive id under an id-named key, and the bot-token rule for a 12-digit account id followed by PascalCase words or, inside a CodeDeploy target, a CloudFormation-generated name. A real credential is still refused, a bot token behind a padded or glued account id included. The one residual, a key glued behind an id's own opening under an id key, is stated in the spec. kirocrew cron preview shares the scan.

The facades (cron.py, cron_script.py, cli_server.py, slack/gateway.py, dashboard/handlers/updates.py) export the new names. The owning specs and user docs describe the new behaviour, the user doc naming the two id shapes the scan exempts (learn-cron-dashboard.md, cli.md, security.md, slack-gateway.md, src/kiro_crew/docs/cron-and-scheduling.md).

Backwards compatibility

Breaking: ctx.call_tool() and kirocrew cron preview refuse a call when the credential scan would replace any part of a string argument, where main sent that call with a [REDACTED: ...] placeholder in place of the span. A script that relied on the rewrite gets a ValueError naming the argument instead. Writer sweep on origin/main @ 39aecc7 (git grep -n "call_tool(" -- src/kiro_crew/apps src/kiro_crew/builtin_skills src/kiro_crew/docs, and git grep -n "_scanned_tool_args"): no built-in app or skill calls ctx.call_tool; apps/builtins/mochi/mcp_server.py:_call_tool is that MCP server's own dispatch, not this scan; src/kiro_crew/docs/cron-and-scheduling.md is the user doc, which states the new rule. The only writers are operators' own script crons, and the error names the argument to change.

Reader: src/kiro_crew/cron_script_context.py:ScriptContext.call_tool -- cron -- test_cron_call_tool_scan.py::test_a_call_the_scan_would_change_is_refused_by_path_and_never_sent
Reader: src/kiro_crew/cli_commands_cron.py:_cron_preview -- cron -- test_cron_preview_cmd.py::TestCronPreviewCallToolPath::test_call_tool_sends_identifiers_as_written_and_refuses_a_credential
Reader: src/kiro_crew/cron_script.py:_wholly_redacted_path -- cron -- removed with its only caller, _scanned_tool_args; CREDENTIAL_REDACTION_TAGS leaves this facade too, and its other readers import it from kiro_crew.security, unchanged

Tests

The full backend and frontend suites run in CI.

At head 84fc1bada4 (this patch on main db4ef699b0), on a Linux DevSpace. The GPT 6.1 finding (the kirocrew restart line promised a next run to a one-shot that never gets one) was reproduced first, at c5f93b61c8 (the same patch on main 39aecc7296). With this patch's tests and the restart code of the previous head 0a10f6144d, test_cron_stop_interrupt_notice.py gave 8 failed, 24 passed: the two test_restart_names_the_cron_run_it_interrupts_before_signalling cases, test_restart_does_not_promise_a_consumed_one_shot_runs_again, test_restart_says_a_kept_one_shot_runs_again_at_once, test_restart_keeps_the_next_run_line_for_a_recurring_job_beside_a_one_shot and the three test_restart_names_a_run_it_cannot_promise_a_next_run_for cases. With this patch's code it gave 32 passed, 0 failed (-n0). test_a_stopped_one_shot_is_consumed_or_left_due passes both ways, because it pins what the stop already does and the new wording rests on. The changed and added test files, the tests that read cli_server_restart.py or cron_service/readers.py (test_cron_refactor_readers.py, test_cli_server_facade.py, test_stdlib_shadow.py, test_internal_python_isolation.py, test_mcp_call_site_auth_coverage.py, test_campaign_facades_base_public_names.py) and test_cron_cancel.py, test_cron_gateway_integration.py and test_dashboard_stale_wake.py, plus the tests that read cli.md or learn-cron-dashboard.md (test_cli_cron_add_kinds.py and eight more) and the planned-restart tests (test_restart_*.py, test_dashboard_updates_coverage_apply.py, test_inapp_restart_keeps_turn_marker.py, test_events_facade.py, test_managed_launcher_restart.py, test_r10_update_routes_owner_gate.py), gave 1936 passed, 0 failed at -n 8 --dist loadgroup --max-worker-restart=2, and the flake pattern ratchet passed. black, isort, flake8, mypy --platform linux, comment history, brand name, harness parity, file line cap, docs-lint and semgrep --baseline-commit db4ef699b0 --error exited 0 at this head.

CI at ac2d74ce4c failed test_cli_cron_add_kinds.py::TestArgparse::test_help_copy_numbers_track_the_production_bounds on Linux and Windows: that test reads the one cli.md row that names cron add, and the restart row named it too. The restart row now says "the one-shot an --at schedule makes"; the test fails at ac2d74ce4c and passes at this head.

Rebased onto main db4ef699b0 after review. Main's #33670 rewrote the Slack restart row in slack-gateway.md, so that row is merged by hand: main's bounds wording, plus this patch's cron stop between the save and close_all, the order _handle_restart runs them in. git range-diff from ac2d74ce4c shows that row as the only change to the patch; the code in events_slash.py, updates_apply.py and update_schedule.py merged cleanly with the cron stop still ahead of close_all. Then rebased onto the newest main with the patch unchanged (git range-diff shows =); main's commits since db4ef699b0 touch none of this patch's files.

At head 76b7cd9791 on main 941c3bd4da, on a Linux DevSpace, the changed and added test files (test_cron_call_tool_scan.py and test_cron_stop_interrupt_notice.py, both new, plus test_cron_failure_alert_one_spelling.py, test_cron_service_bindings.py, test_slack_gateway_composition_contract.py, test_cron_preview_cmd.py and test_cron_script.py) gave 787 passed, 0 failed at -n0. Every gate of the resolved profile except the three CI runs (the scoped backend and frontend suites and test:electron) exited 0 there, mypy, flake8, isort, black, docs-lint, comment history, brand name, harness parity, the website build and jscpd included. jscpd ran after the other gates had finished: i18n:render builds into a scratch directory under website/ and removes it, so a jscpd run beside it fails reading files that are gone. So did python -m pytest -n0 test/test_flake_pattern_ratchet.py and semgrep scan --config semgrep/ --baseline-commit 941c3bd4da --error. The neighbouring test_cron_cancel.py, test_cron_gateway_integration.py and test_cron_skip_dates.py gave 154 passed at -n 4 at the previous head 1250de3d8a, whose code differs from this head only in the wording of the kirocrew restart line and two comments.

Determinism, at head 1250de3d8a on the same DevSpace (this head changes one expected string in test_cron_stop_interrupt_notice.py): the new and changed tests (689: the two new files, test_cron_failure_alert_one_spelling.py, test_cron_service_bindings.py, test_slack_gateway_composition_contract.py, TestCronPreviewCallToolPath and TestScriptContextCallTool) passed 20 of 20 runs at -n0, 10 of 10 at -n 4 --dist loadgroup --max-worker-restart=2 beside test_cron_script.py and test_cron_preview_cmd.py (787 tests), and one shuffled order (seed 7105, 689 node ids).

What each test pins:

  • test_cron_stop_interrupt_notice.py: a gateway stop tells the owner about the run it cut; a silent job is not told; the notice says when the job runs next for each schedule kind, and a stopped cron-expression run is due again only inside its slot's minute while a stopped every run is not; stop() returns only after its notices and cuts one still running at its bound; a run that ended on its own, or that the user cancelled, is not told; each planned restart stops the cron run it cuts and tells the owner; a refused or deferred restart leaves the cron service serving; a cron stop past its bound does not hold the restart; kirocrew restart names the run it interrupts before it signals and gives each job the next-run line its stored schedule supports: a consumed one-shot is told to be scheduled again, a kept one-shot runs at once, a recurring job at its next scheduled time, and a paused job or one it cannot read gets no promise; it names no run whose writer is gone; a stopped delete_after_run one-shot is consumed and one that keeps its row is left due.
  • test_cron_call_tool_scan.py: Graph ids, drive ids, account and resource names and CodeDeploy targets reach the server byte-identical; a call the scan would change is refused by path, audited, never sent, and never echoes the value; a credential-shaped key is refused; an argument JSON cannot hold fails before the kept server is touched.
  • test_cron_preview_cmd.py and test_cron_script.py: the preview shares the scan, and a credential span inside a longer string is refused rather than sent redacted.
  • test_cron_failure_alert_one_spelling.py, test_cron_service_bindings.py and test_slack_gateway_composition_contract.py: the notice reaches Slack only through the shared one-surface helper, and the new members are bound on the service and the orchestrator.

Proof: PROVEN test/test_cron_call_tool_scan.py::test_identifiers_reach_the_server_byte_identical[args0], test/test_cron_call_tool_scan.py::test_identifiers_reach_the_server_byte_identical[args1], test/test_cron_call_tool_scan.py::test_identifiers_reach_the_server_byte_identical[args2], test/test_cron_call_tool_scan.py::test_identifiers_reach_the_server_byte_identical[args3], test/test_cron_call_tool_scan.py::test_identifiers_reach_the_server_byte_identical[args4] (head 84fc1bada45b)

Manual verification

Each defect's user scenario was run end to end on a Linux DevSpace at head 84fc1bada4, and before that at c140fa741f and c5f93b61c8. Both exited 0 on the fix side each time. At the previous head both exited 1 (bug present) on main 39aecc7296 itself.

  • Restart: two daily script crons were cut mid-run, one by the dashboard Restart and one by kirocrew restart. Both restarts told the owner about the run they cut, and kirocrew restart named only that run (since 23:59 UTC) before it signalled, followed by "daily-report-crc runs again at its next scheduled time, or at once if the gateway is back within the minute that run was due." The line's wording at head, "A restart interrupts the cron job(s) running now: ...", is pinned by test_restart_names_the_cron_run_it_interrupts_before_signalling. The bell note began "Interrupted: the cron service stopped before this run finished.", and no in-flight marker was left. The line on when the job runs next is pinned at head by test_the_notice_says_when_the_job_runs_again. The harness's sign-in step reads the link with kirocrew token --port, because main's kirocrew restart prints it only to a terminal; the check itself is unchanged.
  • call_tool: on a gateway cron run and on kirocrew cron preview, a Graph message id, a Microsoft Loop drive id and a CodeDeploy target reached the MCP server byte-identical. A control call carrying a real credential was refused with "args.text reads as a credential" and never reached the server in plaintext. At head 76b7cd9791, a 40-character AWS key alone under message_id was refused and the same key behind AAMk was sent, the residual the spec states.

Screenshots / video

N/A: no frontend file changes. The bell note is backend text shown by the existing notification list.

Related Issues

Fixes #33831

#26246 (closed) is an earlier, related report about the same call_tool scan replacing a whole opaque id.

Sibling sweep

Swept: git grep -nE "reexec_launcher|reexec_python_module|hard_exit(" -- src/kiro_crew/
Sibling: src/kiro_crew/dashboard/handlers/updates_apply.py -- changed here
Sibling: src/kiro_crew/slack/gateway_runtime/update_schedule.py -- changed here
Sibling: src/kiro_crew/slack/events_slash.py -- changed here
Sibling: src/kiro_crew/slack/gateway_runtime/exit_path.py:516 -- not affected -- the second-signal force exit, an operator's way out of a stuck shutdown; the first signal's _shutdown already awaits cron_svc.stop() (line 319)
Sibling: src/kiro_crew/mcp_gateway/stub.py:914 -- not affected -- an MCP stub process, which runs no cron service
Swept: git grep -nE "json.loads(redact(|redact(json.dumps(|_scanned_tool_args" -- src/kiro_crew/
Sibling: src/kiro_crew/cli_commands_cron.py:1064 -- not affected -- the preview's notify prints the redacted kwargs to the terminal and sends nothing
Sibling: src/kiro_crew/dashboard/handlers/debug.py:649 -- not affected -- a debug response for a person to read, where display redaction is the point
Sibling: src/kiro_crew/dashboard/file_api/outbox.py:260 -- not affected -- a stored display copy, not an argument sent to a tool

Pattern harvest

Rule candidate: review-prompt
Pattern: a scrubber's output sent onward as data (tool arguments, ids) instead of only judging it; refuse or send the original.
Rule candidate: review-prompt
Pattern: a planned restart that ends in exec or os._exit skips the SIGTERM shutdown, so every service that shutdown stops must be stopped on that path too.

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 9, 2026 14:38
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision a99e533fa1c0b8c0b39741f216f1293124425b51 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of a99e533fa1c0b8c0b39741f216f1293124425b51 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Neither change has a design flaw that blocks: the restart path now goes through stop() and lands the notice before exit, and the call_tool scan sends arguments exactly as written or refuses them.

Notes

  • The identifier exemptions in _account_resource_apart and _OPAQUE_ID_RE read private redaction internals (_CDK_WORDS, _BOT_ID_LENGTHS, _ARN_ACCOUNT_ID_12_DIGITS_RE) from cron_script_context.py. That makes a second owner of how those rules behave: if someone changes the Telegram or bare-secret rule in security/redaction, these exemptions drift without anything failing. Moving the "is this positively an identifier" decision into security/redaction as a public helper would keep a single owner.
  • The PR carries two unrelated fixes (restart-cut notice and call_tool argument scan) that share only their issue number. Splitting them would let the scan, which is the part that refuses more calls than before, be reverted without losing the restart fix.

[DESIGN-REVIEWED] a99e533

Description read

[DESCRIPTION-READ] aeef02048471c044ccff97ec31ffeea57108c3df5b56775879fc81026bb1a41c

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 Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of a99e533fa1c0b8c0b39741f216f1293124425b51 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The issue is linked (#33831) and tests pin both defects. Two items carry more surface than the Goal needs.

Notes

  • Item 4 — oversized: the Goal is that "its owner is told", and the restart notice (item 1) already does that. _print_running_cron_runs also adds a five-way per-job forecast built on a new reader, StoredSchedule/job_schedules_from_disk, and kirocrew restart is its only consumer. Subtraction: delete the after outlook branch, StoredSchedule and job_schedules_from_disk, and keep the one-line list of the runs being interrupted.
  • Item 2 — inherited: stop_cron_before_restart is called by hand at three restart sites. pre_exec_stops.register_pre_exec_stop (src/kiro_crew/pre_exec_stops.py:41) already exists so that "a new owner needs no edit to either restart path". The only grounds for the separate helper are an ordering ("before close_all() as _shutdown orders it") and the Slack hard-exit path. Subtraction: if neither holds, register cron's stop there and delete the three call sites.

What this change ships

Inventory (8 items) — 6 justified

Intent: a cron run cut by a restart is recorded and its owner told, and script call_tool arguments reach the server unaltered. FIX.

  1. A run cut by a restart now sends a bell note and a channel/Slack notice — justified
  2. The dashboard, update and Slack restarts now stop cron first, so the cut run gets a history row — justified
  3. Gateway stop waits up to 3 s for those notices — justified
  4. kirocrew restart prints the running cron jobs and a per-job "runs again" forecast — oversized
  5. call_tool/cron preview refuse a call when a credential-scan rewrite was sent before — justified
  6. Graph/drive ids under id-named keys and account-id resource names are exempt from that scan — justified
  7. _wholly_redacted_path and the facade's CREDENTIAL_REDACTION_TAGS export are removed — justified
  8. The update_schedule.py docstring is reflowed — rides along

[FIRST-PRINCIPLES-REVIEWED] a99e533

Description read

[DESCRIPTION-READ] f43db8b28efaf441d6701f05912e897832355a843baeaae5bfcdb775a8649fcf

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 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed a99e533fa1c0b8c0b39741f216f1293124425b51 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] a99e533

Verdict parsed from the review's SHA-scoped output markers for commit a99e533fa1c0b8c0b39741f216f1293124425b51.

False positive or not applicable? A repository writer can comment:
/ai-review override fable a99e533fa1c0b8c0b39741f216f1293124425b51 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 6.1 flagged blocking issues on a99e533fa1c0b8c0b39741f216f1293124425b51; Opus 5.5 adjudication downgraded every one of them. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

This comment is updated in place on each push.

Review details

BLOCKING -- src/kiro_crew/slack/gateway_runtime/cron_failure.py:395 -- Interrupted-run notices promise another run for paused jobs

text += " The job runs again at its next scheduled time"
Trigger: Pause a running recurring job through api_cron_enable, then restart. The pause persists without cancelling execution; CronService.stop() cancels the run, and _run_job_isolated invokes _alert_cron_interrupted.
Outcome: The dashboard and channel notice promise automatic execution, but settlement preserves the pause and the scheduler excludes the job after restart.
Anchor: defect
Fix: Derive the next-run statement from the current stored schedule and enabled state after settlement; omit it for paused, removed, or unreadable jobs.

[BLOCK-MERGE-DOWNGRADED] a99e533
[GPT-REVIEWED] a99e533

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 — LOW. It needs a narrow pair of conditions: the operator pauses a job while it is running (dashboard/handlers/cron_jobs.py:1218 enable_job_async), and the gateway then stops before that run ends, so stop() cancels it and the notice fires (cron_service/service/run_execution.py:334-345). The sentence at cron_failure.py:394-395 checks only schedule.kind, never whether the job is enabled. The result is wrong notice text and nothing else: the job stays paused as the operator asked, the dashboard shows it as paused, and no run is lost or corrupted, so there is nothing to recover.
The real fix means reading back the stored schedule and enabled state after settlement, and handling the paused, removed and unreadable cases. That is a new read-after-settle ordering contract across the cron service and gateway modules, for a notice the operator just made moot themselves. That cost is larger than a one-off misleading sentence.

[ADJUDICATION] a99e533fa1c0b8c0b39741f216f1293124425b51 total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/slack/gateway_runtime/cron_failure.py:395 reason=disproportionate-remedy
[GPT-ADJUDICATED] a99e533fa1c0b8c0b39741f216f1293124425b51

False positive or not applicable? A repository writer can comment:
/ai-review override gpt a99e533fa1c0b8c0b39741f216f1293124425b51 false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) November 9, 2026 14:47
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 9, 2026
buluoray
buluoray previously approved these changes Nov 9, 2026

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

Approved at 637dc8d. Fixes #33831: a cron run cut by a restart now gets a history row and a bell/channel notice on every planned restart path (src/kiro_crew/cron_service/service/run_execution.py:239, service_lifecycle.py:168, src/kiro_crew/cron.py:381, src/kiro_crew/dashboard/handlers/updates_apply.py:309, src/kiro_crew/slack/gateway_runtime/update_schedule.py:1038, src/kiro_crew/slack/events_slash.py:633). call_tool sends args as written or refuses by path (src/kiro_crew/cron_script_context.py:504, :587). Credentials are still refused, so the scan got stricter, not looser. Backend shards were still running when posted.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 9, 2026
@bolichen97
bolichen97 force-pushed the fix/sweep-g6-cron-runs-and-script-tools branch from 637dc8d to 0a10f61 Compare November 9, 2026 19:42
@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: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 9, 2026
@bolichen97
bolichen97 force-pushed the fix/sweep-g6-cron-runs-and-script-tools branch from 0a10f61 to ac2d74c Compare November 9, 2026 23:02
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge 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 Nov 9, 2026
@bolichen97
bolichen97 force-pushed the fix/sweep-g6-cron-runs-and-script-tools branch from ac2d74c to 201895c Compare November 10, 2026 00:06
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 10, 2026
buluoray
buluoray previously approved these changes Nov 10, 2026

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

Approve on 201895c. Since the APPROVE verdict at ac2d74c, the branch was rebased from main 16d40aa onto 08e371d (15 main commits, incl. #33670 restart close). The src/ and test/ patch is identical apart from hunk offsets; range-diff shows only two doc rewordings (cli.md "the one-shot an --at schedule makes"; slack-gateway.md /restart row merges #33670's close_all bound wording with this PR's cron stop). Tests pass and the Slack cron-stop guard still reddens its test on the new base. Decisive lines: src/kiro_crew/slack/events_slash.py:634-639 (cron stop after the slot save and before record_running_slots/close_all, beside main's #33670 bounded close), src/kiro_crew/slack/gateway_runtime/update_schedule.py:1038-1040 (stop_cron_before_restart after the fence, before the session close), src/kiro_crew/cron.py:381-409 (bounded, never raises), plus every Decisive line of review-33905-ac2d74c.md (src/test patch unchanged)

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Nov 10, 2026
A cron run in flight when the gateway stops or restarts is filed
cancelled and not retried, so a daily job skips that day, and its owner
was never told. The run now rings the bell and takes the failure alert's
one-surface delivery (silent jobs stay quiet, nothing is counted as a
failure). The planned in-app restarts stop the cron service after
their last refusal, so the run they cut is recorded and its in-flight
marker cleared, and kirocrew restart names the running jobs before it
signals anything. It reads each job's stored schedule to say whether
the job runs again: a consumed one-shot does not, so the line says to
schedule it again.

ctx.call_tool() and kirocrew cron preview sent arguments rewritten by
the credential scrubber, so a Graph message id, a drive id or a
CodeDeploy target reached the server corrupted while the run recorded
success. A call the scan would change is now refused, naming the
argument's path and never its value, and an id or an account and
resource name the scan only mistook is sent as written. Chat and
display redaction are unchanged.

Fixes #33831
@bolichen97
bolichen97 force-pushed the fix/sweep-g6-cron-runs-and-script-tools branch from 201895c to a99e533 Compare November 10, 2026 19:15
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 10, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Automated, not a person, and not a review: a maintainer still decides.

decider-v3c@217fe607 · p_defect 0.15 · router R0 (approves only when p_defect <= 0.12, on changes of at most 400 changed lines) · head a99e533fa1 · 1594 changed lines

Why: the decider approves but is not confident enough to auto-approve (p_defect 0.15 > 0.12).

Two cron fixes with tests. (1) When stop() cuts a run that has no outcome of its own (no cancel or reap flag), the run is filed cancelled and now starts an owner notice; stop() waits up to 3 s for those notices. All three planned in-app restarts (dashboard and update apply, the update restart, Slack /kirocrew restart) now call stop_cron_before_restart, bounded at 5 s, after their last refusal and before close_all(). Tests cover each refusal path leaving the scheduler running. stop() is safe to repeat, and the SIGTERM _shutdown path is unchanged except for the bounded wait. The kirocrew restart line reads the same home the cron service writes to and is best-effort. (2) The call_tool scan now refuses any change the scrubber would make, where main sent a redacted copy, so it is stricter and fails closed. It only loosens for narrow, documented identifier shapes: a Graph or drive id under an id-named key, and an account-id resource name, which is re-checked with the ':' read as a space. Verified against the callers, the restart ordering and the cron claim and cancel paths. No regressions or fail-open paths found. Windows backend CI was still pending.

If this recommendation is wrong, reply here; the replies are how the approver is evaluated.

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

Approve on a99e533. Since buluoray's approval at 201895c the branch was only rebased, from main 08e371d onto 4477b72 (259 main commits). The PR's added/removed lines in src/, test/ and docs/ are byte-identical; the only diff text change is hunk context in the dashboard/handlers/updates.py TYPE_CHECKING import list (main added overlay_owners imports). Tests pass and the Slack cron-stop guard still reddens its test on the new base. The one [BLOCK-MERGE] on this head (GPT, downgraded) is a rare wrong-notice-text case: APPROVE with it named. Named finding for @bolichen97 (non-blocking, rare): cron_failure.py:394-395 decides 'will run again at the next scheduled time' from schedule.kind alone, so a recurring job an operator paused mid-run and then interrupted by a restart gets that text although it won't run; please gate the line on the job being enabled in a follow-up. Decisive lines: src/kiro_crew/slack/events_slash.py:637-643 (cron stop after the slot save, before record_running_slots/close_all), src/kiro_crew/slack/gateway_runtime/update_schedule.py:1039-1045 (cron stop before record/close), src/kiro_crew/dashboard/handlers/updates_apply.py:318-323 (dashboard restart, same order), plus every Decisive line of review-33905-201895c.md (src/test/docs +/- lines unchanged)

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 10, 2026
@bolichen97
bolichen97 merged commit ffc89b7 into main Nov 10, 2026
102 checks passed
@bolichen97
bolichen97 deleted the fix/sweep-g6-cron-runs-and-script-tools branch November 10, 2026 20:47
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 10, 2026
@bolichen97 bolichen97 mentioned this pull request Nov 11, 2026
5 tasks done
bolichen97 added a commit that referenced this pull request Nov 11, 2026
Backport of #33905 (main ffc89b7). Conflicts resolved to the release side: dropped main-only trigger_run, expected_owner and overlay_owners imports and the quiet_run context lines; added set_interrupt_alert only. security.md: the PR sentence was applied into the release JWT bullet. test_cron_stop_interrupt_notice.py got a local _trigger_run helper in place of CronService.trigger_run.
bolichen97 added a commit that referenced this pull request Nov 11, 2026
Backport of #33905 (main ffc89b7). Conflicts resolved to the release side: dropped main-only trigger_run, expected_owner and overlay_owners imports and the quiet_run context lines; added set_interrupt_alert only. security.md: the PR sentence was applied into the release JWT bullet. test_cron_stop_interrupt_notice.py got a local _trigger_run helper in place of CronService.trigger_run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron: a run cut by a gateway restart is never reported, and script call_tool sends arguments the credential scrubber rewrote

3 participants