T3 Code explained: the client controls work on another machine
Reading T3 Code source: RPC, EventSink and EffectWorker
Use three entry points to separate authorization, durable state and actual execution
What you will learn
- Start at the contract
- Read the transaction edge
- Finish at the worker
Before you start
- A disposable project on an environment host
- One authenticated supported provider
Turn a disposable trial into evidence before connecting important repositories
Key takeaways
- A typed RPC is not automatically authorized.
- EventSink keeps intent and projections consistent.
- A checkpoint is not an ordinary branch commit.
Start at the contract
`packages/contracts/src/rpc.ts` declares commands, queries and subscriptions crossing the client/server boundary. Check the command payload and advertised capabilities before following a new client feature.
A matching TypeScript type is not sufficient authorization. The environment-auth document says each RPC declares a required scope and server middleware checks it before the handler runs.
Read the transaction edge
`apps/server/src/orchestration-v2/EventSink.ts` records accepted receipts, events, projections and outbox entries together. The orchestrator itself decides changes without provider or filesystem work.
Inspect a command by tracing its decision through the sink and then its outbox effect. Treat retry behavior and old event replay as part of correctness, because environments persist history across upgrades.
Finish at the worker
`EffectWorker.ts` handles effects after commitment and returns results to orchestration. `CheckpointStore.ts` uses hidden Git refs to capture workspace state without adding a commit to the user branch.
A checkpoint revert also needs provider conversation coordination; unsupported rollback must be rejected before changing files. This review read fixed files and did not execute a checkpoint or inject a worker failure.
Decision guide
| Criterion | Option A | Option B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
Implementation steps
- 1
Find the RPC contract and required scope.
- 2
Trace one receipt through EventSink and outbox.
- 3
Follow one effect and its recovery condition.
Copy-ready example
rpc.ts -> scope check -> Orchestrator.ts
EventSink.ts -> event + receipt + outbox
EffectWorker.ts -> side effect -> resultFrequently asked questions
Does a hidden Git ref change my branch history?
The documented checkpoint path captures state without adding a commit to the user branch.
Was a worker crash tested for this article?
No. The article is a fixed-source walkthrough only.
Sources
- T3 Code / packages/contracts/src/rpc.tsSource checked 2026-10-04
- T3 Code / docs/internals/environment-auth.mdSource checked 2026-10-04
- T3 Code / apps/server/src/orchestration-v2/Orchestrator.tsSource checked 2026-10-04
- T3 Code / apps/server/src/orchestration-v2/EventSink.tsSource checked 2026-10-04
- T3 Code / apps/server/src/orchestration-v2/EffectWorker.tsSource checked 2026-10-04
- T3 Code / apps/server/src/checkpointing/CheckpointStore.tsSource checked 2026-10-04