Repository navigation
fix: tighten a diagnostic file read check on windows - #36662
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This is a narrow fix that reuses the existing Notes
What this change shipsInventory (3 items) — 2 justifiedIntent: on Windows, the gateway's crash-diagnostics read refuses a link planted at a dump's name, as it already does on Linux and macOS. FIX.
[FIRST-PRINCIPLES-REVIEWED] df67835 Description read[DESCRIPTION-READ] 5f13e10ddc23e0ee6085daa1e641700e93f6ef47c089b71afaa663c5a4e50017 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the read now goes through the existing named helper for this refusal, Linux and macOS make the same call as before, and the Windows descriptor is still opened in binary mode. [DESIGN-REVIEWED] df67835 Description read[DESCRIPTION-READ] aef499ad4f8029333a1d4cbc7ed917063c5973a67f9547564657b12645bec59f 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: |
Code change approver recommendation: ApproveWhy: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. One-line swap of a hand-rolled os.open(O_NOFOLLOW|O_NONBLOCK) for the existing platform_compat.open_file_no_reparse(nonblocking=True, links_only=True). On POSIX the flags are identical to before (O_BINARY is 0 there). On Windows the helper opens the name itself without following it, in binary mode, refusing a symlink or junction with ELOOP; links_only lets files with cloud or dedup tags still open, and read/write sharing is unchanged, so a live writer doesn't conflict. Every caller catches OSError in general, so the refusal takes the documented 'leave alone' path. New symlink test pins the refusal and the empty output of both public readers, and runs on Windows where links can be created. CI failures (goal_plan parity test, Playwright/auto-improvement timeouts, coverage gate fed by those shards) are unrelated to this change. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
|
Review passed on this head. Please rebase onto the latest main so CI can run fresh; the current CI run predates fixes on main and cannot go green as is. The approval will follow once the rebased head is green. |
On Windows the gateway's reads of its own crash diagnostics did not refuse, at the name they open, what their comments say they refuse there, as they already do on Linux and macOS. The read now makes that refusal in the open itself. Linux and macOS make the same call as before. Part of #9731
|
Rebased: main moved in src/kiro_crew/dashboard/crash_dump_store.py (#36890) and in test/test_mate_conductor_parity.py (the red-main fix #36652, which clears the red Backend Tests (3.12, 3) and Backend Tests (Windows) (3) checks on the old head) since this head's CI ran (c22557c -> 8beb3f2); CI re-running. This is the rebase onto the latest main asked for above; the change itself is the same patch. The old head's red Backend Tests (3.12, 7) were timeouts in built-in app tests this change does not touch; they re-run on the new head. [operator: bolichen97] |
ce4ce05 to
df67835
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
I reviewed head df67835. On Linux and macOS the dump read uses the same flags as before (no-follow, non-blocking, read-only), so nothing changes there. On Windows it now goes through the shared no-reparse helper. That helper opens a link or junction at the dump name as itself and refuses it, keeps binary mode and the earlier sharing rules, and still lets cloud or dedup tagged regular files open. Every caller already handles the refusal as an OSError and leaves the file alone. The related crash dump test files pass locally, the new test checks both the refusal and that nothing from the link target is shown, and no CI check on this head is failing or pending.
Problem / Motivation
Goal: On Windows, the gateway's read of its own crash diagnostics refuses what its documentation says it refuses at the name it opens, as it already does on Linux and macOS.
Part of the class of cases tracked in #9731: that issue already describes, in public, how a read can keep its documented refusal on Linux and macOS and lose it on Windows. This PR closes one more of those cases.
Why it matters
The gateway reads these files at startup and on demand, from a folder an agent can write to, and shows what it read in the doctor output, the gateway log and a debug view. On Windows the refusal its documentation promises at that name could be skipped, so the gateway could read and show a file that is not one of its diagnostics, and no test pinned it on Windows.
Not a goal
What changed (motivation → approach → change)
On Windows, the doctor output, the gateway log and the debug view now show only the gateway's own crash diagnostics, never another file that a diagnostics name points to, as on Linux and macOS. The read behind all three did not reliably make the refusal its documentation promises at the name it opens; it now refuses exactly that, as the cases in #34484 and #35684 do, and nothing else, and its documentation says what holds on each system. Linux and macOS make the same call as before. A new test in
testpins the refusal and runs on Windows hosts that can create links. The code change is insrc/kiro_crew/dashboard.Backwards compatibility
Compatible: Linux and macOS make the same call as before. On Windows the only difference is that what the read documents as refused is refused, and every caller already treats a refused read as "leave the file alone": nothing is shown for it, and the startup cleanup sets it aside as it does on Linux.
Removes nothing: no caller, key or field changes.
Tests
One new test checks that a diagnostics name that is not a plain diagnostics file is refused by the read and that nothing of it is shown, after first checking that the same content as a plain file would be shown. Linux and macOS run it too, where the read already refused. On Windows it runs wherever the host can create links and is skipped where it cannot.
Proof: not provable -- other: the changed read differs only on Windows and prove.py runs on a Linux host, where it already refused; CI's Windows shards run the test where they can create links
Determinism: the new test passed 20 runs in fresh processes, both with and without a simulation of the Windows behaviour of this read; the two crash-diagnostics test files (82 tests) passed in a shuffled order (seed 692216923). With the simulation, the new test fails on the unchanged code (
DID NOT RAISE) and passes with this change.Manual verification
Reproduced and smoke-tested on Linux (Ubuntu, Python 3.12), simulating the Windows behaviour of this read and driving the real dump reader behind the debug view against an isolated data home:
SENTINEL PRESENT: True).FileNotFoundError: no readable dump content), with and without the simulation, and a real crash dump still reads its stack frames.The Windows branch of the shared helper itself runs on CI's Windows shards wherever their runner can create links.
Screenshots / video
N/A — no user-visible change.
Related Issues
Part of #9731
Sibling sweep
Swept: the same read shape across the codebase, on main @ 8beb3f2.
Siblings: tracked in #9731 -- each remaining case needs its own check that it is reachable on Windows.
Pattern harvest
Not generalizable: a single repository-wide rule for this class was tried and closed in #17557 because it changed no runtime behaviour, so the class is being closed one reachable case at a time under #9731.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Submitted under the project's Apache-2.0 license.