Skip to content

chore(fork): remove TMAD-derived carry - #30

Merged
camerontaylor merged 4 commits into
minefrom
fm/remove-tmad-derived-code
Nov 12, 2026
Merged

camerontaylor merged 4 commits into
minefrom
fm/remove-tmad-derived-code

Conversation

@camerontaylor

@camerontaylor camerontaylor commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

What

Removes the code the fork inherited from tmad4000/paseo. This is the follow-up to the 0.16.0-beta.2 rollout: the basket carried TMAD in, and this drops it while keeping everything else the fork owns.

Method: reverse-apply the TMAD delta 84ba5a691..79422b485 (TMAD 0.11.1 tip, merged as 27daed7df) onto the released 0.16.0-beta.2 tree, then resolve every conflict toward upstream 0.16 plus the fork's own carries. 196 files, +883 / −23,840.

Removed

Surface What goes
Durable agent queue (TM-02) agent.queue.* RPCs, AgentQueueService, the server queue store and send-or-queue path, the client queue outbox store, receipt-driven dispatch, the queue UI in the composer, durableAgentQueueV1 / durableVoiceInputV1 capabilities
Companion stream (TM-03) CompanionEntry model and storage, updateCompanionEntry, message pin / Q&A actions, the companion feed, companionStreamPortV1
Artifacts (TM-05) artifact collector, feed view, AgentArtifact storage and projection fields, paseo agent artifacts, the artifacts view switcher
Native Find (TM-07) chat-find/matches, native-viewport, native-message-scroll (module and its suite), the native stream's scrollToMessage plumbing; native ChatFind returns upstream's no-op stub
TMAD voice work (TM-04) per-device speak arbitration and generation tokens, concurrent voice input, voice receipt routing, voiceOwner, and the "speak is advertised before voice attaches" gate: the tool registers on voice attachment again, and an unattached call fails instead of settling
Docs TMAD plans, briefs, evidence, docs/companion-stream.md, docs/queue-mirroring.md, CLAUDE.md rows

Kept

Everything else the fork carries, including: side conversations, provider accounts with rename migration, checkout base refs, package.json scripts, outbound-byte metrics, turn timing footer, pinned prompt, plan copy sources, file-explorer inline path errors, shared-turn steering (PeerTurnActiveError), app-level voice chat (voice-session, registerVoiceCallerContext, the speak tool itself, TTS playback), theme and layout work, and the 0.16 host registrations.

Verification

  • npm run build:client, npm run build:server deps, tsgo typecheck of protocol/client/relay/server: clean. The only remaining typecheck noise is pre-existing environment drift in this worktree's shared node_modules (@opencode-ai/sdk/v2/client, p-limit, commander typings, lucide-react-native, expo-audio, Ajv) and reproduces on files this PR does not touch.
  • npm run lint and npm run format on every changed file: clean.
  • Named tests: agent-projections (27), agent-storage (23), agent-prompt (23), app replica-cache (52), app composer/actions + audio/playback + stores/session-store (75). All pass.
  • session.test.ts, mcp-server.test.ts and the websocket-server suites cannot run in this worktree: their import chain needs @opencode-ai/sdk/v2/client / lru-cache@11, missing from the shared install. CI is the authority for those.
  • CI (upstream workflow) on the first head: server-tests (ubuntu-latest) failed one test, mcp-server.test.ts > speak MCP tool > does not register speak tool unless voice tools are enabled, which is exactly the leftover gate this PR now fixes; 496 other server test files passed. Fork CI was green on that head.
  • Exact head 3b9b9c25b: CI run 43270998967 success and Fork CI run 43270998784 success. server-tests (ubuntu-latest) ran websocket-server.relay-reconnect.test.ts with 31 tests, i.e. including the new legacy-RPC case. Head c2525c224 was green on both workflows too.

Follow-ups

  • 76f41f351 restored upstream's speak registration gate (voiceOnly || enableVoiceTools || callerContext.enableVoiceTools). The TMAD carry had added scope === "agent", which advertised speak to every agent session even though nothing could handle the call.
  • c2525c224 deleted agent-stream/native-message-scroll.ts and its suite: once strategy-native went back to upstream, the scroller had no callers.
  • 3b9b9c25b is the revert(tmad): remove TMAD-derived stream, queue, and find code #31 comparison: U2d handover restored, app pretypecheck restored, fork/tmad-removal.md added, and the legacy-RPC rpc_error path covered by a test.

Risk

Highest-risk resolutions are the files where TMAD and later fork work overlapped: session.ts, agent-manager.ts, websocket-server.ts, composer/index.tsx, agent-stream/view.tsx, agent-panel.tsx, replica-cache. Each was resolved by keeping the fork's behaviour and deleting only the TMAD surface; a reviewer should look at those first.

Comparison with #31

#31 (revert(tmad): remove TMAD-derived stream, queue, and find code) targets custom. The two base trees are identical (1c46a58f6 vs 99e212869, git diff --quiet clean), so the branches compare directly. This PR is the superset: it also removes the TMAD protocol schemas, capability constants, artifact/companion storage, client voice transport and the app surfaces, where #31 keeps them.

Adopted from #31:

Item Why
fork/handover-beta-upgrade-u2d-2026-10-17.md restored handover-beta-upgrade-u2e links to it, and it records how the fork's own layers reached the basket. It is fork provenance, not TMAD code; deleting it left a dead link.
packages/app pretypecheck @getpaseo/expo-two-way-audio is upstream and stays, so the declaration build is still what makes packages/app typecheck work on a clean tree.
fork/tmad-removal.md Provenance and the two resolutions a re-port has to reverse.
Legacy-RPC error behaviour, as a test #31 keeps the TMAD wire schemas and answers each removed RPC with a typed error. The daemon already answers any inbound request it cannot parse with rpc_error {code: "unknown_schema", requestId} (websocket-server.ts, handleInvalidInboundMessage), which the old client surfaces as a rejection. websocket-server.relay-reconnect.test.ts now locks that path, so the decision not to keep ~990 lines of fork-only schema is covered instead of assumed.

Reviewed and not adopted:

#31 change Why not
Retained TMAD protocol schemas, CLIENT_CAPS entries, companion-stream.ts, agent-types.ts additions, per-RPC DURABLE_QUEUE_REMOVED_ERROR handlers and their operation-permissions entries Same user-visible outcome through the generic protocol-failure path, without keeping the wire surface and eight handler branches.
Removal of the upstream voice auto-allow block in session.ts (isVoicePermissionAllowed) That block is upstream 0.16; removing it regresses voice mode.
AgentRunBusyError, queue-oriented replaceRunning: false / blockPendingPermissions in agent-prompt.ts, stripVoiceModeSystemPrompt in agent-manager.ts, and an empty if (isTurnTerminalEvent(event)) {} Remnants of the queue design; the empty block is dead code.
agent-stream/native-message-scroll.ts and its suite restored No callers once strategy-native is upstream.
RetainedPanel / ChatAgentDockContent / computeInitialHistoryLoading restored in agent-panel.tsx Those constructs existed to switch between chat and the artifacts view; with artifacts gone they are a wrapper and an inlined expression.
VoiceTransport attachment/generation parameters back on the client voice methods Per-device voice arbitration is the TMAD carry this PR removes.
Upstream composer queue e2e spec and helpers deleted sendBehavior: "queue" is upstream 0.16 and stays; that is coverage on a feature this PR does not touch.
daemon-executions.test.ts subscription tracking rewritten in the shared Hub harness A test-robustness change with no observed flake on this branch; it belongs in its own PR, not in a code removal.
Static import of @getpaseo/expo-two-way-audio in audio-engine.native.ts Unrelated to the removal.

Reverse-applies the TMAD delta (84ba5a6..79422b4, tmad4000/paseo 0.11.1)
onto the assembled 0.16.0-beta.2 tree and resolves every conflict toward
upstream 0.16 plus the fork's own carries.

Removed: the durable agent queue (agent.queue.* RPCs, queue outbox, receipt
driven dispatch), companion entries and the pin/Q&A actions on messages, the
agent artifacts feed and CLI scan, native chat Find, TMAD's voice concurrency
(per-device speak arbitration, concurrent voice input, voice receipt routing),
and the TMAD plans, evidence and docs.

Kept: every unrelated fork carry - side conversations, provider accounts and
rename migration, checkout base refs, package.json scripts, outbound byte
metrics, pinned prompt, plan copy sources, file-explorer inline path errors,
shared-turn steering (PeerTurnActiveError), theme and layout work.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 1

  • ^merge-queue$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 11f034bb-c51f-4648-8fd4-6591ef149ff7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T16:23:17.693228Z 2e83f53 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e83f532fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 3684 to 3685
SideConversationListRequestMessageSchema,
AgentQueueEnqueueRequestSchema,
AgentQueueUpdateRequestSchema,
AgentQueueReorderRequestSchema,
AgentQueueDeleteRequestSchema,
AgentQueueRetryRequestSchema,
AgentQueueSendNowRequestSchema,
AgentQueueListRequestSchema,
AgentQueueGetItemImagesRequestSchema,
SetAgentTimelineSubscriptionRequestMessageSchema,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Retain retired RPC alternatives in the wire schemas

Removing the queue request alternatives makes previously valid messages such as agent.queue.list.request fail WebSocket inbound validation. Removing the feature implementation and withdrawing its advertised capability is separate from removing its wire contract: existing SDK callers must still receive a parseable unavailable-feature response rather than an unknown-schema error. Retain the retired request/response declarations and subscription enum values while disabling their implementations, as required by the backward-compatibility rule in AGENTS.md.

AGENTS.md reference: AGENTS.md:L149-L151

Useful? React with 👍 / 👎.

onStop,
onCancelAgent,
}: RealtimeVoiceOverlayProps) {
const { theme } = useUnistyles();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the themed wrappers instead of adding useUnistyles

This introduces a new useUnistyles() call where the previous implementation used withUnistyles wrappers. The hook subscribes the entire voice overlay subtree to runtime changes, including breakpoint and inset updates, instead of limiting theme-driven renders to the icons and spinner. AGENTS.md explicitly forbids this hook, and its linked Unistyles guide requires rejecting new calls; retain the wrappers for these third-party props.

AGENTS.md reference: AGENTS.md:L35-L35

Useful? React with 👍 / 👎.

Comment on lines 453 to 455
} catch (error) {
if (!this.isVoiceMode && this.voiceModeAgentId) {
await this.disableVoiceModeForActiveAgent();
}
const errorMessage = error instanceof Error ? error.message : "Failed to set voice mode";
const unavailable = this.getVoiceFeatureUnavailableResponseMetadata(error);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Roll back voice registration when controller startup fails

If startVoiceTurnController() fails after the agent reload succeeds—for example, when the turn detector cannot connect—the catch block no longer disables the partially enabled voice session. The agent retains its voice-only system prompt and registered speak handler, while the client receives accepted: false and does not send a disable request because its enable operation failed. A retry then attempts to register the same handler and fails with “Voice mode is already active for this agent.” Restore the failure cleanup so startup errors release the bridge, controller, and modified agent configuration.

Useful? React with 👍 / 👎.

} finally {
item.controller.signal.removeEventListener("abort", cancelPlayback);
}
item.resolve(await start(item.source, item.controller.signal));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Settle canceled playback without waiting for preparation

When playback is canceled while start() is awaiting preparation, this direct await leaves the canceled item active until preparation finishes. Both engines await audio.arrayBuffer(), and the web engine also awaits decoding before checking the abort signal, so those stages cannot settle the queue's cancellation themselves. A stalled preparation therefore leaves the canceled play promise unresolved and blocks subsequent voice or plugin audio. A deferred-start reproduction confirms that stop() leaves isPlaying() true and prevents the next item from starting; retain the abort race that releases queue ownership immediately.

Useful? React with 👍 / 👎.

Comment on lines +756 to +760
await session.adapter.setVoiceMode(true, agentId);
enabledCurrentVoiceMode = true;
await deps.engine.startCapture();
if (state.generation !== generation) {
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check startup cancellation before starting microphone capture

If stopVoice() or provider teardown runs while the enable acknowledgement is pending, the stopped startup still calls engine.startCapture() when that acknowledgement arrives. The generation check happens only afterward and returns without stopping the newly started capture. A deferred-acknowledgement reproduction leaves the microphone capturing while the runtime snapshot reports phase: "disabled" and isVoiceMode: false. Restore lifecycle serialization and cancellation checks before capture admission, with cleanup if cancellation occurs during capture startup.

Useful? React with 👍 / 👎.

Comment on lines 259 to 260
archivedAt: IsoDateSchema.nullable().optional(),
artifacts: z.array(AgentArtifactSchema).optional(),
companionEntries: z.array(CompanionEntrySchema).optional(),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve cached agents when dropping obsolete snapshot fields

After upgrading from the previous fork build, cached agent snapshots contain artifacts and companionEntries, including empty arrays, because the previous daemon projections supplied them and serializeStreamStateFields() persisted them. Removing these keys from this z.strictObject() makes those otherwise valid snapshots fail validation. readAgent() then deletes the row and returns undefined, while readDirectory() deletes the affected agent rows, so users upgrading while their host is offline lose their cached agent directory until reconnection. Strip or tolerate the obsolete fields during cache reads rather than treating the entire agent snapshot as corrupt.

Useful? React with 👍 / 👎.

The TMAD voice carry registered speak for every agent-scoped catalog, so
agent sessions that never attach voice advertised a tool whose handler
threw. Restore the upstream gate: speak registers when the catalog is
voice-only or voice tools are enabled for the session.
strategy-native was reverted to upstream, so createNativeMessageScroller
had no callers outside its own test.
Compare with the duplicate removal branch (#31) turned up three things
worth taking:

- Restore the U2d beta-upgrade handover. U2e links to it, and it records
  how the fork's own layers reached the basket; it is fork provenance,
  not TMAD code.
- Restore app pretypecheck, which builds the expo-two-way-audio
  declarations that packages/app typecheck reads.
- Test that a 0.16.0-beta.2 request type reachable only through the
  removed TMAD RPCs still gets a structured rpc_error, so dropping the
  protocol schemas stays a deliberate, covered decision.

fork/tmad-removal.md records the provenance and both resolutions that a
future re-port has to reverse.
@camerontaylor
camerontaylor merged commit 9a7a9d7 into mine Nov 12, 2026
24 checks passed
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