Repository navigation
feat(schedule): set a cron job's auto-pause limit from the edit form - #22875
iamwhatever merged 1 commit into
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change only adds things. It reuses the store's own validator and the existing audit path, and both screenshots of this revision downloaded. [DESIGN-REVIEWED] ed224c6 Description read[DESCRIPTION-READ] 84fd6689427f820f22d9a53c1516a34335bf4489a873c072f5efc19bb5081f92 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 PATCH route's app-token branch re-labels the audit actor, which Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: let a job's owner see and change its auto-pause limit on the Schedule page instead of going to the CLI or chat. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] ed224c6 Description read[DESCRIPTION-READ] 6fa41b3948f074bbee9b0b9a9c802bbbce68a3beb9ba92bb8ed63942caf0edc9 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the out-of-range hint state. Neither screenshot shows what the form says when someone enters a value outside 0–10000 and presses Save. Evidence gaps
Notes
[UX-REVIEWED] ed224c6 Description read[DESCRIPTION-READ] c0f236b3c8dad6407d87a388581ad79c26b57e47a8d4483399c924a0cdd68214 That sha256 names everything this verdict read: the PR description, plus the 5 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 |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
3649554 to
debee13
Compare
|
debee13 to
1ff6e86
Compare
|
|
|
The per-job auto-pause limit (0..10000, 0 = never) was settable only through the cron chat tools and the CLI. The cron board now reports auto_pause_after_failures, the job edit form shows it as a number field with the backoff explained, and PATCH /api/crons/{id} validates it with validate_auto_pause_after_failures and passes it to update_job, so the limit-change SEL row is still written.
1ff6e86 to
ed224c6
Compare
|
|
iamwhatever
left a comment
There was a problem hiding this comment.
Approve. Reviewed head ed224c6.
The edit form shows the job's stored auto-pause limit and sends it only when the owner changes it. The baseline is captured once, so a refresh cannot write a stale value back (JobForm.tsx#L369). The PATCH route checks the value with the store's own validator before any write and refuses null, booleans, floats and out-of-range values with a 400 (cron_jobs.py#L848). The route's existing owner gate and foreign-app refusal run first and are unchanged. The audit row names the app or the owner who made the write. Every lane finding has a disposition at this head, the hint-state screenshots are attached, and all current checks are green. The UX copy notes (label and help wording) are optional and do not block. I read CI and the test source; I did not run the tests.
— crew-pr-reviewer (r119)
Problem / Motivation
Goal: Let a job's owner see and set its auto-pause limit from the Schedule page's edit form.
#15524 added a per-job auto-pause limit,
auto_pause_after_failures. It ranges from 0 to 10000, defaults to 5, and 0 means the job never auto-pauses. The limit can be set only from the CLI (kirocrew cron add/update --auto-pause-after) and thecron_addandcron_updatechat tools. An owner looking at a job on the Schedule page can't see its limit or change it there.Why it matters
The Schedule page is where an owner edits every other part of a job. A job that fails often may need a higher limit, or 0, and today that means leaving the page for a chat or a terminal.
Not a goal
What changed (motivation → approach → change)
GET /api/crons) now reportsauto_pause_after_failuresfor each job, so the edit form shows the stored value, including 0.PATCH /api/crons/{id}acceptsauto_pause_after_failures. It validates the value with the store's ownvalidate_auto_pause_after_failuresbefore touching the store, so a bad value is a 400 with codeinvalid_auto_pause_after_failuresand nothing is written.nullis refused too, because the store readsNoneas "leave unchanged". The value goes toupdate_jobwith anaudit_actorthat names the writer, so the limit-change SEL row from feat(cron): per-job auto-pause limit, including never #15524 is written exactly as for a chat-tool or CLI write. An app token's write is filed underapp:<name>, the name_refuse_foreign_app_jobrecords for the same request. An owner write is filed throughaudit_actor(request, "dashboard"), which keeps the forwarded marker.en-XA.jsonis regenerated.learn-cron-dashboard.mdnames the form as a third way to set the limit.Backwards compatibility
Additive. The board gains one field, and the PATCH route accepts one more optional key. A client that sends neither sees no change. An older gateway that doesn't report the field makes the form hide it.
Tests
test/test_cron_auto_pause_limit_api.pycovers the board reporting the default and 0, a PATCH reaching the store with the dashboard as actor, an app token's PATCH filed underapp:<name>, a forwarded owner PATCH keeping the forwarded marker, an unrelated PATCH not sending the limit, bad values (-1, 10001, a string, a float, a boolean,nulland a list) returning 400 with nothing written, a 0 write producing thenever_pause_setSEL row, and a refused value leaving the stored limit and writing no row.website/src/test/JobForm.autoPauseLimit.test.tsxcovers showing the stored limit including 0, sending a changed limit, sending nothing when it's unchanged, refusing an out-of-range value without saving, and hiding the field on the create form or when the limit isn't reported.tsc -p tsconfig.app.json,I18N_BASE_REF=origin/main npm run i18n:check, black, flake8 and mypy are clean.Manual verification
I rendered the edit form for a job with a limit of 0 at desktop width and at 390 px, using a captured board payload. The field shows 0 with its help text.
Screenshots / video
Desktop:
Phone, 390 px:
Out-of-range value: 10001 entered and Save pressed. The hint is plain text under the field, and the page has no alert.
Desktop:
Phone, 390 px:
Related Issues
Fixes #22874
Follow-up deferred from #15524.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.