Skip to content

fix(server): allow ProviderProcesses to register Linux providers spawned via ProcessLauncher - #42690

Closed
bedair81 wants to merge 1 commit into
pingdotgg:mainfrom
bedair81:fix/provider-processes-launcher-ppid
Closed

bedair81 wants to merge 1 commit into
pingdotgg:mainfrom
bedair81:fix/provider-processes-launcher-ppid

Conversation

@bedair81

Copy link
Copy Markdown
Contributor

Problem

On Linux, starting a Cursor turn fails immediately with:

CursorAgentSdkRunnerError: Cursor Agent SDK worker.register failed.
  [cause]: Error: Cannot identify spawned provider

Since #39526 moved the Cursor SDK worker out of process, CursorAgentSdkProcessRunner.spawnWorker launches __cursor-sdk-worker through ChildProcessSpawner, which on Linux delegates to the ProcessLauncher helper process (process-launcher.mjs). As a result, the spawned worker's ppid is ProcessLauncher.currentPid rather than the server's process.pid.

ProviderProcesses.register (apps/server/src/process/providerProcesses.ts) still required provider.ppid === process.pid, so registration threw Cannot identify spawned provider on every attempt. (Claude was unaffected because spawnClaudeProcessGroup calls child_process.spawn directly from the server process.)

This is a small, focused fix (+14 / -1 non-test lines) for an obvious Linux regression mirroring #42151's ProcessLauncher.currentPid handling in PortScanner.

Fix

  • In apps/server/src/process/providerProcesses.ts, read ProcessLauncher.ProcessLauncher (already in context via layerPlatformServices in server.ts, with a safe Effect.undefined default) and look up currentPid dynamically inside register(pid).
  • Accept a provider whose ppid is either process.pid or the active ProcessLauncher helper PID, while verifying identity(launcherPid)?.ppid === process.pid so a dead, reused, or foreign PID cannot authorize registration.
  • In apps/server/src/process/providerProcesses.test.ts, add focused Linux regression tests covering direct children, ProcessLauncher.layerServer-spawned children, unrelated PIDs, and a non-owned ProcessLauncher PID.

Verification

  • Found on: Linux (aarch64), T3 Code 0.1.12, starting a Cursor (gemini-4-neon) thread — all 5 startup retries failed in CursorAgentSdkProcessRunner.spawnWorker with Error: Cannot identify spawned provider at ProviderProcesses.register.
  • Before fix: vp test run apps/server/src/process/providerProcesses.test.ts failed on registers providers spawned directly or through ProcessLauncher with Error: Cannot identify spawned provider at src/process/providerProcesses.ts:131.
  • After fix:
    • vp test run apps/server/src/process/providerProcesses.test.ts apps/server/src/process/agentScope.test.ts apps/server/src/provider/ProviderOrchestrationAdapterInfrastructure.test.ts — 3/3 files, 22/22 tests passed.
    • vp run check:changed origin/main — format (2 files), lint (0 warnings, 0 errors), knip 1/2 & 2/2, graphql (apps/server), typecheck (3 packages), and test (2/2 files, 5/5 tests) all passed.
  • Also verified on Linux host: systemd-run --user --scope via exec preserves the spawned process's PID and ppid.
  • Not verified: full desktop AppImage rebuild and live end-to-end Cursor turn against the rebuilt binary.

Built with Gemini 4 Neon (Antigravity harness in T3 Code).

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 25, 2026
@bedair81

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #41936, which already fixes #41929.

@bedair81 bedair81 closed this Nov 25, 2026
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 25, 2026
@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants