Skip to content

Real approval flow and kill switch - #1

Merged
angelraph merged 2 commits into
masterfrom
feature/approval-and-killswitch
Sep 21, 2026
Merged

angelraph merged 2 commits into
masterfrom
feature/approval-and-killswitch

Conversation

@angelraph

Copy link
Copy Markdown
Owner

ESCALATE used to be confirmed by re-running the same command with --execute, so the proposer could confirm its own escalation. This replaces that with a real approval flow and adds a kill switch.

Approval

  • An ESCALATE opens a pending approval. --execute and execute:true no longer bypass it.
  • Deciding needs a separate credential (CHARTER_APPROVER_KEY plus an X-Charter-Approver identity). The agent key can propose and poll its own escalation status, never approve.
  • The proposing agent cannot approve its own proposal.
  • Approvals expire, and are evaluated again against current conditions (market, daily spend, drawdown, kill switch) when approved. Refused if the result is now a veto.
  • The audit chain is verified before an approval is acted on. An approval can be granted once, including under simultaneous requests. The approver is recorded on the grant, the execution attempt, and the fill.

Kill switch

  • halt, resume, status, and /control endpoints. While engaged, every proposal is vetoed, including an already-approved one that has not executed.

State for both is derived from the audit log, not a separate store.

Also: malformed JSON no longer returns an HTML stack trace with file paths, the dashboard shows halted state and pending approvals, and README gains an explicit Trust boundary section.

Testing: 48 new tests (95 total), all offline. Also run live against Binance Spot Testnet: an escalated trade cannot be forced with --execute, self-approval is refused, an approval fills once and cannot be replayed, and an approval attempted after the kill switch was engaged is blocked by the re-check.

Behaviour change to note: on this branch the ESCALATE step in the submission demo (re-running with --execute) no longer works. The v1.0-submission tag still pins the code the video shows.

ESCALATE used to be "confirmed" by re-running the same command with
--execute, which meant the proposer could confirm its own escalation.
It now opens a pending approval that a different person must grant.

Approval
- Separate credential to decide (CHARTER_APPROVER_KEY plus an
  X-Charter-Approver identity). The agent key can propose and poll its
  own escalation status, and can never approve.
- The proposing agent cannot approve its own proposal.
- Approvals expire (CHARTER_APPROVAL_TTL_MINUTES, default 10).
- On approval the proposal is evaluated again against current
  conditions (market, daily spend, drawdown, kill switch) and refused
  if it would now be vetoed.
- The audit chain is verified before an approval is acted on.
- An approval can be granted once, including under simultaneous
  requests. The approver is written into the audit log on the grant,
  the execution attempt, and the fill.
- CLI: approvals, approve, reject. API: /approvals, /escalations.

Kill switch
- halt / resume / status, and /control endpoints. While engaged every
  proposal is vetoed, including an already-approved one that has not
  executed yet. Who, when, and why are logged.

Both approval and kill-switch state are derived from the audit log
rather than a separate store, so they cannot disagree with the record.

Also: malformed JSON no longer returns an HTML stack trace with file
paths; the dashboard shows the halted state and pending approvals; the
rogue agent now tries to force an escalated trade and stays blocked.
README gains Human approval, Kill switch, and an explicit Trust
boundary section stating what this does and does not protect against.

48 new tests (95 total). Verified live on Binance Spot Testnet: an
escalated trade cannot be forced with --execute, self-approval is
refused, an approval fills once and cannot be replayed, and an
approval attempted after the kill switch was engaged is blocked by the
re-check.
@angelraph
angelraph merged commit 9dbb600 into master Sep 21, 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.

1 participant