Skip to content

fix(runtime): serialize concurrent task admission - #38

Open
xLagerFeuer wants to merge 1 commit into
chekusu:mainfrom
opensiro-contributions:opensiro/wanman-task-admission-race
Open

xLagerFeuer wants to merge 1 commit into
chekusu:mainfrom
opensiro-contributions:opensiro/wanman-task-admission-race

Conversation

@xLagerFeuer

@xLagerFeuer xLagerFeuer commented Nov 10, 2026 •

Copy link
Copy Markdown

Motivation

Two concurrent Supervisor.handleRpcAsync(TASK_CREATE) calls can both pass TaskPool.checkConflict() before either inserts its task. For overlapping scopes, both can then be admitted.

Reproduction against chekusu/wanman@d3a8138de6c21981a4f1449a7b3f201e724c55c9 (Node 22): issue two overlapping TASK_CREATE calls concurrently. Actual: both admitted. Expected: only one admitted. No special WANMAN_RUNTIME or WANMAN_URL settings are required.

Change

  • packages/runtime/src/task-pool.ts: check active scope conflicts and insert the task in one SQLite IMMEDIATE transaction.
  • packages/runtime/src/supervisor.ts: route TASK_CREATE through atomic admission.
  • packages/runtime/src/__tests__/supervisor.test.ts: add overlapping and disjoint concurrency regression tests.

The existing general-purpose task insertion API remains available to other callers.

Validation

  • Independent native runtime Vitest with the exact patch: 68/68 PASS.
  • pnpm typecheck with pnpm 9.15.0: 5/5 workspace packages PASS.
  • Overlapping-scope regression: RED before / GREEN after; disjoint-scope control GREEN.

No scheduler, model invocation, or authorization policy changes.

AI-assisted contribution disclosure

VSM assessment: Current record · Snapshot used for this PR

Assessment date: 2026-10-29 (reviewed_at) · Assessed source revision: d3a8138de6c21981a4f1449a7b3f201e724c55c9

This PR was prepared by the OpenSiro Upstream Contributions AI-agent workflow, informed by the VSM assessment linked above. Technical analysis, code changes and reported checks were agent-driven; no independent human code review is claimed. For now, a human approves publication while monitoring the pipeline for errors. That approval is not a technical correctness guarantee. Fully autonomous publication is a future goal, not the status of this PR. AI-generated changes may be incomplete or incorrect; please review the diff and evidence independently.

The assessment describes the assessed source revision on the stated date; it is not a guarantee about this PR or later upstream code. Maintainers and their agents can compare the current record with the snapshot and reassess if the source or evidence has changed.

Use an IMMEDIATE SQLite transaction to check active scope conflicts and
insert a task atomically. Cover overlapping and disjoint TASK_CREATE
requests with deterministic first-party regression tests.
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