Skip to content

feat(schedule): set a job's run time limit from the job form - #21496

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
leonlaiyc:feat/cron-run-time-limit
Oct 24, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
leonlaiyc:feat/cron-run-time-limit

Conversation

@leonlaiyc

@leonlaiyc leonlaiyc commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A scheduled job's run time limit can be seen and changed from the Schedule page, so a long job is no longer stuck at 30 minutes unless someone hand-edits crons.json.

#18552 reports exactly that: "Long-running tasks appear limited to 30 minutes", and "the timeout appears configurable through manual edits to /home/$USER/.kiro/crew/crons.json, but the Kiro Crew UI does not expose this setting."

The limit is real and already stored per job: timeout_secs, the whole-run budget, after which _execute_with_timeout stops the run and records Timed out after <N>s. The CLI and the cron tools set it. The dashboard's three cron routes did not: POST /api/crons dropped the field, PATCH /api/crons/{id} did not accept it, GET /api/crons did not return it, and the job form had no control.

Why it matters

Anyone who schedules a job that needs more than half an hour (a test sweep, a report over a large repo) gets a run that is cut off. The only remedy inside the product is to ask an agent or use the CLI, and nothing on the Schedule page even says the limit exists.

Not a goal

  • The other half of Expose schedule timeout and report timeout failures #18552, alerting when a run times out. That shipped separately as fix(cron): alert a run its deadline ended #21284.
  • The subprocess timeout of a command or script job. The dashboard does not create those jobs (the create form is always an agent job), and the CLI and cron tools set it. The issue asks to label the two separately if both exist; this form labels its field as the whole run's limit and leaves the subprocess bound where it is set today.
  • Changing the default (_JOB_TIMEOUT_SECS, 1800 s) or the accepted range (1..86400).
  • The reaper's force-kill floor for a budget under 30 minutes, which mcp_cron._sub_floor_timeout_note already describes.

What changed (motivation → approach → change)

Approach. The store already validates and enforces the field, so this PR only carries it across the dashboard's HTTP boundary and into the form, and changes no execution behavior.

  • GET /api/crons returns each job's timeout_secs as effective_wake_budget(job), not the raw field. A stored value outside the range runs under the default, so the form must show the limit a run actually gets.
  • POST /api/crons and PATCH /api/crons/{id} take an optional timeout_secs through one helper, dashboard/cron_timeout_field.timeout_secs_from_body (a new module beside the route owners). The create and update routes live in handlers/cron_jobs.py and the list in handlers/cron_board.py, the owner modules refactor(dashboard): split cron.py handlers into cron_* owner modules #21672 split out of handlers/cron.py. A JSON integer in 1..86400 passes. Anything else (a boolean, a float, a string, null, out of range) is 400 with code: invalid_timeout_secs before anything is written: a client sending one of those has a bug, and coercing it would store a guess as the job's real limit.
    • After that, the store's own check still runs: a command or script job's budget must cover its subprocess timeout plus cleanup. apply_job_update evaluates it on the post-update values, and its ValueError is the 400 the form shows.
  • JobForm gains Time limit, a whole-minutes field (1 to 1440) for every job kind. Both places that render the form, the Schedule page's job panel and the crew wake section, use its vertical layout, where the field has a heading and help text. The horizontal layout (the component's default, rendered by nothing in production today) gets the same field with a visible label, as its checkbox neighbours have.
    • The form sends timeout_secs only when the minutes change. A limit set elsewhere in seconds (1000 s shows as 17 minutes) would otherwise be rewritten to 1020 s by an unrelated rename.
  • i18n: three components.jobForm keys in en.json, translated in all 11 catalogs (reusing each catalog's existing word for "minutes"), with en.context.json entries and the regenerated pseudolocale.
  • Docs: learn-cron-dashboard.md gains "Run Time Limit (timeout_secs)". Its App SDK section also stops saying that apply_job_update skips the budget cover check: the code (cron_service/fields.py, "Cross-field: the wake budget must cover the subprocess bound") runs it on every update that changes either value, and a test below drives that through the new PATCH path.

Backwards compatibility

Compatible: every new request field is optional and every response field is additive. A client that never sends timeout_secs creates and edits jobs exactly as before, and a job's stored limit is untouched unless the field is sent.

Removes nothing: the change only adds an accepted field to two routes, a returned field to one, and a form control.

Tests

test/test_cron_timeout_secs_api.py (24):

  • create forwards the limit; an absent field leaves the store default; 7 invalid values are each 400 invalid_timeout_secs with nothing created.
  • PATCH forwards the limit; an unrelated PATCH sends no limit; the same 7 invalid values are refused without a write; the store's own refusal reaches the client as 400.
  • list returns a set limit, the default for a job without one, and the default for an out-of-range stored value.
  • against a real CronService: a PATCHed limit is what effective_wake_budget gives a run; a 60 s budget on a df -h command job is refused and the stored limit is unchanged.

website/src/test/JobForm.timeLimit.test.tsx (9): default 30 minutes; an existing limit is shown; a change is sent in seconds; an unchanged limit is not sent on create or edit; a 1000 s limit survives a rename; a script job's limit is sent; both layouts edit and save through the real form; the field clamps to 1..1440.

Red before the change: backend 20 failed, 2 passed (the two absent-field guards); frontend 8 failed, 1 passed.

Local gates, run on this Windows box:

  • After the rebase onto 20fcbd54e8 (one commit, no merge): the four route hunks moved from handlers/cron.py into cron_jobs.py and cron_board.py. The rest of the diff is the previous branch's net change, line for line. test_cron_timeout_secs_api.py plus every test_dashboard_cron*.py and test_*cron*api*.py: 306 passed, 2 skipped. JobForm.timeLimit.test.tsx passed. npx tsc -b is clean. black, isort, flake8, check_comment_history.py, check_brand_name.py, check_file_line_cap.py (0 failures) and mypy pass. src/i18n + JobForm: 1,167 passed. The one failure is the same navLabels.test.tsx 15 s timeout, which also fails on a clean main worktree.

Earlier gates, on the pre-rebase head:

  • black, isort and flake8 on the touched Python files, check_black_formatting.py, check_subprocess_encoding.py, check_comment_history.py, check_brand_name.py, check_file_line_cap.py (0 failures; it reports handlers/cron.py and types/index.ts growing past their baseline rows, report-only), mypy on handlers/cron_jobs.py, handlers/cron_board.py and cron_timeout_field.py (clean), docs_lint.py (passed), gen-ui-index --check (up to date), npx tsc -b (clean), npm run lint:i18n (OK), eslint on the changed frontend files (clean), pr-description-check.sh (success).
  • Every test/test_cron*.py, every test/test_dashboard_cron*.py, test_api_input_validation.py and test_client_py_route_contract.py: 126 files, 3,186 passed, 0 failed.
  • src/i18n (1,022 tests): one failure, navLabels.test.tsx's 15 s timeout, which fails identically with this PR's frontend diff reverted.
  • scripts/local-gate.py frontend related set (488 files, run in batches): 14,840 passed. Its two style failures were real and are fixed in the second commit: the Bengali help text used Bengali digits and the French one a plain space before a colon. The four remaining failing files (decisionStripContract, ToolRiskBadgeContract, electronShellEvidence, uiIndex) fail identically at the merge base with this diff reverted.
  • scripts/local-gate.py backend related set: handlers/cron.py is a hub file, so it selects 1,483 files, run as the gate's three chunks to the end: 49,754 passed, 221 failed, 10 errors. The 141 unique failing nodes were rerun on a clean worktree at the merge base with nothing of this diff: 140 fail there the same way (cloud source and launch, the AI-review workflow greps, private workflow execution, ACP liveness and sandbox, Slack gateway coverage, and other Windows-local cases). The one that passed there, test_spec_builder_routes_coverage.py::TestScanSubdirs::test_the_listing_is_bounded, passes 3 of 3 alone on this branch and has no path to this diff. Chunk 2 also ended in an xdist INTERNALERROR after six crashed workers, so not every test in that chunk ran locally; CI runs the full suite.

Manual verification

The screenshots below are the real JobForm, rendered by Vite with the real stylesheet and catalogs, with only fetch stubbed, editing a job whose timeout_secs is 7200. Not exercised against a live gateway: the round trip is covered by the real-CronService tests above.

Screenshots / video

The vertical layout, which the Schedule page's job panel and the crew wake section render, light and dark:

Time limit field in the vertical job form, light

Time limit field in the vertical job form, dark

The horizontal layout (unused in production), and the Japanese catalog

Time limit field in the horizontal job form

Time limit field in Japanese

Related Issues

Part of #18552

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

Contribution License Agreement

🤖 Generated with Claude Code

@leonlaiyc
leonlaiyc requested review from a team and KiroCrewCaptain as code owners October 17, 2026 06:10
@leonlaiyc
leonlaiyc requested a review from bolichen97 October 17, 2026 06:10
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 17, 2026

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

Looks good to me at 79b1a97. No must-fix or should-fix findings from this pass.

What I checked:

  • timeout_secs_from_body refuses bool, float, string, null and out-of-range values before any write, on both POST and PATCH. On PATCH it runs before update_job_async, so a refused value writes nothing.
  • The store accepts the field on create (build_job) and update (apply_job_update), and apply_job_update does run the cover check on the post-update values. The spec correction in learn-cron-dashboard.md matches the code on main.
  • GET /api/crons reports effective_wake_budget(job), and the form sends timeout_secs only when the minutes change. A limit set elsewhere in seconds therefore survives an unrelated edit, and the frontend test pins that case.
  • No other dashboard caller sends a list row back to PATCH, so the new list field cannot be echoed into a write.
  • The new module sits outside dashboard/handlers/, so the feature map gate has no new handler row to require. handlers/cron.py growth past its baseline row is report-only.
  • The linked issue is tier T2, and no path hits the security path list.

Remaining before merge: the fork review lanes and CI have not reported on this head yet, and readiness is not passed. I will look again once they finish.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 228ef145d719aa481e5544d159698791f8774560 via the fork AI-review pipeline — 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 fix addresses #18552 directly: the stored timeout_secs now reaches the dashboard's HTTP routes and the job form. Two small riders can be trimmed.

Notes

  • Item 6 — zero consumers: handlers/cron.py adds timeout_secs_from_body to the TYPE_CHECKING re-export block, but nothing imports it from handlers.cron. Grepping for handlers.cron import .*timeout_secs_from_body finds 0 hits, and the test imports only the three route handlers. Subtraction: delete that re-export hunk.
  • Item 2 — second spelling: TIMEOUT_SECS_MIN = 1 / TIMEOUT_SECS_MAX = 86400 restate the range already in cron_service/fields.py:_check_timeout_secs_range and execution.py:149, which makes 3 places to keep in sync. Subtraction: lift the store's bound into one importable constant and use it, keeping only the bool/int type check local, since the store doesn't do that check.

What this change ships

Inventory (8 items) — 6 justified

Intent: let a person see and change a scheduled job's run time limit from the Schedule page without hand-editing crons.json. ADDITION. It closes the gap reported in #18552.

  1. Schedule job form shows a "Time limit" minutes field in both layouts — justified
  2. Create and edit routes accept timeout_secs, refusing a non-integer or out-of-range value with 400 invalid_timeout_secs — justified
  3. Job list returns each job's effective limit — justified
  4. Form sends the limit only when the minutes change, so a limit set in seconds survives — justified
  5. An untouched field follows a limit changed in another tab — justified
  6. timeout_secs_from_body re-exported from handlers/cron.py — zero consumers
  7. Spec now says apply_job_update also runs the budget cover check, matching fields.py:476 — justified
  8. Four review screenshots under temp-screenshots/ — justified

[FIRST-PRINCIPLES-REVIEWED] 228ef14

Description read

[DESCRIPTION-READ] ab9704b06aa5a7a9e2ec6faee1f3b7ee41aedc792651ae7f5e2414bc32729b4f

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 Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 228ef145d719aa481e5544d159698791f8774560 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the patch only adds an optional field that the store already validates and enforces. It removes nothing, and four committed screenshots show the new control.

Notes

  • The 1..86400 range now lives in three places: cron_timeout_field.TIMEOUT_SECS_MIN/MAX, JobForm's MAX_RUN_LIMIT_MIN/DEFAULT_RUN_LIMIT_SECS, and cron_service.fields. If the service range changes, the form and the HTTP check will drift unless the constants are imported from cron_service.

[DESIGN-REVIEWED] 228ef14

Description read

[DESCRIPTION-READ] fed9e77e2dc313ec2ff56e0c4812363e39726fd1bec8ca1f131445cccb69e9eb

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 Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 228ef145d719aa481e5544d159698791f8774560 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

The four committed screenshots show every control this PR adds: Time limit in both layouts, in light and dark, and in Japanese. No first-time reader has looked at them, because this lane reviews forks without a blind read.

Notes

  • If you lower the limit on a command or script job below what its own command needs, the form shows the store's raw ValueError (timeout_secs (wake budget) must cover…), which is in code terms. Map that refusal to a translated message in plain words, such as "This job's command needs at least N minutes".
  • Screenshot horizontal-en-light shows the field with only its "Time limit" label. In the horizontal layout, the 30-minute default and the fact that the limit covers the whole run appear only in the tooltip (title). That layout has no production use today, so this is not urgent.

[UX-REVIEWED] 228ef14

Description read

[DESCRIPTION-READ] 9d865cfb3924126e44e69463f541c95559a7910051302b5e36ef77bf3e9ac80f

That sha256 names everything this verdict read: the PR description, plus the 7 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 Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 228ef145d719aa481e5544d159698791f8774560 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 228ef14

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 228ef145d719aa481e5544d159698791f8774560 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 228ef14

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 17, 2026
@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 18, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

Thanks for the follow-up commit. The stale-tab fix in 6da1076 looks right to me: the field now compares against the limit it was seeded from, an untouched field follows a re-fetched value, and an edit survives it. The four new tests pin each case, and the spec paragraph matches the code. Clearing and retyping the field also works now.

One thing blocks merge: PR Hygiene fails on f1f40a3 because the branch has 4 commits, including a merge of main. The check allows at most 2 and counts a merge commit. Please rebase onto main instead of merging, and squash your commits into one:

git fetch upstream
git rebase -i upstream/main   # mark the later commits as fixup

Then force-push the branch. The screenshot links in the description point at 79b1a97, so they keep working after the rebase.

The fork review lanes have reported on this head: Design, Opus and GPT have no findings. First Principles and UX have advisory concerns (the duplicated range check, the horizontal-layout field, and silent clamping above 1440 minutes). They do not block, but a short reply on each would help.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 19, 2026
@leonlaiyc
leonlaiyc force-pushed the feat/cron-run-time-limit branch from f1f40a3 to cd483c4 Compare October 19, 2026 08:01
@leonlaiyc

Copy link
Copy Markdown
Contributor Author

Thanks @bolichen97. The branch is now one commit, cd483c46d0, rebased onto 20fcbd54e8 with no merge commit. #21672 had split handlers/cron.py into owner modules in the meantime, so the four route hunks now live in cron_jobs.py (create/update) and cron_board.py (list). The rest of the diff is the previous branch's net change, line for line, the stale-tab fix included. The rebase checks are recorded in the Tests section.

@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: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 19, 2026

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

Thanks for the rebase. The branch is one commit now and PR Hygiene passes. I compared the new net diff with the previous branch: the form, its tests, the API tests, the field module and the types are line for line the same, and the route hunks sit where the handler split put them.

One thing blocks merge: Backend Tests shard 5 fails on cd483c4 in test/test_cron_handler_facade.py::test_every_name_served_from_outside_the_family_is_visible_to_type_checkers. The new module-level import of timeout_secs_from_body in cron_jobs.py makes the cron facade serve that name, and the facade test requires every such name to also be imported under TYPE_CHECKING in handlers/cron.py. Adding this block to the second if TYPE_CHECKING: section of dashboard/handlers/cron.py, right after the cron_inject import, should turn it green:

from kiro_crew.dashboard.cron_timeout_field import (  # noqa: F401
    timeout_secs_from_body,
)

Coverage Gate fails only because that shard failed. Everything else on this head is green or skipped, and the Design, Opus and GPT lanes report no findings.

from kiro_crew import model_registry
from kiro_crew.cron import CronStoreBusy, CronStoreUnreadable, is_valid_timezone, parse_time_string
from kiro_crew.dashboard.cron_inject import chat_folder_exists, move_cron_job_tab
from kiro_crew.dashboard.cron_timeout_field import timeout_secs_from_body

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.

This import fails the cron facade manifest test.

A module-level import in a cron owner module is served through the handlers/cron.py facade, and test_every_name_served_from_outside_the_family_is_visible_to_type_checkers requires the facade to name each such import under TYPE_CHECKING. The facade has no entry for this one, so shard 5 fails with Right contains 1 more item: {'timeout_secs_from_body': ('kiro_crew.dashboard.cron_timeout_field', 'timeout_secs_from_body')}.

from kiro_crew.dashboard.cron_timeout_field import timeout_secs_from_body

Suggestion: add the matching block to the second if TYPE_CHECKING: section of dashboard/handlers/cron.py, after the cron_inject import:

    from kiro_crew.dashboard.cron_timeout_field import (  # noqa: F401
        timeout_secs_from_body,
    )

Rule: a required check failing on the current head blocks merge.

@bolichen97
bolichen97 dismissed their stale review October 20, 2026 05:04

Fixed on ac54c0b: the cron handler facade now lists timeout_secs_from_body in its TYPE_CHECKING imports, and the facade and time limit tests pass on this head.

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

Re-reviewed at ac54c0b.

The blocker from my last review is fixed: the cron handler facade (dashboard/handlers/cron.py) now imports timeout_secs_from_body under TYPE_CHECKING, so the cron facade manifest matches. I ran test/test_cron_handler_facade.py and test/test_cron_timeout_secs_api.py on this head: 35 passed. The rest of the change is the rebase onto main (the job type now lives in website/src/types/index.jobs.ts after the types split, and the i18n context entries moved with it); the feature diff is otherwise unchanged.

I dismissed my earlier request for changes. Approval waits on CI: several Backend Tests shards are still running and readiness has not passed on this head yet. I will approve once it does.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 20, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

The only red check on this head is Backend Tests (3.12, 2), which fails on the test_facade_mirror_guards 120s timeout (tracked in #22004). That timeout is fixed on main by #22320, which merged today.

Could you rebase onto current main and push? Once CI is green on the new head I can re-check and merge it. Nothing else in the change needs to move.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 21, 2026
@leonlaiyc
leonlaiyc force-pushed the feat/cron-run-time-limit branch from ac54c0b to 239b4b0 Compare October 22, 2026 12:34
@leonlaiyc

Copy link
Copy Markdown
Contributor Author

@bolichen97 Rebased onto current main (64576241e0) and pushed. Head is now 239b4b0736, still one commit.

Main had added the auto-pause field to JobForm.tsx in the meantime. It is a separate field, so the conflict kept both: the auto-pause state sits next to the time-limit state, and the form's dirty check now compares both. cron_board.py keeps main's backoff_delaying_next_run import next to this PR's effective_wake_budget one. en.context.json keeps main's Mate wording, with the three time_limit* keys after it. git range-diff against ac54c0b05f shows no other change.

Local checks on this head: 136 backend tests passed (test_cron_timeout_secs_api.py, the cron facade and dashboard cron suites), 261 frontend tests passed (every JobForm.* and Cron* file, auto-pause included), tsc --noEmit and i18n:check clean. CI is running on the new head now.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Oct 22, 2026

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

Thanks for the rebase. On 239b4b0 the branch merges cleanly with main again, and the range diff against the previous head shows only the conflict resolution next to the new auto pause field: the dirty check, the submit payload and the imports keep both features. The new API tests and the facade tests pass locally on this head.

One blocking item remains, raised by the GPT lane on this head and reproduced here: the Time limit field reads its value with parseInt, so a number written with an exponent or a decimal is cut to its leading digits and saved as a much shorter limit. Details and a suggested fix are inline. Backend and frontend checks were still running when this was written, so I have not confirmed the earlier slow test failure is gone yet.

Comment thread website/src/components/JobForm.tsx Outdated
const [timeLimitBase, setTimeLimitBase] = useState(defaults.savedTimeoutSecs)
// The raw text, so the field can be cleared and retyped; it is clamped on blur.
const [timeLimitText, setTimeLimitText] = useState(String(defaults.timeLimitMin))
const parsedLimit = parseInt(timeLimitText)

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.

A value like 1e2 is saved as a 1 minute limit

parseInt stops at the first character it cannot read as an integer, and a number input accepts exponent and decimal notation. Typing 1e2 (100) gives parseInt("1e2") === 1, 2e3 gives 2, and 1.5 gives 1. The blur handler then writes that value back and buildBody sends timeout_secs: 60, so every run of the job is stopped after one minute. Checked in Node on this head; main has no such field.

const parsedLimit = parseInt(timeLimitText)

Suggestion: parse the whole string, keep the empty draft fallback (note Number("") is 0), and round before the existing clamp:

const trimmed = timeLimitText.trim()
const parsedLimit = trimmed === '' ? NaN : Math.round(Number(trimmed))

A test that types 1e2 and expects timeout_secs: 6000 would pin it.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 22, 2026
@leonlaiyc
leonlaiyc force-pushed the feat/cron-run-time-limit branch from 239b4b0 to caf63bf Compare October 22, 2026 14:13
@leonlaiyc

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: parseInt(timeLimitText) stops at the first non-digit. A number input accepts exponent notation, so 1e2 (100 minutes) parsed as 1, and saving sent timeout_secs: 60.

fixed in caf63bf, still one commit on the same base.

The field now parses its whole text with Number (empty text is still a draft and falls back to the stored limit) and rounds to whole minutes inside the existing 1..1440 clamp. A new test, reads the whole number the field holds, exponent and fraction included, enters 1e2 (blurs to 100), then 90.4 (blurs to 90), and checks that Save sends timeout_secs: 5400. On 239b4b0736 it fails at the 1e2 step. All 13 JobForm.* files pass (159 tests), and tsc --noEmit and eslint are clean.

@bolichen97 the head moved from 239b4b0736 only for this fix; CI is re-running on caf63bf73f.

@bolichen97
bolichen97 dismissed their stale review October 22, 2026 15:07

The Time limit parsing issue is fixed on caf63bf, with a test that fails without the fix.

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

Thanks for the fix. On caf63bf the Time limit field now parses its whole text with Number, keeps an empty field as a draft that falls back to the stored limit, and rounds before the existing 1 to 1440 clamp. I checked the parse and clamp logic directly: 1e2 gives 100 minutes, 1.5 gives 2, 2e3 and Infinity clamp to 1440, and a blank field falls back as before.

The new test reads the whole number the field holds, exponent and fraction included passes on this head (14 of 14 in JobForm.timeLimit.test.tsx), and with only JobForm.tsx reverted to the previous head it fails at the 1e2 step, so it pins the fix. The branch still merges cleanly with current main, and the only change since the last review is this fix and its test.

All five AI review lanes report no blocking findings on this head. Some backend and frontend test shards were still running when I checked, and none had failed.

My earlier change request is resolved, so I have dismissed it. From my side this is ready for maintainer approval. Because it is a feature change across more than 20 files, I am leaving the approval to a maintainer.

@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 Oct 22, 2026
A scheduled run that is still going after its time limit is stopped and
recorded as timed out. The store, the CLI and the cron tools all carry
that limit (timeout_secs), but the dashboard did not: POST /api/crons
dropped it, PATCH refused it, the list omitted it, and the Schedule form
had no control. So the only way to give a long job more than 30 minutes
was a hand edit of crons.json.

- GET /api/crons returns each job's effective limit (effective_wake_budget),
  the one a run actually gets.
- POST and PATCH take an optional timeout_secs: a JSON integer in
  1..86400, else 400 invalid_timeout_secs before anything is written. The
  store's own check that a command job's budget covers its subprocess still
  runs after it.
- The job form gains Time limit, in whole minutes, in both layouts and for
  every job kind. It sends the field only when the minutes change, so a
  limit set in seconds elsewhere survives an unrelated edit.

The cron spec also stops saying that an update skips the budget cover
check; apply_job_update runs it on the post-update values.

The field holds the limit it was seeded from, so a job re-fetched under an
open form (another tab saved a new limit) does not turn an untouched field
into an edit that writes the old limit back. It holds raw text and clamps
on blur, so clearing it and retyping works.

Part of kirodotdev#18552

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leonlaiyc
leonlaiyc force-pushed the feat/cron-run-time-limit branch from caf63bf to 228ef14 Compare October 24, 2026 10:42
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 24, 2026

@iamwhatever iamwhatever 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 at 228ef14.

The change carries the existing timeout_secs field across the dashboard's cron routes and into the job form, without changing execution. Invalid values are refused with 400 invalid_timeout_secs before anything is written (cron_timeout_field.py#L21), the list returns the effective budget (cron_board.py#L156), and the form sends the limit only when the minutes change, so a seconds-precise limit survives an unrelated edit. The earlier parseInt defect is fixed with a whole-text parse (JobForm.tsx#L399). Since the last human review (caf63bf) only rebase context changed.

All AI lanes pass on this head with advisory notes only, the earlier change requests were dismissed, and every check is green. Not touched by the sensitive-path rules.

— crew-pr-reviewer (r124)

@iamwhatever
iamwhatever merged commit 7d8e53a into kirodotdev:main Oct 24, 2026
103 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants