Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

providers.md

145 lines9.6 KB

1# Provider constraints
2​
3Orchestration records intent and state without knowing which provider runs a thread. Provider
4protocols, account ownership, permissions, and capabilities belong at the
5[adapter boundary](../../apps/server/src/orchestration-v2/ProviderAdapter.ts). Normalize there
6instead of spreading provider checks through reactors and clients.
7​
8A driver kind identifies an integration; an instance identifies one configuration and account
9lifecycle. Route work by instance, so two accounts using the same driver do not share mutable
10session or catalog state.
11​
12## Process and account isolation
13​
14T3-managed OpenCode chat uses one server per thread. Its MCP registrations are directory-scoped, while
15T3's MCP connection is thread-scoped. Sharing a chat server between threads in one directory would
16let them replace each other's connection. Catalog and text-generation work can share the
17[instance-owned helper](../../apps/server/src/provider/OpenCodeServerOwner.ts), which closes
18after an idle period. External OpenCode servers remain externally owned and can require an
19external restart to pick up configuration changes.
20​
21OpenCode also stores persistent approval grants per directory. Automatic full-access replies use
22`once` so they cannot widen a supervised thread's permissions on a shared external server.
23See the [adapter](../../apps/server/src/orchestration-v2/Adapters/OpenCodeAdapterV2.ts).
24​
25Pi runs the user's own `pi` install in RPC mode and owns native extension, package, and project
26trust discovery. T3 injects only its namespaced MCP bridge, so a Pi session behaves as it does in
27the Pi TUI. Pi session files back native resume, rollback, and same-instance thread forks.
28Forks use Pi's CLI in the destination directory because RPC session switching retains the source
29session's cwd. Provider switches still use portable handoff summaries.
30See the [adapter](../../apps/server/src/orchestration-v2/Adapters/PiAdapterV2.ts).
31​
32Antigravity separates account profiles per instance while sharing installed executables across the
33environment. It forces file-based credential storage because the native macOS keychain entry would
34otherwise be shared across instances. The launch environment removes ambient Google credentials,
35so an instance cannot silently use another account or billing project. The agent also resolves
36its user-global skill directories under that profile, so the profile links those two directories
37back to the user's real `~/.gemini`; MCP servers, hooks, and rules there stay out of the profile.
38See [profile isolation](../../apps/server/src/provider/antigravityAuthSupport.ts).
39​
40The [Antigravity installer](../../apps/server/src/provider/AntigravityInstallation.ts) outlives
41client connections and provider-instance rebuilds. Releases are immutable, with an atomic pointer
42selecting the version for new processes. Running processes hold leases on their version. Updates
43and removal must respect those leases instead of replacing executables under a running agent.
44​
45## Setup must not happen as a health-check side effect
46​
47Opening a provider session can start MCP servers, run hooks, or launch a login browser.
48[Grok probes](../../apps/server/src/provider/Layers/GrokProvider.ts) avoid authentication and
49session creation for this reason. Antigravity likewise reserves authenticated catalog sessions for
50explicit setup or model refresh; background checks use initialization only.
51​
52[Antigravity sign-in](../../apps/server/src/provider/AntigravityAuth.ts) belongs to the initiating
53T3 auth session. The client carries the return URL back to the environment because the provider's
54loopback listener may be on another machine. Forward only the callback for the owned pending flow;
55a successful callback HTTP request is not proof that provider authentication finished. The native
56process owns token exchange and storage.
57​
58Managed ChatGPT sign-in for a remote environment can finish on a local primary. The
59[primary handoff](../../apps/server/src/provider/CodexChatGptHandoff.ts) uses an ephemeral
60credential store and the destination's environment ID. It exchanges and verifies the code before
61transferring the issued client registration and tokens. Only the destination persists and refreshes
62that session; retaining a primary refresh session would race refresh-token rotation. Without a local
63primary, the client uses the remote callback completion flow.
64​
65Antigravity sign-out closes admission to new processes and stops existing processes before clearing account
66metadata. Otherwise a helper or resumed session could retain the old account. Cached model lists
67do not establish current access, and an authoritative empty catalog must clear the old list.
68​
69Antigravity text-generation helpers deny tool requests, but native hooks and MCP configuration can
70run before the prompt. They reject profiles with such configuration before launch. Prompt
71instructions and tool denial do not create a native sandbox.
72See [helper constraints](../../apps/server/src/textGeneration/AntigravityTextGeneration.ts).
73​
74## Provider updates run only through the owning installer
75​
76A one-click update is offered only when the resolved executable's path proves which installer owns
77it. Homebrew and npm are proven by the real path (symlinks followed): a versioned keg or cask under
78`brew --prefix`, or `<prefix>/lib/node_modules/<pkg>/` (Windows: the shim beside `node_modules`).
79Native installer layouts and the global bin directories of pnpm, Bun, and Vite+ may match on either
80the resolved path or its real target, since those installers place real files or their own symlinks
81there. Cursor and Grok are the exception: their only updater is the CLI itself, which detects its
82own installer, so any resolved executable runs `<binary> update`. Anything unproven stays
83manual-only but still reports the version gap. npm updates pin
84`--prefix` because the `npm` on `PATH` can belong to a different Node than the one that owns the
85provider. Homebrew
86compares against `brew info` since casks trail npm by hours; native installs share npm's version
87train, so the registry stays authoritative for them.
88See the [resolver](../../apps/server/src/provider/providerMaintenance.ts).
89​
90Ownership is cached per instance and re-read immediately before an update runs. The
91[runner](../../apps/server/src/provider/providerMaintenanceRunner.ts) refuses when the lock key
92changed since the advisory, and reports success only when the refreshed provider is still installed
93with a readable, current version.
94​
95## Protocol traps
96​
97Codex async questions arrive as notifications and are answered with a new user message. There is
98no pending RPC response to send. The
99[adapter](../../apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts) persists them as
100`user_input_request` turn items and runtime requests with `responseCapability: { type: "message" }`.
101Their execution nodes do not block the run. Web, desktop, and mobile use their normal question
102panels, and requests remain pending after a turn finishes, a provider exits, or the server restarts.
103​
104`runtime-request.respond` reads the persisted request and question item, validates required
105answers, and commits the resolution and a user message in one transaction. Repeating the same
106command returns its receipt without posting the answer twice. The normal message path starts or
107resumes a run, queues behind active work, or steers when the adapter supports it. Blocking questions
108retain the provider's live response path. Do not infer that a request has disappeared merely because
109it is outside the recent history window.
110​
111Capabilities must describe what the provider can actually do. Antigravity can capture workspace
112checkpoints but cannot roll back its conversation. The [checkpoint boundary](./overview.md#turn-completion-and-checkpoints)
113therefore rejects revert before touching files. Native permission and question option IDs must
114also survive normalization; a display label is not necessarily a valid reply.
115​
116## Attachments and stored history
117​
118Attachments live outside the project workspace. The
119[attachment boundary](../../apps/server/src/orchestration-v2/AttachmentClaims.ts) validates and claims
120uploads for a thread; adapters choose native input formats for those environment-local files.
121A path in the prompt does not grant filesystem access. Keep provider sandbox and approval rules
122in force; copying uploads into the project to bypass them changes that boundary.
123​
124File attachments introduced a replay compatibility limit. Image-only clients cannot decode
125file-bearing messages, and an image-only server can fail the entire environment's startup when
126replaying one such event. Rollouts and downgrades must account for persisted history as well as
127current client support.
128​
129## Provider diagnostics
130​
131Native event logs retain lifecycle events, responses, and failures. Token deltas and duplicate raw
132frames are filtered before adapters copy or redact payloads. The filter accepts both legacy native
133events and v2 protocol envelopes; decode failures remain visible through diagnostic frames.
134​
135Log payloads have a 64 KiB encoded budget. Large or deeply nested payloads become structural
136summaries that retain routing identifiers, methods, status, and error fields. Traversal is bounded
137before redaction and serialization, so logging a large response does not require several full
138copies. These limits apply to diagnostics; provider event handling is unchanged.
139​
140Codex resumes with metadata-only reads when it needs a thread's identity and update time. Its
141initialization capabilities opt out of `turn/diff/updated`: T3 derives diffs from checkpoints.
142The logger filters those notifications before traversal when an older provider still sends them.
143​
144Model classification has its own [manifest constraints](./model-manifest.md). Assistant-reference
145handling is documented under [citations](./assistant-citations.md).