1# Live background-work verification
2
3Run from the repository root with Node 24 and installed dependencies. This uses
4real provider CLI credentials and consumes model usage:
5
6```sh
7node apps/server/scripts/verify-background-live.ts --repeat 2
8```
9
10Each scenario starts the production server in a fresh temporary T3 home and Git
11project. It connects through authenticated HTTP and the same typed WebSocket RPC
12contract as clients. There are no substituted adapters, in-memory databases, or
13seeded projection rows. Existing T3 environments are not modified.
14
15The scenarios exercise delegated completion after the parent ends its turn,
16delivery into an active foreground command, native background-command wake-up,
17and nested delegated results. A local HTTP request holds the actual background
18command until the required parent state is observed. Its random response is not
19included in the parent prompt. Passing requires the agent to retrieve that result,
20acknowledge it, and finish; a delivery receipt alone is insufficient.
21
22Assertions also check task-result publication, acknowledgement state, typed
23notifications rather than additional user-message items, run boundaries, and an
24empty provider background roster. Successful scenarios restart the real server
25and check that the acknowledgement survives and runs remain completed. This is
26a clean-restart persistence check, not proof of crash recovery during delivery.
27
28Use `--scenario idle|active|native|nested`, `--model`, `--provider`, and `--timeout`
29in seconds to narrow a run. The default provider is `claudeAgent` and the default
30model is `claude-sonnet-4-6`. The native scenario specifically requests Claude's
31background Bash tool; do not treat it as generic provider conformance. Active
32delivery expects a provider supporting active steering. Missing authentication,
33unsupported capabilities, provider failures, and model instruction violations
34are failures, never skipped passes. Inspect the retained trace to distinguish them.
35
36Check the verifier's failure detection with a real failing HTTP dependency:
37
38```sh
39node apps/server/scripts/verify-background-live.ts --scenario active --fail-gate
40```
41
42That command must exit nonzero. It must not be counted as a passing product test.
43
44Each run prints its evidence directory. It retains the SQLite database, native
45provider logs, streamed events, final projection, prompt, revision and dirty-file
46inventory, and machine-readable verdict. Suite reports link every attempt,
47including failures; repeating a test does not erase an earlier failure. Evidence
48is local and may contain provider output. Do not upload the entire T3 home.
49
50This loop does not verify rendered folding, mobile UI, cancellation, or abrupt
51process loss between provider acceptance and receipt persistence. Those require
52additional scenarios before claiming complete background-lifecycle coverage.