Skip to content

design: durable fail-closed audit option (#32) - #35

Merged
chaodu-agent merged 6 commits into
mainfrom
design/durable-audit
Nov 19, 2026
Merged

chaodu-agent merged 6 commits into
mainfrom
design/durable-audit

Conversation

@chaodu-agent

Copy link
Copy Markdown
Contributor

Design note for #32: an opt-in audit.mode = best_effort | fail_closed with a durable file sink, write-ahead decision records, fsync/gap/rotation behaviour, request id, secrecy allow-list, failure analysis, metrics/readiness, wire shape of the refusal, staged plan with acceptance tests, and open questions.

Documentation only: one new file, docs/design/durable-audit.md. No existing file is edited.

Draft. Not final. Needs the standing council review before it is treated as settled. PR #29 (stage 2) is in review and not merged; the note describes its shape only and does not depend on its details.

Refs #32. Related: #1, #5, #29.

Documentation only. One new file. Measured fsync cost on a scratch file (section 4.6).
Action boundary at the first request byte, supported local storage with a
statfs check, secure directory and file checks, blocked-writer state machine,
immutable segments, secrecy allow-list, reader conclusions, readiness rules,
reordered test plan, new disk and DoS bound section, first stage cut to held
writes, open questions marked DECIDED or PROPOSED DEFAULT.
Verified: re-read PR #29 at e7818ad (admit, claim_start, approved) and Rust std
sync_data at rustc 0ef1bc386. Docs only, nothing built or run.
@chaodu-agent

Copy link
Copy Markdown
Contributor Author

Revision 2 of docs/design/durable-audit.md is pushed (head 80d8f63). The PR stays a draft. Design only, no code, and no implementation until the revised text is re-reviewed. Each change from the review feedback maps to the section that now addresses it:

Required change Section
Action boundary is the first request byte. held durable before admission, approved before the forward, forward_started after connect and before any byte. PR #29's exact 503 refusal kept 1.2, 3.2, 3.3, 9.1
"Durable" narrowed to supported local Linux storage. Startup statfs refuses tmpfs, ramfs, NFS, CIFS, FUSE (and overlay). stdout and journald never fail-closed. emptyDir semantics. macOS numbers scale only, sync_data = F_FULLFSYNC on Apple read in std 4.1, 4.6, 12
File security: fstat on the opened descriptor (owner, mode, link count), O_NOFOLLOW limits, proxy-owned 0700 directory, openat from a directory descriptor, proxy UID differs from agent UID, no agent-mounted volume, per-record cap 4.2, 4.8, 4A
Blocked writer: probe is "writer free", recovery runs on the writer's own timer, gap has its own seq (M+1), shutdown deadline, deny and refusal records non-waiting, late success is uncertainty not loss 4.3, 4.4, 4.7
Rename rotation replaced by immutable audit.<boot>.<first_seq>.jsonl segments (O_EXCL, directory fsync, never renamed), new segment per boot, prev_tail in the start record 4.5
Secrecy: aws_target named as the one header-value exception, length caps, path, identity and approver names and digest marked sensitive and owner-approved, allow-list updated 6.1, 6.2, 11 (Q17)
Reader conclusions: decision without outcome is authorized and possibly sent, outcome proves only what the proxy observed, absence proves no send only with a complete segment set and no gap, no tail-truncation detection, a retry gets a new request id 5.1, 6.3, 7.3, 7.4
Readiness does not depend on heartbeat_secs, never a liveness failure, approval plane stays reachable 8.2, 8.3
Test plan reordered (records before ids, integration before refusals), backend seam for fsync, partial-write and permanent-block faults, real ENOSPC only on write, FIFO seam-only, SIGKILL proves ordering not durability, hostile-load tests 10
New section on the disk and DoS bound (record cap, rate bound, total quota, isolated volume, fail closed at the cap, no silent deletion) 4A
First stage cut to durable fail-closed for held writes, with the reserve/persist/commit lock change and the exact 503 wire; group commit, heartbeat, rotation, hash chain, admin socket and rich metrics deferred 1.3, 4.2, 10 (stage 1 to 5)
Open questions: Q2, Q3, Q4, Q6, Q7, Q8, Q9, Q11, Q13 marked DECIDED. Q1, Q5, Q10, Q12 and the new owner questions (disk cap and behaviour at the cap, retention and shipping, emptyDir, sensitive fields, who may read the files, deny rate bound) marked PROPOSED DEFAULT, owner approval pending 11

Facts checked in this revision: PR #29 was re-read at e7818ad (it moved since 6f3e678). admit runs the held write under the table lock, claim_start runs forward_started under the table lock after the connect and before the first byte, and approved uses the best-effort write. Rust std at rustc 0ef1bc386 uses F_FULLFSYNC for both sync_all and sync_data on Apple targets and fdatasync on Linux. PR #29 is still in review and may change.

One finding belongs on PR #29, not here: its held record goes to stdout while the hold-table lock is held, so a blocked stdout pipe already stalls admission, approval and drain.

Owner approved all policy defaults on 2026-11-19. Relabel the design
note to match. No value changed.

- Replace every PROPOSED DEFAULT and "owner approval pending" label with
  OWNER APPROVED DEFAULT (2026-11-19), including the timing comments in
  the config block.
- max_total_bytes = 1073741824 is the owner-approved default, not a
  placeholder. Its line is byte-identical to af9cb8b apart from the label.
- Remove sentences that said the owner still had to decide or name items.
  Shipper ownership and retention are now described as deployment settings.

Checks (against af9cb8b):
(a) grep -n -e 'PROPOSED DEFAULT' -e 'owner approval pending': no lines.
    Also no lowercase "proposed default", "owner approval", "owner decides"
    or "owner question" left.
(b) grep -niE 'placeholder|not answered|has not|awaiting|pending': 11 hits,
    all read by hand. All are technical uses of Pending or "has not returned"
    or "has not yet taken" (writer and entry states). None says the owner has
    not decided, and none calls the quota a placeholder.
(c) Numeric tokens: the multiset diff of [0-9][0-9_.,]* tokens is only
    +17 "2026", +17 "11", +17 "19" from the new date labels. The value line
    max_total_bytes = 1073741824 is identical.
(d) git diff af9cb8b: 22 added and 23 removed lines. Every change is a
    label or wording change. No numeric value changed.
Rename section 11 heading from 'Open questions' to 'Decisions and deployment choices'. Every item in the section is DECIDED or OWNER APPROVED DEFAULT (2026-11-19). No values changed.

Checks run on the committed file:
- grep -n "Open questions" docs/design/durable-audit.md
  output: (no match, exit 1)
- grep -n "owner approval pending" docs/design/durable-audit.md
  output: (no match, exit 1)
- grep -n "max_total_bytes = 1073741824" docs/design/durable-audit.md
  output: 205:max_total_bytes = 1073741824    # fail_closed only: quota over all segments in `dir` (section 4A, OWNER APPROVED DEFAULT (2026-11-19))
  max_total_bytes value: 1073741824 (1 GiB), unchanged from eef6cd9
- git diff --stat: 1 file, 1 insertion, 1 deletion
@chaodu-agent
chaodu-agent marked this pull request as ready for review November 19, 2026 05:22
@chaodu-agent
chaodu-agent merged commit 1236609 into main Nov 19, 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