✔ inbox lists only decisions routed to the human, with what approving authorizes and how to decide (134.382091ms)
✔ decide resolves by id prefix with --yes, and the trail shows it in broker order with the task to follow (127.538676ms)
✔ decide refuses without a terminal or --yes, on an unknown option and on a short reference (116.860604ms)
✔ decide prints a declining choice as declining (125.22075ms)
✔ an unknown outcome is reported once and never resent (103.496002ms)
✔ a decision closed before the answer arrives exits 2 and points at its trail (125.776748ms)
✔ a prefix that matches two open decisions exits 2 and resolves neither (117.149997ms)
✔ without --business a command uses the live host's business, and a stale host.json is not a host (115.624806ms)
✔ every human command refuses inside an agent run before it touches the bus (223.103098ms)
✔ usage errors exit 4; no business and no host is a usage error (150.021496ms)
✔ agents and tasks print through the broker (124.340719ms)
✔ notify.json: missing, loose, malformed and extra keys refuse; a binding or null passes (1.57056ms)
✔ bootConfig builds the broker's boot message for one business, with no trackers key when no project names one (41.155739ms)
✔ trackers come from the tracker.* variables of the one project that names a tracker project (35.962477ms)
✔ with two projects, the one that sets tracker.project supplies the tracker and the other is no conflict (34.977988ms)
✔ two projects that each name a tracker project refuse, since the boot shape holds one (45.484448ms)
✔ a business without tracker.baseUrl gets no trackers entry (35.743739ms)
✔ an unknown business and a broken system config refuse with exit 3 (70.823037ms)
✔ empty views say so (1.141349ms)
✔ the trail keeps the broker's order and names a decision's task without its rows (1.432144ms)
✔ tasks print the tracker fields the snapshot carries (0.228737ms)
✔ the host boots the broker, binds a launch in process, and the notifier DMs a blocking decision exactly once (911.580879ms)
✔ a notifier that dies takes the host down with exit 1, so the unit restarts the pair (276.115157ms)
✔ a second host for the same data root refuses with exit 3 while the first runs (200.288603ms)
✔ a notifier that refuses stops the broker and the host refuses with exit 3 (202.357798ms)
✔ a notifier that refuses after the broker died still refuses with exit 3, without a send to the dead broker (207.000651ms)
✔ a notifier that dies before it replies, after the broker died, still refuses, without a send to the dead broker (112.164695ms)
✔ a close send that fails with EPIPE after the notifier refuses still gives the notifier's refusal, exit 3 (185.066354ms)
✔ a close send that fails with EPIPE after the notifier dies unanswered still gives the notifier's error (134.881776ms)
✔ close() whose stop and close sends fail with EPIPE still finishes, with exit 1 (189.591959ms)
✔ watchChildren reports a child that died before it was called, and one that dies later (22.719956ms)
✔ bus stop refuses to signal a live pid that is not a bus host (203.112654ms)
✔ bus start refuses with exit 3 and the code when the broker refuses to boot; bus status names the lock (213.10587ms)
✔ bus start refuses with exit 3 without a notifier config (86.928226ms)
✔ bus start runs until bus stop; status reports it while it runs (656.036208ms)
✔ bus-service.sh renders the unit and installs it into a given directory (26.867061ms)
✖ bus start --pm: the PM runs under its own PID namespace, registered, with a manifest (282.417559ms)
✖ the PM launches a coder through its launch tool; the coder answers; refusals name their code (575.753358ms)
✔ a runner that stops at once ends its launch with the runner's reason (272.021572ms)
✔ a host that died hard leaves its sessions to the next host, which kills them and ends their runs so the role can be launched again (770.912983ms)
✔ a host that died hard leaves its sessions to the next host, which finds one already exited (23) and ends their runs so the role can be launched again (3659.382952ms)
✔ a malformed sessions.json refuses the host start with exit 3 and stays as it was (135.231912ms)
✔ zoned uses the IANA zone across DST (17.476571ms)
✔ each open blocking decision is DM'd once, across polls and a restart; non-blocking ones are not (132.004501ms)
✔ two blocking decisions get two DMs with different nonces (122.871191ms)
✔ the digest nonce differs per business and per day and fits Discord's 25 characters (0.292362ms)
✔ a failed DM is journaled, backs off, and is retried until it lands (105.352783ms)
✔ five definite refusals stop a DM: one gave-up line, one log line, and a restart keeps the count (109.51429ms)
✔ 429s, 5xx-style unknowns and refusals without a status never count toward the limit (121.525089ms)
✔ a crash between the fifth refusal and its gave-up line: the next poll appends it and sends nothing (118.943528ms)
✔ polled every POLL_MS against a permanent 403, a DM is sent at 0, 30, 60, 90 and 120 min and gives up only then (173.203968ms)
✔ a restart after the second refusal does not send before that refusal's 30 min are up (138.607623ms)
✔ the digest goes at 08:00 Chicago once a day, with blocking ones marked as DM'd (259.309314ms)
✔ a late start with no digest for the day sends one at once; an empty inbox gets one line (157.557174ms)
✔ an inbox read failure is logged and the next poll retries (0.717398ms)
✔ no Discord id reaches the journal or the log (113.42138ms)
✔ the journal: a torn tail is copied out and truncated, so an append after it reopens cleanly (20.122071ms)
✔ the journal: a crash between the copy and the truncate leaves a tail the next open repairs (38.603439ms)
✔ the journal: a whole file that is one torn line truncates to empty (25.084268ms)
✔ the journal: a malformed complete line refuses and leaves the file and any torn tail alone (2.048053ms)
✔ the journal: a loose file mode, a loose directory or a symlinked journal refuses (0.595689ms)
✔ the journal: a line with a wrong type refuses with exit 3 and names the field (1.751411ms)
✔ the journal: a symlinked directory refuses and says it is a link (0.383996ms)
✔ the journal: a dangling directory link, a parent that is a file and a journal that is a directory each refuse with exit 3 (0.480832ms)
✔ the journal: an append after the file was swapped for a symlink refuses and writes nothing through it (0.369812ms)
✔ the journal: a directory it cannot write or create refuses with exit 3 and names the path (0.429485ms)
✔ digest content stays within Discord's 2000 characters (0.264703ms)
✔ runLoop never overlaps ticks and stops after the one in flight (110.764422ms)
task.close {} answered: invalid-request; fake saw 18 requests, first GET /info 200, GET /projects/1 200, GET /projects/1/views 200
task.close on a missing task answered: task-not-found; it made GET /tasks/999 404
✔ bootConfig trackers reach the S3 adapter in the real broker child, which goes ready against a fake Vikunja (394.904188ms)
✔ the transport writes {business, verb, args} to the child and reads its JSON (41.671676ms)
✔ a bus code on stderr becomes the exit code; garbage and timeouts are outcome problems (2160.080078ms)
✔ busExit and refuseInsideAgent (0.4448ms)
✔ talk sends a REQUEST, prints and reads everything that arrives, and stops at the reply (219.683221ms)
✔ talk --wait 0 only sends; no reply within --wait exits 1 and says where it will show (1121.161112ms)
✔ talk, stop and launches off/on refuse inside an agent run; bad arguments are usage errors (108.204627ms)
✔ launches off and on go to the broker and change the business's launch state (117.554155ms)
✔ launches list reads sessions.json and marks a stale entry; stop reports it and refuses a non-runner (112.64814ms)
ℹ tests 77
ℹ suites 0
ℹ pass 75
ℹ fail 2
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 5778.01493

✖ failing tests:

test at packages/cli/tests/launcher.test.mjs:105:1
✖ bus start --pm: the PM runs under its own PID namespace, registered, with a manifest (282.417559ms)
  AssertionError [ERR_ASSERTION]: The input did not match the regular expression /PM launch refused: instance-running/. Input:
  
  'CliError: PM launch refused: capacity-full (opus sessions: 1 of 1)'
  
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
      at async TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r41/wt/packages/cli/tests/launcher.test.mjs:137:3)
      at async Test.run (node:internal/test_runner/test:1409:7)
      at async startSubtestAfterBootstrap (node:internal/test_runner/harness:387:3) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: CliError: PM launch refused: capacity-full (opus sessions: 1 of 1)
        at file:///home/jwoltje/darkwing-scratch/r41/wt/packages/cli/src/launcher.mjs:295:15
        at process.processTicksAndRejections (node:internal/process/task_queues:104:5),
    expected: /PM launch refused: instance-running/,
    operator: 'rejects',
    diff: 'simple'
  }

test at packages/cli/tests/launcher.test.mjs:175:1
✖ the PM launches a coder through its launch tool; the coder answers; refusals name their code (575.753358ms)
  AssertionError [ERR_ASSERTION]: coder
  + actual - expected
  
    {
  +   error: 'capacity-full',
  -   error: 'instance-running',
      ok: false
    }
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r41/wt/packages/cli/tests/launcher.test.mjs:209:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
      at async Test.run (node:internal/test_runner/test:1409:7)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: { ok: false, error: 'capacity-full' },
    expected: { ok: false, error: 'instance-running' },
    operator: 'deepStrictEqual',
    diff: 'simple'
  }
