Skip to content

test(app-route-trust-gate): seed transcripts off the event loop - #19711

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
test/trust-gate-seed-off-loop
Oct 13, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
test/trust-gate-seed-off-loop

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The app-route trust-gate tests stop going red on Windows when a scanner briefly holds a freshly written transcript temp file.

test_app_catalog_does_not_return_metadata_from_a_foreign_incarnation[query1] failed on Windows shard 4 on a PR that touched none of its code: its seed write failed with PermissionError: [WinError 5] Access is denied: '...\tmp….tmp' -> '...\dashboard_plain-chat.jsonl' inside replace_with_retry.

Why it matters

Each red lands on whichever PR shares the shard and costs a rerun. Most async tests in this file seed the same way, so any of them can take the same hit.

Not a goal

  • No production change: replace_with_retry keeps re-raising on the event-loop thread on purpose (it must not sleep the gateway loop).
  • No new shared helper: the fix uses the existing test/off_loop_helpers.off_loop.

What changed (motivation → approach → change)

Symptom → cause. The test's _transcript seed helper ran on the event-loop thread of an async test. There, replace_with_retry re-raises a Windows sharing violation on the first attempt instead of retrying, so a scanner touching the new temp file for an instant failed the seed. This is the same class #17828 fixed in test_telegram_sessions.py.

Change. _transcript in test/test_app_route_trust_gate.py now runs its writes on a worker thread through off_loop, like the dashboard handlers reach the store. Every caller in the file gets the bounded Windows retry, including the ones already wrapped in asyncio.to_thread. A new test pins that the seed's atomic replaces never run on the loop thread.

Backwards compatibility

Compatible: test-only change; no production code or contract is touched.

Removes nothing: the seed helper writes the same transcript, only from another thread.

Tests

  • test_transcript_seed_replaces_files_off_the_event_loop: records whether each os.replace the seed makes runs with a running event loop, and asserts at least one replace happened and none was on the loop. Red with _transcript calling the writer directly (the parent's shape), green with off_loop.
  • Determinism: the new test passed 20/20 at -n0; the whole file passed 10/10 at -n 4 and once in a shuffled order (seed 19561), 68 passed.

Manual verification

N/A — unit coverage sufficient: the Windows sharing violation itself cannot be reproduced on Linux, so the pin asserts the property that gives the retry (the write runs off the loop).

Related Issues

Fixes #19561

Pattern harvest

Rule candidate: semgrep
Pattern: an async def test calling a sync store writer that ends in replace_with_retry directly on the loop thread.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 13, 2026 06:09
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision df027d6ea079b5fc97581d7cbdd1a3435f2a540f ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of df027d6ea079b5fc97581d7cbdd1a3435f2a540f — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] df027d6

Description read

[DESCRIPTION-READ] 55ae0d8bb60b839e2db8b833408ae4dca3e60d41249202d42b786063a4635cbf

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] df027d6

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable df027d6ea079b5fc97581d7cbdd1a3435f2a540f: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] df027d6

False positive or not applicable? A repository writer can comment:
/ai-review override gpt df027d6ea079b5fc97581d7cbdd1a3435f2a540f: <one-sentence reason>

@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 13, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Backend Tests (Windows) (6) failure is not caused by this PR.

The one failing test is test/test_mcp_gateway_wedge_ping_gate.py::test_unknown_notification_silently_ignored (the tools/call with id 7 got no response). This PR does not touch src/kiro_crew/mcp_shared.py or any MCP code.

Evidence:

Re-ran the failed jobs.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 13, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 13, 2026 09:05

@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: test (1 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: test-only change that seeds transcripts on a worker thread and adds a test that pins the atomic replace off the event loop.

@KiroCrewCaptain
KiroCrewCaptain merged commit b1d42ad into main Oct 13, 2026
147 of 148 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the test/trust-gate-seed-off-loop branch October 13, 2026 09:06
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 13, 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.

Flaky: test_app_catalog_does_not_return_metadata_from_a_foreign_incarnation (test_app_route_trust_gate) on Windows

2 participants