Skip to content

feat: harness CLI workbench — phase 1 core (registry, output lanes, async runner) - #43

Draft
noodlemind wants to merge 13 commits into
mainfrom
feat/workbench-phase1-core
Draft

feat: harness CLI workbench — phase 1 core (registry, output lanes, async runner)#43
noodlemind wants to merge 13 commits into
mainfrom
feat/workbench-phase1-core

Conversation

@noodlemind

@noodlemind noodlemind commented Aug 6, 2026

Copy link
Copy Markdown
Owner

What

Phase 1 of the Harness CLI Workbench (contract: docs/architecture/harness-cli-workbench.md, plan: docs/plans/2026-07-29-harness-cli-phase1-core.md).

Turns the CLI's dispatch, output, error, and process layers into the kernel every later phase builds on — behavior-compatible for all current consumers.

Workstreams (one commit each as they land)

  • Docs: workbench contract + locked phase 1 plan
  • P1.1 Command registry + strict args + pilot migration (orient, learnings, version)
  • P1.2 Output lanes: versioned JSON envelope, JSONL streaming, agent-lane renderer (budgeted/hardened/metered), unified error/status model incl. cancelled and timed-out
  • P1.3 Async process runner: timeout, Ctrl-C cancellation, descendant termination; verify streams and cancels
  • P1.4 Secret redaction at emission and persistence boundaries
  • P1.5 Event registry with actor/execution metadata
  • P1.6 Full command migration; delete the switch
  • P1.7 Regression + contract pass (AC1–AC10)

Verification

Named checks: harness-tests, prompt-contracts, build-assets (host-contracts retired on main by #38; plan updated accordingly). Acceptance: AC1–AC10 in the plan file.

Notes

  • Baseline on branch: 668/668 tests green.
  • Contract test updated to register docs/architecture/harness-cli-workbench.md in the canonical architecture-doc listing.

Final review & disclosures

  • Whole-branch final review (architecture + security + patterns lenses) returned 2 Critical AC6 gaps (json-envelope lane and evidence artifacts were unredacted) + doc/contract drift — all fixed and re-review-verified. 852/852 tests; harness verify --plan passes 14/14 with the evidence artifact.
  • Scope amendment for your sanction: AC3/AC10 originally said the envelope/agent lanes cover every command; the delivered surface is the lane-bearing set (orient, learnings, status, plus verify --output jsonl), with every other command rejecting --output via a structured E_USAGE instead of silently degrading. Lanes expand per command in Phase 2 as resultOf producers land. The amendment is recorded inline in the plan's AC3 with the reversal path (expand resultOf to all commands) if you'd rather hold the original bar.
  • Deferred with rulings (in the plan's Review Findings): ~20 legacy writeEvent call sites migrate to the event registry with Phase 4a; 8 triaged minors logged in the SDD ledger.

⚠️ Reopened — external review found real gaps (2026-08-06)

Codex external review returned No-go; I reproduced every Critical, so my earlier "ready" was wrong. Root cause: redaction was wired per-new-output-lane and no component made it universal — the legacy --json/JSONL serializers and the event metadata path (added after payload redaction) still leak.

Verified must-fix (fix wave in progress):

Do not merge until the fix wave lands, re-review passes, and AC6/AC8 hold end-to-end.

Redaction hardening — landed (2026-08-06)

The universal-redaction fix wave landed (commit 758d746). Every open finding from both Codex rounds is fixed and internally verified — 919/919 tests, all headline bypasses (toJSON, -- boundary, ledger/human leak, __proto__, PEM streaming) re-confirmed by controller probes + per-finding evasion tests, secret-free byte-identity preserved.

One honest caveat: the third independent Codex certification could not run — the Codex CLI's OAuth token expired (401) mid-session. Last independent third-party confirmation is Codex round 2 (8/11 fixed); the round-2 residuals + new findings are controller-verified but not Codex-re-certified. Re-run codex login + a third pass before merge if independent sign-off is required. Details in the plan's "External Review (Codex)" section.

Commits: 6ca1e62 docs · f547452 runner · 58dcb76 registry · 02bfd10 redaction · c28dbf5 lanes · 9dd1f17 events · b5ed24d migration · dac4a70 final-review fixes · 758d746 universal-redaction hardening.

Controller review (2026-08-06) — one Critical found and fixed

With Codex unavailable (expired auth), I reviewed the unverified round-3 surface myself and found a regression introduced by that round's own fix: redactedJson masked by running the text redactor over already-serialized JSON, so a secret-shaped value before an escaped quote consumed the escape backslash and emitted unparseable JSON from every machine sink (--json, JSONL, events, evidence, telemetry). Trigger was the harness's own E_TARGET message shape (no learning "token=…" found).

Fixed at value level via a JSON.stringify replacer — still runs after toJSON (so the bypass it was added for stays closed), but the serializer owns escaping, so masking can't corrupt structure. Audited every other sink: events/evidence/event-registry were already value-level; envelope/telemetry fixed transitively. 924/924, JSON-validity property tests added, byte-identity preserved. Commit 8ea2a29.

Also verified clean: human-path redaction (3ms/1000 ledger lines, help intact), runner group-settlement (no hang), and all six prior headline bypasses.

Final PR review (2026-08-06)

Controller: READY. Whole-PR pass — hygiene clean (no .harness/evidence/scratch committed, no debug debris, 10 commits one-per-workstream); help renders for all 24 commands; read-only smoke across 12 commands with no crashes; the read-paths-never-create-the-store invariant holds; test quality real (254 tests / 794 assertions across the ten new suites, no vacuous padding); doc/code agreement verified (no stale CATALOG claim; all three named event opt-outs exist in events.mjs). 924/924, harness verify --plan 13/13.

One Minor, non-blocking, non-regression: recall/get with a missing required positional emit E_UNEXPECTED/exit 1 rather than a usage error/exit 2. Verified pre-existing on main (handler-owned validation, deliberately unchanged by the migration — compatibility preserved). The registry now makes positional validation cheap; suggest closing it in Phase 2.

Codex: could not run. Its OAuth token is still expired (token_expired 401 on probe). Independent certification of the round-2/round-3 fixes remains open — run codex login, then a final Codex pass, if independent sign-off is wanted before merge.

Merged with main (2026-08-06) — one known failure

Main advanced with #42 (harness evolution: blueprint + its Phase 1–4 implementation), touching nine of the same files this branch rewrote. Merged in commit 2987e90 — 11 conflict hunks across 8 files, resolved keeping both sides.

The part that would have broken silently: this branch's registry does strict unknown-flag rejection, and #42 shipped flags it never declared. A clean textual merge would have left main's new features failing with unknown flag. Eight flags are now declared on their proper entries — index --structural/--since, knowledge --branch/--ids/--merged/--stale/--yes, consolidate --layer — and verified live through registry dispatch (index --structural, knowledge status, consolidate --layer golden all exit 0). Git's auto-merge had also dropped #42's new value-flag branches into the rewritten parser in a way that bypassed the -- literal boundary, silently re-opening a leak an earlier review closed; that is fixed and re-verified.

--refresh / --semantic were deliberately left undeclared — they pre-date the merge base and have no readers anywhere in lib/+bin/. Confirm they aren't placeholders for unlanded work.

Suite: 1182 tests, 1173 pass, 8 skipped, 1 fail. The single failure is prompt-library retains at most one non-terminal PR plan — two dated plans are now in flight (this PR's 2026-07-29, and #42's 2026-08-06 at status: review, phase 3). That is a policy collision, not a code defect: the one-plan convention assumed one PR at a time. Left failing by decision, to be resolved separately. Every code-level test from both sides passes.

harness verify --plan consequently reports the two check failures that roll up from that assertion; the criteria remain evidenced by the passing suite.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 67716701-6d68-4c33-9429-bb627aa5b73b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

…t, reject unsupported lanes, true up the tool contract
…nce boundaries

Close two rounds of external adversarial review: route every machine and
human output sink (legacy --json, JSONL, events log incl. metadata, ledger,
debug stack, telemetry sync) and the toJSON serialize path through one
redacting boundary; honor the -- literal argument boundary in every flag
read; settle runner cancellation only after the process group is reaped;
map verify timeout to exit 8; stream and redact check output live; fix
JSONL backpressure and quadratic UTF-8 clipping.
The serialize-then-mask pass could consume a JSON escape backslash when a
secret-shaped value preceded an escaped quote, terminating the string early
and emitting unparseable JSON from every machine sink. Mask through a
stringify replacer instead: it still runs after toJSON, and the serializer
owns escaping.
recall, get, and plan-new reported a harness fault (E_UNEXPECTED, exit 1)
when invoked without a required argument, so callers could not distinguish
misuse from breakage. Enforce the requirement declaratively in the registry
and raise the standard usage error instead; the guidance messages are
unchanged.
Declares main's new flags on their registry entries so strict validation
accepts them, routes its structural-index flag read through the boundary
aware check, and keeps both sides' event types, fields, and docs.

Known failure: the one-live-plan contract assertion, because two dated
plans are now in flight at once. Policy decision, not a code defect.
The primary consumption platform is Windows, but every check ran on Linux,
leaving the win32 branches untested: descendant termination via taskkill,
LOCALAPPDATA path resolution, console glyph degradation, and the .cmd shim.
Captures console output verbatim as an artifact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant