Skip to content

fix(meetings): finish a meeting delete a held file interrupted - #32190

Merged
bolichen97 merged 1 commit into
mainfrom
fix/27832-meeting-delete-held-file
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/27832-meeting-delete-held-file

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Deleting a meeting on Windows while another program holds one of its files open finishes the delete, or fails in a way that a second delete completes.

On Windows, a meeting delete contended by a held file half-deletes the meeting, and a retry answers not found. delete_meeting removed the session directory first with a bare shutil.rmtree; a file held without FILE_SHARE_DELETE stopped it partway, after session.json (the existence marker) was already gone. The retry then returned False, the route answered 404 meeting_not_found, and the transcript, edits or note stayed on disk.

Why it matters

A user who deletes a meeting while an editor, indexer or antivirus scan has its transcript or note open cannot finish the delete from the product, and the private transcript text stays on disk out of the delete route's reach.

Not a goal

What changed (motivation → approach → change)

On Windows a held file no longer fails a meeting delete if it is let go within about three seconds. A longer hold gets an error naming the file, and deleting again after the program lets go finishes. POSIX is unchanged.

Part Change
delete_meeting (meetings store.py) removes the edits and note sidecars, then every entry of the meeting folder except session.json, then session.json and the folder. Any failure leaves session.json, so a retry finds the meeting. A held file that outlasts the wait answers 500 meeting_delete_failed with the file name, as JSON the dashboard can show
remove_with_retry in src/kiro_crew/platform_compat_files.py, forwarded by src/kiro_crew/platform_compat.py the retry loop app uninstall already had, moved here so both deletes share it: winerror 32/33, 15 attempts x 0.2 s, no sleep on an event-loop thread, the final error names the held file plus the caller's hint. A link or junction is unlinked, never followed
manager_uninstall._rmtree_app_dir calls the shared helper with its own hint; its error text is byte-identical

Containment, the link refusal and meta_transaction() in delete_meeting stay as they are. Specs platform-compat.md (helper table) and meetings.md (delete paragraph) describe the new behaviour.

Backwards compatibility

Compatible: every delete that succeeds today succeeds the same way; a held file that used to fail at once now waits first, and the meeting route answers JSON instead of a bare 500.

Reader: src/kiro_crew/apps/manager.py:_RMTREE_MAX_ATTEMPTS -- app -- the three uninstall retry constants leave the manager facade and live in platform_compat_files; the only reader, test/test_app_manager.py, reads them there

Tests

  • test/test_meetings_store.py: test_delete_waits_out_a_file_held_open_briefly (one sharing violation on transcript.jsonl, the delete returns True and every tree is gone) and test_delete_held_past_the_budget_keeps_the_marker_for_a_retry (violation on every attempt: 500 meeting_delete_failed naming the file, session.json survives, a later delete returns True). Both fail with the old delete_meeting body. test_delete_unlinks_a_directory_link_inside_the_meeting_without_following_it pins that a link inside the meeting is removed and its target kept (a symlink on POSIX, a junction on Windows).
  • test/test_app_manager.py uninstall retry tests patch the moved constants; assertions unchanged. test/test_manager_uninstall.py unchanged and green.
  • test/test_platform_compat_refactor_facade.py lists the helper and its constants; test/link_screen_sites.py records remove_with_retry as a site that unlinks a link and never traverses one.
  • Determinism: test/test_meetings_store.py run 10 times, each in a fresh shuffled order, 73 of 73 every run.

Proof: PROVEN test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_files-_SHARING_VIOLATION_WINERRORS], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_files-_RMTREE_MAX_ATTEMPTS], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_files-_RMTREE_BACKOFF_SECONDS], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_defined_by_its_owner_and_read_through_the_facade[kiro_crew.platform_compat_files-remove_with_retry], test/test_platform_compat_refactor_facade.py::test_every_moved_name_is_forwarded_unless_code_still_here_reads_it (head 9618255)

Manual verification

Native Windows 11, a scratch KIROCREW_HOME, one meeting with session.json, transcript.jsonl, an edits sidecar and a note. A second process holds one file with open(..., "rb").

Held file Before: first call Before: retry After: first call After: retry
transcript.jsonl, 1 s WinError 32; marker gone, all 3 trees left False True in 1.0 s, nothing left n/a
note.md, 1 s WinError 32; note tree left False True in 1.0 s, nothing left n/a
transcript.jsonl, 10 s WinError 32; marker gone, all 3 trees left False meeting_delete_failed naming the file after 2.8 s; session.json kept True, nothing left
none True n/a True n/a

The issue's portable script prints FAIL: marker deleted, rest of tree stranded on this host.

Related Issues

Closes #27832
Refs #24889

Sibling sweep

Swept: git grep -nE "shutil.rmtree(" -- src/kiro_crew/apps src/kiro_crew/appearance_packs
Sibling: src/kiro_crew/apps/builtins/meetings/backend/store.py -- changed here
Sibling: src/kiro_crew/apps/manager_uninstall.py -- changed here
Sibling: src/kiro_crew/apps/builtins/code_review_sage/sage_lib/store.py -- tracked in #32171
Sibling: src/kiro_crew/apps/builtins/code_review_sage/sage_lib/learning.py -- tracked in #32171
Sibling: src/kiro_crew/appearance_packs/store.py -- tracked in #32171
Sibling: src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py -- not affected -- an engine-asset move that #15394 rewrites

Pattern harvest

Not generalizable: whether a delete must keep an existence marker until last depends on what each store treats as "exists", which a rule cannot see; the retry itself is now one shared helper.

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 7, 2026 07:35
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 19e4f65118b63ca2fc0f40e3a5b28d791317f2cd 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 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. Keeping session.json until last turns a half-finished delete into one a retry can complete. That fixes the cause of the stranded files. Sharing the retry helper with app uninstall removes a second copy of the same loop.

Notes

  • During the up-to-three-second retry, the delete still holds meta_transaction() and task_mutation_transaction(). Any meta write or task mutation that arrives meanwhile has to wait. That cost can be undone later, but the specs should say it is accepted.

[DESIGN-REVIEWED] 19e4f65

Description read

[DESCRIPTION-READ] 503e7aafa06c06a5473254518d1acd6739205bf0ff3374462df81703384977f0

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 19e4f65118b63ca2fc0f40e3a5b28d791317f2cd — 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 works on the cause: session.json is removed last, so a failed delete stays findable. The retry loop is moved out of app uninstall rather than written a second time. The other bare-rmtree deletes are deferred to #32171.

Not checked: Windows winerror 32/33 behaviour while a file is held (the manual run on Windows 11 is claimed, not something I could read).

What this change ships

Inventory (6 items) — 6 justified

Intent: let a user finish deleting a meeting on Windows when another program holds one of its files open. FIX.

  1. A meeting delete on Windows now waits about 3 s for a held file to be released before failing. — justified
  2. A failed delete keeps session.json, so deleting again finishes instead of answering 404. — justified
  3. A hold that outlasts the wait returns 500 meeting_delete_failed, naming the held file. — justified
  4. A link or junction inside a meeting folder is unlinked, and its target is left alone. — justified
  5. App uninstall and meeting delete share one retry helper, remove_with_retry, in platform_compat. It has 2 consumers. — justified
  6. The uninstall retry constants move from manager_uninstall to platform_compat_files, and the uninstall error text stays the same. — justified

[FIRST-PRINCIPLES-REVIEWED] 19e4f65

Description read

[DESCRIPTION-READ] 2203d9fc00fddd12439aa5165eeaddf90acc30ff2a34e985c0c458bb15a0dc83

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 19e4f65

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

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

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 19e4f65

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 07:43
@bolichen97
bolichen97 force-pushed the fix/27832-meeting-delete-held-file branch 2 times, most recently from 8cb1e00 to daff96e Compare November 7, 2026 08:12
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/*.md and src/kiro_crew/acp/skill_projection.py (plus 22 more overlapping by directory or import) since this head went green (b65af1a -> 0795ebc); CI re-running. [operator: bolichen97] The same push removes a link or junction inside a meeting through the existing unlink_link_or_junction helper (GPT 6.1 finding on 347fd32), with a junction test on Windows.

@bolichen97
bolichen97 force-pushed the fix/27832-meeting-delete-held-file branch from daff96e to 9618255 Compare November 7, 2026 08:53
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget is red on main too (this PR does not touch src/kiro_crew/security_gate); #32183 raises the budget. This PR waits for it and rebases once it merges.

@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 7, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in test/test_security_gate_liveness.py (#31625 raised the security package line budget; #32183 closed unmerged) and same-directory spec docs since this head ran (0795ebc -> bab2387). CI re-running. [operator: bolichen97]

@bolichen97
bolichen97 force-pushed the fix/27832-meeting-delete-held-file branch from 9618255 to 19e4f65 Compare November 7, 2026 12:25
@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

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: fix (11 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: meeting delete and app uninstall retry a Windows file another program holds open (#27832). Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/common/platform-compat.md, docs/system-specs/modules/meetings.md.

@bolichen97
bolichen97 merged commit e28abd2 into main Nov 7, 2026
97 of 98 checks passed
@bolichen97
bolichen97 deleted the fix/27832-meeting-delete-held-file branch November 7, 2026 14:06
buluoray added a commit that referenced this pull request Nov 8, 2026
(cherry picked from commit e28abd2)

Original author: Bolin Chen (#32190). test/link_screen_sites.py hand-resolved: added only this PR's remove_with_retry row; the neighbouring PinnedDirectory.is_link row belongs to a main change not on release.
bolichen97 added a commit that referenced this pull request Nov 10, 2026
On Windows, deleting a custom appearance pack while another program
held one of its files open (an editor, an indexer, an antivirus scan)
failed with WinError 32 and left a half-deleted pack behind. The delete
now goes through platform_compat.remove_with_retry, which waits out the
sharing violation for about three seconds, the same helper the meeting
delete uses since #32190.

Where shutil.rmtree walks a folder by path (Windows), the pack's
entries are removed one at a time with manifest.json last, so a hold
that outlasts the wait leaves the pack listed and a second delete
finishes it. Everywhere else the delete stays one shutil.rmtree call,
which removes through the folder it opened. The platform-compat helper
table names the pack delete among its callers.

Part of #32171
bolichen97 added a commit that referenced this pull request Nov 11, 2026
On Windows, deleting a custom appearance pack while another program
held one of its files open (an editor, an indexer, an antivirus scan)
failed with WinError 32 and left a half-deleted pack behind. The delete
now goes through platform_compat.remove_with_retry, which waits out the
sharing violation for about three seconds, the same helper the meeting
delete uses since #32190.

Where shutil.rmtree walks a folder by path (Windows), the pack's
entries are removed one at a time with manifest.json last, so a hold
that outlasts the wait leaves the pack listed and a second delete
finishes it. Everywhere else the delete stays one shutil.rmtree call,
which removes through the folder it opened. The platform-compat helper
table names the pack delete among its callers.

Part of #32171
bolichen97 added a commit that referenced this pull request Nov 11, 2026
On Windows, deleting a custom appearance pack while another program
held one of its files open (an editor, an indexer, an antivirus scan)
failed with WinError 32 and left a half-deleted pack behind. The delete
now goes through platform_compat.remove_with_retry, which waits out the
sharing violation for about three seconds, the same helper the meeting
delete uses since #32190.

Where shutil.rmtree walks a folder by path (Windows), the pack's
entries are removed one at a time with manifest.json last, so a hold
that outlasts the wait leaves the pack listed and a second delete
finishes it. Everywhere else the delete stays one shutil.rmtree call,
which removes through the folder it opened. The platform-compat helper
table names the pack delete among its callers.

Part of #32171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:windows readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

2 participants