Skip to content

v1.91.297.0 fix(browse): read Windows process start times in-process so the terminal agent boots without PowerShell (GSTA-139 flaky pass) - #3545

Merged
capy-ai[bot] merged 5 commits into
mainfrom
flaky-2026-10-28-windows
Oct 28, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
flaky-2026-10-28-windows

Conversation

@garrytan

@garrytan garrytan commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3545,
  "head": "20d77073143ee8cd9148282a221617e24aa74925",
  "version": "1.91.294.0",
  "base": "main",
  "gate": {
    "remote_gate": {
      "pass": 12909,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "pregate": "requires-remote cleared @44fb1d5a19a2 (1 checks, current for 20d77073143e)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/40704571615",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/40704571615",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/40704565417",
    "pregate.json/remote_gate: remote-gate tree=44fb1d5a19a2 tests=12909"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "base 4b8c03b to head 20d77073: browse/src/terminal-agent-control.ts, three browse test files, CHANGELOG.md; all authored docs keyword-searched, relevant ones read"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 2,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 2,
    "dispatches": {
      "specialist": 1,
      "red-team": 1
    }
  }
}

What changed

Windows terminal-agent boot: the owner identity read moved from two PowerShell spawns to in-process GetProcessTimes, so boot fits the 5 s watchdog window

Windows terminal-agent boot: the owner identity read moved from two PowerShell spawns to in-process GetProcessTimes, so boot fits the 5 s watchdog window.

Before/after as text: Windows terminal-agent boot: the owner identity read moved from two PowerShell spawns to in-process GetProcessTimes, so boot fits the 5 s watchdog window
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+windows-latest, terminal agent boot (owner -> pid file), 3 jobs x 40 boots
+branch flaky-2026-10-28-windows, probe run 40700055293
+  p50 859 ms  p95 1033 ms  max 1038 ms  outcomes {"pid<=5s,alive":40}
+  p50 897 ms  p95 1030 ms  max 1120 ms  outcomes {"pid<=5s,alive":40}
+  p50 911 ms  p95 1150 ms  max 1177 ms  outcomes {"pid<=5s,alive":40}
+in-process GetProcessTimes: 0 ms, equals PowerShell CreationDate 147/147
-windows-latest, terminal agent boot (owner -> pid file), 2 jobs x 40 boots
-base 4b8c03b, probe run 40697033633
-  p50 2426 ms  p95 3124 ms  max 5095 ms  outcomes {"pid>5s,alive":1,"pid<=5s,alive":39}
-  p50 2826 ms  p95 3939 ms  max 5083 ms  outcomes {"pid>5s,alive":1,"pid<=5s,alive":39}
-PowerShell identity probe: p50 0.93 s, max 10.8 s
 

Why

The daily flaky pass (GSTA-139) found terminal-agent-owner-watchdog.test.ts red on Windows because "terminal-agent-pid never appeared in 5 s", and path-security-realpath.test.ts stalled for 30 s and then reported "8.3 short names are disabled". Both waited on a powershell.exe launch that took 0.93 s at the median and up to 10.8 s on windows-latest. The agent now reads its Windows start time in-process, so it boots in about 0.9 s, and the test builds its 8.3 alias with GetShortPathNameW.

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-28 S5 Windows terminal-agent fix: option A (edit terminal-agent-control.ts and process-liveness-windows.test.ts) “A, with three conditions” (GSTA-139 parent lane (GStack Minder crew)) approved Windows only; no open PR touches the two files; test 5 replaced by FFI path test plus kill-time command-line test; legacy start-time records safe with a test none
2026-10-28 S5 dispositions for the remaining flaky entries “macOS lifecycle stays Open with your diagnosis. Everything else as you decided.” (GSTA-139 parent lane (GStack Minder crew)) approved path-security FFI repair, cookie-import-native-job diagnostics, Open for cookie-auth, land-and-deploy, qa-probe, team-init, cookie-picker, cookie-import-native, gstack-doctor, macOS lifecycle none
2026-10-19 Daily flaky-test fix pass “we should have a flaky test fix pass every day that tries to fix flaky tests” (Garry) standing approval daily flaky pass lanes none

Source: gstack-approvals record for flaky-2026-10-28-windows (display only; not an approval citation).

Summary

Under Bun, browse/src/terminal-agent-control.ts reads a Windows process start time through OpenProcess and GetProcessTimes. It writes the result in the /Date(<ms>)/ format that PowerShell's CreationDate gives, and the two matched on 147 of 147 processes. The Node daemon (server-node.mjs) cannot load bun:ffi, so it keeps the PowerShell reader through a lazy require. The kill-time check still reads the command line through PowerShell and stops a process only when it carries the record's --agent-gen.

Two flaky entries are fixed at their cause (the Windows owner watchdog and the path-security alias). One gets diagnostics: cookie-import-native-job now prints the Restart Manager receipt when its owner assertion fails. Eight stay Open with diagnoses in the ledger: cookie-auth (the 400 ms budget is the limiter), team-init PowerShell, land-and-deploy (about 2 s per bash+jq dispatch), qa-probe EBUSY (not reproduced in 50 tries), cookie-picker ENOBUFS (one event), cookie-import-native (no log), macOS terminal-agent-lifecycle (ps -o lstart= with a 2 s timeout) and gstack-doctor EBUSY (open PR #3273 owns that file).

Test 5 in process-liveness-windows.test.ts changed. It was an implementation-coupled expectation that moved along with the product. On Windows it expected the PowerShell mock's fixture-owner-start as the owner start time. It now requires the in-process value, equality with a real read, and no PowerShell query naming the owner pid. Linux and macOS keep the old assertion, and a separate test still pins the PowerShell command-line check at kill time. The file went from 7 tests to 14.

Blast radius

Agent records written by earlier releases and by the Node daemon still compare, because the start time keeps the same /Date(<ms>)/ format: 147 of 147 in-process reads equalled PowerShell's CreationDate on windows-latest (script ran, probe 40700055293). If the two readers ever disagree, for example across a time-zone change, a live process that carries the record's --agent-gen is still the agent. One whose command line cannot be read is unknown. Every caller treats unknown as hands-off. Nothing is signalled, the discovery files stay, and a second agent is refused (walked failure path, reviewer read of killAgentByRecord, stopAgentByRecord, spawnTerminalAgent and server.ts teardown; tests for each). Linux and macOS behaviour is unchanged.

Test Coverage

All new code paths have test coverage. process-liveness-windows.test.ts covers the in-process reader, the Node fallback, the kill-time command-line check, a reader disagreement identified by generation, and the unknown path (never signalled, never gone). Two Windows-only cases run against real processes: the in-process value equals CreationDate, and a live agent whose identity cannot be read blocks a second one. The disagreement test was failing-first: it fails on the old reader with Received "".

Tests: 7 → 14 in browse/test/process-liveness-windows.test.ts (+7 new).

Tests ran: Windows Free Tests 6 of 6 shards green at 20d7707 (run 40704565417), all seven win32 terminal-agent identity (GSTA-139) cases passed in shard 3. Free Tests green at 20d7707 (run 40704571615): 21 suite shards, typecheck, macOS named regressions and CSO launchers.

Pre-Landing Review

REVIEW_LOOP: passes=1 blocking_found=1 deferred=0 noted=2 fixed=3 scope=frozen fix_checks=2 dispatches=2

Gate edits: test 5 in browse/test/process-liveness-windows.test.ts was changed (Windows branch only), kept as an implementation-coupled expectation that moved with the product, per the option A approval above.

One CRITICAL in pass 1, fixed: test 5's zero-PowerShell assertion also counted the fallback query for the fake child pid (Windows Free Tests 40699973746). Scoped to the owner in c397b4c.

Review notes

These are informational findings below the blocking floor, listed rather than looped:

  • terminal-agent-control.ts agentProcessInfo still launches PowerShell when the in-process start time already mismatches the record (specialist, confidence 6). This costs about 1 s on a stale record and does not affect correctness.
  • A win32 mismatch with an empty command line is unknown. That also covers a successful query whose CommandLine is null, which happens for an elevated process that reused a dead agent's pid. The terminal pane then stays down until that process exits (adversarial fix-check, confidence 5). It fails safe: nothing is killed and no second agent starts.
  • Pregate stage 1 warned 3 MEDIUM pii.phone.e164 matches: numeric pid and /Date(...)/ literals in the tests. Warn only.
  • Windows Free Tests 40702347594 at caa404d was red: terminal-agent-watchdog.test.ts test 3 pins the zombie check before return actual.commandLine.split. 20d7707 restores that shape without changing behaviour.

Exploratory QA

Windows probes on a scratch branch measured each entry before the change (run 40697033633) and the agent boot after it (run 40700055293). 120 of 120 boots finished inside the 5 s window, compared with 78 of 80 before.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

TODOS

No TODO items completed in this PR.

Documentation

Status: current. No documentation changes were needed.

Scope: base 4b8c03b to head caa404d (3 commits). It covers browse/src/terminal-agent-control.ts (the Windows start time is read in-process through GetProcessTimes under Bun and through PowerShell under Node, with the same /Date(ms)/ value; on win32 a start-time mismatch counts as the agent when the command line carries the record's --agent-gen, and as unknown when the command line cannot be read), three browse test files and CHANGELOG. There were no staged, unstaged or untracked changes. All authored docs were checked by keyword search, and the relevant ones were read.

Documentation health:

  • docs/BROWSER_INTERNALS.md: Current. Teardown keeps the discovery files when identity is uncertain, which is consistent with the new win32 unknown result.
  • BROWSER.md: Current. The terminal agent row and the process-identity reap text are unaffected.
  • docs/troubleshooting.md: Current. Nothing documents the PowerShell identity probe.
  • docs/TESTING_INTERNALS.md: Current.
  • TODOS.md: Current. The historical v1.44 entry was not changed.
  • CHANGELOG.md: Current. Owned by /ship and not audited for voice in this mode.
  • README.md, CLAUDE.md, ARCHITECTURE.md: Current. BROWSER_INTERNALS is reachable from CLAUDE.md.

Coverage: all shipped features have adequate documentation. The change is an internal identity fix, and its only new export is a test seam. Diagram drift: none.

Test plan

  • bun test over every terminal-agent test plus process-liveness, path-security and cookie-import-native-job (24 files): no failures on Linux
  • Remote pregate (Ubicloud, us-east-a2) at tree 44fb1d5a19a2: 12909 pass, 0 fail across 403 files
  • bun run typecheck: clean
  • Windows Free Tests 40704565417 at 20d7707: 6 of 6 shards green
  • Free Tests 40704571615 at 20d7707: green
  • Windows probe 40700055293: 120 of 120 agent boots inside 5 s; in-process start time equals CreationDate 147 of 147

🤖 Generated with Claude Code

garrytan and others added 4 commits October 28, 2026 13:49
…hell from two flaky test paths (GSTA-139 S5)

The terminal agent's identity probe launched powershell.exe Get-CimInstance
with a 2 s timeout on every boot (twice when started standalone). On loaded
Windows runners a launch takes ~0.94 s at p50 and up to 10.8 s, so the agent
missed the watchdog test's 5 s window and a stalled launch returned an empty
identity. Under Bun the start time now comes from GetProcessTimes in the
same /Date(ms)/ form PowerShell's CreationDate serialises to, so records,
the Node daemon (which keeps the PowerShell reader) and earlier releases
agree. The kill-time command-line check still uses PowerShell.

path-security-realpath builds its 8.3 alias with GetShortPathNameW instead
of a PowerShell launch that stalled for 30 s and was reported as '8.3
disabled'. cookie-import-native-job prints the Restart Manager receipt when
its owner assertion fails.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…fy a win32 agent by generation when readers disagree

Review of d4f0ea3 (specialist + outside voice, confirmed by Windows Free
Tests 40699973746 shard 3): test 5's fake child pid cannot be opened, so its
start time falls back to the PowerShell query; only the owner must skip it.
Adversarial note: the Bun reader and the Node daemon's PowerShell reader can
disagree for a process created in a DST-ambiguous hour; on win32 a live
process carrying the record's --agent-gen is still the agent, so it is
stopped, never treated as gone beside a second agent.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ine is unknown, not gone

Fix-check (adversarial reviewer): when the Bun reader and a Node-written
record disagree and the PowerShell command-line query also fails, the agent
was read as gone and a second agent could start beside it. Base treated a
failed query as unknown; this restores that. CHANGELOG [Unreleased] entry.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…turn (terminal-agent-watchdog source pin)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Evals: ✅ PASS

[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 3/3 · behavior 0/0 · judge 1/1 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 0m43s · cost $0.17 known + 3 of 4 trial(s) cost unknown

3 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $.17 rule/judge cost | reconcile exit: 0

Profile: pr / mode pr; selected behaviors: 3, judges: 1. Deferred to scheduled/release coverage: 14 behaviors and 0 changed prompt files. Deferred checks did not run and receive no PR-pass credit.

Rule and judge shards
Shard Automated result Manual/unscored Executed Reused Status Cost
llm-judge/skill-llm-eval 1/1 0 1 0 ✅ $0.06
e2e-browse/skill-e2e-bws 2/2 0 2 0 ✅ $0.11
Fail-closed reconciliation
[test:paid] report: 1/1 slices, 3 planned shards, tier=gate, attempt 1
[test:paid] coverage: profile=pr mode=pr; selected E2E=3, judges=1
[test:paid] deferred: 14 broad behaviors, 0 changed prompts without quick live coverage; these are not PR passes
  slice 1  passed             21s  test/skill-llm-eval.test.ts
  slice 1  passed             29s  test/skill-e2e-bws.test.ts
  slice 1  passed             17s  test/skill-e2e-diagram.test.ts
[test:paid] collector final outcomes: 3 executed, 0 reused; 3 passed, 0 failed, 0 manual accepted (unscored; no score-cache credit) (3 attempt records from 2 collectors; every record counts)
[test:paid] deselected testcases, zero credit (28):
[test:paid]     27  outside the run's case selection
[test:paid]      1  periodic-tier case (this lane runs gate)
[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 3/3 · behavior 0/0 · judge 1/1 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 0m43s · cost $0.17 known + 3 of 4 trial(s) cost unknown
[test:paid] exercised-path map (shadow, non-blocking): 0 MAP_GAP line(s) over 2 executed case(s) with recorded commands
[test:paid] report: every planned shard accounted and passed

Sliced lane: planner → duration-packed executors → fail-closed report. Behavior cases run a pre-registered 3-trial panel (PASS at 2/3 with no contract violation); a PASS 2/3 is shown with its failed trial, never as a clean pass. Reused results retain their original provenance and expiry.

Dispatched narrow screen (gstack-ship-queue ready --screen) of merge commit 91340d426095a024b659784949e23f05a383fa29.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title fix(browse): read Windows process start times in-process so the terminal agent boots without PowerShell (GSTA-139 flaky pass) v1.91.297.0 fix(browse): read Windows process start times in-process so the terminal agent boots without PowerShell (GSTA-139 flaky pass) Oct 28, 2026
@capy-ai
capy-ai Bot merged commit fb30ed1 into main Oct 28, 2026
62 checks passed
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.

1 participant