Skip to content

fix: read a ~/.kiro/crew cron script path as the configured data home - #31442

Merged
bolichen97 merged 1 commit into
mainfrom
fix/29828-cron-script-data-home
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/29828-cron-script-data-home

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A cron script given as ~/.kiro/crew/crons/<file>.py:<func>, the spelling the cron help and tool schema document, runs from the configured data home, also when KIROCREW_HOME points somewhere else.

With KIROCREW_HOME set, adding a job with script="~/.kiro/crew/crons/<file>.py:run" fails with Script file not found: <user home>/.kiro/crew/crons/<file>.py, although the file sits in <data home>/crons/. Only an absolute path works.

Why it matters

Anyone on a custom data home (the desktop build, a pod, a worktree preview, a second instance) cannot use the documented script spelling. The agent writes what the tool help tells it to, so its script crons fail to register.

Not a goal

  • Rewording the cron help, tool schema or docs.
  • Changing which files a script cron may run: crons/ containment, the app bundle roots and the sensitive-path check stay as they are.
  • The legacy ~/.kirocrew/ spelling, or any other ~ path.

What changed (motivation → approach → change)

The resolver expanded ~ against the real home, so ~/.kiro/crew/crons/f.py named the real home's copy, which is outside the data home's crons/ (missing, or refused).

resolve_script_path now rewrites a spec that starts with ~/.kiro/crew/crons/ to <config_dir()>/crons/<rest> before resolving (_data_home_spec in cron_script_paths.py). With the default home that is the same path. Every other spec keeps the plain expanduser, so a spec that spells out a data home nested under ~/.kiro/crew (~/.kiro/crew/dev/crons/...) resolves exactly as before, links included. The rewrite is path arithmetic on the spec: the result still goes through resolve, the sensitive-path check and crons/ containment, on a resolve line left as it was.

Every consumer (cron_add, the CLI, the fire-time gate, the launcher, the script-source endpoint) goes through this one resolver, so registration and fire time agree. cron_script.py lists the two new names in its type-checking manifest, and the cron spec (learn-cron-dashboard.md) describes the rewrite.

Backwards compatibility

Compatible: with the default home the rewrite is the identity, and only ~/.kiro/crew/crons/... specs under an override change meaning. Those could resolve inside the override's crons/ before only through a link from the real home's crons/ into it, and the rewrite names the same file then, unless that link renamed the file.

Removes nothing: the diff adds a rewrite in front of the existing checks and changes no check.

Tests

  • test_the_documented_tilde_spelling_names_the_configured_data_home: with HOME and KIROCREW_HOME on different scratch dirs, the documented spelling resolves to <data home>/crons/job.py (also with allow_bundle_roots=True, the fire-time path), a missing file's error names the data home, and ~/.kiro/crew/crons/../loose.py (a file in the data home outside crons/) is still refused.
  • test_a_nested_data_home_that_links_out_of_the_default_keeps_its_spelling: KIROCREW_HOME=~/.kiro/crew/dev, a link to a directory elsewhere, still resolves ~/.kiro/crew/dev/crons/job.py (skipped on Windows, where a directory symlink needs a privilege).
  • test_a_data_home_above_the_default_still_takes_the_documented_spelling: with KIROCREW_HOME=~/.kiro, ~/.kiro/crew/crons/job.py resolves to <data home>/crons/job.py.
  • Determinism: the three pass 10/10 at -n0 and in reversed order, and the file 3/3 at -n 4.

Proof: PROVEN test/test_cron_script_more_coverage.py::TestPathAndSecretResolution::test_the_documented_tilde_spelling_names_the_configured_data_home (head 880e2d5)

Manual verification

N/A — unit coverage sufficient: the resolver is a function of the spec, HOME and KIROCREW_HOME, and the tests drive the real config_dir().

Screenshots / video

N/A — no frontend change.

Related Issues

Closes #29828

Sibling sweep

Swept: git grep -nE "expanduser" -- src/kiro_crew/cron_script_paths.py src/kiro_crew/cron_script.py src/kiro_crew/mcp_cron.py src/kiro_crew/mcp_cron_vet.py src/kiro_crew/cli_commands_cron.py
Sibling: src/kiro_crew/cron_script_paths.py:127 -- not affected -- _bundle_relative_spec expands only to test absoluteness and hands the spec on unchanged to the rewrite

Pattern harvest

Not generalizable: the script spec is the one input that both documents a ~/.kiro/crew/crons/ spelling and is then contained under config_dir(); a rule on expanduser would flag every legitimate real-home path.

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 6, 2026 13:54
@bolichen97
bolichen97 requested a review from Zedmor November 6, 2026 13:54
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision b89898cc664808f0907127550128d0bfe3afae0b 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 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of b89898cc664808f0907127550128d0bfe3afae0b — 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. Issue #29828 reports the defect, and the rewrite sits in the one resolver every consumer calls. A repo grep found no other code that maps ~/.kiro/crew onto config_dir().

What this change ships

Inventory (4 items) — 4 justified

Intent: let an operator on a custom KIROCREW_HOME register a script cron with the documented ~/.kiro/crew/crons/<file>.py:<func> spelling. This is a FIX.

  1. Under a KIROCREW_HOME override, a ~/.kiro/crew/crons/... script spec now runs the file in the data home's crons/, at registration and at fire time — justified
  2. The "Script file not found" error for that spelling now names the data-home path — justified
  3. The cron spec section on script path resolution describes the rebase — justified
  4. The cron_script.py type-checking manifest lists _data_home_spec and CONFIG_DIR_NAME — justified

[FIRST-PRINCIPLES-REVIEWED] b89898c

Description read

[DESCRIPTION-READ] 6598ac3e5e0596bc46caaf7a3b4d6d23f49d56d1ac3fb5602ae1ae4fda22176f

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 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns: one rewrite in the shared resolver fixes registration and fire time together, it runs before checks the diff leaves unchanged, and it is the identity on the default home.

Notes

  • The rewrite matches only the literal ~/.kiro/crew/crons/ prefix. A spec spelled with the expanded real home (/home/u/.kiro/crew/crons/...) still misses under an override. That fits the stated goal, but the cron help could point agents at the ~ form.

[DESIGN-REVIEWED] b89898c

Description read

[DESCRIPTION-READ] eccd632b3a8fe3cc2ab5b38924698b71d027e2d352d1d2dadb935ff6067d56bc

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 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] b89898c

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

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

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of b89898cc664808f0907127550128d0bfe3afae0b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b89898c

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 6, 2026 14:13
Comment thread src/kiro_crew/cron_script_paths.py Fixed
Comment thread src/kiro_crew/cron_script_paths.py Fixed
@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 Nov 6, 2026
@bolichen97
bolichen97 force-pushed the fix/29828-cron-script-data-home branch from a5ee5dc to ccb688b Compare November 6, 2026 17:23
@bolichen97

bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

span=d3aae2759429

fixed in ccb688b: the nested-data-home step now reads the nesting from the resolved data home relative to the resolved default home, not from where the spec lands, so a data home above the default (KIROCREW_HOME=~/.kiro) rebases ~/.kiro/crew/crons/job.py onto <data home>/crons/job.py.
A data home nested under ~/.kiro/crew whose spec spells out its segments keeps them once; with the default home the rebase is still the identity.
Pinned by test_a_data_home_above_the_default_still_takes_the_documented_spelling, red on a5ee5dc.

[operator: bolichen97]

@bolichen97
bolichen97 force-pushed the fix/29828-cron-script-data-home branch from ccb688b to 880e2d5 Compare November 6, 2026 19:37
@bolichen97

Copy link
Copy Markdown
Contributor Author

span=d3aae2759429
resolution: removed -- the nesting step is gone; only the documented ~/.kiro/crew/crons/ prefix is rewritten

fixed in 880e2d5: _data_home_spec rewrites only a spec starting with ~/.kiro/crew/crons/ (to <config_dir()>/crons/<rest>); every other spec keeps main's plain expanduser.
So ~/.kiro/crew/dev/crons/job.py under KIROCREW_HOME=~/.kiro/crew/dev (a link to /data/crew) is untouched and resolves through the link to /data/crew/crons/job.py, as on main.
The documented spelling under any override, and a data home above the default (KIROCREW_HOME=~/.kiro), still land in the data home's crons/; resolve, the sensitive-path check and containment judge every result.
Pinned by test_a_nested_data_home_that_links_out_of_the_default_keeps_its_spelling, red on ccb688b (FileNotFoundError on <data>/dev/crons/job.py).

[operator: bolichen97]

@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 Nov 6, 2026
@bolichen97
bolichen97 force-pushed the fix/29828-cron-script-data-home branch from 880e2d5 to fc3d2f0 Compare November 7, 2026 02:40
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/cron_script.py, docs/system-specs/modules/learn-cron-dashboard.md since this head went green (3b67f43 -> c5c4de1); CI re-running.

The previous head's backend reds (test_the_package_stays_within_its_line_budget, test_only_the_allowed_workflows_use_pull_request_target) were red on main and are fixed there by #31625 and #31803; both pass on this base. The diff is unchanged.

[operator: bolichen97]

@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 Nov 7, 2026
The cron help, tool schema and docs spell a script as
~/.kiro/crew/crons/<file>.py, but the resolver expanded ~ against the
real home, so under a KIROCREW_HOME override the documented spelling
never resolved. Rebase that prefix onto config_dir() before resolution.
A spec already inside the data home (an override nested under
~/.kiro/crew, compared on canonical paths) is kept, and the resolve,
sensitive-path and containment checks still judge the result.

Closes #29828
@bolichen97
bolichen97 force-pushed the fix/29828-cron-script-data-home branch from fc3d2f0 to b89898c Compare November 7, 2026 05:32
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/learn-cron-dashboard.md since this head went green (c5c4de1 -> 464b547); CI re-running.

Main's change to that spec is in unrelated sections; the rebase was clean and the diff is unchanged. On the previous head the GPT 6.1 and Opus 5.5 lanes computed a verdict but could not publish it (the GitHub API rate limit for the app installation was exhausted), so both lanes re-run on this head.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 7, 2026
@bolichen97
bolichen97 merged commit 1694a06 into main Nov 7, 2026
99 checks passed
@bolichen97
bolichen97 deleted the fix/29828-cron-script-data-home branch November 7, 2026 06:21
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray added a commit that referenced this pull request Nov 8, 2026
…#31442)

The cron help, tool schema and docs spell a script as
~/.kiro/crew/crons/<file>.py, but the resolver expanded ~ against the
real home, so under a KIROCREW_HOME override the documented spelling
never resolved. Rebase that prefix onto config_dir() before resolution.
A spec already inside the data home (an override nested under
~/.kiro/crew, compared on canonical paths) is kept, and the resolve,
sensitive-path and containment checks still judge the result.

Closes #29828

(cherry picked from commit 1694a06)

Original author: Bolin Chen (#31442). Hand-resolved, docs/tests only: docs/system-specs/modules/learn-cron-dashboard.md  keep release's structure plus this commit's added and removed lines.
buluoray added a commit that referenced this pull request Nov 8, 2026
…#31442)

The cron help, tool schema and docs spell a script as
~/.kiro/crew/crons/<file>.py, but the resolver expanded ~ against the
real home, so under a KIROCREW_HOME override the documented spelling
never resolved. Rebase that prefix onto config_dir() before resolution.
A spec already inside the data home (an override nested under
~/.kiro/crew, compared on canonical paths) is kept, and the resolve,
sensitive-path and containment checks still judge the result.

Closes #29828

(cherry picked from commit 1694a06)

Original author: Bolin Chen (#31442). Hand-resolved, docs/tests only: docs/system-specs/modules/learn-cron-dashboard.md  keep release's structure plus this commit's added and removed lines.
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.

A cron script given as ~/.kiro/crew/crons/… is looked up in the real user home, not the configured data home

3 participants