Repository navigation
fix(apps): trace aws-control's job records by kind when it is disabled - #33286
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The waiver is generic and only applies to the SDK's own store at its configured path under the data home. It keeps the nofollow, regular-file, hardlink, size and containment checks, so a linked jobs dir still gets the path screen. Notes
[DESIGN-REVIEWED] 11905ae Description read[DESCRIPTION-READ] 13a08abe730b74a124f57ae9ef4df44c797b2078643251c68c8844465746c3d5 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix reaches the cause: the disable scan was reading the SDK's own store through the agent-facing read, whose path screen refuses aws-control's protected data dir. What this change shipsInventory (4 items) — 4 justifiedIntent: when aws-control is disabled, the audit trail should truthfully name which of its runs were cut off, by kind. FIX (#33163).
[FIRST-PRINCIPLES-REVIEWED] 11905ae Description read[DESCRIPTION-READ] f3d1cfd9c56dd39724693932350f390429d9bb2119214a97c7ce476bd65170cb That sha256 names the PR description this verdict read. 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: |
5fe9169 to
2306f28
Compare
[operator: bolichen97] |
2306f28 to
5a55179
Compare
|
5a55179 to
b17ffb0
Compare
|
Rebased onto
|
buluoray
left a comment
There was a problem hiding this comment.
Approving. The disable scan reads the SDK's own job records through open_regular_nofollow instead of the agent-facing read, so aws-control's stale runs are traced by kind and finished runs get no line. The sensitive-path screen is waived only when the jobs dir resolves to its own place under the data home, and otherwise fails toward screened (apps/job_sdk.py:1351-1358, 1392-1398; test/test_job_sdk.py:1464-1525). Agent reads are not loosened.
b17ffb0 to
1187a78
Compare
|
Rebased onto main (086256f) to pick up #33695, which fixes the Static Ratchet Gate red ( |
|
|
Disabling an app writes one job_killed_on_disable line per stale record before deleting the records. The scan read each record through the agent-facing read, whose path screen refuses the security lists' protected app data dirs, aws-control's among them, so every non-live aws-control record was traced as unreadable, finished runs included. The scan now opens each record with jsonl_util.open_regular_nofollow and keeps the descriptor checks that read made: a link at the name, a non-regular, hardlinked or oversized file, or one outside the jobs dir is still unreadable. The path screen is waived only for a store at its own place under the data home; a store reached through a link below the home keeps it, so its records in a protected location stay unreadable. Closes #33163
1187a78 to
11905ae
Compare
|
Rebased onto main 52a2ebb to pick up #33795, the fix for the main-only red on |
Problem / Motivation
Goal: Disabling aws-control names each of its stale job runs with its kind in the audit trail, and leaves its finished runs out, instead of tracing every record as unreadable.
When an app is disabled, the Job SDK writes one
job_killed_on_disableaudit line for each record it is about to delete that was still running. For aws-control every record that is not live gets anunreadable staleline, finished backups included, and no line carries a kind.Why it matters
That trace is the only lasting answer to "which runs did this disable cut off". For aws-control it names files, says every one of them was unreadable and stale, and cannot say which backup kind was interrupted. Anyone reading the audit after a disable is told something false about runs that had already finished.
Not a goal
What changed (motivation → approach → change)
Every aws-control record read as unreadable because the disable scan read the SDK's own store through
safe_read_file_bytes_nolink, the read built for agent-chosen paths. Its path screen refuses the directories the security lists protect, and aws-control's data dir is one of them, so the app's own job records were refused like an agent's request would be.The scan in
JobSDK.remove_all_asyncopens each record withjsonl_util.open_regular_nofollowand keeps the other checks the old read made on the opened file: a link at the record's name, a non-regular, hardlinked or oversized file, and a file outside the jobs dir (the dir as it resolved when the scan started) are still traced as unreadable. The path screen now depends on where the jobs dir resolves:config_dir()), the operator's links at or above the home resolvedunreadableA stale aws-control record gets its
kind='…' staleline and a finished one gets none, as in any other app.The facade
kiro_crew.apps.job_sdkkeeps offeringFileTooLargeErrorandsafe_read_file_bytes_nolink, which the scan no longer calls, because both are in its frozen public inventory (test/campaign_facade_inventories/kiro_crew.apps.job_sdk.json). The scan opens records through the same_open_regular_nofollowbinding the retention sweep uses.Backwards compatibility
Compatible: the trace lines keep their shapes and every other app's records read as before; records under a protected app data dir, which the path screen refused, are parsed and traced by kind when the jobs dir sits at its own place under the data home.
Removes nothing: the disable deletes the same records and writes the same kinds of lines; the scan reads the records the path screen refused instead of tracing them as unreadable.
Tests
test/test_job_sdk.py::TestDisableTrace)test_a_protected_app_data_dir_still_traces_each_record_by_kind[False](new)kind='backup'.test_a_protected_app_data_dir_still_traces_each_record_by_kind[True](new)test_a_jobs_dir_linked_into_a_protected_dir_traces_each_record_unreadable(new)unreadable stale, never by kind.Both directory links are made with
make_dir_link(a junction on Windows), so the link cases run on an unelevated Windows shell instead of skipping. The existing link, corrupt, permission-denied and stale-versus-finished tests in the same class pin the checks the read keeps.Proof: PROVEN test/test_job_sdk.py::TestDisableTrace::test_a_protected_app_data_dir_still_traces_each_record_by_kind[False], test/test_job_sdk.py::TestDisableTrace::test_a_protected_app_data_dir_still_traces_each_record_by_kind[True] (head 11905ae)
Determinism: the three new test ids passed 20 of 20 runs at
-n0, and all 72 tests oftest_job_sdk.pypassed in three shuffled orders (seeds 4817, 22903, 31337). The related backend set (446 tests, includingtest_campaign_facades_base_public_names.pyandtest_job_sdk_retention.py) passes at-n auto --dist loadgroup.Manual verification
N/A — unit coverage sufficient: the tests drive
remove_all_asyncagainst the real protected path under a temporary data home, which is the whole reachable path.Related Issues
Closes #33163
Built on #33196 (merged), whose retention sweep reads the same store; this PR does not change that sweep.
Sibling sweep
Swept: git grep -nE "safe_read_file_bytes_nolink(|safe_read_file_bytes(|safe_read_file(" -- 'src/kiro_crew/apps/.py' 'src/kiro_crew/apps/**/.py'
Sibling: src/kiro_crew/apps/job_sdk.py -- changed here
Sibling: src/kiro_crew/apps/builtins/aws_control/crew/packaging/pipeline/crew.py -- not affected -- reads agent specs from the crew source for an export bundle, where the screen is wanted
Sibling: src/kiro_crew/apps/builtins/code_review_sage/sage_lib/store.py -- not affected -- its data dir is not on the security lists
Pattern harvest
Rule candidate: review-prompt
Pattern: a component reading files it owns through the agent-facing read, whose path screen refuses that component's own protected directory
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)