P1: add an in-memory resource queue scheduler - #64
Merged
Merged
Conversation
Request-owned patch and exec work waits on a per-resource FIFO. A live process still returns WORKSPACE_BUSY immediately. MCP read and find stay unlocked. Co-authored-by: Cursor <cursoragent@cursor.com>
…nto occupancy. Queue wait is no longer resuming. Live process ownership fails trailing waiters. RESOURCE_QUEUE_FULL is a separate failure from WORKSPACE_BUSY. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Issue
Remaining P1 occupancy work (resource queue scheduler). No tracking issue.
Summary
Workspace occupancy now waits on an in-memory per-resource FIFO for request-owned patch and exec work. A live process still rejects overlapping
apply_patch/exec_commandimmediately withWORKSPACE_BUSY. MCPreadandfindstay unlocked.Contract changes
LIVE_TOOLSnames unchanged. No new MCP tools.WorkspaceSerializationInfoflags unchanged: live process holds the mutation lease, no parallel exec, read/find while a process is live, no patch while a process is live,conflict_error=WORKSPACE_BUSY.WORKSPACE_BUSYstill means a live process owns the workspace. Overlapping request-owned mutations wait in FIFO order instead of failing.Tests
Verified:
cargo test -p codespace-store --offline— 39 passed, including FIFO order, process-held immediate busy, waiter cancel, SharedRead wait/no-barge, workspace isolation.cargo test -p codespace-server --lib --offline— 24 passed.cargo test -p codespace-server --test apply --offline— 2 passed, including concurrentapply_patchserializing withoutWORKSPACE_BUSY.cargo test -p codespace-server --test process --offline— 13 passed, including live shell still blocking patch/exec andLIVE_TOOLSunchanged.Not re-run here: full workspace CI, e2e, security, recovery, UDS worker death.
Security scenarios
read/finddo not take SharedRead, so live-process non-exclusion for reads is preserved.Out of scope
restart_recovery=none).apply_patch.read/findto SharedRead.