fix(scheduler): eliminate intake double-create (+ fmt normalize) #207

Merged
clawdie merged 2 commits from fix/intake-task-no-duplicate into main 2026-06-26 10:39:46 +02:00
Owner

Fixes the intake double-create regression that #206 introduced, and clears the inherited fmt drift on main.

The fix (a336f17) — verified correct

#206 made cmd_intake_task create_task and the scheduler tick create_task again → two tasks per intake, with the returned id being the orphaned-queued copy. This branch makes intake create the task once and the scheduler claim the existing task:

  • TaskRequest carries the pre-created task_id
  • cmd_intake_task passes it
  • the tick drops its create_task, keeps pick_agentclaim_task(task_id, agent)

Empirically verified (built + ran the daemon): intake-task once → exactly one task, status claimed, and its id equals the id returned to the caller. Unit test asserts tasks.len()==1; both intake integration tests pass.

fmt (b812c1e) — separate commit

cargo fmt --all normalized 4 files (scheduler/socket/multi_agent_board/store-lib): main's fmt gate was already red from drift inherited via earlier Phase-3 merges. Kept separate from the logic fix; brings fmt --all --check green.

Gates

  • cargo fmt --all --check
  • intake unit + integration tests
  • live e2e: one task, claimed, returned-id == routed task

Heads-up: main's fmt gate was red before this PR (recurring rustfmt drift slipping through merges). Worth a pre-commit/CI enforcement so it stops recurring.

🤖 Generated with Claude Code

Fixes the intake double-create regression that #206 introduced, and clears the inherited fmt drift on `main`. ## The fix (`a336f17`) — verified correct #206 made `cmd_intake_task` `create_task` **and** the scheduler tick `create_task` again → two tasks per intake, with the returned id being the orphaned-queued copy. This branch makes intake create the task once and the scheduler **claim the existing task**: - `TaskRequest` carries the pre-created `task_id` - `cmd_intake_task` passes it - the tick drops its `create_task`, keeps `pick_agent` → `claim_task(task_id, agent)` **Empirically verified** (built + ran the daemon): `intake-task` once → **exactly one task**, status **`claimed`**, and its id **equals** the id returned to the caller. Unit test asserts `tasks.len()==1`; both intake integration tests pass. ## fmt (`b812c1e`) — separate commit `cargo fmt --all` normalized **4 files** (scheduler/socket/multi_agent_board/store-lib): `main`'s fmt gate was already **red** from drift inherited via earlier Phase-3 merges. Kept separate from the logic fix; brings `fmt --all --check` green. ## Gates - ✅ `cargo fmt --all --check` - ✅ intake unit + integration tests - ✅ live e2e: one task, `claimed`, returned-id == routed task > Heads-up: `main`'s fmt gate was red before this PR (recurring rustfmt drift slipping through merges). Worth a pre-commit/CI enforcement so it stops recurring. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clawdie added 2 commits 2026-06-26 08:08:44 +02:00
The merged #206 created a regression: cmd_intake_task created a task
at submit time (returning id A) AND the scheduler tick created a second
task from the same request (id B, which got claimed). Two tasks per
intake, with the returned id pointing to the orphaned copy.

Fix: TaskRequest now carries the pre-created task_id. The tick drops
its create_task() call and only does pick_agent + claim_task on the
existing id. One task, one id, the returned id is the one the
scheduler routes.

- TaskRequest gains task_id field
- cmd_intake_task creates once, pushes id to queue
- scheduler tick claims via req.task_id (no create_task)
- scheduler unit test pre-creates task before submit
- multi_agent_board test verifies id in response
style: cargo fmt — normalize pre-existing drift inherited from main
Some checks are pending
CI / rust (pull_request) Waiting to run
CI / markdown (pull_request) Waiting to run
CI / port (pull_request) Waiting to run
CI / agent-jail-pkgs (pull_request) Waiting to run
b812c1ee22
main's fmt gate was red (over-indented host/last_seen in scheduler test
fixtures + drift in socket/store/tests from earlier Phase-3 merges). This
brings the branch to fmt --all --check clean so the gate passes; kept
separate from the dedup fix commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clawdie merged commit 9d8fe55b6f into main 2026-06-26 10:39:46 +02:00
clawdie deleted branch fix/intake-task-no-duplicate 2026-06-26 10:39:47 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: clawdie/colibri#207
No description provided.