Skip to content

chore: sync upstream through a21d788752 - #279

Merged
andrewcai8 merged 513 commits into
mainfrom
sync/upstream-a21d788752
Nov 5, 2026
Merged

andrewcai8 merged 513 commits into
mainfrom
sync/upstream-a21d788752

Conversation

@andrewcai8

@andrewcai8 andrewcai8 commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Brings the fork up to upstream a21d788: 511 upstream commits since #277's d897d3f, with upstream CI green at that commit. It is a merge commit, not a squash, so the next sync's merge base stays upstream's sha.

Why

The PC's T3 server froze and then crashed on a V8 heap OOM. Its statev2.sqlite is 54 GB, with 8.46M rows in orchestration_events, because the fork's event log never shrinks. Upstream now prunes events the projections already cover (pingdotgg#29806).

Notable upstream changes

New server migrations

  • 077 RepairBooleanSettledOverride: one UPDATE on orchestration_v2_projection_threads, limited to rows whose override is a JSON boolean.
  • 078 DropOrchestrationEventCorrelationIndex: drops idx_orch_events_correlation_id. Cheap, and it frees pages. No fork code reads by correlation id.
  • 079 DelegatedRecoveryIndexes: two partial indexes. One full scan of the threads table and one of the runs table, with JSON functions per row. Expect a slower first start on the PC.
  • Fork 009 DropDuplicateDelegatedCompletionIndex: fork 008 built the same partial index as upstream 079's runs index. Two identical indexes double the write cost, so 009 drops the fork's.

None of them scans, backfills or indexes orchestration_events, the turn items, turn item positions, nodes or message search tables.

First pruning pass on a large backlog

  • The first compaction runs 1 minute after start. It only records the prune mark at the current head, and it starts paced pruning of imported v1 history.
  • Event deletion starts on the first pass after the mark is a day old. Passes run every 6 hours, so expect the first deletes 24 to 30 hours after the first start.
  • Each delete transaction removes at most 50 rows. The pruner runs at 10% duty: after a 25 ms slice it rests nine times as long. It never holds a transaction or the reader lock across a rest.
  • Discovery runs on the reader pool. Its largest read groups every stream head once, which holds a WAL snapshot for that one statement.
  • pruned-through is published before rows go, so resuming clients take a snapshot instead of missing events.

Conflict resolutions (34 files)

  • Projections: ProjectionStore takes upstream's node and streaming-message queries. Recovery liveness takes upstream's perf(server): bound runtime recovery reads by thread ownership pingdotgg/t3code#29429 provider-thread clauses over the fork's narrowing (e9860a5), which had dropped live turn items from that check.
  • Server wiring: server.ts and ws.ts keep the fork's environment control, cloud RPCs and local nodeHttpServer, and drop the model manifest and latest-version RPCs as upstream did. DatabaseStorage gets ProjectionMaintenance as upstream wires it.
  • Codex: upstream's environment merge (fix(server): Codex switches respect each instance's CODEX_HOME variable pingdotgg/t3code#24664) keeps the fork rule that only an instance's own CODEX_HOME picks its home.
  • Claude adapter: upstream's buffered result arrivals and the fork's process-ended handling both stay. The wake check keeps the fork's opaque task notification case.
  • MCP: orchestrator capabilities check the caller's project when it is known. Project and thread tools keep Home routing on SecureRandom.
  • Usage: the Cursor scan follows upstream's instance list. API keys win. With a key, only key sources are shown, so a replaced key never shows the previous account. On the CLI-login path, the fork keeps per-instance logins and stored history for removed logins.
  • Web: cloud delete hooks, the cloud machine pill, the environment setup card and guest server updates are re-applied on upstream's reshaped components. Upstream removed the unreachable thread status priority.
  • Mobile: upstream moved the sidebar into WorkspaceThreadSidebar.tsx. The fork's useNewThreadNavigation is wired there now.
  • Root: package.json keeps the fork's case:check, the protobuf, connect, e2b and modal dependencies, and drops jose as upstream did. The lockfile is upstream's, re-resolved.

Fixes the merge needed

  • Effect 4.1.2 in fork code:
    • effect/Crypto became SecureRandom and Digest in the fleet, Home, cloud host and worker fork code and in scripts/cloud.
    • Layers and scripts add NodeCrypto.layer, since NodeServices no longer carries crypto.
    • NodeWS imports moved.
    • SpawnHost unwraps Redacted args and env.
    • boxUsage chunks its inserts.
    • The provisioned gateway refuses an unknown HTTP method with 405.
  • tsgo: five stale @effect-diagnostics directives are removed. A fork benchmark keeps its JSON printing outside Effect code.
  • Scheduled tasks: upstream fix(server): a failed scheduled run shows its error without a stack trace pingdotgg/t3code#29889 records only a failed run's outer error message. On a cloud-only host, local runs are now refused before launch, so the run's error still says why.
  • Tests:
    • Fake Claude sessions gain the four new SDK methods.
    • In-process MCP tests use layerInProcessMcpServer.
    • ServerSecretStore mocks answer get.
    • Registry mocks carry entries.
    • ForkMigrations.test.ts gains 077–079 and fork 009.
    • The writer-worker pruning test expects one remaining event, since upstream now prunes message.updated rows too.
    • The cloud task test expects upstream's fix(server): Run now on a scheduled task says why it was refused pingdotgg/t3code#29620 refusal message.
    • The client-runtime server test types its registry mock's entries (separate commit, after CI's typecheck caught it).
  • Agent context budget shrank (5153 → 5133, 6883 → 6863, 54149 → 54109), so no label is needed.

Verification

Not verified

  • No real client was run, and no cloud box or provider was exercised.
  • Pruning was not run against a copy of the PC's 54 GB database. Its wall time on the 8.46M-event backlog is an estimate: about 169K delete pages, likely 5 to 25 hours of paced work.
  • The 079 index build time on the PC is not measured.

Follow-ups

  • Upstream build: run Effect rules on mobile and lock in clean suggestion rules pingdotgg/t3code#31111 (one commit past a21d788) turns on Effect rules for mobile and locks the suggestion rules. Expect fork-code fixes on the next sync.
  • Label PR size fails on this PR with spawnSync git ENOBUFS, from the upstream .repos vendor diff (about 27,800 files). It is not required, and it runs from the base branch, so this PR cannot fix it.
  • Kiro is new. The fork's account switching and cloud box credential handoff make no decision for it yet.
  • Back up the PC's database before the first start. Expect migration 079 to slow that start, and the first event deletes a day later.

Merged and verified by Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

juliusmarminge and others added 30 commits November 2, 2026 18:30
…hind (pingdotgg#28373)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…otgg#28253)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…el bursts (pingdotgg#28236)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ger stay running (pingdotgg#28040)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…rade from 1.x (pingdotgg#27779)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…to run t3 service restart (pingdotgg#27660)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…g#25061)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…4803)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…adable .git/config (pingdotgg#23690)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…es (pingdotgg#23456)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…#23373)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…tance (pingdotgg#23198)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…turn absorbed its wake (pingdotgg#28010)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
…ory scan ends (pingdotgg#29535)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…tch (pingdotgg#29476)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…n starts (pingdotgg#28431)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ching origin (pingdotgg#27961)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…3804)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…g#23326)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Yash-Singh1 and others added 23 commits November 3, 2026 20:57
Add 8 px edge padding to usage breakdown tables shared by Cost and Tokens. Align thread status text and actions to a common baseline while keeping icons centered.

Validated with check:changed, CI, usage-table before/after browser captures, and actual ThreadNow component captures at 100% and 91% CSS zoom. No behavior or calculation changes.

Model: GPT 6.1 Sol. Harness: Codex in T3 Code.
…reenContent (pingdotgg#30500)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…tgg#30256)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: maria-rcks <maria@kuuro.net>
…f chat (pingdotgg#30257)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…#30501)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…#30523)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…intSigner (pingdotgg#30529)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…bile (pingdotgg#30540)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…he git-read timeout (pingdotgg#30554)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…otgg#30900)

Co-authored-by: Victor Romo <vic@Victors-MacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Seth Dixon <333797056+seth-dixon@users.noreply.github.com>
Merges 511 upstream commits from pingdotgg/t3code main (d897d3f..a21d788),
including event store pruning (pingdotgg#29806), so the event log stops growing without bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. 📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. labels Nov 5, 2026
The untyped Map made the cast to the registry service fail typecheck.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB −35 B (−0.7%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.3 KiB 1.2 KiB −35 B (−2.7%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.6 KiB 21.5 KiB −41 B (−0.2%) 24.4 KiB ✅
Codex Live turn messages 2 1 −1 (−50.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB −29 B (−0.6%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.3 KiB 1.2 KiB −29 B (−2.3%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB −41 B (−0.2%) 24.4 KiB ✅
Claude Live turn messages 2 1 −1 (−50.0%) 8 ✅

Baseline: cad73c7 · PR result: 5440425 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@andrewcai8

Copy link
Copy Markdown
Owner Author

PASS+NOTES for head 5440425 (independent Shipping verifier, fresh worktree)

Resolutions (git show --remerge-diff abfacdbea5, 75 files outside .repos/lockfile)

  • ProjectionStore takes upstream's perf(server): bound runtime recovery reads by thread ownership pingdotgg/t3code#29429 liveness clauses and the run-indexed streaming-message query. The other fork recovery code is intact.
  • server.ts keeps SpawnHost and adds NodeCrypto. DatabaseStorage is wired as upstream does it. ws.ts keeps EnvironmentControl and layerCloudWsRpc and takes upstream's readSettingsClient.
  • No fork-added line reads orchestration_events by sequence, so pruning only reaches upstream paths, and those have the pruned-through snapshot fallback.
  • Fork 009 drops ..._runs_delegated_completion_idx. It is byte-identical to upstream 079's ..._delegated_delivery_idx. No INDEXED BY names it. ForkMigrations.test.ts lists 77–79 and fork 9.

Tests (local)

  • vp test run on ProjectionMaintenance, FoundationPersistence, src/persistence, and ws.test.ts passed: 32 files, 140 passed, 1 skipped.
  • These include "discovers on the reader worker and deletes on the writer worker" and the five pruned-boundary resume tests.
  • Prune reads use NodeSqliteClient.readOnly. Deletes run inside sql.withTransaction on the writer.

Real-data boot on a .backup copy of ~/.t3-host/userdata/statev2.sqlite (1.2 GB, 210,969 events)

  • Before boot I sanitized the copy. I cleared schedules, outbox, launch workflows, auth and peer links, and marked the 1 running run interrupted.
  • The server ran with env -i, a fake HOME, and a PATH without provider CLIs.
  • Migrations: 077 0.28 s, 078 0.92 s, 079 0.43 s, fork 009 3 ms. It was listening about 3 s after the migrations. Recovery completed and launched no runs.
  • At 1 min the prune mark was recorded in orchestration_v2_projection_metadata (event-log-prune-mark, seq 218697). That pass took about 12 s.
  • I then backdated the mark on the copy and rebooted. event-log-pruned-through was published first. Then Compacted orchestration history logged deletedEventCount: 209302 in about 29 min (about 7K events/min at 10% duty), leaving 1,667 events and 708 MB reclaimable (auto_vacuum=2).
  • A third boot after pruning was healthy: 381 threads, /.well-known/t3/environment 200.
  • The only WARNs came from the sandbox: no gh credential, no cloud config. No ERROR lines.

CI: every required check is green. Label PR size failed with ENOBUFS, which is known and not required.

Notes

  • At the measured rate, 8.46M events on the PC is roughly 20 h of paced deletes after the first day. That is an extrapolation, not a measurement on that hardware.
  • 54 GB of file space comes back only if the PC's DB is auto_vacuum=incremental. Otherwise t3 doctor must VACUUM it. I did not check the PC.
  • Two event-loop stalls (5.9 s and 2.1 s) had low CPU and thousands of major page faults. This Mac is swapping heavily, so I attribute them to paging, not pruning (inferred).
  • A short-lived claude child spawned at boot and exited. No turn ran (likely a provider probe).
  • Not verified: the 54 GB DB itself, the box's 079 build time, real clients, cloud boxes.

🤖 Generated with Claude Code

@andrewcai8
andrewcai8 merged commit e911faa into main Nov 5, 2026
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.