← Back to Pull requests

Short receipts for queue writes, behind an off-by-default switch #1137

Closed
unknown closed this pull request without merging on Oct 12, 2026 10:54 UTC
View on GitHub
unknown unknown commented on Oct 10, 2026 19:26 UTC
Author

What a person gets

Queue writes can print a short receipt instead of the whole row. Today rig queue create, claim, unclaim, update, block, handoff and handoff-and-complete print the daemon's full row: about 30 fields, pickup, waiting and the entire body. A handoff prints two full rows. With the new output.compact switch on, a write prints what the seat acts on next and says how to get the rest.

The receipt shows:

  • the row (both rows for a handoff), its state and owner, and its tags (they can't be changed after create, so a wrong one is caught here);

  • tsCreated and bodyBytes, so a seat can confirm the write landed without a second call;

  • the blocker and the next backstop, including the daemon's own UNVERIFIED: no timed backstop when there is none;

  • closure, warnings (body not saved), advisories and handoff advisories, word for word;

  • the wake evidence the response actually carries;

  • a footer naming what was left out and the read that returns it (rig queue show <id> --full --json, or --full on the write).
  • It never echoes the body.

    Wake evidence is labelled, and never says "scheduled". A write's response can't prove a wake reached the outbox, so the receipt reports only what it can prove:

    | Case | What the receipt says |
    |---|---|
    | --no-nudge | suppressed |
    | failed:wake not retained | the row saved but its wake was NOT staged |
    | An idempotent create that returned an existing row | no new wake; the row's earlier result is marked as earlier |
    | No outbox | the daemon's own recorded result |
    | Otherwise | one line: no result recorded yet |
    | A same-body create --id retry, or a re-driven cross-host handoff | a recorded result is labelled as the row's, possibly an earlier wake's, never as this write's |
    | --verify | persisted and the whole delivery object, as today |

    Writes that fail read as today. Refusals, a missing row, and cross-host INDETERMINATE writes print the whole response, with the same exit codes (1 and 2) and the same stderr.

    --json keeps today's paths. Every field the receipt keeps sits at today's key name, path and type, so existing jq filters work in both modes. That includes:

  • qitemId, state, destinationSession, sourceSession, tsCreated, tsUpdated, tags (null kept);

  • priority even when it's routine, and summary even when it's null;

  • pickup, and lastNudgeResult/lastNudgeAttempt with nulls kept;

  • waiting.blocker and waiting.nextBackstop, nested as today. The receipt's waiting keeps only those two; the rest is listed in receipt.omitted as waiting., and each verb's --full help says so;

  • closed/created for handoffs, and persisted/delivery for --verify.
  • The only additions are bodyBytes, wake, host and receipt.

    A fix folded in: the daemon's unknown_target_repo refusal told agents to run rig whoami --json | jq .workspace.repos, but compact whoami --json has no workspace. It now names rig whoami --full --json, which does.

    That the new command really yields .workspace.repos was checked by reading the source; no test asserts it:

  • rig whoami --full --json prints the daemon's whoami payload whole (cli/src/commands/whoami.ts:291).

  • That payload carries workspace (daemon/src/domain/whoami-service.ts:334-350), whose block has repos (daemon/src/domain/workspace/workspace-resolver.ts:21,48).

  • The compact --json projection drops workspace, and cli/test/whoami.test.ts:413 asserts that, which is why the old hint was false.

  • The changed test in this PR asserts only the hint's text.
  • The switch

    output.compact, off by default. An install prints today's output until the switch is turned on.

  • On: rig config set output.compact true, or OPENRIG_OUTPUT_COMPACT=1 for a seat or a single command.

  • Off: rig config set output.compact false, or OPENRIG_OUTPUT_COMPACT=0.

  • Values: the switch resolves exactly as rig config get output.compact reports it, through the config store. The environment variable accepts true/1 (on) and false/0 (off); an empty value defers to the config file. An invalid value is rejected with the store's warning and falls back to the file, for config get and for writes alike. An unreadable config is off.

  • --full on each of the seven verbs prints today's output byte for byte whether the switch is on or off, so scripts can pin it now.
  • One switch is named for all compact defaults. Only queue writes read it in this PR.

    The artery: the queue

    Where it's shaped: the projection is CLI-side, in one new module (cli/src/queue-receipt.ts) applied at the seven verbs' print call. The following are unchanged:

  • daemon route shapes;

  • the payload a cross-host create or handoff forwards;

  • the UI.
  • The only daemon source change is the refusal hint's text, plus output.compact registered in the daemon settings store (twin of the CLI key).

    Downstream consumers of a write's stdout, checked across in-repo scripts, skills, docs and tests:

  • cli/test/queue.test.ts: the --verify fields and create/handoff JSON. These run with the switch off, so today's output is unchanged. The receipt keeps persisted and delivery whole when on.

  • queue-forwarded-response-outcome.test.ts and d14-loud-queue-transport-failure.test.ts: errors and indeterminate outcomes, which print whole in both modes.

  • scenario-pipeline.ts: reads exit codes only, which are unchanged.

  • The software-factory skill's worked example (rig queue claim <id> --json): shows the call only.

  • Seats reading back tsCreated and the body's size: the receipt carries tsCreated and bodyBytes.

  • Named in the brief but don't read write output:

  • - verify-world.sh and trace-to-root.py read rig whoami;
    - refocus.cjs reads rig queue whoami;
    - read-defaults.test.ts covers the show and health read views;
    - bodyTruncated/bodyBytes in the queue-handoff skill are queue show fields.
  • Docs: the as-built CLI reference lists --full on the seven verbs, and rig config help lists the key.
  • Risk

  • Off by default: nothing changes for an install until the switch is on. Turning it off restores today's output.

  • When the switch is turned on: plain write output becomes short labelled lines, so anything that greps the indented JSON of a plain write breaks. Such readers should use --json, which keeps retained fields at today's paths, or --full for today's output.

  • Shape drift: if the daemon's row gains fields, they show up as omitted and are counted in the footer's receipt.omitted, not silently dropped. A response shape the projection doesn't recognize prints whole.

  • Test environment: the shared test setup now clears OPENRIG_OUTPUT_COMPACT, so a seat with the switch on doesn't change what the suite prints.

  • --host writes: the receipt settles locality the way the daemon does (resolvesToLocalHost). It reads the selected daemon's own selfHostId (/healthz, receipt path only), so --host naming this daemon reads as local. If that id can't be read, the receipt says it can't confirm where the row lives (hostUnconfirmed in --json) rather than assert remote. It then offers both reads as alternatives: the local rig queue show as fullCommand, and the on-host form as fullCommandOnHost (createdFullCommandOnHost for a handoff's new row). A remote row's footer names the read as OPENRIG_URL='<daemon-url of host X>' rig queue show …, as the existing create recovery text does.
  • Proof

    Tests: cli/test/queue-write-receipt.test.ts has 85 tests. The file fails on main (its module doesn't exist there). It covers:

  • for every verb, with the switch off and with --full, output equal to today's printer, in plain and --json;

  • the receipt per verb: identity, state, owner, tsCreated, body size, no body, and the footer;

  • that every response field is shown or listed as omitted;

  • that the --json receipt keeps each retained field at today's key, path and type, for every verb;

  • parked rows with and without a timer, a handoff's two rows, and advisories;

  • refusal, indeterminate and missing-row writes, unchanged with the switch on;

  • each wake case, including that a null result is one line and never "scheduled";

  • that claim, unclaim, update and block show no wake line in plain form;

  • --host: another daemon, this daemon's own host id, and an unreadable host id (both reads offered, for a create and a handoff);

  • a same-body --id retry whose row has a recorded result;

  • the switch through the real config store: on, off, env over file, an invalid env value falling back to the file with the store's warning, and rig config get agreeing with the writes (file true + OPENRIG_OUTPUT_COMPACT=yes);

  • tags on every verb, and the --full help's note on waiting.
  • Updated tests:

  • The two key-list tests and the settings route count gain output.compact.

  • The cross-host target-repo test asserts the corrected hint.
  • Builder P1/P6 run, on one build with fixed rows:

  • Setup: a private daemon from this branch, started through the repo's hermetic test scaffold with a temp home and a free port. Rows were seeded once and the database snapshot restored before each form. A recording proxy kept every daemon response, which was then replayed to main's CLI and to this branch's CLI in every form.

  • Cases: the seven verbs, plus:

  • - --no-nudge;
    - an idempotent create with a different body;
    - a create to a mistyped seat (advisory);
    - a park with no timer;
    - a refused update;
    - a missing row;
    - a cross-host create to a registered host that drops the connection mid-response (INDETERMINATE);
    - --verify.

    Results:

  • Today's output: byte-identical to main for the same response in all 29 cases, plain and --json, with the switch off, with --full and the switch off, and with --full and the switch on.

  • Switch on: exit codes and stderr byte-identical to main in every case.
  • | stdout characters, same response | plain: today → receipt | --json: today → receipt |
    |---|---|---|
    | create | 3,281 → 613 | 2,956 → 1,240 |
    | claim | 4,102 → 643 | 3,683 → 1,563 |
    | unclaim | 3,575 → 484 | 3,250 → 1,345 |
    | update | 3,606 → 544 | 3,281 → 1,400 |
    | block | 3,658 → 542 | 3,304 → 1,436 |
    | handoff | 7,279 → 1,104 | 6,348 → 3,050 |
    | handoff-and-complete | 7,227 → 1,083 | 6,296 → 3,016 |
    | create --no-nudge | 3,268 → 503 | 2,943 → 1,127 |
    | create, existing row returned | 4,310 → 1,170 | 3,872 → 2,166 |
    | create with an advisory | 3,834 → 909 | 3,426 → 1,715 |
    | block with no timer | 3,677 → 532 | 3,323 → 1,442 |
    | refusal / missing row / INDETERMINATE | unchanged (printed whole) | unchanged (printed whole) |
    | create --verify | — | 3,202 → 1,488 |

    These are characters for these rows, with bodies of about 1.7 KB. They aren't a promise about savings in other workloads, or about usage allowance.

    Not shown on the private daemon:

  • A wake that failed to stage, and a daemon without an outbox, don't occur on a production daemon. Unit tests cover both.

  • On the live daemon, transition ids and recovery fields in the row change between runs from its own background work. That's why the identity proof replays recorded responses rather than comparing live runs.
  • Full gate:

  • On c6642730:

  • - npm run lint: passes.
    - npm test:
    - repo checks 286/286;
    - daemon 14,058 passed and 10 failed;
    - CLI 4,038/4,038 (3,961 on main);
    - TUI 912/912.
  • The review-fix commits after it change only the CLI receipt, the --full help text and their tests. On the final head, npm run lint passes and the CLI package passes 4,046/4,046.

  • The 10 daemon failures are the same by signature as on main (14,058 passed and 10 failed). They're environment failures on the test VM (relay file modes, a Node probe, Docker staging timeouts, terminal UTF-8, a scenario seed), not queue code.
  • Native: NOT RUN (environment gap). Builder evidence on private daemons from the repo's harness, not Build's data or seats, and not a QA run.

    Noted follow-ups, not in this PR

  • "Scheduled": a receipt could say "scheduled" only if the create and handoff responses carried an additive wakeStaged flag from the daemon. This PR doesn't change route shapes.

  • rig queue resolve and rig queue fallback also print full rows.

  • The rest of the slice: queue show, transitions, capture and whoami can join the same output.compact switch.
  • Refs: slice 15 (smaller everyday command output), P1 and P6.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Successful queue writes can display compact receipts when compact output is enabled. Receipts summarize key details without including the full record and provide commands to view it; use --full to display the complete response. Errors and writes without a receipt continue to show the full response.
    Added the output.compact setting, off by default, configurable through settings or OPENRIG_OUTPUT_COMPACT.
    Documentation
    Updated queue command references to include --full and clarified that unknown repository errors direct users to the full whoami output.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: mvschwarz Review duration: 2367m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1137"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%