Skip to content

feat(server): isolate provider commands by thread - #289

Merged
patroza merged 1 commit into
fork/changesfrom
feat/provider-command-thread-lanes
Aug 2, 2026
Merged

feat(server): isolate provider commands by thread#289
patroza merged 1 commit into
fork/changesfrom
feat/provider-command-thread-lanes

Conversation

@patroza

@patroza patroza commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace the global provider-command FIFO with lazy FIFO lanes keyed by thread ID
  • preserve strict ordering within a thread while allowing unrelated threads to execute concurrently
  • reclaim idle lanes immediately and cancel/drop a lane when its thread is deleted, so historical threads allocate no workers
  • document the concurrency and lifecycle guarantees

Orchestrator v2 alignment

This matches v2's KeyedSerialExecutor<ThreadId> architecture: serialize within a thread, run unrelated threads concurrently, and remove keyed state after the last user. The v1 worker remains a queue-oriented wrapper because it additionally needs deterministic drain() and explicit cancellation/drop of queued commands on thread deletion.

Tests

  • vp check
  • ELECTRON_SKIP_BINARY_DOWNLOAD=1 vp run -r --cache --log labeled typecheck
  • vp test run packages/shared/src/DrainableWorker.test.ts packages/shared/src/KeyedDrainableWorker.test.ts apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts apps/server/integration/orchestrationEngine.integration.test.ts
  • 58 passed, 1 skipped

@patroza
patroza marked this pull request as ready for review August 2, 2026 09:20
@patroza
patroza enabled auto-merge (squash) August 2, 2026 09:20
@patroza
patroza force-pushed the feat/provider-command-thread-lanes branch from 96e4835 to f8ff1db Compare August 2, 2026 09:21
@patroza
patroza merged commit 1d4b7d5 into fork/changes Aug 2, 2026
10 checks passed
patroza added a commit that referenced this pull request Aug 4, 2026
Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Aug 4, 2026
Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Aug 4, 2026
Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Aug 5, 2026
Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
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