✔ inbox lists only decisions routed to the human, with what approving authorizes and how to decide (114.924706ms)
✔ decide resolves by id prefix with --yes, and the trail shows it in broker order with the task to follow (139.856708ms)
✔ decide refuses without a terminal or --yes, on an unknown option and on a short reference (164.979267ms)
✔ decide prints a declining choice as declining (104.117279ms)
✔ an unknown outcome is reported once and never resent (84.975621ms)
✔ a decision closed before the answer arrives exits 2 and points at its trail (77.461823ms)
✔ a prefix that matches two open decisions exits 2 and resolves neither (85.020978ms)
✔ without --business a command uses the live host's business, and a stale host.json is not a host (72.178605ms)
✔ every human command refuses inside an agent run before it touches the bus (73.770936ms)
✔ usage errors exit 4; no business and no host is a usage error (88.478931ms)
✔ agents and tasks print through the broker (92.537743ms)
✔ notify.json: missing, loose, malformed and extra keys refuse; a binding or null passes (1.125131ms)
✔ bootConfig builds the broker's boot message for one business, with no trackers key when no project names one (39.654827ms)
✔ trackers come from the tracker.* variables of the one project that names a tracker project (32.193424ms)
✔ with two projects, the one that sets tracker.project supplies the tracker and the other is no conflict (30.69513ms)
✔ two projects that each name a tracker project refuse, since the boot shape holds one (34.294892ms)
✔ a business without tracker.baseUrl gets no trackers entry (30.904946ms)
✔ an unknown business and a broken system config refuse with exit 3 (57.72543ms)
✔ empty views say so (0.930348ms)
✔ the trail keeps the broker's order and names a decision's task without its rows (0.916593ms)
✔ tasks print the tracker fields the snapshot carries (0.19946ms)
✔ the host boots the broker, binds a launch in process, and the notifier DMs a blocking decision exactly once (912.063406ms)
✔ a notifier that dies takes the host down with exit 1, so the unit restarts the pair (218.563894ms)
✔ a second host for the same data root refuses with exit 3 while the first runs (139.935075ms)
✔ a broker reply that misses the wait breaks the channel: the late reply answers nothing, later requests refuse, the host exits 1 (1122.68701ms)
✔ a broker reply with another request's id, or none, breaks the channel and the host exits 1 (224.906111ms)
✔ a notifier that refuses stops the broker and the host refuses with exit 3 (156.620082ms)
✔ a notifier that refuses after the broker died still refuses with exit 3, without a send to the dead broker (144.463327ms)
✔ a notifier that dies before it replies, after the broker died, still refuses, without a send to the dead broker (102.863039ms)
✔ a close send that fails with EPIPE after the notifier refuses still gives the notifier's refusal, exit 3 (152.969174ms)
✔ a close send that fails with EPIPE after the notifier dies unanswered still gives the notifier's error (108.27205ms)
✔ close() whose stop and close sends fail with EPIPE still finishes, with exit 1 (176.554181ms)
✔ watchChildren reports a child that died before it was called, and one that dies later (23.0238ms)
✔ bus stop refuses to signal a live pid that is not a bus host (202.545734ms)
✔ bus start refuses with exit 3 and the code when the broker refuses to boot; bus status names the lock (211.140698ms)
✔ bus start refuses with exit 3 without a notifier config (87.559733ms)
✔ bus start runs until bus stop; status reports it while it runs (657.201834ms)
✔ bus-service.sh renders the unit and installs it into a given directory (26.508444ms)
✖ bus start --pm: the PM runs under its own PID namespace, registered, with a manifest (254.585334ms)
✖ the PM launches a coder through its launch tool; the coder answers; refusals name their code (590.273225ms)
✔ a runner that stops at once ends its launch with the runner's reason (232.427964ms)
✔ 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 (673.190299ms)
✔ 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 (3568.794721ms)
✔ a malformed sessions.json refuses the host start with exit 3 and stays as it was (110.916678ms)
✔ an over-long launch request is refused at once, not at the 10 s idle timeout (115.609679ms)
✔ a launch client that never closes its side doesn't hold the host's close (122.872825ms)
✔ a runner that ignores SIGTERM is killed when the host closes (1220.581529ms)
✔ zoned uses the IANA zone across DST (17.027978ms)
✔ each open blocking decision is DM'd once, across polls and a restart; non-blocking ones are not (115.264119ms)
✔ two blocking decisions get two DMs with different nonces (140.488003ms)
✔ the digest nonce differs per business and per day and fits Discord's 25 characters (0.176949ms)
✔ a failed DM is journaled, backs off, and is retried until it lands (153.766588ms)
✔ five definite refusals stop a DM: one gave-up line, one log line, and a restart keeps the count (93.240357ms)
✔ 429s, 5xx-style unknowns and refusals without a status never count toward the limit (96.146403ms)
✔ a crash between the fifth refusal and its gave-up line: the next poll appends it and sends nothing (80.318033ms)
✔ 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 (143.67716ms)
✔ a restart after the second refusal does not send before that refusal's 30 min are up (117.870439ms)
✔ the digest goes at 08:00 Chicago once a day, with blocking ones marked as DM'd (102.613945ms)
✔ a late start with no digest for the day sends one at once; an empty inbox gets one line (69.197617ms)
✔ an inbox read failure is logged and the next poll retries (0.602564ms)
✔ no Discord id reaches the journal or the log (64.714634ms)
✔ the journal: a torn tail is copied out and truncated, so an append after it reopens cleanly (23.527415ms)
✔ the journal: a crash between the copy and the truncate leaves a tail the next open repairs (33.810355ms)
✔ the journal: a whole file that is one torn line truncates to empty (19.310715ms)
✔ the journal: a malformed complete line refuses and leaves the file and any torn tail alone (2.017871ms)
✔ the journal: a loose file mode, a loose directory or a symlinked journal refuses (0.600636ms)
✔ the journal: a line with a wrong type refuses with exit 3 and names the field (1.703496ms)
✔ the journal: a symlinked directory refuses and says it is a link (0.415299ms)
✔ 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.470597ms)
✔ the journal: an append after the file was swapped for a symlink refuses and writes nothing through it (0.374525ms)
✔ the journal: a directory it cannot write or create refuses with exit 3 and names the path (0.435053ms)
✔ digest content stays within Discord's 2000 characters (0.251933ms)
✔ runLoop never overlaps ticks and stops after the one in flight (110.674121ms)
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 (392.840776ms)
✔ the transport writes {business, verb, args} to the child and reads its JSON (32.321136ms)
✔ a bus code on stderr becomes the exit code; garbage and timeouts are outcome problems (2145.259182ms)
✔ busExit and refuseInsideAgent (0.431683ms)
✔ talk sends a REQUEST, prints and reads everything that arrives, and stops at the reply (226.799451ms)
✔ talk --wait 0 only sends; no reply within --wait exits 1 and says where it will show (1186.533855ms)
✔ talk, stop and launches off/on refuse inside an agent run; bad arguments are usage errors (76.542107ms)
✔ launches off and on go to the broker and change the business's launch state (64.933849ms)
✔ launches list reads sessions.json and marks a stale entry; stop reports it and refuses a non-runner (58.812077ms)
ℹ tests 82
ℹ suites 0
ℹ pass 80
ℹ fail 2
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 6968.504134

✖ failing tests:

test at packages/cli/tests/launcher.test.mjs:106:1
✖ bus start --pm: the PM runs under its own PID namespace, registered, with a manifest (254.585334ms)
  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/r41b/wt/packages/cli/tests/launcher.test.mjs:138: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/r41b/wt/packages/cli/src/launcher.mjs:297: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:176:1
✖ the PM launches a coder through its launch tool; the coder answers; refusals name their code (590.273225ms)
  AssertionError [ERR_ASSERTION]: coder
  + actual - expected
  
    {
  +   error: 'capacity-full',
  -   error: 'instance-running',
      ok: false
    }
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r41b/wt/packages/cli/tests/launcher.test.mjs:210: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'
  }
