Skip to content

maintainer: wire the fail-closed Governor chokepoint before every write action #2340

Description

@JSONbored

This is the safety-critical core of Phase 5: the single chokepoint every miner write action (open_pr, file_issue, apply_labels, post_eligibility_comment, create_branch, delete_branch — the exact set in src/mcp/local-write-tools.ts) MUST pass through before it executes, and it must FAIL CLOSED — any internal error, missing config, or unexpected state denies the action rather than allowing it. This wires together the previously-built pure calculators (rate-limit, budget caps, non-convergence detector) into one real enforcement path and is the reason this phase exists.

Given the strategic risk (the #1 slop-at-scale concern per the roadmap), this issue is intentionally maintainer-owned: the owner wants to build and review the actual enforcement wiring personally.

Deliverables

  • A GovernorDecision chokepoint function that every local-write-tool caller invokes before executing a LocalWriteActionSpec from src/mcp/local-write-tools.ts
  • Composes the existing pure calculators (rate-limit, budget caps, non-convergence detection) into a single allow/deny verdict; ANY calculator throwing or returning an ambiguous result denies
  • Every decision (allow AND deny) is recorded to the append-only governor ledger (companion foundation issue)
  • Integration tests proving fail-closed behavior under simulated calculator failures, and a full allow-path + full deny-path integration test exercising a real LocalWriteActionSpec
  • Documented precedence order matching src/settings/agent-execution.ts's "safest wins" style (global kill-switch > per-repo pause > dry-run > rate-limit > budget cap > non-convergence > allow)

References

  • src/mcp/local-write-tools.ts (70 lines) — the exact write-action spec builders this chokepoint gates
  • src/settings/agent-execution.ts — the existing "safest wins" precedence pattern (paused/dry_run/live resolution) to mirror for composing multiple safety layers
  • src/settings/autonomy.ts (resolveAutonomy, deny-by-default pattern) — the reusable autonomy dial this chokepoint should consult first

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintainer-onlyOwner-only work — yields no Gittensor points.

    Projects

    Status
    In Progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions