Skip to content

fix: tighten a diagnostic file read check on windows - #36662

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/9731-windows-read-check-4
Nov 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/9731-windows-read-check-4

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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

  • The other cases listed in Gate the O_NOFOLLOW-on-Windows no-op: 88 sites, 24 convertible today #9731, including the other read in the same module, whose documentation already says what holds on Windows. The issue stays open for them.
  • Any change on Linux or macOS: the read there makes the same call as before.
  • Any refusal beyond the one the read already documents, and anything about the folders above the name it opens.

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 test pins the refusal and runs on Windows hosts that can create links. The code change is in src/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:

  • Before: the debug view's dump read returned the other file's content (SENTINEL PRESENT: True).
  • After: the same read is refused (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

  • 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

Contribution License Agreement

Submitted under the project's Apache-2.0 license.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 13, 2026 14:29
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision df67835b770a6e4f1bc0395a7f56749c9cae494c 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 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of df67835b770a6e4f1bc0395a7f56749c9cae494c — 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 is a narrow fix that reuses the existing platform_compat.open_file_no_reparse helper. The siblings it leaves unfixed are declared and deferred to #9731.

Notes

What this change ships

Inventory (3 items) — 2 justified

Intent: 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.

  1. On Windows, a loopstall-*.txt link to another file is no longer read or shown in doctor output, the gateway log or the debug view — symptom-level: 160 files still open-code the flag, deferred to Gate the O_NOFOLLOW-on-Windows no-op: 88 sites, 24 convertible today #9731
  2. The dump-read docstring now says what holds on each OS — justified
  3. A new test pins the refusal wherever the host can create links — justified

[FIRST-PRINCIPLES-REVIEWED] df67835

Description read

[DESCRIPTION-READ] 5f13e10ddc23e0ee6085daa1e641700e93f6ef47c089b71afaa663c5a4e50017

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] df67835

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

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

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] df67835

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 13, 2026 14:51
@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 13, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: 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 ce4ce053bc · 60 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@buluoray

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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]

@bolichen97
bolichen97 force-pushed the fix/9731-windows-read-check-4 branch from ce4ce05 to df67835 Compare November 17, 2026 11:31
@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 17, 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.

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit 3f13f57 into main Nov 17, 2026
98 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/9731-windows-read-check-4 branch November 17, 2026 12:51
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 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.

3 participants