feat(runs): offline coordinator decision audit (#595) - #649
Conversation
Introduce brigade runs audit as a read-only lifecycle journal consumer that re-projects runs, fingerprints coordinator-owned decisions, and reports the first divergence without writing the run directory or constructing providers. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: escoffier-labs/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Grader review: APPROVE-WITH-CHANGES. All hard constraints verified: read-only (byte-compared), protected journal modules untouched, read_journal_bounded + validate_event only, fail-closed on chain errors, prompts reduced to fingerprints with a planted-secret test. No collision with #641 (your base already contains it). Two required changes before merge:
Should-fix while in there (non-blocking): _read_json_object checks S_ISLNK but not S_ISREG (run_audit.py:253-263) so a FIFO at run.json blocks forever; _routing_drift has a dead inner condition (:721-723) so seat-order permutations are never reported; _error_report hardcodes sequence=1 (:883); exit codes 1 vs 2 for corrupt vs missing evidence deserve a doc line; note in the coverage docs that #641 control.* events are intentionally outside _COORDINATOR_EVENT_TYPES. Ping for re-grade after push. |
Wrap _safe_digests so symlinked or non-regular evidence cannot escape audit_run as an uncaught AuditError. Add S_ISREG to _read_json_object, fix seat-order routing drift detection, derive chain-error sequence from the journal report, document control.* out-of-scope coverage, and document CLI exit codes for match/diverge/not-auditable paths. Co-authored-by: Cursor <cursoragent@cursor.com>
Adds brigade runs audit to docs/command-inventory.md (10 -> 11 paths) so repo-metadata CI passes. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Re-grade ready. Grader feedback from #issuecomment-5152790005 addressed in two commits on Required
Should-fix (same commit
Verification
Constraints unchanged: read-only audit; no edits to |
|
Grader: APPROVE, merging. Both required changes verified: _safe_digests now catches AuditError per artifact so a symlinked plan.json yields a bounded not_auditable report instead of a CLI traceback (test_legacy_run_symlinked_plan_json_returns_bounded_not_auditable), and the command inventory is regenerated. All five should-fixes landed too, including the S_ISREG guard and the _routing_drift dead-condition fix with test_seat_order_permutation_reports_routing_drift. Read-only constraints held: no edits to run_journal.py, run_events.py, run_projector.py, or run_lifecycle.py. Receipt 20260801-192546-work-verify-cde323, CI green. |
Summary
brigade runs audit <run-id>as a read-only lifecycle-journal consumer (src/brigade/run_audit.py) that re-projects viaproject_run_snapshot, fingerprints coordinator-owned route/policy, dispatch, approval, adapter, and composed-prompt decisions, and stops at the first divergence.run_journal.py/run_events.py/run_projector.py/run_lifecycle.py, and no provider-adapter or subprocess construction.cli/runs.py+ thinruns_cmd.auditwrapper so it rebases cleanly beside concurrent runs: add durable cursors and idempotent live control on the lifecycle journal #604 work.Acceptance criteria → tests
test_golden_run_audits_twice_to_byte_identical_normalized_eventstest_changing_prompt_template_stops_at_first_composed_prompttest_changing_route_selection_stops_at_first_coordinator_decision,test_changing_approval_state_stops_at_first_coordinator_decisiontest_forbid_live_side_effects_sentineltest_missing_corrupt_evidence_reports_exact_artifacttest_unsupported_transport_states_coveragetest_unsupported_projector_version_stops_with_compatibility_diagnosticsnot_auditable→test_legacy_run_without_journal_reports_not_auditabletest_private_data_fixtures_expose_only_safe_summariestest_receipt_records_required_fieldsTest plan
brigade work verify run --target . --command "./scripts/verify" --capture brigade-work20260801-034500-work-verify-13980f(exit=0)Closes #595
Made with Cursor