Files
t3code/packages/client-runtime
Theo BrowneandClaude Fable 5 0c1de35f5a Harden PR monitoring after adversarial review
Findings from a multi-agent review panel (23 confirmed after two-lens
adversarial verification), grouped by root cause:

Lifecycle identity
- Thread a monitor generation through monitor commands, events, and the
  projected monitor state; reject updates/ends whose generation is not
  the active one, and make every registry removal generation-conditional
  so a delayed lifecycle event cannot delete a newer monitor
- Re-validate registration, projected monitor status, archive state,
  generation, and claim at the wake send boundary (after the fresh fetch,
  not before it)

Event loss
- Diff before the readiness exit: actionable activity now wins over
  ending as ready, so a bot comment landing in the same poll as green CI
  is never discarded
- Persist non-actionable cursor transitions so resolved→reopened is
  still detectable
- Acknowledge the cursor only if the wake claim still exists, so a
  user-turn release is not overwritten

Readiness
- Collapse reviews to each reviewer's latest opinionated review, so an
  approval supersedes that reviewer's earlier changes-requested
- Re-include pre-monitor review threads once they are edited or reopened

Snapshot integrity
- Final terminal/head revalidation after pagination, with one bounded
  refetch on head change
- Fetch the last 10 comments per review thread and track per-thread
  updatedAt so edits to non-final comments are visible
- Reopened threads wake regardless of self-authorship
- Include the changes-requested review body in the wake prompt

Lifecycle events
- Archive atomically emits thread.monitor-ended before thread.archived,
  mirroring settle
- Treat a queued-but-unadopted user turn as busy at the send boundary
- Boot reconciliation isolates per-thread failures (Bugbot)

UI
- Gate ready-state PR actions on the checkout PR matching the monitored
  PR number
- Wake snoozed threads on monitor ready/needs-attention/session-ended
- Legacy sidebar renders the ready payoff and a needs-attention state;
  session failure outranks Monitoring
- Reset merge confirmation when PR or monitor status changes
- endThreadMonitor honors a caller-provided endedAt

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-26 19:39:43 -07:00
..

Client Runtime

Shared client behavior for web and mobile. Public APIs are organized by package subpath. The package intentionally has no root export.

Public subpaths

Subpath Responsibility
authorization Bearer and DPoP authorization plus token persistence contracts
connection Targets, catalog, supervision, retries, registry, and onboarding
environment Environment identity, descriptors, endpoints, and scoped keys
errors Shared client error inspection
operations Multi-step application workflows
operations/projects Multi-step project creation workflows
platform Platform capability and persistence service contracts
relay Managed relay API and environment discovery
rpc HTTP/RPC clients, protocol, sessions, and subscriptions
state/<domain> Focused shared state, retention, reducers, and Atom constructors

Dependency direction

Platform applications provide platform services. connection composes those capabilities with authorization, relay, and rpc to supervise environment sessions. Independent state modules consume the connection registry and expose focused state or Atom constructors to application-owned runtimes.

Applications should import the narrowest relevant subpath. There is no broad state export: use domain paths such as state/shell, state/threads, state/terminal, or state/vcs. Subpath indices and explicitly exported domain files are public API boundaries; all other files remain implementation details.