Skip to content

fix(session): reclaim issue-radar one-run work directories - #24986

Merged
bolichen97 merged 1 commit into
mainfrom
fix/issue-radar-run-dirs-23880
Oct 28, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/issue-radar-run-dirs-23880

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Issue Radar's one-shot AI calls stop leaving an empty work folder behind for every click.

Each Issue Radar AI call (issue triage, PR summary, recommendations, tagging) runs one throwaway session. Its key looks like issue-radar-ai:<owner>/<repo>#<n>:<uuid hex>. That shape was not in the one-run table in src/kiro_crew/session_work_dir.py, so the provider never marked or reclaimed the folder. Every click left one more issue-radar-* folder under the workspace root.

Why it matters

A user who uses Issue Radar a lot piles up one folder per AI call, each holding only Crew's own .kiro/settings/cli.json residue. They slow directory listings and keep skill-view aliases alive, the same cost #16049 removed for the other one-run sessions.

Not a goal

  • Reclaiming folders older builds already left. They carry no marker; kirocrew doctor keeps counting them, as for every other shape.
  • Azure DevOps repos whose path holds a space. Their key does not match, so their folder stays long-lived.
  • Changing how Issue Radar mints its keys or how folder names are derived.

What changed (motivation → approach → change)

Symptom: one leftover folder per Issue Radar AI call. Cause: the four keys carry / and #, and the shape table only knew colon-separated parts.

The folder name already comes from _safe_dir_name, which turns / into _ and keeps #. So the mapping is settled: issue-radar-ai:octo/hello#12:<hex> lives in issue-radar-ai_octo_hello#12_<hex>.

Key Folder name
issue-radar-ai:<owner>/<repo>#<n>:<hex32> issue-radar-ai_<owner>_<repo>#<n>_<hex32>
issue-radar-pr-ai:<owner>/<repo>#<n>:<hex32> issue-radar-pr-ai_<owner>_<repo>#<n>_<hex32>
issue-radar-reco:<owner>/<repo>:<hex32> issue-radar-reco_<owner>_<repo>_<hex32>
issue-radar-tagging:<owner>/<repo>:<hex32> issue-radar-tagging_<owner>_<repo>_<hex32>

A table part may now be a pair: its key form and its folder form. The key form is strict: segments of [A-Za-z0-9._-], split by / (a GitLab subgroup path is fine), and a positive number. The folder form is one segment class, because _ is both a segment character and the / stand-in; a nested _-split repeat there would backtrack. The folder name is only the sweep's candidate filter. The marker, written only for a key that matches, still decides every deletion, so no safety rule changes.

The owning spec, docs/system-specs/modules/acp-client.md, now lists the four shapes, their folder form and the new pair entry, and says they are reclaimed on both platforms' walks.

Backwards compatibility

Compatible: the table only gains shapes; every key that matched before matches the same way.

Removes nothing: no key, record, validator or reader is removed or tightened.

Tests

  • test_issue_radar_one_run_keys_and_their_directory_names: the four shapes, GitLab subgroups, and refused near-misses (no number, negative number, short id, space, unknown surface), checked through the real _session_work_dir name.
  • test_issue_radar_keys_as_the_routes_mint_them: the exact f-strings from the three route files.
  • test_the_sweep_reclaims_a_predecessors_issue_radar_folders: a dead predecessor's marked folders go; an unmarked one stays.

Proof: PROVEN test/test_session_work_dir.py::TestDisposableSessionKey::test_issue_radar_one_run_keys_and_their_directory_names[issue-radar-ai:octo/hello#12:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-True], test/test_session_work_dir.py::TestDisposableSessionKey::test_issue_radar_one_run_keys_and_their_directory_names[issue-radar-pr-ai:octo/hello.js#7:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-True], test/test_session_work_dir.py::TestDisposableSessionKey::test_issue_radar_one_run_keys_and_their_directory_names[issue-radar-reco:octo/hello_world:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-True], test/test_session_work_dir.py::TestDisposableSessionKey::test_issue_radar_one_run_keys_and_their_directory_names[issue-radar-tagging:octo-org/hello-world:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-True], test/test_session_work_dir.py::TestDisposableSessionKey::test_issue_radar_one_run_keys_and_their_directory_names[issue-radar-ai:group/sub/project#3:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-True] (head c61fbb1)

Determinism: the new tests use fixed strings, uuid4 ids and tmp_path only. They pass 20/20 at -n0, the whole file passes 10/10 at -n 4, and all 199 tests pass in a shuffled order (seed 7).

Manual verification

N/A - unit coverage sufficient: the change is a pure shape table, exercised by key, folder name and a real sweep over tmp_path.

Related Issues

Closes #23880

Sibling sweep

Swept: git grep -nE 'key = f"[a-z-]+:.*uuid.uuid4().hex' -- src/
Sibling: src/kiro_crew/apps/builtins/issue_radar/backend/http_routes/ai.py -- not affected -- its two keys are matched by the table rows this PR adds
Sibling: src/kiro_crew/apps/builtins/issue_radar/backend/http_routes/recommendations.py -- not affected -- its key is matched by the table row this PR adds
Sibling: src/kiro_crew/apps/builtins/issue_radar/backend/http_routes/tagging.py -- not affected -- its key is matched by the table row this PR adds
Sibling: src/kiro_crew/decisions/impl_llm.py -- not affected -- judge key already in the table

Pattern harvest

Not generalizable: the table already exists to catch this class; the defect was four shapes deferred from #20110 until the folder mapping was settled.

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 October 27, 2026 20:38
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision c61fbb138b4efa37e2450f312a5721e2bdb05e3c touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@bolichen97
bolichen97 enabled auto-merge (squash) October 27, 2026 20:39
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c61fbb138b4efa37e2450f312a5721e2bdb05e3c — 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

This fixes a reported defect (#23880) at the mechanism level. One sibling with the same root cause is still unfixed.

Notes

  • Item 1 — symptom-level point patch, 1 unfixed sibling: the root cause is that a one-shot call only counts as one-run if its key matches a regex in _DERIVED_SESSION_SHAPES. I grepped uuid\.uuid4\(\)\.hex\} under src/kiro_crew and found 7 keys. 5 are in the table after this PR. 1 passes an explicit cwd (auto-improvement). The last, meetings-translate-<hex> (apps/builtins/meetings/backend/domain/translate.py:113), says it "Mirrors issue-radar's _run_oneshot_model" and creates one session per translated line, but it is not in the table. The PR's sibling sweep pattern key = f"[a-z-]+: cannot match that key.

What this change ships

Inventory (4 items) — 3 justified

Intent: Issue Radar AI clicks stop leaving one empty work folder behind per call — FIX.

  1. Issue Radar triage, PR-summary, recommendation and tagging calls now get their work folders marked and reclaimed — symptom-level (sibling meetings-translate shape left out)
  2. Shape table entries can now carry a separate key pattern and folder pattern — justified
  3. The sweep now picks issue-radar-* folders as candidates on both platforms' walks — justified
  4. Spec section on one-run keys lists the four issue-radar shapes — justified

[FIRST-PRINCIPLES-REVIEWED] c61fbb1

Description read

[DESCRIPTION-READ] 49878e416aa7b511921b8eed721cc807d360c4dd897cb046ec77491df0e43265

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. The change only adds shapes to an existing table, and deletion is still decided by the marker, not by the broader folder-name filter.

[DESIGN-REVIEWED] c61fbb1

Description read

[DESCRIPTION-READ] bbd2e177adb372728463830fd9bbc54be9c06f9ba571d9f3482ab608e4ba9da8

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

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c61fbb1

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

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] c61fbb1

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

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

@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 27, 2026
@bolichen97
bolichen97 force-pushed the fix/issue-radar-run-dirs-23880 branch from 953fa88 to 23af7f2 Compare October 27, 2026 21:15
@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 Oct 27, 2026

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

🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:

Requesting changes at 23af7f2785 for one small item. The code is sound.

Blocking: the owning spec is not updated. docs/system-specs/modules/acp-client.md:465-481 lists every one-run key the provider marks for reclaim (subagent, cron, memory-consolidation, judge, taskrunner, hook, wf-author). This PR adds four issue-radar-* shapes and a new key-to-folder form (/ becomes _), and the spec does not mention issue-radar at all. AGENTS.md requires the spec to change in the same commit, otherwise the spec is wrong about which folders Kiro Crew deletes. Please add the four shapes, their folder form, and that they run on both platforms' walks.

Deletion safety, checked against source: no new delete code, only shape-table rows. Reclaim still goes through reclaim_session_work_dir / _reclaim_by_name, which remove only Kiro Crew's own .kiro/settings leftovers plus the marker and refuse links and junctions. User-chosen cwd is excluded (loader_config.py:1527). Key matching is anchored and the allowed characters exclude / \ : space, so the folder is always one path component. The sweep still needs a marker, a dead predecessor gateway, no live session, and one hour of age. On Windows an open handle makes the delete fail and the folder is kept (read from source; Windows CI passes).

199 tests pass; 4/4 mutations redden named tests (removing the rows, loosening the key charset, using the key form as the folder name, making #<n> optional).

Non-blocking: reclaim returns False without logging on every refusal (pre-existing).

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 28, 2026
@bolichen97
bolichen97 force-pushed the fix/issue-radar-run-dirs-23880 branch from 23af7f2 to c61fbb1 Compare October 28, 2026 03:04
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] @buluoray thanks for the review.

  • Blocking: owning spec not updated -- fixed in c61fbb1.

fixed in c61fbb1: docs/system-specs/modules/acp-client.md now lists the four one-run keys (issue-radar-ai, issue-radar-pr-ai, issue-radar-reco, issue-radar-tagging), the route files that mint them, and that _run_oneshot_model releases and destroys each one.
It states the folder form (_safe_dir_name turns each / into _ and keeps #, e.g. issue-radar-ai:o/r#7:<hex> -> issue-radar-ai_o_r#7_<hex>) and the new (key pattern, folder pattern) pair entry in the shape table.
It states that these four shapes are reclaimed on both walks (pinned and by-name/Windows), and that a key outside the segment set (an Azure segment with a space) stays long-lived.
Same single commit, rebased on main 33590d6; code unchanged. 199 tests in test/test_session_work_dir.py pass; local GPT and Opus reviews PASS on c61fbb1.

  • Non-blocking: reclaim returns False without logging on refusal -- rebutted for this PR.

Rebutted: pre-existing behavior on main, not touched by this diff; out of this PR's goal. Left as-is.

@bolichen97
bolichen97 requested a review from buluoray October 28, 2026 03:04
@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 Oct 28, 2026

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

🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:

Approving at c61fbb138b. This supersedes my changes-requested review at 23af7f2785.

The blocking item is fixed: acp-client.md now lists the four issue-radar-* key shapes, their folder form (/ and : become _, # kept), the [A-Za-z0-9._-] segment limit, and that they are reclaimable on both walks. Compared against the earlier head, the code and test changes are identical; only the spec was added. My earlier deletion-safety check therefore still holds. CI: 93 pass, 16 skipped, 0 failed.

@bolichen97
bolichen97 merged commit 363057b into main Oct 28, 2026
110 checks passed
@bolichen97
bolichen97 deleted the fix/issue-radar-run-dirs-23880 branch October 28, 2026 04:33
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 28, 2026
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.

fix(session): reclaim issue-radar one-run work directories

2 participants