Skip to content

Refuse a second, different task assignment with a typed 409 - #9983

Open
olety wants to merge 6 commits into
opus-task-proof/task-fact-test-pinsfrom
opus-task-proof/refuse-second-task-assignment
Open

olety wants to merge 6 commits into
opus-task-proof/task-fact-test-pinsfrom
opus-task-proof/refuse-second-task-assignment

Conversation

@olety

@olety olety commented Nov 20, 2026

Copy link
Copy Markdown
Member

FIX [TASK-ASSIGNED-FORK-ON-CONCURRENT-AMENDED-SETTLES] (P3). Ruling: Engine ANSWER TASK-ASSIGNED-FORK = C (20 Nov 21:32), a mechanism ruling inside the owner's SR-1 TASK-OWNER-FORK = A.

What was wrong

A task's Assigned fact says who the task is for, and the fold refuses two different bindings at every read ("task assignment fork"). Two of the owner's devices can each approve one task proposal with a different assignee, and both settles mint the same task id. When device B already holds device A's Assigned fact and B's owner approves, B's settle wrote its own Assigned fact through put_task_authority_fact_in_txn. That door folded the facts before it wrote, saw only A's single binding, admitted the owner's write and committed the fork. The approve succeeded, and from then on every read of the task failed.

The change

  • put_task_authority_fact_in_txn (task_authority/mod.rs): after the admits check, an Assigned or HumanAssigned fact whose (actor, assignee) binding differs from the one the fold already holds is refused with the new RecordError::TaskAssignmentConflict { task_ref, held_assignee, offered_assignee } (ErrorKind::TaskAssignmentConflict). Nothing is written. A fact naming the held binding still writes as a set duplicate. The fork still fails closed at every read.
  • settle_refusal (task_verb/highway_post.rs) keeps the refusal typed instead of wrapping it as InvalidConfig, so every approve door answers INVALID_STATE (409) rather than 400. The approving transaction fails, so the proposal stays pending.
  • MemoryError gains task_assignment_conflict: Option<Box<TaskAssignmentConflict>> (task, held and offered as 32 hex; boxed, skipped when absent) and one suggestion. The engine's From<Error> sets it with MEMORY_CODE_INVALID_STATE.
  • MCP gateway: kind task_assignment_conflict (-32020) with error.data.task_assignment_conflict, from both the engine-error path and the facade-refusal path. The device release hold words include the field.
  • HTTP: core_engine_error answers 409 InvalidState { state: "task_assignment_conflict" } with the engine message (which names the task and both assignees) and the suggestion. The owner plane reaches it through its existing fallthrough. Carrying the typed field on the HTTP facade body and in the SDK error types comes in the next PR of this stack ([TASK-ASSIGNMENT-CONFLICT-HTTP-FACADE-FIELD]).
  • Mechanical task_assignment_conflict: None at every MemoryError literal (napi, py, remote, the SDK generator's native template, three engine sites).

Test

crates/oneiron/tests/task_assignment_conflict_refused.rs (new). It uses the host and owned-device fixtures of task_fact_carrier_proof.rs. A foreign agent parks a STANDARD task-create proposal on the host, assigned to Y. The device signs an Assigned fact for the settled task id naming X, and the fact lands on the host without the TASK row. The owner then reviews and approves on the host. Expected: Err with MEMORY_CODE_INVALID_STATE, the serialized task_assignment_conflict naming the task, X and Y, the proposal still Proposed, and the task's facts still folding with X as the only assignee.
Red on the base (#9981's head plus this file): the approve returns Ok, so expect_err fails. Green here.
Run: RUSTFLAGS="--cfg oneiron_test_support" cargo test --locked -p oneiron --all-features --test task_assignment_conflict_refused.

Stored change

None: no stored row changes shape, and a refused write writes nothing. MemoryError is a wire shape, and its new field is additive and skipped when absent. Builds on the launch-reset stack (#9096, then #9823) and lands only with it. No verb, no grant.

When another device of this vault already assigned a task, the mint door
refuses an Assigned or HumanAssigned fact that names another binding with
RecordError::TaskAssignmentConflict (the task, the held assignee, the offered
assignee) instead of committing a fork that every later read fails on
(Engine ANSWER TASK-ASSIGNED-FORK = C, FIX
[TASK-ASSIGNED-FORK-ON-CONCURRENT-AMENDED-SETTLES]). A fact naming the held
binding still writes as a set duplicate.

settle_refusal keeps the refusal typed, so each approve door answers
INVALID_STATE (409) instead of a 400; MemoryError carries the field
task_assignment_conflict, the MCP gateway answers kind
task_assignment_conflict with the same data, and the HTTP error map answers
409 InvalidState "task_assignment_conflict". The approving transaction
fails, so the proposal stays pending.

Test: task_assignment_conflict_refused.
@olety olety added the launch-reset Lands only in the launch-reset stack; no normal train or direct merge takes it label Nov 20, 2026
@greptile-apps

greptile-apps Bot commented Nov 20, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@olety
olety added this pull request to stack #9823 November 20, 2026 19:24
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 28 billable files and costs up to $7.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 55 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 151 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0b364c5 and 4761bb1.

Files selected for processing: 28

  • crates/oneiron-base/src/error.rs
  • crates/oneiron-contracts/src/error/mod.rs
  • crates/oneiron-contracts/src/error/record.rs
  • crates/oneiron-contracts/src/memory.rs
  • crates/oneiron-contracts/src/memory/error.rs
  • crates/oneiron-contracts/src/memory/error/engine.rs
  • crates/oneiron-napi/src/facade/input_error.rs
  • crates/oneiron-napi/src/facade/numeric.rs
  • crates/oneiron-py/src/lib.rs
  • crates/oneiron-remote/src/error.rs
  • crates/oneiron-remote/src/remote/response.rs
  • crates/oneiron-sdk-generator/src/generate/emit_native.rs
  • crates/oneiron-server/src/api/error_map.rs
  • crates/oneiron-server/src/api/mcp_gateway/device_release.rs
  • crates/oneiron-server/src/api/mcp_gateway/envelope.rs
  • crates/oneiron-server/src/api/mcp_gateway/facade_refusals.rs
  • crates/oneiron-server/src/api/mcp_gateway/tasks_response.rs
  • crates/oneiron/src/booking/emergency_reschedule/execution.rs
  • crates/oneiron/src/context_board/plugin/state.rs
  • crates/oneiron/src/memory/mod.rs
  • crates/oneiron/src/task_authority/mod.rs
  • crates/oneiron/src/task_verb/ask_record/guard.rs
  • crates/oneiron/src/task_verb/ask_record/tests.rs
  • crates/oneiron/src/task_verb/create_validation.rs
  • crates/oneiron/src/task_verb/highway_post.rs
  • crates/oneiron/src/task_verb/highway_post/settlement.rs
  • crates/oneiron/src/task_verb/proposal_create.rs
  • crates/oneiron/tests/task_assignment_conflict_refused.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…d TASK holds

Both create-proposal settle paths returned Ok as soon as the TASK row they
would land existed. A concurrent approval on another device can land that TASK
with its Assigned fact first; a later local approval of the same proposal,
amended to another assignee, then committed while the TASK stayed assigned to
the first one.

The early return now runs the check the assignment write makes: when the fold
holds an assignment and the approval offers another, it refuses with
TaskAssignmentConflict (409 INVALID_STATE with typed fields, TASK-ASSIGNED-FORK
= C). The same assignee, or none, still changes nothing.

Review round 1 of #9983, P1 task_verb/proposal_create.rs:193 and
highway_post/settlement.rs:114.
…store

The whole-vault import queued an ask answer behind its group only. A
foreign-stated answer's link proof also reads its actor's PERSON row; when the
archive held both the answer and that PERSON and the answer came first in a
pass, its guard answered AskDependencyPending and the whole restore failed.
ask_record_dependencies now names that PERSON too.

Review round 1 of #9983, P1 task_verb/ask_record/guard.rs:48.
…estore order

task_assignment_conflict_refused.rs: the other device's approval landed the
TASK and its Assigned fact first; the local approval offering another assignee
answers 409 INVALID_STATE with the typed conflict and the proposal stays
pending (red at b20a975: the approval returns Ok); offering the same
assignee changes nothing (control).

ask_record/tests.rs: a foreign-stated answer's archive dependencies name its
group and its actor's PERSON; a human answer names its group only (red at
b20a975).

Review round 1 of #9983, both P1s.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

launch-reset Lands only in the launch-reset stack; no normal train or direct merge takes it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant