Repository navigation
fix: read a ~/.kiro/crew cron script path as the configured data home - #31442
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of 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 What this change shipsInventory (4 items) — 4 justifiedIntent: let an operator on a custom
[FIRST-PRINCIPLES-REVIEWED] b89898c Description read[DESCRIPTION-READ] 6598ac3e5e0596bc46caaf7a3b4d6d23f49d56d1ac3fb5602ae1ae4fda22176f That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of 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
[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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
a5ee5dc to
ccb688b
Compare
|
span=d3aae2759429
[operator: bolichen97] |
ccb688b to
880e2d5
Compare
|
span=d3aae2759429
[operator: bolichen97] |
880e2d5 to
fc3d2f0
Compare
|
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 ( [operator: bolichen97] |
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
fc3d2f0 to
b89898c
Compare
|
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] |
…#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.
…#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.
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 whenKIROCREW_HOMEpoints somewhere else.With
KIROCREW_HOMEset, adding a job withscript="~/.kiro/crew/crons/<file>.py:run"fails withScript 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
crons/containment, the app bundle roots and the sensitive-path check stay as they are.~/.kirocrew/spelling, or any other~path.What changed (motivation → approach → change)
The resolver expanded
~against the real home, so~/.kiro/crew/crons/f.pynamed the real home's copy, which is outside the data home'scrons/(missing, or refused).resolve_script_pathnow rewrites a spec that starts with~/.kiro/crew/crons/to<config_dir()>/crons/<rest>before resolving (_data_home_specincron_script_paths.py). With the default home that is the same path. Every other spec keeps the plainexpanduser, 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 andcrons/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.pylists 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'scrons/before only through a link from the real home'scrons/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: withHOMEandKIROCREW_HOMEon different scratch dirs, the documented spelling resolves to<data home>/crons/job.py(also withallow_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 outsidecrons/) 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: withKIROCREW_HOME=~/.kiro,~/.kiro/crew/crons/job.pyresolves to<data home>/crons/job.py.-n0and 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,
HOMEandKIROCREW_HOME, and the tests drive the realconfig_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_specexpands only to test absoluteness and hands the spec on unchanged to the rewritePattern harvest
Not generalizable: the script spec is the one input that both documents a
~/.kiro/crew/crons/spelling and is then contained underconfig_dir(); a rule onexpanduserwould flag every legitimate real-home path.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)