Skip to content

fix(ui-react): recover safety history and name unresolved sources - #4269

Merged
schlessera merged 4 commits into
mainfrom
fix/safety-review-findings-20261120
Nov 20, 2026
Merged

schlessera merged 4 commits into
mainfrom
fix/safety-review-findings-20261120

Conversation

@schlessera

@schlessera schlessera commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Closes #4267
Closes #4268

What changed

A dropped safety-history subscription now recovers from an oversized delta by obtaining a fresh paginated snapshot and subscribing at its final watermark. Grouped safety indicators name an unresolved source in their accessible name and hover/focus reason even when an earlier trigger has already been marked safe.

Why this shape

Both fixes restore the existing per-trigger and bounded-history contracts from #3596. The wire cannot distinguish a dropped delta from a refused subscription. Capacity recovery therefore allows one automatic resnapshot until a valid advancing update or explicit refresh/reselection/reconnect; a second refusal remains visibly unavailable. Page completion and duplicate updates do not rearm recovery. Capacity during a page read remains a visible refusal. Individual decisions, counts and persistent details retain their original scope. No machine schema or provider conversation changes.

Proof

Initial tested base: c5071f7025b4eab3ff40e2a7c77c5a0d8ee05542. Current base: 615a7fcfc21051612d48933097cada690d56c757, merged cleanly into reviewed head 5b021368134959324d917c71e377dfbb66ba38c1 as c566b9cf680df0111dac3d70a6beb556cf08168a. The base adds immutable-reference read binding and has no file overlap with this diff. Fresh combined-candidate preflight and 28 focused tests pass. Earlier build/typecheck/browser receipts retain their actual pre-refresh identity; complete candidate and main proof below qualify the combined tree.

  • Client failing-first: capacity loss fails SUBSCRIPTION_LOSS_REQUESTS_FRESH_SNAPSHOT because no read is emitted (8 pass/1 fail). Removing capacity recovery after implementation fails the same assertion (11 pass/1 fail); restored client tests pass 12/12, including cursor-free new request IDs, stale-page fencing, pagination, final subscription and refusal-loop checks.

  • Pinned offline Chromium: reviewed web fetch followed by unresolved workspace read fails GROUP_REASON_NAMES_UNRESOLVED_SOURCE in both themes. Mutation restoring the first-occurrence expression gives exactly 2 failures/9 passes at that assertion. Restored browser suite passes 11/11, including hover, focus, accessible name, persistent details and existing 320/1280 light/dark flows. Image: mcr.microsoft.com/playwright@sha256:eff16c30e6f3f4af0a03fa4b706120d5e9b0891c344a27d64559aff5900a4a27. Initial missing-build and screenshot-permission failures were harness setup failures, not reproduction receipts.

  • bun run test packages/ui-react/tests/safety-client.test.ts packages/ui-react/tests/safety-evidence.test.ts packages/ui-react/tests/safety-reviewer.test.ts: 28 pass, 0 fail.

  • NODE_OPTIONS=--max-old-space-size=6144 bun run build and NODE_OPTIONS=--max-old-space-size=6144 bun run typecheck: both pass.

  • Capacity-bound review fix: before the fix and with its bound removed, the new tests fail at CONSECUTIVE_CAPACITY_REFUSALS_HAVE_BOUNDED_RECOVERY and ONLY_ADVANCING_CONTIGUOUS_UPDATE_REARMS_CAPACITY_RECOVERY (12 pass/2 fail). Restored tests pass 14/14. Audited all read(target) resnapshot paths; existing gap/page/update recovery does not reset the capacity bound.

  • Re-review fixes: while paging, uncorrelated resync notices leave the active read intact; a refusal bearing its request ID remains terminal. All four resync reasons now recover two reviewed occurrences over separate pages at high-water 4, proving record retention, partial normal=false and final afterRevision=4. Notice-fence, dropped-first-page, premature-normal and revision-zero mutations each produce the intended named assertion failures (15 pass/4 fail); restored client tests pass 19/19. Other frame handlers already fence by request ID, identity or paging state; read/refusal-focused fixtures retain their narrow parser/flow purpose.

  • Pending changeset package validation and full changeset status plan pass; the consumer fix has a ui-react patch changeset.

  • NODE_OPTIONS=--max-old-space-size=6144 bun run check:pr --base origin/main: passed at merge head c566b9cf680df0111dac3d70a6beb556cf08168a, receipt below.

  • Candidate qualification: run 44764503535 passed at head c566b9cf680df0111dac3d70a6beb556cf08168a, base 615a7fcfc21051612d48933097cada690d56c757. The shared merge path verified every successful selected job at synthetic checkout 30cbbf8d899d122e2efe3523eea2a1f65d8be57c, whose parents are that base/head and whose tree is 182a200025c44f6a41aeae0150401301b564929f.

  • Delivered squash 63bb400b31403ee319926d38e223711a9bf0e7e1 has that exact parent/tree and is on main. Automatic-main run 44767813281 passed on attempt 2. Audited all nine selected categories and all 17 successful job checkouts at the exact squash. Attempt 1 had only a pinned-image registry connection reset before endurance tests; one diagnosed infrastructure retry passed the ten-minute native endurance test and aggregate. Passing-job logs retain their original execution timestamps; this is not a claim that all jobs executed again. The structured receipt has no retained categories, and only the two planner-unselected repeat categories were skipped.

{"version":1,"kind":"brain-check-pr-receipt","head":"c566b9cf680df0111dac3d70a6beb556cf08168a","base":"origin/main","mode":"focused","startedAt":"2026-11-20T15:31:13.143Z","finishedAt":"2026-11-20T15:31:57.088Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":14213.857214},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":124.98506999999881},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":73.5970559999987},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":22.987403999999515},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":29490.935351999997}]}

Checklist

  • Focused local preflight, behavioral receipts and complete selected hosted proof passed; actual head/base/job checkout evidence is in Proof.
  • Both issues' acceptance criteria are covered by focused tests and browser proof.
  • Recorded independent review of head 5b021368134959324d917c71e377dfbb66ba38c1 returned no findings; the clean base merge preserves it.
  • PR and both issues use release milestone 0.45.0, read back before merge.
  • Consumer-visible changeset included.
  • Leakage gate covers the diff and issue bodies.
  • Machine surface unchanged; existing contract restored.
  • Documented behavior unchanged.
  • No enforcing guard or provider-facing history changed.

Anything left open

No implementation or qualification work remains for #4267/#4268. Epic #3596 stays open for its parent's follow-up combined review. Operational incident #4272 remains open awaiting a subsequent inclusive main plan: this successful retry reused metadata selected before the incident existed, so the separate red-main controller marker has not cleared. Its evidence and handoff are recorded; no source fix is justified by the transient registry failure.

@schlessera
schlessera marked this pull request as draft November 20, 2026 15:16
@schlessera schlessera added area: ui-react React chat/files/voice components, stores, WebSocket transport. type: fix Something is broken and must behave the way it is documented. labels Nov 20, 2026 — with schlessera-agent-fleet
@schlessera schlessera added this to the 0.45.0 milestone Nov 20, 2026 — with schlessera-agent-fleet
@uploads-sh

uploads-sh Bot commented Nov 20, 2026

Copy link
Copy Markdown

No uploads on this PR yet

This PR changes UI files (packages/ui-react/src/components/chat/safety-indicator.tsx and packages/ui-react/tests/browser/safety-review.layout.tsx). Screenshots help reviewers see what changed.

  • From the CLI: uploads put before.png after.png --pr 4269
  • From an agent: ask it to attach screenshots with uploads.sh
  • By hand: drag images into the PR description and they're imported automatically
Tips for agents

Label each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one put per shot:

uploads put after.png --pr 4269 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 4269 --app ios --screen "Chat" --state after

No CLI? With the Uploads MCP, call sign_upload_url for files on disk (or put) with repo, pr: 4269 and the same screen, state and caption fields.

This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with uploads list --pr 4269. More in the github-screenshots skill or the agent docs.

Workspace admins can turn this comment off in Settings → GitHub · docs

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 949b6c3 against base c5071f7. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4269,
  "head": "949b6c39dacaaf705449f2422c0b8db34d124704",
  "base": "c5071f7025b4eab3ff40e2a7c77c5a0d8ee05542",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-react/src/lib/safety-client.ts:52 retries every capacity refusal after the final page. When the host already has 256 subscriptions, it refuses the new subscription with capacity. Each fresh snapshot then leads to another refused subscription, repeatedly paging the selected history until a host limit stops it. Recovery needs a bound for consecutive capacity refusals."
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 949b6c3 against base c5071f7. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4269,
  "head": "949b6c39dacaaf705449f2422c0b8db34d124704",
  "base": "c5071f7025b4eab3ff40e2a7c77c5a0d8ee05542",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-react/src/lib/safety-client.ts:52 retries every capacity refusal after the final page. When the host already has 256 subscriptions, it refuses the new subscription with capacity. Each fresh snapshot then leads to another refused subscription, repeatedly paging the selected history until a host limit stops it. Recovery needs a bound for consecutive capacity refusals.",
      "disposition": "fixed",
      "commit": "f4b11154ce9440c755b4bd9a11981c935965c257"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head f4b1115 against base c5071f7. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4269,
  "head": "f4b11154ce9440c755b4bd9a11981c935965c257",
  "base": "c5071f7025b4eab3ff40e2a7c77c5a0d8ee05542",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-react/src/lib/safety-client.ts:58 clears the active request ID when a capacity notification without a request ID arrives during pagination. A delayed or duplicate subscription-loss notice can therefore cancel the fresh snapshot and make the client discard its remaining pages. Ignore uncorrelated capacity notices while awaiting a page, while preserving terminal handling for a refusal bearing the active read’s ID."
    },
    {
      "summary": "packages/ui-react/tests/safety-client.test.ts:156 uses empty, restricted pages at high-water 0 and checks only partial status. The recovery test still passes if the client drops first-page records, enables normal policy on partial evidence, or always subscribes after revision 0. Use distinct records across pages, a normal projection and a nonzero high-water, then assert retained records, partial normal=false and the final afterRevision."
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head f4b1115 against base c5071f7. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4269,
  "head": "f4b11154ce9440c755b4bd9a11981c935965c257",
  "base": "c5071f7025b4eab3ff40e2a7c77c5a0d8ee05542",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-react/src/lib/safety-client.ts:58 clears the active request ID when a capacity notification without a request ID arrives during pagination. A delayed or duplicate subscription-loss notice can therefore cancel the fresh snapshot and make the client discard its remaining pages. Ignore uncorrelated capacity notices while awaiting a page, while preserving terminal handling for a refusal bearing the active read’s ID.",
      "disposition": "fixed",
      "commit": "5b021368134959324d917c71e377dfbb66ba38c1"
    },
    {
      "summary": "packages/ui-react/tests/safety-client.test.ts:156 uses empty, restricted pages at high-water 0 and checks only partial status. The recovery test still passes if the client drops first-page records, enables normal policy on partial evidence, or always subscribes after revision 0. Use distinct records across pages, a normal projection and a nonzero high-water, then assert retained records, partial normal=false and the final afterRevision.",
      "disposition": "fixed",
      "commit": "5b021368134959324d917c71e377dfbb66ba38c1"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Collision assessment at head 5b021368134959324d917c71e377dfbb66ba38c1: the last completed graph found shared proof closures with #3054/#3056/#3059/#3069/#3581/#4151/#4234/#4264/#4265/#4266 and a textual overlap with #4270 in safety-indicator.tsx and safety-review.layout.tsx. No other branch is being changed. Fresh graph is running; integration will re-check the actual main base and preserve the other reservation. Local proof at this head: check:pr, full build, strict typecheck, 28 focused safety tests and 11 pinned browser tests pass. The four re-review mutation variants each fail their intended assertion, and both findings are recorded as fixed.

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 5b02136 against base c5071f7. Reviewer: agent. No findings.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4269,
  "head": "5b021368134959324d917c71e377dfbb66ba38c1",
  "base": "c5071f7025b4eab3ff40e2a7c77c5a0d8ee05542",
  "reviewer": "agent",
  "outcome": "no-findings",
  "findings": []
}

Copy link
Copy Markdown
Owner Author

Fresh collisions scan at reviewed head 5b021368134959324d917c71e377dfbb66ba38c1 completed: shared proof closures with #3054/#3056/#3059/#3069/#3581/#4151/#4234/#4265/#4266, plus textual overlap with #4270 in packages/ui-react/src/components/chat/safety-indicator.tsx and packages/ui-react/tests/browser/safety-review.layout.tsx. Independent review at that head returned no findings; the receipt is recorded and review-receipt.ts check 4269 reports refusal:null. Main advanced to 615a7fcfc21051612d48933097cada690d56c757; refreshing this branch by merge and rerunning affected qualification before confirmation.

Copy link
Copy Markdown
Owner Author

Current combined-candidate collision graph at c566b9cf680df0111dac3d70a6beb556cf08168a: completed. Shared proof closures remain with #3054/#3056/#3059/#3069/#3581/#4151/#4234/#4265/#4266; #4270 still has textual overlap in safety-indicator.tsx and safety-review.layout.tsx. The merge of main 615a7fcfc21051612d48933097cada690d56c757 was clean, without resolving or editing any other branch. Review receipt remains valid with refusal=null. Fresh combined-candidate check:pr and 28 focused safety tests pass.

@schlessera
schlessera marked this pull request as ready for review November 20, 2026 15:33
@schlessera
schlessera merged commit 63bb400 into main Nov 20, 2026
49 of 62 checks passed

Copy link
Copy Markdown
Owner Author

Merged via the shared integration command as 63bb400b31403ee319926d38e223711a9bf0e7e1. Candidate run https://github.com/schlessera/brain-kit/actions/runs/44764503535 passed the complete selected proof; the merge path inspected every successful selected job's actual checkout. Its synthetic checkout 30cbbf8d899d122e2efe3523eea2a1f65d8be57c has parents base 615a7fcfc21051612d48933097cada690d56c757 and head c566b9cf680df0111dac3d70a6beb556cf08168a, tree 182a200025c44f6a41aeae0150401301b564929f. The actual squash has that exact parent/tree and is an ancestor of fetched main. Automatic-main run https://github.com/schlessera/brain-kit/actions/runs/44767813281 is in progress; main qualification is not yet claimed.

Copy link
Copy Markdown
Owner Author

Automatic-main qualification run 44767813281 has an endurance infrastructure failure before any test executed. Actual job 136397887662 checked out squash 63bb400b31403ee319926d38e223711a9bf0e7e1, completed the workspace build, then failed to pull the pinned Playwright image with a registry connection reset by peer. This is not a failing assertion or evidence against the safety fix. Retaining this failed attempt; a single infrastructure retry after the run completes will obtain missing endurance execution. No test, guard, image pin or source change is justified by this transport failure.

Copy link
Copy Markdown
Owner Author

Main run 44767813281 attempt 1 completed: verification, packaging, all four unit partitions, both layout partitions, all three browser partitions, runtime, native-host runtime and captures passed. Endurance alone failed before tests at the diagnosed pinned-image registry connection reset, causing the aggregate failure. A single job-specific infrastructure retry of endurance (and its dependent aggregate) has now been requested. The source remains squash 63bb400b31403ee319926d38e223711a9bf0e7e1; no merged branch is being changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui-react React chat/files/voice components, stores, WebSocket transport. type: fix Something is broken and must behave the way it is documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui-react: name unresolved evidence in grouped safety reasons ui-react: resnapshot safety history after capacity subscription loss

1 participant