Skip to content

chore(sync): rebase fork onto upstream v0.1.12-nightly.20261123.5138 - #74

Merged
falistos merged 0 commit into
mainfrom
sync/v0.1.12-nightly.20261123.5138
Nov 23, 2026
Merged

falistos merged 0 commit into
mainfrom
sync/v0.1.12-nightly.20261123.5138

Conversation

@falistos

Copy link
Copy Markdown

Rebases the fork's commits onto upstream nightly v0.1.12-nightly.20261123.5138 (1368854828), per FORK.md step 2. No merge commit, no sync-only commit.

  • Rebased from fork/main a82c6138bd (5124 + 46 commits). fork/main then moved to eba3b08b8b (docs: fork syncs land on main through fork-land, FORK.md only); that commit was replayed on top, so this head is <T> + 47 linear commits and covers fork/main eba3b08b8b.
  • Old base 2808e878de (= tag 5124 = git merge-base eba3b08b8b <T>).
  • Dropped commits: none.
  • Generated files: upstream migration manifest unchanged (upstream's head is still 110_Workflows); agentContextBudget.json delta 0 (the budget test passes on this head). No fixup needed.

Conflicted commits

Commit (new) Files Resolution
748e9e6545 feat(server): resume runs that failed on transient provider errors apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts Keep the fork's failure = { ...failure, retryable: codexFailureRetryable(...) }, then upstream's const failureItemId = codexFailureItemId(input.context).
526330ddf0 feat(server): give each thread its own temp directory and an optional agent memory ceiling apps/server/src/process/agentScope.ts Upstream pingdotgg#28106's absolute executable path is computed first, the fork's withThreadTemp takes command: executable, and the systemd branch returns agentScopeCommand({ ...launch, scope: systemdScope }).
2892a04920 fix(server): delegated children hold their completion on background commands they left running docs/orchestration-v2/orchestrator-mcp-server.md (deleted upstream in pingdotgg#41330, modified by the fork) D1: keep the file with the fork's content: it documents fork-only MCP behaviour. This commit now recreates the whole file (644 lines); the later fork commits ed27084f81, 7365343189, a55aaca00d, c71dfce223 apply their edits on top unchanged.

The six other ! entries in the range-diff (c3aa3f51ce, a55aaca00d, 5b0c2719dc, 058ff7bfc1, dfff6e336e, b55a4fcee1) did not conflict: their added and removed lines are identical, only the surrounding upstream context moved.

The tree at this head equals the earlier verified merge resolution of the same tag, apart from the fork's own later FORK.md / test-comment commits.

What to review: fork commits in core paths that upstream also changed

748e9e6545, 526330ddf0, 2892a04920 (conflicted, above), plus f6762928a0, 3b4dce371e, eb4b3ea860, 74306b23c6, c7a2349f00, cd8d23fa75, ac6d8dd785, b4c57c6975, c3aa3f51ce, ddbc2cab49, ed27084f81, c714c28cff, 4fd39380ef, 7365343189, a55aaca00d, c71dfce223, c9aefd2dab, 5b0c2719dc, 09f0b651f8, 058ff7bfc1, be9b4b85a5 (files in orchestration-v2/, packages/contracts/, packages/provider-* that upstream 5124..5138 also changed; no overlap in peer/ or persistence/).

Checks (clean env: env -i, Node 26.13.1, TMPDIR outside tmpfs, T3_UPSTREAM_REF=<T>)

Run on 8b39d8981c; the head adds only the FORK.md commit (vp fmt --check FORK.md passes).

  • vp check 0 · vp run i18n:check 0 · vp run typecheck 0 · vp test run in every package with tests: 0 except below.
  • Red here and also red on <T> and on old fork/main (same tests):
    • apps/server (15 failed / 9939 passed / 16 skipped): CommandOutputHub ×2, orchestration-v2/http ×1 (fork-only, red on old fork/main), Antigravity ×1, CodexChatGptAuth ×2, CodexManagedRuntime ×4, GrokProvider ×5 (red on <T>).
    • apps/desktop: browser-secret-native (libsecret missing on the host).
    • packages/provider-acp-registry driver.test.ts ×1, packages/ssh tunnel.test.ts ×1.
    • apps/web *.renders.tsx ×16 (T3CODE_RENDER_REPORT_DIR is not set under a direct vp test run).
    • vp run knip exit 1: same categories; unused exports here are exactly the union of <T>'s and old fork/main's.
  • Flaky under full-suite load, green when rerun on this head: provider-opencode usage.test.ts, web FilePreviewPanel.browser.test.tsx ×2.

Database migration

A sqlite3 -readonly ".backup" copy of dev2's state database, migrated with this build: ledger = upstream's 110 numbered migrations (1_OrchestrationEvents … 110_Workflows), both fork indexes present, fork columns present, quick_check ok. (The copy was already at 110, so the run was a no-op.)

git range-diff 2808e878de..eba3b08b8b v0.1.12-nightly.20261123.5138..sync/v0.1.12-nightly.20261123.5138
 1:  5ec36067d3 =  1:  f6762928a0 fix(server): treat a delegated task like a subagent for background work
 2:  077aae36af =  2:  3b4dce371e fix(server): delegated tasks notify only when they wait on the user
 3:  50cf4cd75f =  3:  483178485e fix(client): pickers and announcer leave out delegated tasks shown under a parent
 4:  934c6cf8c7 =  4:  febe93f32d feat(client): group delegated tasks under their parent when its machine is not connected
 5:  178674019f =  5:  88f1190493 fix(client): Settled count leaves out tasks shown under their parent
 6:  25f79d0d81 =  6:  eb4b3ea860 fix(server): a delegated task settles with its parent across machines
 7:  f4ea1aeb55 =  7:  0da99c2dfa fix(mobile): Personal Team iOS builds drop push and associated domains entitlements
 8:  949d9ddfa7 =  8:  ffd6f79300 fix(server): the parent-done route refuses read-only links and renews only accepted ones
 9:  10c2d1d4f6 =  9:  74306b23c6 fix(server): a parent's stop, archive or delete reaches its tasks in linked environments
10:  5cdc2803d6 = 10:  c7a2349f00 fix(server): Codex full-access agent threads no longer ask command approvals
11:  25ee597426 = 11:  cd8d23fa75 fix(server): scheduled Codex full-access runs no longer ask command approvals
12:  9b7f7fc598 = 12:  d0be4903e9 feat(server): dispatch tools refuse unfilled briefs and misplaced model settings
13:  64796fa1da ! 13:  748e9e6545 feat(server): resume runs that failed on transient provider errors
    @@ apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts: export const makeCo
     +                  retry?.errorInfo,
     +                ]),
     +              };
    +               const failureItemId = codexFailureItemId(input.context);
                    return {
                      type: "turn.terminal",
    -                 driver: CODEX_PROVIDER,
     @@ apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts: export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
                        nativeCode: state.nativeCode,
                        failure: {
14:  491165a009 = 14:  ac6d8dd785 feat: project standing instructions and role models for delegated tasks
15:  2007b4c6c5 ! 15:  526330ddf0 feat(server): give each thread its own temp directory and an optional agent memory ceiling
    @@ apps/server/src/process/agentScope.test.ts: describe("AgentScope service", () =>
     -          expect(yield* scope.oomKilled("a")).toBe(true);
     +          expect(yield* scope.oomKilled("a")).toStrictEqual({ memoryMaxGiB: null });
      
    -           const codex = yield* launchCodex(scope, "a");
    -           expect(codex.args).toContain("--property=OOMPolicy=continue");
    +           const executable = String(agent.args.at(-1));
    +           const codex = yield* launchCodex(scope, "a", {
     @@ apps/server/src/process/agentScope.test.ts: describe("AgentScope service", () => {
                yield* scope.wrap({ command: "agent", args: [], name: "t", threadId: `other-${index}` });
              }
    @@ apps/server/src/process/agentScope.ts: export const make = Effect.gen(function*
          }) {
            const resolved = yield* resolve(command, env ?? hostEnvironment);
            if (resolved === null) return { command, args };
    -+      const launch = yield* withThreadTemp({ command: resolved, args, threadId, env, shared });
    ++      // systemd-run does not search the caller's cwd, so anchor a relative path to it. Keep ".."
    ++      // as spelled: collapsing it would skip a symlinked parent directory.
    ++      const executable = path.isAbsolute(resolved)
    ++        ? resolved
    ++        : `${process.cwd()}${path.sep}${resolved}`;
    ++      const launch = yield* withThreadTemp({ command: executable, args, threadId, env, shared });
            const scope = yield* systemd;
     -      if (scope === undefined) return agentScopeCommand({ command: resolved, args });
     +      if (scope === undefined) return agentScopeCommand(launch);
    @@ apps/server/src/process/agentScope.ts: export const make = Effect.gen(function*
     +            : [`--property=MemoryMax=${memoryMaxGiB * GiB}`, "--property=MemorySwapMax=0"]),
              ],
            };
    --      return { ...agentScopeCommand({ command: resolved, args, scope: systemdScope }), unit };
    +-      // systemd-run does not search the caller's cwd, so anchor a relative path to it. Keep ".."
    +-      // as spelled: collapsing it would skip a symlinked parent directory.
    +-      const executable = path.isAbsolute(resolved)
    +-        ? resolved
    +-        : `${process.cwd()}${path.sep}${resolved}`;
    +-      return {
    +-        ...agentScopeCommand({ command: executable, args, scope: systemdScope }),
    +-        unit,
    +-      };
     +      return { ...agentScopeCommand({ ...launch, scope: systemdScope }), unit };
          }),
     +    threadTemp,
16:  a3693a7b44 = 16:  b4c57c6975 feat(server): delegate_task runs a task in another project here and reports back
17:  7bc4dac0d4 ! 17:  c3aa3f51ce fix: transient retries count across the continuation chain; banner names environments
    @@ packages/provider-core/src/server/failure.ts: export function makeProviderFailur
     +}
     +
      export function makeProviderRetryTurnItem(input: {
    +   readonly id?: TurnItemId;
        readonly driver: ProviderDriverKind;
    -   readonly threadId: ThreadId;
18:  22da0c14b0 = 18:  ddbc2cab49 fix(server): a declined transient try no longer blocks its run's continuation
19:  d9ce694f7a = 19:  bb0ae4f776 feat(mobile): edit standing instructions, provider error resume and agent memory ceiling
20:  313e7e87f7 ! 20:  2892a04920 fix(server): delegated children hold their completion on background commands they left running
    @@ apps/server/src/provider/agentContextBudget.json
     +  "mcpToolListJsonBytes": 58768
      }
     
    - ## docs/orchestration-v2/orchestrator-mcp-server.md ##
    -@@ docs/orchestration-v2/orchestrator-mcp-server.md: run. `status: "starting"` means the child's provider has not started its turn
    - yet, so a task that stays there has not begun work. A task in a linked
    - environment reads its run's status there for this. `workState` distinguishes
    - active work, a finished turn waiting for children, and an available result. The
    --task remains nonterminal until its known work finishes. Its published `summary`
    + ## docs/orchestration-v2/orchestrator-mcp-server.md (new) ##
    +@@
    ++# Orchestrator MCP Server
    ++
    ++## Purpose
    ++
    ++T3 exposes V2 orchestration through its app-owned MCP endpoint. A provider
    ++agent can use this endpoint to:
    ++
    ++- create an app-owned sub-agent on any supported provider instance;
    ++- wait for or poll the sub-agent's durable result;
    ++- cancel an active delegated task; and
    ++- create one or more ordinary top-level T3 threads;
    ++- list a project's threads and incrementally read any thread;
    ++- rename threads, regenerate titles, and link or unlink pull requests;
    ++- send or steer follow-up messages;
    ++- wait for or interrupt ordinary thread runs; and
    ++- schedule recurring work that runs without an active turn.
    ++
    ++These are T3 orchestration operations, not provider-native sub-agent APIs.
    ++Delegated tasks always create a T3 child thread and run. The child receives
    ++only the supplied task prompt, plus an optional role instruction supplied in
    ++the same tool call. Parent conversation history is not copied into the child.
    ++
    ++`ThreadManagementService` is the shared server application boundary for V2
    ++WebSocket commands and MCP. It owns thread lookup, listing, send-mode
    ++selection, durable send postconditions, wait polling, and interrupt selection;
    ++`OrchestratorV2` remains the lower-level command/event processor. Transport
    ++adapters only authenticate, resolve transport-specific inputs, and shape
    ++responses.
    ++
    ++## Transport And Authentication
    ++
    ++The orchestration tools share the existing authenticated HTTP MCP endpoint:
    ++
    ++```text
    ++http://127.0.0.1:<server-port>/mcp
    ++```
    ++
    ++The provider-visible server key is `t3-code`. The endpoint registers both the
    ++preview toolkit and the orchestration toolkit.
    ++
    ++Before `ProviderSessionManager` opens a new V2 provider session, it asks
    ++`McpSessionRegistry` for a credential scoped to:
    ++
    ++- the T3 environment;
    ++- the parent T3 thread;
    ++- the concrete provider instance; and
    ++- the provider session.
    ++
    ++The credential grants `preview` and `orchestration` capabilities. Credentials
    ++expire after a maximum lifetime, expire when idle, and are revoked when the
    ++provider session is released. The raw token is not persisted in orchestration
    ++state.
    ++
    ++The MCP HTTP server resolves the bearer token and supplies the resulting
    ++`McpInvocationScope` to tool handlers. Orchestration handlers additionally
    ++check the `orchestration` capability before reading or mutating state.
    ++
    ++## Provider Injection
    ++
    ++### Codex V2
    ++
    ++Codex gets T3's MCP server in each thread's `thread/start`, `thread/resume`,
    ++and `thread/fork` config, with the provider-session token in an
    ++`Authorization` header. The same server is registered twice:
    ++
    ++- `t3-code`: every tool except `t3_thread_wait` and `delegate_task`.
    ++- `t3-code-direct`: only `t3_thread_wait` and `delegate_task`, with
    ++  `omit_tools_from = ["code_mode", "deferred"]`.
    ++
    ++Code Mode yields a script after about 30 seconds, so the model polls a blocking
    ++`t3_thread_wait` or `delegate_task` with `mode: "wait"`, resending its context
    ++on each poll. The second entry makes both direct tool calls, like Codex's own
    ++wait tools. Codex reports calls as `<server>.<tool>`, so
    ++`packages/shared/src/t3McpToolPresentation.ts` must resolve both server names.
    ++Tool display and pending-work detection depend on it.
    ++
    ++### Claude Agent SDK V2
    ++
    ++Claude receives an HTTP MCP server in its query options:
    ++
    ++```ts
    ++{
    ++  mcpServers: {
    ++    "t3-code": {
    ++      type: "http",
    ++      url: "http://127.0.0.1:<port>/mcp",
    ++      headers: {
    ++        Authorization: "Bearer <provider-session-token>",
    ++      },
    ++    },
    ++  },
    ++  allowedTools: [
    ++    // existing allowed tools
    ++    "mcp__t3-code__*",
    ++  ],
    ++}
    ++```
    ++
    ++The adapter logs only whether MCP configuration exists; it does not log the
    ++server headers or token.
    ++
    ++### Cursor Agent SDK V2
    ++
    ++Cursor receives the same authenticated HTTP MCP endpoint through the SDK's
    ++`mcpServers` on `Agent.create` / `Agent.resume` and each `send`. With
    ++`@cursor/sdk` 1.0.39+, send-level servers replace only the create-time inline
    ++set; ambient servers from `settingSources` (`project`, `user`, `team`, `mdm`,
    ++`plugins`) stay available. The adapter passes the authorization header to the
    ++SDK but projects only redacted option metadata into protocol diagnostics.
    ++
    ++### Grok ACP V2
    ++
    ++Grok receives the authenticated HTTP MCP endpoint through the ACP
    ++`session/new`, `session/load`, and `session/fork` `mcpServers` field. The shared
    ++ACP adapter owns standard protocol behavior; the Grok flavor adds xAI extension
    ++requests such as structured user questions.
    ++
    ++ACP does not define native subagents or active steering. Grok therefore uses
    ++orchestrator-owned child threads and implements steering through
    ++cancel-and-restart. Its current driver also lacks `session/fork`, so app forks
    ++use portable context transfer. These are orchestrator policies, not
    ++provider-specific MCP tools.
    ++
    ++### ACP Registry V2
    ++
    ++The `acpRegistry` driver is the generic flavor of the same shared ACP adapter.
    ++Each provider instance names an agent from the official ACP Registry. Settings
    ++searches the registry through the connected server, then prepares a compatible
    ++distribution before persisting the provider instance. Binary distributions use
    ++a managed, versioned cache; declared checksums are verified when present.
    ++Version-pinned `npx` packages install globally through `npm`; `uvx` packages use
    ++`uv tool install`. ACP launches the resulting global command directly, so the
    ++same command is available for terminal authentication. A local executable may
    ++override the installed command without changing the registry-declared arguments
    ++or environment.
    ++
    ++Search, preparation, provider status, and session startup share one
    ++server-scoped catalog service. This keeps platform selection and registry
    ++validation identical across settings and runtime use. Catalog inspection never
    ++starts an ACP process, probes models, or performs authentication. The managed
    ++provider snapshot creates a disposable `session/new` through the normal provider
    ++refresh lifecycle, using success as the authentication-readiness proof and
    ++projecting advertised models into the snapshot. Terminal-only login remains a
    ++manual operation on the connected server.
    ++
    ++Capabilities such as session loading, session forking, models, modes, and MCP
    ++transport are enabled only when the selected agent advertises them. Missing
    ++features degrade through V2 policy: steering uses interrupt-and-restart,
    ++forking uses portable context when native `session/fork` is unavailable, and
    ++subagents use orchestrator-owned child threads. Registry agents do not receive
    ++provider-specific extensions; those remain in flavors such as Grok.
    ++
    ++### Pi V2
    ++
    ++T3 keeps a provider-session HTTP bridge even when Pi supports native MCP.
    ++`mcp.json` entries override native registrations, and native MCP's default
    ++60-second request timeout can interrupt long-running T3 tools. The bridge owns
    ++the injected endpoint and credential and forwards Pi's cancellation signal.
    ++
    ++When a provider session credential exists, the adapter writes a T3-owned
    ++extension into the server cache and spawns
    ++`pi --mode rpc --extension <cache>/pi-t3-mcp-extension.ts` with:
    ++
    ++```text
    ++T3_MCP_URL=http://127.0.0.1:<port>/mcp
    ++T3_MCP_BEARER_TOKEN=<provider-session-token>
    ++```
    ++
    ++The extension preserves public names under `mcp__t3-code__` for saved loadouts
    ++and tool selectors. Modern Pi also receives `mcp__t3_code__` aliases, Pi's own
    ++name for the server, which reserve it against configured MCP servers. They are
    ++`model-only` and hide their own declarations, so the model can call them without
    ++added declarations, search results, or codemode entries. An alias follows its
    ++public tool: dropped when that tool is excluded, and off while a direct one is
    ++off. Pi's `hidden` exposure would make them unreachable. On Pi 0.99+,
    ++`orchestrator_capabilities`, `delegate_task`, and `task_status` remain directly
    ++available; optional tools are discovered through Pi's builtin `tool_search`.
    ++On older Pi or without builtin search, all tools remain directly available.
    ++The bridge calls the original MCP tool name over HTTP. Follow-up requests send
    ++`mcp-protocol-version: 2025-06-18`; Effect's MCP transport returns 400
    ++without it. The first turn of a session also receives the shared T3
    ++orchestration instructions.
    ++
    ++Pi keeps ownership of native extension discovery. T3 does not replace Pi's
    ++`subagent` tool or reproduce Pi's package and project-trust loader. Durable
    ++delegation goes through the namespaced T3 MCP `delegate_task` tool and the
    ++shared orchestration child-thread lifecycle. When Pi's example `subagent`
    ++extension is installed, the adapter observes its documented `details.results`
    ++shape and projects task cards with no child thread id. Unknown result shapes
    ++remain ordinary dynamic tool output.
    ++
    ++### Provider Support
    ++
    ++A provider instance can run child tasks when its live `ProviderInstance`
    ++exposes a V2 `orchestrationAdapter` — the same registration the orchestrator
    ++resolves when a `delegated_task.request` executes. That covers Codex, Claude
    ++Agent SDK, Cursor Agent SDK, Grok, generic registry agents over ACP, OpenCode,
    ++OpenCode 2, Pi, Antigravity, and any future driver that builds an adapter.
    ++Capability discovery still reports other registered provider instances, but
    ++marks them unavailable for orchestration when no adapter resolves. This keeps
    ++provider selection model-visible without allowing a request that cannot run.
    ++
    ++## Tool Surface
    ++
    ++`OrchestratorToolkit` in
    ++[`toolkits/orchestrator/tools.ts`](../../apps/server/src/mcp/toolkits/orchestrator/tools.ts)
    ++is the authoritative list of orchestration tools. The sections below cover
    ++delegation and thread tools. `t3_thread_launch` is documented with them but
    ++registered by the project toolkit in
    ++[`toolkits/project/tools.ts`](../../apps/server/src/mcp/toolkits/project/tools.ts).
    ++
    ++### `orchestrator_capabilities`
    ++
    ++Returns:
    ++
    ++- the inherited provider instance and model;
    ++- the parent runtime and interaction modes;
    ++- registered provider instances and advertised models;
    ++- whether each provider can run a child task; and
    ++- feature flags for polling, cancellation, and batch thread creation.
    ++
    ++Unavailable providers include model-visible constraints such as missing V2
    ++adapter support, disabled state, missing executable, or missing authentication.
    ++
    ++The model list is short on purpose: catalogs such as OpenCode can hold hundreds
    ++of models, and every call lands in the agent's context. Each provider lists
    ++custom, favorite, and the caller's own models, plus all current (non-legacy)
    ++models for Codex, Claude, Muse, and Grok, or the first 8 current models in the
    ++user's model order for other providers. `omittedModels` counts the rest, and the
    ++`search` input finds them, legacy models included. `delegate_task` still accepts
    ++any catalog model.
    ++
    ++### `delegate_task`
    ++
    ++Creates a T3-owned child thread and immediately dispatches the supplied task
    ++prompt.
    ++
    ++The [shared contract](../../packages/contracts/src/orchestratorMcp.ts) is authoritative for
    ++inputs and results, including target options and linked-environment fields.
    ++
    ++```ts
    ++import type {
    ++  OrchestratorMcpDelegateTaskInput as DelegateTaskInput,
    ++  OrchestratorMcpDelegateTaskResult as DelegateTaskResult,
    ++} from "@t3tools/contracts";
    ++```
    ++
    ++For local delegation, provider, model, runtime mode, and interaction mode inherit
    ++from the parent when omitted. A driver-only target inherits the parent's provider instance
    ++when it can run child tasks, and otherwise selects an available instance of
    ++that driver; an explicit `providerInstanceId` is honored exactly and fails
    ++when unavailable. Selecting a different provider without a model uses that
    ++provider's first advertised model.
    ++
    ++Set `target.options` using the options returned by `orchestrator_capabilities`, such as
    ++`{effort: "max"}`. Supplied values override inherited selections; `{}` or `[]` clears them.
    ++For local delegation, use `isolation: "worktree"` for a separate prepared checkout from
    ++the parent's commit; the default `"shared"` uses the parent's checkout. Uncommitted parent
    ++edits are not copied. A linked-environment target (`target.environmentId`) runs in the remote
    ++project's checkout and rejects worktree isolation. To launch an isolated thread there, use
    ++`t3_thread_launch` with `environmentId` and a worktree `workspaceStrategy`.
    ++
    ++A provider runs a runtime mode it does not offer as `approval-required`, so a
    ++child would ask for approval on every command. `orchestrator_capabilities`
    ++lists `runtimeModes` only for a provider that offers some of the modes, and
    ++omits it for a provider that offers all of them. When the target lists
    ++`runtimeModes`, an explicit `runtimeMode` outside that list is refused, and an
    ++inherited mode steps down to the broadest mode the target offers.
    ++
    ++Each independent delegated review round uses a new `delegate_task` call with the
    ++original brief, prior findings, responses, and unresolved objections. Track each
    ++round by its own `taskId` and use a distinct `clientRequestId` per round, stable
    ++across retries of that round.
    ++A follow-up that needs the same child's conversation goes through `t3_thread_send`
    ++on its `childThreadId`. After the original task completes, that follow-up runs as a
    ++fresh task in the child thread; it does not reopen the completed task or change its
    ++published result.
    ++
    ++Delegation requires an active parent run owned by the MCP credential's
    ++provider session. The request becomes the V2 command
    ++`delegated_task.request`.
    ++
    ++`mode: "async"` returns the current durable state immediately.
    ++`mode: "wait"` waits for the task result, including nested work and completion follow-ups, or until
    ++the timeout expires. A wait timeout does not cancel the child; the result sets
    ++`waitTimedOut: true`. When the result includes `next`, completion wakes the parent:
    ++do not wait on the task or poll it; continue other work, and end the turn when none is
    ++left. A pending blocking question also ends the wait with `hasPendingQuestion: true` and
    ++`waitTimedOut: false`.
    ++If `hasPendingQuestion`, pass `threadId=childThreadId` to `t3_pending_request` with
    ++action `list`, `read` (with `requestId`), or `respond`, or ask the user; the task's completion still wakes this thread. A pending live approval for the
    ++task's own unfinished work also ends the wait. Its identity appears in `pendingApproval`;
    ++it grants no approval authority. Read the fresh full request in the child thread before
    ++responding, since the durable record can outlive its provider callback. Async questions
    ++do not end the wait.
    ++
    ++### `task_status`
    ++
    ++Reads a delegated task from the parent thread's durable projection. A task ID
    ++from another parent thread is rejected. `childRunId` identifies the original
    ++run. `status: "starting"` means the child's provider has not started its turn
    ++yet, so a task that stays there has not begun work. A task in a linked
    ++environment reads its run's status there for this. `workState` distinguishes
    ++active work, a finished turn waiting for children, and an available result. The
     +task remains nonterminal until its known work finishes. That work includes
     +background commands the child did not mark awaited, unlike on a top-level
     +thread, but only for 15 minutes after its turn ended; a result sent past that
     +lists the commands still running. Its published `summary`
    - and result transfer then remain stable across later follow-ups.
    - `hasPendingChildRuns` reports later queued or executing turns; `latestTerminal*`
    - exposes later executed, non-monitor results without replacing the published task
    ++and result transfer then remain stable across later follow-ups.
    ++`hasPendingChildRuns` reports later queued or executing turns; `latestTerminal*`
    ++exposes later executed, non-monitor results without replacing the published task
    ++result.
    ++
    ++### `task_cancel`
    ++
    ++Stops every task the child delegated, then the child thread with the internal
    ++`thread.stop` command, cancels the task's own queued turn, and disposes automatic
    ++parent delivery. Like a user Stop, `thread.stop` interrupts the running turn, holds
    ++queued turns, and ends pull request watches. The task's own queued turn is cancelled
    ++even if Stop already held it, so a task that is only queued can be cancelled; other
    ++queued turns in the child stay held for Resume. A nonterminal task is rejected when
    ++it has no interruptible run, no queued turn of its own, and its finished turn no
    ++longer waits on background work or delegated tasks. Once a cancelled task's turn
    ++ends, a completed result settles as `interrupted` and a failed one stays `failed`. A
    ++terminal task returns its existing status, and its child thread still stops,
    ++including later runs and watch wakes. In both cases, a follow-up that lost its child
    ++run but still shows as running on the parent is cancelled there and reported as
    ++`cancelled`. Published task results remain available. It accepts an
    ++optional cancellation reason.
    ++
    ++### `create_threads`
    ++
    ++Creates between one and twenty ordinary top-level T3 threads:
    ++
    ++```ts
    ++import type { OrchestratorMcpCreateThreadsInput as CreateThreadsInput } from "@t3tools/contracts";
    ++```
    ++
    ++Each entry independently resolves provider, model, and modes. The new threads
    ++inherit the parent's project, branch, and worktree path, but they have no
    ++sub-agent lineage. Entries with a prompt immediately dispatch a run; entries
    ++without a prompt remain idle. `create_threads` is local-only: `target.environmentId` and
    ++`target.projectId` are ignored even though the shared target contract accepts them. Use
    ++`t3_thread_launch` with `environmentId` and `projectId` to select another environment or project.
    ++
    ++### `t3_thread_launch`
    ++
    ++Launches one ordinary top-level thread through the app's launch service. Use an
    ++explicit `workspaceStrategy` to create a new worktree (`worktree` with `baseRef`),
    ++attach an existing checkout (`existing_worktree` with `worktreePath`), or use the
    ++project root (`root`, also the default). The thread is bound to that workspace
    ++before the agent starts. Creating a worktree in the task prompt does not update
    ++this binding.
    ++
    ++Pass the task in `message`. Project, model, and modes inherit when omitted;
    ++workspace does not. `scratch: true` launches without a project, in a folder of
    ++its own under the environment's Scratch project. A new worktree with `startFromOrigin` omitted follows the new-worktree setting. For stacked PRs, use the parent branch as `baseRef` with
    ++`startFromOrigin: false`. The new thread may not run with broader runtime or
    ++interaction modes than the caller. As for `delegate_task`, a runtime mode the
    ++provider does not offer is refused, and an inherited or default one steps down
    ++to the broadest mode it offers. `create_threads` remains the batch option for a
    ++shared checkout.
    ++
    ++Set `clientRequestId` on the initial launch to make it retryable. After an error
    ++or a lost reply, resend the same request with the same key from the same
    ++provider session. This reuses any thread already created by that request. If the
    ++initial request had no key, check for the thread before launching again.
    ++
    ++### `t3_thread_list`
    ++
    ++Lists durable thread shells in one project, newest first: `projectId` when
    ++given, else the calling thread's project. Callers can filter by title, run
    ++status, and whether app-owned sub-agent threads are included. Results are
    ++bounded and offset-paginated. Deleted threads are never listed.
    ++
    ++### `t3_thread_read`
    ++
    ++Reads the durable state, recent runs, and visible timeline of any thread in
    ++the environment by thread ID. A deleted thread returns `thread_not_found`. The
    ++default `messages` view returns user messages, assistant
    ++messages, and proposed plans. The `activity` view also returns summarized tool,
    ++reasoning, checkpoint, handoff, and runtime-request items. Large item text is
    ++bounded and reports whether it was truncated. An agent in a T3 thread that
    ++reads without a cursor gets the newest items, and `beforePosition=earlierPosition`
    ++reads older ones. Client callers (the CLI, linked environments, outside MCP
    ++clients) start at the oldest item instead, because the CLI and linked
    ++environments on older versions read that way and follow only `hasMore`.
    ++`afterPosition=-1` starts any read at the oldest item, and
    ++`afterPosition=nextPosition` reads newer items. The server stops adding items once the result reaches about 30,000 characters and
    ++reports the rest through `earlierPosition` or `hasMore`. Claude Code saves MCP
    ++results over its token limit to a file instead of showing them, so a read has
    ++to fit whatever `limit` an agent asks for.
    ++
    ++Thread and message results include required `createdBy` and `creationSource`
    ++provenance. MCP-created threads and user-role messages use `createdBy: "agent"`
    ++and `creationSource: "mcp"`; provider output uses `creationSource: "provider"`.
    ++Actor and ingress are separate so agent-authored user-role messages remain
    ++distinguishable from human-authored messages.
    ++
    ++Agents mention another thread by the `link` its result carries,
    ++`<t3-thread://v2/<environmentId>/<threadId>>`, so they never format an id or
    ++write a title, which goes stale when the user renames the thread. The
    ++environment that owns the thread builds the link, so forwarded results and tasks
    ++delegated to a linked environment name that environment. Clients open only that
    ++environment's thread and show its current title; a link to a thread they do not
    ++know renders as a label that opens nothing. Older `t3-thread://v1/<threadId>`
    ++links name no environment: clients resolve them in the message's environment,
    ++then by a unique match in another enabled environment. An outside OAuth client,
    ++one that is not a linked environment, cannot render `t3-thread://` links, so it
    ++gets the link Copy thread copies, `https://app.t3.codes/threads/<environmentId>/<threadId>`
    ++on the server's `T3CODE_HOSTED_APP_URL`, for threads in this environment. The
    ++hosted app offers the desktop app, the mobile app, or itself.
    ++
    ++List and read results report `snoozed`, `snoozedUntil`, and `pinned`, and
    ++`t3_thread_list` filters on `snoozed`. The server's `isSnoozed` follows the
    ++client's `effectiveSnoozed`, so agents and the sidebar agree: a snoozed thread
    ++wakes early only when it has a pending request or fails after snoozing. Completed
    ++runs, background wakes, and delegated completions keep it snoozed.
    ++
    ++They also report `blockedOnThreadWait` and `pendingBackgroundTasks`, the shell
    ++fields behind the sidebar's Waiting label, so an agent can see what a thread
    ++still waits on after its run completed. A subagent or `background_task` holds
    ++the thread. A command or monitor holds it only with `awaited: true`, since agents
    ++often leave a dev server running.
    ++
    ++### `t3_thread_update`
    ++
    ++Updates metadata for the calling thread or any other thread in the environment.
    ++The typed actions are `rename`, which requires `title`, and `regenerate_title`,
    ++which rejects one. Pull request links go through the separate
    ++`link_pull_request` and `unlink_pull_request` tools. Branch and workspace
    ++changes are outside this tool.
    ++
    ++The result includes the command ID and durable event sequence together with the
    ++resultant title, title-regeneration marker, and linked pull request. Reusing a
    ++`clientRequestId` for the same action and thread replays the same command
    ++receipt. Thread list and read results expose the linked pull request, and thread
    ++detail also exposes an in-flight title regeneration.
    ++
    ++### `t3_thread_send`
    ++
    ++Sends a message to any ordinary or delegated thread in the environment:
    ++
    ++- `auto` starts an idle thread, steers a fully active turn, or queues behind a
    ++  turn that is not yet steerable;
    ++- `queue` creates a separate follow-up run after active work;
    ++- `steer` requires a steerable active provider turn; and
    ++- `restart` requires an active provider turn and uses the orchestrator's
    ++  interrupt-and-restart path. On a provider that can stop a turn and queue
    ++  messages but not restart a turn with new input, it stops the turn and queues
    ++  the message ahead of other queued messages; an unheld delegated-task result
    ++  that survives the stop still runs first. It is rejected when neither path
    ++  applies: the provider cannot stop a turn, Stop has already reached the turn,
    ++  or the turn or the new message is `/compact` or `/logout`.
    ++
    ++The target runtime and interaction modes may not be broader than the caller's.
    ++Stable command and message IDs are derived from `clientRequestId` for
    ++idempotent retries.
    ++
    ++`outputSchema` (also on `t3_thread_launch`) asks the run for a result as data.
    ++The run stores the schema, the turn's prompt ends with how to hand the result
    ++back, and the agent calls `t3_submit_output`. The server checks the value
    ++against the schema before storing it, so the caller never parses a reply. A send
    ++that asks for a result is queued instead of steered: the result belongs to one
    ++whole turn. A turn can end without submitting; the caller sees a finished run
    ++with no `output`.
    ++
    ++### `t3_submit_output`
    ++
    ++Stores the calling thread's result on its running turn, once it fits the schema
    ++that turn was sent with. A turn that was asked for nothing answers for the
    ++newest turn that was asked and has not answered yet, which is how an agent that
    ++ended its turn to wait gives its result after it is woken. A rejection names what did not fit, so the agent can
    ++correct it and call again; a later accepted submission replaces an earlier one.
    ++
    ++### `t3_thread_wait`
    ++
    ++Waits for a selected run to become `completed`, `failed`, `cancelled`,
    ++`interrupted`, or `rolled_back`. Without `runId`, it pins the latest run at call
    ++time; an idle thread returns immediately. A timeout reports the latest durable
    ++status and does not cancel work. `output` carries what the run submitted
    ++against its `outputSchema`; with `untilOutput`, a completed run that has not
    ++submitted yet is waited on until it has.
    ++
    ++### `t3_workflow`
    ++
    ++Starts, lists, reads, signals, resumes and cancels [workflow runs](../internals/workflows.md), and
    ++lists the questions runs ask a person. It is advertised to clients outside a thread only, such as
    ++the `t3 workflow` CLI, so it costs no thread any context; an agent in a thread drives workflows
    ++through that CLI. `start` is idempotent on `idempotencyKey` and `signal` on `signalId`.
    ++
    ++### `t3_thread_interrupt`
    ++
    ++Interrupts a selected active run through the normal V2 `run.interrupt` command.
    ++Without `runId`, it selects the newest interruptible run. A terminal run is
    ++returned unchanged, and a thread with no active provider turn returns
    ++`no_active_run`.
    ++
    ++### Scheduled tasks
    ++
    ++`schedule_task`, `list_scheduled_tasks`, and `delete_scheduled_task` manage
    ++recurring work in the app scheduler; `schedule_task` with a `scheduledTaskId`
    ++updates an existing task. A schedule
    ++runs its prompt on an interval, at a fixed time in the server's local time
    ++zone, or on each qualifying webhook request, even when no turn is active.
    ++Without a signature, anyone with the webhook URL can trigger a run.
    ++Signature checks, filters, and dedupe can skip a webhook request.
    ++`bindToCurrentThread` defaults to `true` only when the caller has a thread in
    ++the task's project; otherwise it defaults to `false`. Bound runs post into
    ++that thread; unbound runs each launch a fresh thread in the task's project.
    ++Explicit `bindToCurrentThread: true` without a caller thread in that project
    ++is rejected. Pausing uses `schedule_task` with `scheduledTaskId` and `enabled: false`;
    ++deletion is permanent.
    ++
    ++## Delegated Task Lifecycle
    ++
    ++The MCP server is a command ingress into V2. It does not call provider adapters
    ++directly.
    ++
    ++```text
    ++provider model
    ++  -> MCP tools/call delegate_task
    ++  -> authenticated OrchestratorMcpService
    ++  -> shared ThreadManagementService
    ++  -> V2 delegated_task.request command
    ++  -> child thread + child run
    ++  -> parent app_owned subagent projection
    ++  -> parent/child execution nodes
    ++  -> consumed subagent_spawn context transfer
    ++  -> normal provider effect and runtime ingestion
    ++  -> child run reaches a terminal state
    ++  -> parent subagent/node/turn item finalized
    ++  -> consumed subagent_result context transfer
    ++  -> wait result or later task_status result
    ++```
    ++
    ++The child thread has lineage relationship `subagent` and points back to the
    ++parent node. The parent gets an `app_owned` sub-agent projection and a
    ++sub-agent turn item so the existing debug UI can render progress.
    ++
    ++Terminal provider events trigger finalization. The event stream first replays
    ++persisted events and then follows live events, so finalization also runs after
    ++a server restart. An existing `subagent_result` transfer makes finalization
    ++idempotent.
    ++
    ++Users rarely watch child threads, so a child question would otherwise go
    ++unanswered. When a child opens a pending `user_input` request, the parent gets
    ++a notification message telling it to answer with the pending request tools or
    ++ask the user. The message says whether the child is blocked or, for a Codex
    ++async question, still working. If the parent's turn is running and its provider
    ++can steer without interrupting tools, the notification steers into that turn,
    ++like a background task's completion. A queued notice would wait behind a
    ++long-running orchestrator turn that may never end. Otherwise it queues. If the
    ++question is answered or dismissed before a queued notification starts a turn,
    ++that queued turn is cancelled. Approvals are not
    ++routed, because those tools cannot answer them.
    ++A parent still blocked in a `delegate_task` wait gets the blocking question
    ++through that wait instead.
    ++If the provider cuts that wait short, a still-pending live question wakes the
    ++parent when its launching run completes, fails, or waits for post-turn work.
    ++Stopping or interrupting the parent prevents this catch-up.
    ++
    ++A failed run exposes its provider error before any progress text. Successful
    ++results use the latest assistant content from the final work turn.
    ++
    ++## Policy And Idempotency
    ++
    ++- A child runtime mode may stay equal to or become narrower than the parent
    ++  mode. It may not escalate privileges.
    ++- A child interaction mode may stay equal to or narrow from `default` to
    ++  `plan`. It may not escalate from `plan` to `default`.
    ++- Thread tools take any thread in the environment as a target. For a thread
    ++  caller, list and search cover one project: its own unless `projectId` is given.
    ++- A tool that changes another thread needs the calling thread's live run, and
    ++  the target's runtime and interaction modes may not be broader than the
    ++  caller's. This is the same privilege ceiling as child creation.
    ++- Provider instances must be enabled, installed, available, authenticated, and
    ++  backed by a V2 adapter.
    ++- A requested model must be advertised by the selected provider when the
    ++  provider publishes a model list.
    ++- `clientRequestId` derives stable command, thread, and message IDs within the
    ++  provider session. Retrying the same call returns the same durable work.
    ++- Calls without `clientRequestId` receive a generated request key and create
    ++  new work.
    ++
    ++Expected denials use the typed `OrchestratorMcpFailure` result:
    ++
    ++```text
    ++capability_denied
    ++parent_not_active
    ++provider_unavailable
    ++model_unavailable
    ++runtime_mode_escalation_denied
    ++interaction_mode_escalation_denied
    ++task_not_found
    ++task_not_cancellable
    ++thread_not_found
    ++run_not_found
    ++thread_not_sendable
    ++thread_not_interruptible
    ++invalid_request
    ++orchestration_error
    ++```
    ++
    ++## Code Ownership
    ++
    ++- Shared schemas: `packages/contracts/src/orchestratorMcp.ts` and
    ++  `packages/contracts/src/threadMetadataMcp.ts`
    ++- MCP services: `apps/server/src/mcp/OrchestratorMcpService.ts` and the focused
    ++  `apps/server/src/mcp/ThreadMetadataMcpService.ts`
    ++- Tool definitions and handlers:
    ++  `apps/server/src/mcp/toolkits/orchestrator/`
    ++- HTTP registration and authentication:
    ++  `apps/server/src/mcp/McpHttpServer.ts`
    ++- Credential lifecycle: `apps/server/src/mcp/McpSessionRegistry.ts`
    ++- Provider injection:
    ++  `apps/server/src/orchestration-v2/ProviderSessionManager.ts` and V2 adapters
    ++- Durable delegated-task command and finalization:
    ++  `apps/server/src/orchestration-v2/Orchestrator.ts`
    ++
    ++## Verification
    ++
    ++The integration test uses the real MCP toolkit registration, V2 orchestrator,
    ++SQL persistence, event ingestion, projections, and checkpoints. Only the
    ++external provider adapters are deterministic test implementations.
    ++
    ++Coverage includes:
    ++
    ++- capability discovery;
    ++- cross-provider delegated completion;
    ++- prompt-only child context;
    ++- parent and child lineage projections;
    ++- spawn and result context transfers;
    ++- async status polling;
    ++- cancellation;
    ++- batch ordinary-thread creation;
    ++- thread listing and timeline reads, including another project's threads;
    ++- ordinary-thread send, wait, steering, and interruption;
    ++- inheritance and per-thread provider overrides; and
    ++- idempotent retries.
    ++
    ++Provider adapter tests separately verify Codex, Claude, Cursor, Grok, and ACP
    ++Registry behavior and MCP injection. The provider-session manager test verifies
    ++that credentials exist before an adapter opens and are revoked when it closes.
     
      ## packages/provider-core/src/server/subagentProjection.ts ##
     @@ packages/provider-core/src/server/subagentProjection.ts: import type {
21:  6484692453 = 21:  cd8cee3a2b fix(mobile): settings text drafts survive failed saves and never overwrite a changed value
22:  a5ed0df8c0 = 22:  ed27084f81 feat: one call and one strip show a lead's whole fleet
23:  fb9ab00164 = 23:  985a01d041 fix(server): a task delegated to another project uses that project's role models
24:  3233255072 = 24:  4546eb38f6 feat(mobile): a thread with children shows its fleet strip above the composer
25:  27c8a0940f = 25:  c714c28cff feat(server): agent credit lines are removed from PR descriptions when the project asks
26:  35bf5b5f8d = 26:  4fd39380ef feat(server): mask secrets that reach command and tool output
27:  d35bd79469 = 27:  cb6362b6ec feat(mobile): secret masking in tool output can be turned off and on from Maintenance
28:  613eb845cc = 28:  7365343189 feat(server): waits hear the caller's messages and corrections expire with their turn
29:  ba55555030 ! 29:  a55aaca00d feat(server): a delegated task's approval wakes the thread that started it, which can answer it
    @@ packages/client-runtime/src/state/threadShell.test.ts: describe("v2 thread shell
          // The helper the task started there asks for approval: the parent here hears of it.
     
      ## packages/client-runtime/src/state/threadShell.ts ##
    -@@ packages/client-runtime/src/state/threadShell.ts: function sideChatRequest(thread: OrchestrationV2ThreadShell): PendingSubagentReq
    +@@ packages/client-runtime/src/state/threadShell.ts: const asksParent = (thread: OrchestrationV2ThreadShell) =>
       * own subagents, asks.
       */
      function pendingSubagentRequestsByThread(
30:  9554f8e701 = 30:  4f751b9dda fix(server): model settings an agent passes are refused, never silently dropped
31:  5628f90bf4 = 31:  aead648f08 fix(server): a wait on a delegated task ends when its command hold runs out
32:  107ebc6212 = 32:  c45771092c fix(server): create_threads and project defaults refuse model settings they would drop
33:  89979741a3 = 33:  ce8c180b5b refactor(server): only a wait on delegated work keeps a command hold timer
34:  8759ca5ebb = 34:  c71dfce223 feat(server): a task delegated to another environment can run in its own worktree there
35:  32b017dd01 = 35:  c9aefd2dab fix(server): Codex full access keeps asking when its own plugins or apps need an answer
36:  443e4aeddc ! 36:  5b0c2719dc feat(server): ACP threads list their running terminals as background commands
    @@ Commit message
     
      ## apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts ##
     @@ apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts: import {
    -   ProviderSessionId,
    +   RunId,
        ThreadId,
        type OrchestrationV2ProviderThread,
     +  type OrchestrationV2ThreadProjection,
    @@ packages/provider-acp/src/server/adapter.ts: export const makeAcpAdapterV2 = Eff
     +              yield* requireRuntimeRestart;
                    yield* cancelPendingRuntimeRequests();
                    yield* terminalizeOpenForegroundTools(context, "failed");
    -               const minutes = Math.max(1, Math.round(timeoutMillis / 60_000));
    +               // Bounded: it runs under the transition permit that Stop and the next turn wait on.
     @@ packages/provider-acp/src/server/adapter.ts: export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
                                settle.generation,
                                Effect.gen(function* () {
37:  2534bce811 = 37:  09f0b651f8 fix(server): fork-only indexes no longer take upstream migration ids
38:  184f4b22a7 = 38:  65ccefaf41 docs: describe the fork and its upstream nightly sync
39:  52b5612771 = 39:  2ae47d5533 test(server): guard the fork's migration ids and desktop update feed
40:  316daf5614 = 40:  8b06b5f370 docs: regenerate the upstream migration manifest in each sync
41:  9fda6af39f ! 41:  058ff7bfc1 fix(server): fork code reads upstream's forward thread scan and new migration head
    @@ apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: import {
     -import { AGENT_FEEDBACK_INSTRUCTIONS } from "@t3tools/provider-core/server/runtimeInstructions";
      import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
      import type * as ProviderContinuationRequests from "@t3tools/provider-core/server/ProviderContinuationRequests";
    - import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
    + import {
     @@ apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: describe("ClaudeAdapterV2 native protocol logging", () => {
        });
      });
42:  6f574cc301 ! 42:  dfff6e336e feat: scheduled tasks take full options everywhere and never overlap runs
    @@ docs/user/project-settings.md: without the agent's context growing. To move a on
     +
      Deleting a thread also deletes tasks that post into that thread. Tasks that start
      a new thread on each run survive deletion of their previous threads.
    - 
    + An archived thread refuses messages, so a task that posts into one stays on and fails
     
      ## packages/contracts/src/orchestratorMcp.ts ##
     @@ packages/contracts/src/orchestratorMcp.ts: import {
43:  a7d17046e0 = 43:  e43012df3b test(server): the numbered-head ledger case starts from upstream's full head
44:  ca57b4c58e ! 44:  b55a4fcee1 feat(server): scheduled tasks can run an owner-set gate command before each run
    @@ docs/user/project-settings.md: waiting for you: that occurrence is skipped, the
     +
      Deleting a thread also deletes tasks that post into that thread. Tasks that start
      a new thread on each run survive deletion of their previous threads.
    - 
    + An archived thread refuses messages, so a task that posts into one stays on and fails
     
      ## packages/contracts/src/clientRpcPermissions.ts ##
     @@ packages/contracts/src/clientRpcPermissions.ts: export function clientRpcRequiredScopes(
45:  1f4ad11252 = 45:  be9b4b85a5 feat(server): trim bulky payloads to keep the state database small
46:  a82c6138bd = 46:  8b39d8981c docs: sync upstream nightlies by rebasing the fork's commits
47:  eba3b08b8b = 47:  28c2dcba60 docs: fork syncs land on main through fork-land

Rebase by Claude Opus 5.5 (Claude Code in T3 Code).

@falistos

Copy link
Copy Markdown
Author

Review of record: 28c2dcb mergeable

Cross-family review of the range-diff 2808e878de..eba3b08b8b vs v0.1.12-nightly.20261123.5138 (1368854828)..28c2dcba60 (47 linear fork commits, 0 merge commits, 0 dropped commits).

Findings

P1: None.

P3:

  1. [conflict / docs] docs/orchestration-v2/orchestrator-mcp-server.md:530 — Still links to [workflow runs](../internals/workflows.md), which upstream #41330 deleted. All 11 code paths referenced in the doc still exist and match the code at head. Fix: replace the dead link with plain text workflow runs (can be folded in a future fork docs edit).
  2. [core-path overlap / contracts] packages/contracts/src/peerLink.ts:256,263 (and packages/contracts/src/orchestratorMcp.ts:254) — Upstream #41274 (f00893a512) widened OrchestrationV2ThreadLaunchWorkspaceStrategy baseRef from TrimmedNonEmptyString to GitRefName to preserve leading/trailing Unicode whitespace in Git ref names; the fork's PeerLinkWorktreeBaseRequest.baseRef, PeerLinkWorktreeBaseResult.baseRef, and OrchestratorMcpDelegateTaskInput.baseRef still use TrimmedNonEmptyString (no regression vs 5124; only affects refs with leading/trailing Unicode whitespace). Fix: switch those baseRef fields to GitRefName when convenient.

Checked areas

  • Conflicted commits (Focus 1):
    • 748e9e6545 (apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts:6825-6845): codexFailureRetryable and upstream's codexFailureItemId / codexFailureItemKey both survive and compose cleanly across normal failures, recovered-then-failed retries, stalled retries, and ProjectionStore.getTransientFailureCandidates (ProjectionStore.ts:5179-5202, which selects the latest status = 'failed' error row and ignores earlier status = 'completed' recovered rows).
    • 526330ddf0 (apps/server/src/process/agentScope.ts:551-602, agentScope.test.ts:255-303,550-615): anchoring resolved to process.cwd() without collapsing .. before withThreadTemp delivers the absolute executable path to exec on both the non-systemd Linux path (scope === undefined) and the systemd path (wrapped with /usr/bin/env TMPDIR=… for unshared threads, or direct for shared/threadless launches), and handles = in process.cwd(). Both launchCodex (shared) and scope.wrap (unshared + symlinked parent) tests cover the interaction.
    • 2892a04920 (docs/orchestration-v2/orchestrator-mcp-server.md): kept per D1; later fork commits (ed27084f81, 7365343189, a55aaca00d, c71dfce223) apply cleanly on top; no contradictions with head code beyond the P3 dead link above.
  • Core-path semantic overlaps (Focus 2):
    • ProviderSessionManager.ts (#41174 2-minute idle timeout vs 2892a04920 15-minute command hold & 5b0c2719dc ACP terminals): verified hasPendingBackgroundWork / hasPendingBackgroundWorkForThread return true for running commands/terminals in CodexAdapterV2.ts:8393-8437, ClaudeAdapterV2.ts:14611-14662, packages/provider-acp/src/server/adapter.ts:10260-10262, and packages/provider-cursor/src/server/adapter.ts:3312, so idle eviction is deferred while background commands run.
    • Orchestrator.ts (#31449 thread.settle background-work guard & #41229 merge-back): thread.settle excludes app_owned subagents, preserving parent settlement and cross-machine parent-done settlement (eb4b3ea860).
    • packages/provider-acp/src/server/adapter.ts (#41241, #41243, #41256, #33596): every runtimeRestartRequired write uses requireRuntimeRestart (including inactivity watchdog with checkPromptOutcome), disposing client terminals cleanly; AntigravityTurnOutcome.ts:191 sets retryable for 5xx/429/transient-404 compatibly with TransientFailureRecoveryWorker.
    • ProjectionStore.ts & ThreadSearch.ts (#41307), ThreadPullRequestService.ts (#41175 vs c714c28cff), ThreadLaunchService.ts (#36904 vs b4c57c6975 & c71dfce223), threadSnapshotBody.ts (#30836 vs be9b4b85a5), packages/client-runtime/src/state/threadShell.ts (#25537 hasChildThreadInputsAtom vs a55aaca00d & b4c57c6975): all semantically intact.
  • Fork rules (Focus 3):
    • Zero fork numbered migrations: all 110 numbered files in apps/server/src/persistence/Migrations/ have identical blob SHAs to upstream 1368854828 and upstreamMigrations.json.
    • -mediavee. self-update guard (ForkUpstreamUpdateFeedError in scripts/build-desktop-artifact.ts:2866-2876 and its test) is intact; apps/server/src/cloud/selfUpdate.ts had no upstream changes in 5124..5138.

@falistos

Copy link
Copy Markdown
Author

Review of record: 28c2dcb mergeable

Lead check: range-diff 2808e878de..eba3b08b8b vs v0.1.12-nightly.20261123.5138..28c2dcba60 pairs all 47 fork commits (38 =, 9 !), no merge commit, nothing dropped. Cross-family review (Gemini 4 Neon, high): no P1. P3 follow-ups: dead link to the deleted docs/internals/workflows.md in docs/orchestration-v2/orchestrator-mcp-server.md; baseRef in peerLink.ts / orchestratorMcp.ts still TrimmedNonEmptyString while upstream pingdotgg#41274 moved thread-launch baseRef to GitRefName.

@falistos
falistos merged commit 28c2dcb into main Nov 23, 2026
@falistos
falistos deleted the sync/v0.1.12-nightly.20261123.5138 branch November 23, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant