Skip to content

Audit: fix correctness, accounting and robustness bugs across the testbed - #17

Merged
SushantGautam merged 6 commits into
mainfrom
audit/system-remediation
Nov 4, 2026
Merged

SushantGautam merged 6 commits into
mainfrom
audit/system-remediation

Conversation

@SushantGautam

Copy link
Copy Markdown
Collaborator

Summary

Result of a multi-pass system audit (six independent review passes). It fixes 57 confirmed defects and adds 97 regression tests; each test was checked to fail on the pre-fix code. Full findings, evidence, remaining risks and continuation steps are in AUDIT.md.

Split into area-scoped commits that each pass ruff and the full suite on their own:

  1. world + governance
    • A transfer to yourself created resources.
    • Amendments enacted in the same assembly overwrote each other.
    • Vote tallies counted duplicate and ineligible ballots.
    • When two sanctions overlapped, the first expiry restored rights early.
    • Validator now rejects non-string resources, boolean amounts and overflowing amounts.
    • Snapshots are checked for integrity on load.
  2. agents + society
    • The model client survives HTML or null-content responses.
    • API key hidden from repr and covered by the leak guards.
    • The per-tick production cap was enforced society-wide; it is now per agent, as documented.
    • Metrics counts fixed.
    • Prompts show the lifecycle tick instead of the ledger counter.
    • Probe calls attributed to the right agent.
    • Stall watchdog no longer kills runs during long, healthy batches.
  3. analysis + measurement + audit
    • Fixed lifecycle-vs-ledger tick mix-ups in due_tick, recovery_time and exclusion_episodes.
    • The comparative report crashed on dict rule values.
    • Probe answers like "Yes." and "4/5" were mis-parsed.
    • The leak guard aborted artifact writes on ordinary agent speech.
    • Load-time errors for scenario values that previously crashed runs late.
  4. experiments + CLI + pilot
    • Ctrl-C in a sweep started every queued run.
    • Resume reused runs made with a stale config.
    • Re-running a run appended a second ledger into the old run directory.
    • The post-pass interview audit always crashed.
    • --run-dir= form honoured.
  5. docs: AUDIT.md.

Reviewer notes

  • Results differ from pre-audit runs:
    • Economy runs accept produces that the old society-wide cap rejected.
    • Prompt versions are now verdi.society-prompt/5 and verdi.inner-life/2.
    • metrics.json sanctions/appeals, excluded_ticks and due_tick are now counted correctly.
    • Recorded tapes still replay.
    • The full list is in "Behaviour changes researchers should know about" in AUDIT.md.
  • Existing tests changed (3), none deleted or weakened:
    • test_cli asserts the help output instead of a message pointing at a missing doc.
    • test_b2_planted_key_material_fails_leakage now requires that the finding does not repeat the key (stricter).
    • test_completion_rate_well_formed includes the new ledger_tick field.
  • Open owner decisions, deliberately not changed:
    • R1/R2: probe-bank axis/template mismatch and yes/no polarity. Fixing changes the instrument and needs a version bump.
    • R14: the preregistered recovery window can't be evaluated for the shipped constrained scenario.
  • The audit stopping rule (two consecutive clean passes) was not formally met. Finding severity fell each pass; no critical issues remain open.

Test plan

  • ruff check . clean
  • python -m pytest: 769 passed, 1 skipped (was 672)
  • Each commit tested in isolation in a clean worktree
  • All shipped scenario YAMLs pass build_t0_state
  • Key-material patterns: 0 hits over 398 real run artifacts plus the bundled plotly report
  • One live smoke run against a real endpoint (not done: no endpoint used during the audit)

…bugs

- validate/reducer: reject self-transfers (minted resources), non-string
  resources, boolean amounts, and amounts that would make a balance
  non-finite; per-tick produce cap is cumulative
- economy: reject duplicate objective ids and role-only consumption overrides
- branch: allow branching after a rejected event; snapshot load verifies
  digest format and content hash
- constitution: stacked amendments apply together; recorded ballot is the
  single source of truth (dedup, eligibility); out-of-range quorum/threshold
  invalid; no re-enactment; unique version names
- sanctions: keep every revocation interval so overlapping sanctions are
  enforced until the last one ends (expiry and upheld appeals)

See AUDIT.md F1-F5, F18, F19, F24-F27, F52-F54.
- client: non-JSON 200 bodies raise ModelError; null content -> "";
  completed-call counter feeds the stall watchdog
- config: api_key hidden from repr; keys read via model.api_key_env are
  covered by leak guards; range-check retries/timeout/concurrency
- campaign: production cap tracked per agent (was society-wide); sanction
  flag kept while another sanction is live; metrics count only accepted
  sanctions and filed appeals; probe subjects in send order
- tasks: one bad orchestrator field no longer discards the tape; failed
  parses are still logged for token accounting
- memory: consolidation prompt uses only the summary
- prompts show the lifecycle tick (society-prompt/5, inner-life/2)
- live: retry window includes pool/connect/backoff time

See AUDIT.md F6, F13-F17, F33, F41, F42, F49, F50.
- outcome_metrics: due ticks in lifecycle units (declared or derived),
  ordered before matching outcomes; exclusion episodes bounded by the last
  lifecycle tick and merged when overlapping; zero baseline not evaluable
- comparative_report: escape rule values once (dict values crashed);
  label undefined/zero baselines "not evaluable"
- scenario: load-time errors for values that crashed live runs late
- longitudinal: robust yes/no and 0-5 answer parsing
- interview_values: link trajectory rows to the latest event by lifecycle tick
- judge_live: key-material patterns no longer match agent prose and never
  echo the secret; interview_audit counts SimpleAudit ERROR as an error
- live_bridge: scorer failure recorded as missing, not 0.0

See AUDIT.md F7, F8, F20, F28, F30, F32, F34-F38, F40, F43-F48, F51, F55-F57.
… safe

- sweep: Ctrl-C no longer starts queued runs; resume reruns runs whose
  scenario changed and ignores runs from earlier invocations; previous
  attempts are renamed aside instead of appended to; label/YAML hardening
- paired_run: same resume/set-aside rules, readable missing output_root,
  Ctrl-C stops, concurrency default honours VERDI_MAX_CONCURRENCY
- interview_experiment: post-pass audit no longer crashes; uses the
  scenario's model block
- g5: scan every configured key; causal guard ignores verbatim model text
- cli: `--run-dir=` form honoured; bare `verdi` prints help
- pilot: sanction evidence only from the scripted violation; unique
  live capture dir

See AUDIT.md F9-F12, F21-F23, F29, F31, F36, F39, F46.
Records six audit passes, verification results, behaviour changes researchers should know about, open owner decisions (R1, R2, R14) and continuation steps.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Minor bump: the audit fixes change simulation results vs 0.1.x (per-agent production caps, prompt versions, corrected metrics); see AUDIT.md.
@SushantGautam
SushantGautam merged commit 4433ba2 into main Nov 4, 2026
1 check passed
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.

2 participants