Repository navigation
Description
Security fix in the Solenta repo (electron/orchServer.js, the coder-threads MCP server).
Bug: cross-thread stop/archive are meant to be "the user's decision in every permission mode, including Auto and Bypass" (issues #551 / #322). But assertCrossThreadApproved(args, action) (electron/orchServer.js ~line 536) starts with if (!fromId || fromId === targetId) return;, where fromId comes from the OPTIONAL, agent-supplied fromThreadId argument. thread_stop (~line 1058) and thread_archive (~line 1012, when archived:true) only run requireOwnThread (same-project check) before that gate. So any agent that simply omits fromThreadId can stop or archive ANY thread in its project with no human approval. The same "claimed caller id" weakness affects the merge gate's machine-turn check (runner.isAutoTurn(self.id) runs on whichever thread id the caller claims; see the "turn check is the real lock" comment ~line 500).
Root-cause fix (preferred): bind the caller's thread id at the transport, the same way #671 bound projectId. The per-thread MCP config is written in electron/memory-sup.js (search for where the coder-threads URL gets ?projectId=, ~line 1713) and the server reads projectId from the request URL in electron/orchServer.js (~line 1964). Add threadId=<caller> to that URL, pass it into createToolHandlers as a bound caller id, treat it as the caller everywhere, and reject a conflicting claimed fromThreadId (mirror the #671 projectId behaviour). Then in assertCrossThreadApproved a missing fromThreadId resolves to the bound id, so omitting it no longer skips the gate; self-stop/self-archive (bound id === target) stays ungated. External pairing clients (electron/pairing.js) keep their own capability tokens — check how they reach these handlers and make sure they are not broken or newly bypassing.
Minimum acceptable fallback if transport binding is too big: when fromThreadId is absent and the target is not provably the caller, require approval instead of returning early.
Tests: add a test that a worker calling thread_stop on its lead WITHOUT fromThreadId is refused, one that self-stop still works, and one that a conflicting claimed fromThreadId is rejected. Find the existing orchServer tests under test/ (grep for assertCrossThreadApproved or "Stopping another thread"). Note: electron/providers.js contains a NUL byte, so use LC_ALL=C grep -a on it. Before running electron tests in a worktree, clone node_modules and build core/dist per the repo's worktree setup.
Filed from a Solenta suggested-work chip.
Activity
currentbits commentedon Oct 4, 2026
Reproduced at 615b38a0. With
fromThreadIdleft out, a lead on a machine turn stops and archives another thread with no approval. The existing test atelectron/test/orch-server.test.js:1066-1071asserts this behaviour as correct, so it has to be rewritten.Scope this issue to the fallback, which needs no transport binding. In
assertCrossThreadApproved, treat an emptyfromThreadIdas an unknown caller. Refuse cross-thread stop/archive unless the call is provably a self-action, i.e. it carriesfromThreadId === threadId. That repro passes without any binding.The rest belongs to #1425's transport binding:
threadIdonthread_mergelets a sibling worker merge another worker ontomain. Reproduced.fromThreadIdonthread_sendskips the unattended-sender refusal) can't be fixed inside a handler at all.The repro tests are in
research_notes/T3 orchestrator ACP UX and repros/repros/on branchcoder/i-want-you-to-research-t3-codes-orchestr-fae77a.currentbits commentedon Oct 11, 2026
Working the preferred fix: bind
threadId=<caller>on the coder-threads MCP URL (same as #671projectId), pass it intocreateToolHandlersasboundThreadId, reject a conflicting claimedfromThreadId, and treat a missingfromThreadIdas the bound id (or as not-self when unbound). Self-stop/self-archive stay ungated. Pairing stays on its own capability-token handlers.Tests first (TDD): worker
thread_stopon lead withoutfromThreadIdrefused; self-stop still works; conflictingfromThreadIdrejected.currentbits commentedon Oct 11, 2026
Implemented the transport bind (not just the fallback).
threadId=<caller>next toprojectId=(memory-sup + every runner/workflow caller that already had a thread id).createToolHandlerstakesboundThreadIdfrom the request URL. Conflicting claimedfromThreadIdis rejected. MissingfromThreadIdresolves to the bound id; if still empty, the target is not treated as self and approval is required.threadId(the caller) is the same bound id, soisAutoTurncannot run on a claimed lead.createExternalHandlers+ capability tokens.Tests: worker
thread_stopon lead withoutfromThreadIdrefused; bound self-stop works; conflictingfromThreadIdrejected.orch-server,orch-merge,kimi-home,pairinggreen. Nothing committed.currentbits commentedon Oct 11, 2026
PR: #1598
fix(orch): bind caller thread id so stop/archive cannot skip approval (…
fix(orch): bind caller thread id so stop/archive cannot skip approval (…