Offline floor + local ledger + flush: floors apply when the gateway cannot see a call, and the history uploads on connect (0.16.0, #29 phase 1) - #31
Merged
Conversation
7 tasks
With no key, the hook allowed every call with a warning and never ran a floor; unreachable did the same. Now every call the gateway cannot see gets the two floors (hardline deny, new ask-level destructive floor: force push, destructive SQL to a db client, pipe-to-shell, recursive delete outside cwd) and a row in ~/.acp/ledger.jsonl. With a key, the ledger flushes once, detached, so the console shows history from the first call. Local policy engine frozen, not removed (phase 2 is gated). Refs #29
davidcrowe
force-pushed
the
feat/offline-floor-ledger
branch
from
September 8, 2026 20:01
018a255 to
95af920
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #29 (phase 1, additive). Gateway ingest side: davidcrowe/gatewaystack-connect#1115. Floor rules ported from gatewaystack-connect#1109.
What changes
Three states where the gateway does not see a call: no key (the on-ramp), key present but the gateway unreachable or rejecting the key (an outage), and
--localpolicy mode. Before this PR the no-key path allowed everything with a warning and never ran a floor, and the unreachable path ran no floor either. Now, in all three:decide.mjs: force push (not--force-with-lease), destructive SQL handed to a database client in any spelling (flag, positional, here-string, heredoc, piped literal), a remote download piped into a shell, recursive delete outside cwd / temp roots. Scans what will execute: heredoc bodies written to files and quoted prose cannot fire it. In--localmode the floor tightens a policy allow to ask; a policy deny still wins.~/.acp/ledger.jsonl) records the call: id, ts, tool, classification, decision, reason, mode, session, cwd, bounded input preview. Size-capped (5 MB, oldest half dropped). Never blocks the hook. Nothing leaves the machine without a key.govern.mjs --flushchild POSTs batches of 500 to/govern/ledger/flush, truncates on ack, writes a 5-minute backoff on failure, at most one spawn per minute. SessionStart prints one line saying how many buffered calls are uploading.decide.mjsstays pure and import-free. The local policy engine is frozen, not removed (phase 2 is gated on flush data per #29).Not changed
govern.mjscopies; they get this by the same port (coverage doctrine), tracked on Local mode → offline floor + local ledger + on-ramp (phase 1 additive now; phase 2 engine removal gated on flush data) #29.Verification
node --test test/: 180 pass (was 172). New:destructive-floor.test.mjs(unit, same fixtures as the gateway),offline-floor.test.mjs(real subprocess against a throwaway HOME: no-key, unreachable interactive + unattended,--flushagainst a local server, backoff, no-key sends nothing, SessionStart announce + detached flush).Release
Version 0.15.0 → 0.16.0 (
govern.mjs,plugin.json, marketplace). Attestation baseline is per version, so the hash change lands cleanly (#888 lesson).acp-installembedsdecide.mjsverbatim; sync after merge (#4).