Skip to content

fix(server): keep remote delegation idempotency namespace durable across restarts - #222

Open
nullStack65 wants to merge 1 commit into
release/native-0.1.10from
fix/clo-1091-remote-delegation-idempotency
Open

nullStack65 wants to merge 1 commit into
release/native-0.1.10from
fix/clo-1091-remote-delegation-idempotency

Conversation

@nullStack65

Copy link
Copy Markdown
Owner

Problem

McpSessionRegistry set each thread credential's requestNamespace to its ephemeral in-memory providerSessionId UUID. When the origin T3 server restarted (or rotated credentials), retrying delegate_task with the same clientRequestId produced a new idempotency key:

  • retries could launch duplicate remote tasks, and
  • a crash between the remote launch and local delegated_task.remote.request recording could not be recovered by retrying with the same clientRequestId, stranding the remote thread and lane.

Fix

  • Derive thread MCP requestNamespace deterministically from durable thread identity (thread:${threadId}) in McpSessionRegistry while keeping providerSessionId and bearer tokens ephemeral per credential.
  • Match both environmentId and threadId when looking up a replayed remote task record in RemoteDelegation.
  • Add focused unit and integration tests using real McpSessionRegistry instances across origin restarts covering:
    • restart retry idempotency (no duplicate remote launch, same taskId and remote thread),
    • crash-window recovery between remote launch and local record creation (reconciles remote thread, records local task, attaches follower, completes when remote finishes), and
    • distinct clientRequestId values still launching new remote tasks.

Verification

  • vp run typecheck: 41/41 packages passed
  • vp test run (apps/server/src/mcp/McpSessionRegistry.test.ts, apps/server/src/peer/RemoteDelegation.test.ts): 2 files, 69/69 tests passed
  • vp fmt --check & vp lint on touched files: 0 warnings, 0 errors

Deploy: fleet
Model: gemini-4-neon
Task: fix

Derive the thread MCP requestNamespace from durable threadId instead of
the ephemeral per-credential providerSessionId so remote delegation
retries after an origin server restart or crash window reconcile with
the existing remote thread instead of launching duplicates or stranding
lanes.

Model: gemini-4-neon
Task: fix
Agent: antigravity
Lane: CLO-1091
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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