Repository navigation
Description
Problem
The pm-stack dispatch service's bun test suite — 131 tests across 10 files in pm-stack/dispatch/test/ — is run by no workflow, flake check, or justfile recipe, so its regression pins are decorative.
pm-dispatch is a live service: it is the authenticated intake that launches OpenCode sessions and enqueues repo-task/v1 work into the fleet queues, run as a systemd service from this checkout (nixos/services/pm-stack/default.nix:180-188, WorkingDirectory = "${repo}/pm-stack/dispatch").
Evidence (verified this run, laptop primary @ e90672d)
pm-stack/dispatch/package.jsondeclares"test": "bun test", and the suite exists:test/{attach_verify,auth,config,dispatch_preexisting,launch_annotations,launch_failure,packet,queue,server,validate}.test.ts.- Verified on the laptop:
cd pm-stack/dispatch && bun test→ 131 pass, 0 fail, 526 expect() calls, across 10 files (~0.2s, offline). - Wiring check:
grep -rn "pm-stack/dispatch" .github/workflows/ justfile flake.nix→ zero references. The two pm-stack workflows cover the sibling services only:.github/workflows/pm-stack-tests.ymlruns aggregatorbun test, projectorbun test, two script smokes, and the claimant/grist Python suites — never dispatch..github/workflows/pm-aggregator-tests.ymlruns aggregator + projector only.
- The suite pins exactly the failure classes dispatch has shipped before: launch-failure compensation and orphaned-issue cleanup (fix(pm-dispatch): failed launches leave orphan tracking issues open (66 open, #3499–#4899) #4917 pins in
launch_failure.test.ts), pre-existing-task detection (fix(pm-dispatch): detect pre-existing enqueue row — attach dispatch must not silently vanish (#2677) #3143 class), packet/dedupe-key shape (packet.test.ts), auth and config validation. Closed dispatch bugs pm-dispatch(tasks): a second dispatch to an already-tasked issue silently vanishes — enqueue returns the old task and dispatch reports it as the new queued task #2677/pm-dispatch(validate): resolvePriority's plain-object lookup returns prototype members as priorities — 'constructor' becomes the Object constructor function and '__proto__' an object, instead of the documented 400 #2757/pm-dispatch(config): DISPATCH_PORT / DISPATCH_HOSTS are never validated — port 0 silently binds a random port, a typo crashes with a Bun RangeError naming neither variable, hex/scientific spellings become other ports, and an all-separator DISPATCH_HOSTS exits 0 serving nothing #2758/fix(pm-dispatch): wait:false launch failures leave the queue task queued and the issue unnoted #2901/pm-dispatch(launch-failure): issue note claims the queue task 'was cancelled' even when cancelTask itself failed — the orphaned task is recorded as cleaned up #2917/fix(pm-dispatch): POST /v1/tasks issue_number attach never verifies the issue exists, is open, or is an issue #3007/pm-dispatch(server): the 256 KiB body cap is measured in UTF-16 code units, not bytes — a 300 KB CJK body passes readJsonBody's 'too large' check #3010/pm-dispatch(validate): parseModel string form does not trim its segments — "anthropic / claude-sonnet" validates, then launches with an unresolvable model #3177/fix(pm-dispatch): pre-existing-task detection compares the DB clock to the dispatch clock — fresh rows can read as pre-existing and live rows as new (#3143) #4661 all live in the surface this suite covers — with no CI running it, a re-regression of any of them produces no signal.
Why it matters
Dispatch sits on the fleet's work-intake path: a silent regression in packet building, queue enqueue, or launch-failure compensation corrupts or orphans real fleet work (the #4917 orphan-issue flood is the standing example). The suite is fast, offline, and green — the only missing piece is a runner.
Acceptance criteria
- A workflow (extending
pm-stack-tests.yml, or a dispatch job inpm-aggregator-tests.ymlfollowing the projector pattern from ci: no pull_request workflow covers pm-stack/** — projector/aggregator changes merge with zero PR CI #2936) runsbun testinpm-stack/dispatchwith a fail-if-missing guard on the test directory, so a green run cannot be a silently skipped suite. - The step fails the job when any dispatch test fails (verified by a deliberate-break run or equivalent evidence).
- Trigger shape follows the house CI tier policy (
.github/ci-policy.md). - No changes to the dispatch source or tests themselves are needed; if a test fails in CI but passes locally, that discrepancy is reported on this issue before any test is edited.
Activity
developing-today commentedon Nov 5, 2026
CODE-1749
dezren39 commentedon Nov 5, 2026
🤖 Agent note · filed
bun testfor pm-stack/dispatch into a pm-stack workflow with a fail-if-missing guard; done when a check runs the suite and fails on a deliberate break.dezren39 commentedon Nov 5, 2026
🤖 Agent note · picked up
6 remaining items
dezren39 commentedon Nov 5, 2026
🤖 Agent note · picked up
.github/workflows/pm-stack-tests.ymlwith a fail-if-missing guard, mirroring the ci(pm-stack): Python suites test_poll.py (36 tests, #3026 claimant cap gate) and test_update_choice_options.py (7 tests) run by no workflow #5951 claimant/grist pattern — Fixes ci(pm-stack): pm-dispatch bun suite (131 tests, incl. #4917 orphan-compensation pins) run by no workflow — the aggregator/projector workflows never touch dispatch #6090.queue/9899-6090-pm-dispatch-cirunningbun testinpm-stack/dispatch, no dispatch source/test edits.dezren39 commentedon Nov 5, 2026
🤖 Agent note · done
.github/workflows/pm-stack-tests.yml— done via PR ci(pm-stack): run pm-dispatch bun suite in pm-stack-tests #6096, merged as 5f161d2; this issue auto-closed byFixes #6090.pm-stack/dispatch/test/; no dispatch source/test edits.queue/9899-6090-pm-dispatch-ci; verification on the laptop worktree: clean suite 131 pass / 0 fail, deliberate-break run exited 1, missing-dir guard exited 1 with::error::. Codex review on PR ci(pm-stack): run pm-dispatch bun suite in pm-stack-tests #6096 completed with no findings; CodeRabbit was rate-limited (skipped).