Repository navigation
fix(agent-session): read lstart in UTC, and fix the stale link-placement reds - #268
Merged
Merged
Conversation
…ent reds The unit gate is red on main for six cases, none of them in a file #265 touched, so its own suite never saw them. Five are stale placement assertions. #265 moved an in-app link from a new split pane into the clicked pane's own tab group; `file-preview-link-open` (four cases) and `NativeChatInlineVisual.link-placement` still asserted the split: a new group beside the source, and the source tab left showing. They now assert what #265 made true — the page joins the clicked group and takes it over, no group is added, and the layout is untouched — matching how #265 rewrote `browser-link-open-layout-owner` and `http-link-source-placement`. The sixth is a real bug in the darwin start-time probe, not a stale test. `ps -o lstart=` prints local wall clock, and the hour a DST fall-back repeats resolves to the earlier offset: on 2026-11-01 a process started at 01:37 PST read back an hour early, so the probe's own tolerance check failed. `lstart` is now requested with TZ=UTC — which `runPsInProcess` also formats for — and parsed as UTC, so a start time is one instant whatever the zone. The new test pins the repeated-hour string, which a local read cannot satisfy. Why this matters beyond the test: `readProcessStartTimeMs` decides whether an agent-session owner or a spawned provider process is still the same process. An hour of error there is an hour of misidentification, twice a year.
Round 1 (Opus, high) raised nothing blocking and two one-hunk minors. The folder-workspace case asserted an active group its own seed had already set, so it could not fail and nothing proved the "activates its browser" half of its title. Both rewritten tests also said the page "joins as a sibling tab and takes it over" without asserting either: they now pin the group's activeTabId to the page and the source tab's survival in tabOrder, so a replacement would fail where only a move would not. Two nits as well: the titles that still said "beside", and the pairing of the UTC printer with the UTC parser, which only the live darwin test covered.
The delta round caught the new test failing off darwin: `psLocaleEnvironment` pins the en_US locale only on darwin, so `LC_ALL` is unset on the Linux nightly. The locale assertion is now darwin-only; the zone assertion, which is the point, holds everywhere. The detected-preview case also pins the group its outcome reports, which the rewritten store assertion had stopped covering.
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
The comment ratchet is red: 6068 added comment lines against a frozen 6051, and 11 of those are mine from #268 while 6 are this branch's. LOCAL-PATCHES.md forbids fork rationale above upstream code because it is conflict adjacency, so the one-liners that only restate an attribute's name are gone, and the DST rationale stays under a `fork-comment-ok:` marker — that reason cannot live in the PR body, because the next reader of the call site is the one who needs it.
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
* fix(links): give every link in the app the link context menu
The root link menu resolves its address from an `a[href]` or a declared
`data-link-url`, so a button-styled link that declared neither right-clicked
into nothing: the Checks-panel PR id, the folder-workspace PR row, the Jira
status row, task-page and project rows, and the settings doc links all had no
menu at all.
Fifty-one surfaces now declare the address they open, and resolution falls
through to a declaration when the anchor it sits in is an in-app route rather
than a web URL. A new ast-grep rule fails the lint gate when an inline onClick
opens a web link without declaring it, so the next link cannot miss the menu.
* fix(links): close the review's link-menu findings
Round 1 (Opus, high) raised no blockers and two should-fix items.
Surfaces it caught, all of which open a web page through a handler reference
the new lint rule cannot see: the Jira issue action rows (`onClick={item.action}`),
the two artifact "open in browser" buttons (a wrapper one call deep), and the
PR files view's "Open files on GitHub" section header, whose address every
section shares. The new-workspace source chip had the same shape.
Its minor findings are fixed too: a non-web anchor the declaration wraps now
keeps the browser's own menu instead of borrowing the row's address, the rule
test exercises its self-closing branch and an href-less anchor, the rule's
header says which shapes it cannot see, the project view error address is
computed once, and the icon button and error state carry tests.
* fix(links): resolve the innermost link claim, and test the rule's wrapper
The delta re-check closed both should-fix findings and left two minor ones
partly done; both were one-hunk fixes, so they are here rather than in the PR
body. A declaration nested inside a web anchor now wins over the anchor, which
is what "the innermost claim is the most specific" has meant everywhere else.
The rule test drops a case that asserted nothing and gains the artifact wrapper
the rule's regex names.
* local(lint): keep fork rationale out of upstream's files
The comment ratchet is red: 6068 added comment lines against a frozen 6051,
and 11 of those are mine from #268 while 6 are this branch's. LOCAL-PATCHES.md
forbids fork rationale above upstream code because it is conflict adjacency,
so the one-liners that only restate an attribute's name are gone, and the DST
rationale stays under a `fork-comment-ok:` marker — that reason cannot live in
the PR body, because the next reader of the call site is the one who needs it.
* local(lint): record the two markers the comment ratchet now carries
The delta round on the comment cleanup found the rule LOCAL-PATCHES.md states:
a marker is not added without a reason in the ledger. Both reasons are the
DST ambiguity and the printer/parser pairing, neither of which is visible in
the code the marker guards.
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the ledger entry, not the code: the deletion and the overlay rows were clean, but the entry stated one invariant wrongly and left two recorded nowhere. - The pick is display-only in Source Control only. In the Checks pane it is operational: HostedReviewActions gets the shown review and a mutation's refresh goes to the pick first. Scoped the bullet and stated the other half. - Added the two invariants that lost their only guard: the shown-review switch effect (fires on a change rather than on mount, clears the previous review's rows, raises loading flags only for a pick) and the pick-first tab-entry and post-mutation refresh. Neither hook is rendered by any test under right-sidebar/**, which is why the ledger has to carry them. - Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so a switch never changes it and isCurrentRequest cannot see one — it is the result key that cannot tell a switch from this review's own head moving. Added the two test-pinned clauses (re-check the pick after the await and before claiming asyncResultKeyRef; compare pickedRequestKey as a local because isCurrentAsyncResult reads the ref). - Added "a pick's read must not retractStalePRRefreshError", pinned at use-checks-panel-polling.test.tsx. - Fixed the figures: the ratchet counts 118 of the deleted lines (the diff deletes 120; two are JSX comment continuation lines the line rule skips), and the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already in the tree and #266 removed them afterwards, which is the 6169 this branch carried. - The two overlay rows named the cache key by position; they name use-workspace-review-selection.ts instead, so a prune or reorder cannot break the pointer. Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed, so the unit-gate verdict for e88b0f0 still stands and the review is not voided by this commit (LOCAL-PATCHES.md only).
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the ledger entry, not the code: the deletion and the overlay rows were clean, but the entry stated one invariant wrongly and left two recorded nowhere. - The pick is display-only in Source Control only. In the Checks pane it is operational: HostedReviewActions gets the shown review and a mutation's refresh goes to the pick first. Scoped the bullet and stated the other half. - Added the two invariants that lost their only guard: the shown-review switch effect (fires on a change rather than on mount, clears the previous review's rows, raises loading flags only for a pick) and the pick-first tab-entry and post-mutation refresh. Neither hook is rendered by any test under right-sidebar/**, which is why the ledger has to carry them. - Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so a switch never changes it and isCurrentRequest cannot see one — it is the result key that cannot tell a switch from this review's own head moving. Added the two test-pinned clauses (re-check the pick after the await and before claiming asyncResultKeyRef; compare pickedRequestKey as a local because isCurrentAsyncResult reads the ref). - Added "a pick's read must not retractStalePRRefreshError", pinned at use-checks-panel-polling.test.tsx. - Fixed the figures: the ratchet counts 118 of the deleted lines (the diff deletes 120; two are JSX comment continuation lines the line rule skips), and the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already in the tree and #266 removed them afterwards, which is the 6169 this branch carried. - The two overlay rows named the cache key by position; they name use-workspace-review-selection.ts instead, so a prune or reorder cannot break the pointer. Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed, so the unit-gate verdict for e88b0f0 still stands and the review is not voided by this commit (LOCAL-PATCHES.md only).
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
* fix(lint): remove #267's fork comments and record its transitive focus reads The lint gate was 42/44 on this branch, both reds from #267 and both entirely inside src/renderer/src/components/right-sidebar/**: - check-upstream-file-comments: 6180 against a 6051 baseline. #267 added 118 comment lines across 12 files upstream owns. All 118 are removed rather than marked `fork-comment-ok`: each was prose above upstream's code explaining a fork decision, and the fork's own modules (workspace-review-selection.ts, use-workspace-review-selection.ts, WorkspaceReviewSwitcher.tsx) already state the same design without a hunk to resolve on every sync. Total is back to exactly 6051 with 0 stale entries, so no re-baseline was needed. - check:focus-read-ratchet: three files at 1 read each. They are one transitive read, not three routing decisions: use-workspace-review-selection.ts builds its hosted-review cache key through getWorkspaceReferenceRuntimeVersion, which folds getProviderRuntimeContextKey(null) in — null is this app, not the focused host — and it reuses the sidebar card's key on purpose so a switch does not overwrite the branch's entry. The two panes then count because they call the hook. Recorded in config/focus-setting-read-baseline.fork.txt with the reason, the same shape as the 2026-10-16 use-linked-issue-pane-actions.ts row, rather than restructuring reviewed code to dodge a regex. The invariants those comments guarded (display-only pick, the one suppressedGitHubPR tombstone, row-not-slot unlink, renderable rows, the store as the refresh switch test, no branch argument for a picked review) now live in LOCAL-PATCHES.md § local(lint), next to #266's marker note. Verified: check-upstream-file-comments and check:focus-read-ratchet green; tc:web clean; the 9 test files covering the touched hooks and components pass. * local(lint): correct the #267 ledger entry the gate-2 review caught Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the ledger entry, not the code: the deletion and the overlay rows were clean, but the entry stated one invariant wrongly and left two recorded nowhere. - The pick is display-only in Source Control only. In the Checks pane it is operational: HostedReviewActions gets the shown review and a mutation's refresh goes to the pick first. Scoped the bullet and stated the other half. - Added the two invariants that lost their only guard: the shown-review switch effect (fires on a change rather than on mount, clears the previous review's rows, raises loading flags only for a pick) and the pick-first tab-entry and post-mutation refresh. Neither hook is rendered by any test under right-sidebar/**, which is why the ledger has to carry them. - Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so a switch never changes it and isCurrentRequest cannot see one — it is the result key that cannot tell a switch from this review's own head moving. Added the two test-pinned clauses (re-check the pick after the await and before claiming asyncResultKeyRef; compare pickedRequestKey as a local because isCurrentAsyncResult reads the ref). - Added "a pick's read must not retractStalePRRefreshError", pinned at use-checks-panel-polling.test.tsx. - Fixed the figures: the ratchet counts 118 of the deleted lines (the diff deletes 120; two are JSX comment continuation lines the line rule skips), and the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already in the tree and #266 removed them afterwards, which is the 6169 this branch carried. - The two overlay rows named the cache key by position; they name use-workspace-review-selection.ts instead, so a prune or reorder cannot break the pointer. Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed, so the unit-gate verdict for e88b0f0 still stands and the review is not voided by this commit (LOCAL-PATCHES.md only). * local(lint): fix the two MINOR wording errors the delta re-check found Round 2 (the R1..R2 delta re-check, Opus 5.5 high) resolved all seven round-1 findings and reported two MINOR wording errors in the bullet R2 added. Both are one-hunk text fixes, so they are fixed here rather than listed in the PR body: - The bullet title said the switch effect and the tab-entry refresh "are a pick's only re-reads". They are not: the switch effect reads nothing (it clears rows and sets flags), and a manual refresh and polling both read a pick. The title now names what the bullet actually guards, which is that neither hook is rendered by a test. - The mount-guard reason was wrong. In an ordinary single-review workspace shownReviewKey is '' and the unguarded effect would clear rows that are already empty and raise no flags. The guard earns its place on a remount where the pick's cache entry is already warm: showsPickedReview resolves true on the first render, so the unguarded effect would clear rows and raise loading flags with no switch and no read in flight, and setChecksLoading/setCommentsLoading are otherwise written only by a manual refresh, so nothing would clear them. Both ratchets still green. LOCAL-PATCHES.md only: no code changed, so the unit gate verdict for e88b0f0 still stands for that revision, and this commit does not void the review. No third review round: AGENTS.md requires the user's approval for one, and these are the reviewer's own suggested fixes.
nplez1
added a commit
that referenced
this pull request
Nov 2, 2026
…ssion probe (#272) * fix(daemon): read a macOS daemon start time in UTC, like the agent-session probe `ps -o lstart=` prints local wall clock, and the hour a DST fall-back repeats resolves to the earlier offset, so for one hour a year a daemon start time read back exactly an hour early. #268 fixed that in the agent-session probe; these daemon paths still had it, and neither value is compared against itself — both meet a recorded epoch, so the error does not cancel. - `readMacosProcessStartedAtMs` feeds `probeMacosProcess`, whose start-time evidence then fails to match the incarnation it is verifying, degrading evidence to `unknown`. - `getPsProcessIdentityAsync` feeds the PID-identity and retired-daemon-recovery comparisons, which use it to prove the daemon is gone. - `getProcessStartedAtMs` reached the same defect through the synchronous twin's default, so the zone is now pinned unconditionally and the `utc` option is gone rather than left as a wrong default. The two idioms #268 added move into `src/shared/ps-lstart-time.ts` so all three call sites read one implementation instead of three copies. The identity query now inherits the en_US.UTF-8 locale upstream pinned for macOS ps, which keeps non-ASCII argv readable in the command line it matches on. * fix(process-table): read every ps lstart in one zone, so the daemon's UTC read still matches Round 1 (Opus, high) found one blocking defect in R1: `macos-retired-daemon-recovery` compared `Date.parse(snapshot.root.startedAt)` — the descendant table's local wall clock — with the daemon identity's epoch, which R1 had just made UTC. Before R1 both sides were local and matched (wrong by the same hour); after it, a daemon started in the repeated hour differed by 3 600 000 ms and recovery threw "Could not verify the retired macOS terminal service". One zone now covers every lstart-to-epoch conversion, which is what makes the comparison coherent again rather than dropping it: - the fresh descendant table and the provider row reader ask ps for lstart with TZ=UTC, next to the C locale they already pin; - `hasUnambiguousStartTime` and the recovery comparison read that text with `parseUtcLstart`, so the second-boundary PID-reuse proof is also right in the hour that repeats, instead of reading a start an hour into the future. Round 1's other two findings: the repeated-hour guards now stub TZ to America/Los_Angeles, because on a UTC runner a local read satisfies them and the guard would be vacuous (the shared test asserts that premise, so the guard cannot quietly stop biting); and a live darwin test reads this process's own start time with TZ stubbed, which fails if either the in-process reader or the ps fallback loses the zone pin — verified by reverting the env and watching it red. Recorded start times are noted in the PR body: a daemon or orcad that started in the repeated hour and is still alive across the upgrade can mismatch by one hour once. * fix(test): guard the new zone pins, and read the daemon fixture the way the code does Round 2 (Opus, high) found that nothing tested the two `TZ: 'UTC'` pins R2 added to the ps readers, and that `daemon-tcc-attribution-main-thread.test.ts` was red — an R1 miss it caught from the delta. The pins are safety-relevant, not cosmetic: a local `lstart` text parsed as UTC on a Mac west of UTC reads every row hours older, so `hasUnambiguousStartTime` clears a start it cannot distinguish from PID reuse and SIGKILL can reach a recycled PID. Dropping either pin failed no test on any runner. Each reader now has a guard that fails when its pin is removed — the fresh descendant table asserts the `ps` env, and the provider row reader reads this process's own marker with `TZ` stubbed and checks it parses to the real start instant. Both verified by removing the pin and watching them red. The tcc attribution fixture wrote a pid record from a local `Date.parse` of the same `lstart` text its `ps` mock returns, which the daemon identity now reads as UTC, so the 1 500 ms comparison became a 7-hour mismatch on this machine and the suite was red here while green on UTC CI. It and one leftover fixture now use `parseUtcLstart`. * fix(test): give the incarnation fixture a real lstart, not a zoned Date string The unit gate caught this one: the mock emitted `new Date(1_700_000_000_000).toString()`, which carries a GMT offset and the zone name, so it is not the fixed-width lstart that `ps -o lstart=` prints. `Date.parse` accepted it; `parseUtcLstart` reads the first 24 characters and correctly refuses it, so the evidence fell to `unknown`. The fixture now emits the lstart for that same instant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was red
nplez1/mainfails the unit gate for six cases, and every one of them sits in a file the commitbefore it (#265,
fix(browser): open in-app links as a tab in the clicked pane's group) did nottouch — so its own suite never saw them. Reproduced on
ea4100bd6a7with a clean tree and no branchcommits:
Two different causes
Five are stale placement assertions. #265 replaced "a link opens in a new split pane beside the
clicked one, which keeps showing its own tab" with "the page joins the clicked pane's own tab group
as a sibling tab". It rewrote the assertions in
browser-link-open-layout-owner,browser-link-open,http-link-source-placement,http-link-browser-placement,http-link-routing-storeandruntime/web-runtime-browser-link-open, but missed these two files. They now assert the contract#265 established, in the style #265 used:
'a','left'), not a new one;activeTabIdis the page (it takes the group over);tabOrder(a sibling, not a replacement);The sixth is a real bug, not a stale test.
ps -o lstart=prints local wall clock, and the hour aDST fall-back repeats is ambiguous —
Date.parseresolves it to the earlier offset. Measured on2026-11-01 (US fall-back), a process started at 01:37 PST read back as 08:37Z instead of 09:37Z:
exactly one hour early, which broke the probe's own 60 s tolerance check.
lstartis now requested withTZ=UTC— whichrunPsInProcessalso formats for, so the in-processreader and the
/bin/psfallback agree — and parsed as UTC. That covers every reader of the helper:claude-structured-owner-identity,codex-structured-owner-identity,provider-spawned-process-identity,system-ssh-orphaned-forwardand the reservation probe.Why it matters beyond the test:
readProcessStartTimeMsdecides whether an agent-session owner or aspawned provider process is still the same process. An hour of error there is an hour of
misidentification, twice a year.
Evidence
Full unit gate on this revision, after the fix:
The one "failed" is the known flaky
worktree-git-common-root-lifetime(ENOTDIR), which passed onthe isolation re-run;
0 unexpectedis the verdict. Before this branch the same gate reported7 failed (0 allowlisted, 6 unexpected).Also: the three fixed files pass, the neighbouring link-placement suites pass (92 cases),
tc:nodeand
tc:webare clean, andcheck:code-quality:changedis clean.Nits left here rather than fixed
src/main/daemon/daemon-process-inspection.ts:194(readMacosProcessStartedAtMs, sets neither TZnor locale) and
src/main/daemon/daemon-process-identity-query.ts:36(
getPsProcessIdentityAsync, which does not pass theutcoption its synchronous twin alreadyhas). No test covers either, so fixing them blind would be a different change with its own
evidence. Worth its own small PR — the pattern already exists at
daemon-process-identity-query.ts:13.getByRole('button', { name: 'Open in new tab' })) passeswhatever happens, because the visual renders outside the tab tree. Pre-existing, not this branch's.
Reviewed by Opus 5.5, high: R1 clean; 2 MINOR and the delta round's 1 SHOULD-FIX fixed in this branch
Gate 2 detail: round 1 raised no BLOCKER and no SHOULD-FIX — two one-hunk MINORs (a folder assertion
that could not fail, and comments promising a "sibling tab that takes it over" without asserting
either), both fixed. The delta round on that fix caught a cross-platform defect I had introduced: the
new zone test asserted
LC_ALLunconditionally, which is set only on darwin, so it would have reddedthe Linux nightly. Fixed by gating that assertion on darwin; the zone assertion holds everywhere. No
third round was run — the reviewer scoped that fix to a single line in one test.