Repository navigation
fix(link): ensure the desktop sandbox on the remoteDispatch push path - #3702
Merged
Merged
Conversation
The push (remoteDispatch) dispatch site stopped ensuring the sandbox in C-bis S4 (#3698), on the rationale that the daemon self-ensures from the work item — but that backstop exists only on the pull/work-queue path. On the push path the link daemon's control-handler 404s "unknown handle" for an unspawned handle, surfacing as [remoteDispatch] dispatch failed (404). Restore the warm-ensure via ensurePushDispatchSandboxHandle and dispatch the provisioned handle (also closing the thread-vs-input branch drift). Pull site unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
[remoteDispatch] dispatch failed (404)when running a user-desktop CLI agent (e.g. claude-code) viadecocms link.The push (
remoteDispatch) dispatch path stopped ensuring (spawning) the desktop sandbox in C-bis S4 (#3698), on the rationale that "the daemon self-ensures fromWorkItem.sandboxon dequeue." That backstop only exists on the pull/work-queue path (cluster-connection-pull.ts). On the push path the link daemon'scontrol-handler.handleStreamjust callsproxyPort(handle)and returns404 "unknown handle"for a never-spawned handle (control-handler.ts:172-193). The plain-text body isn't JSON, soremote-dispatch.tskeeps its default detail →[remoteDispatch] dispatch failed (404).This restores the warm-ensure at the push site via a small
ensurePushDispatchSandboxHandlehelper and dispatches the handleensureSandboxactually provisioned — which also closes a secondary handle-drift bug (dispatch usedmem.thread.branch ?? input.branch ?? "ephemeral"while the ensure would have usedinput.branch ?? "ephemeral", diverging on a repo-connected first message). The pull site is unchanged (its daemon self-ensure is genuine).Why it only bites now
decidePullDispatchroutes to the pull path only whenmessage_storage_version === 2, which is canary-gated off by default (STREAM_OF_RECORD_V2_PERCENT=0). So every normal (v1) user-desktop thread takes the push path that #3698 left without an ensure.Test plan
dispatch-sandbox.test.ts): the push helper runs the full ensure (not a pure derivation) and honors branch precedence (thread → request →"ephemeral").bun testgreen on the touched area + siblings (dispatch-sandbox / remote-dispatch / thread-gate-workflow / control-handler).bun run check,bun run lint,bun run fmt:checkall green.bun run dev --local-sandbox-provider, send a message in a user-desktop claude-code chat, confirm it streams with no[remoteDispatch] dispatch failed (404)and no[control] handleStream unknown handle=....🤖 Generated with Claude Code
Summary by cubic
Fixes 404 errors in
remoteDispatchfor user-desktop CLI agents (e.g.decocms link) by ensuring the desktop sandbox is spawned on the push path and using the provisioned handle.ensurePushDispatchSandboxHandleto runensureSandboxon the push path and dispatch the handle it provisions, preventing "unknown handle" 404s and handle drift (thread branch now correctly wins over request branch, else"ephemeral").Written for commit 30f70fd. Summary will update on new commits.