Skip to content

land: confine-busy-db - #519

Merged
ualtinok merged 6 commits into
mainfrom
land/confine-busy-db
Oct 18, 2026
Merged

ualtinok merged 6 commits into
mainfrom
land/confine-busy-db

Conversation

@aft-alfonso

@aft-alfonso aft-alfonso Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Accepted agent delivery; branch-keyed search descriptor included.


Summary by cubic

Tool calls no longer fail sporadically while the database is opening or briefly busy; saved session confinement stays enforced, and expired waits still fail closed.

  • Carries in-memory confinement answers through to admission, along with the policy generation, so a busy database slot cannot turn an unconfined call into confine_policy_unavailable; carried answers are rejected once a confining save invalidates them.
  • Waits off-loop for keyed calls' opening policy store, shares the existing persistence deadline, and bounds blocking reads with permits held until completion; unreadable policies, exhausted wait budgets, and over-limit concurrent reads fail closed.
  • Rejects untrusted shell capabilities before any confinement or database lookup, and treats never-configured persistence as unconfined even behind a busy slot.
  • Adds deterministic tests for held slots, slow opens, wait-budget exhaustion, refusal ordering, and reads that finish after their caller times out.

Written for commit 464d189. Summary will update on new commits.

View guided diff Turn on auto-fix

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

The PR keeps confinement checks off the frame loop while the database opens or stays busy.

  • Scoped tool calls wait for their saved confinement policy.
  • Untrusted shell calls are refused before policy lookup.

Both earlier findings are addressed in the current code. Both threads were manually resolved without explanatory replies.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Tool call] --> B{Shell capability refused?}
  B -->|Yes| R[Return error]
  B -->|No| C{Policy known in memory?}
  C -->|Yes| D[Carry answer and generation]
  C -->|No| E{Budget and read permit available?}
  E -->|No| R
  E -->|Yes| F[Wait for database opening]
  F --> G[Read policy off-loop]
  G --> D
  D --> H[Ledger admission wait]
  H --> I{Current policy answer available?}
  I -->|No| R
  I -->|Yes| J[Apply confinement and admit]
Loading

Reviews (2) · Last reviewed commit: "mason: clarify carried policy invalidati..." · Reviewed by Greptile

ualtinok and others added 3 commits October 18, 2026 06:16
Carry frame-loop memory answers through admission so a later busy database slot cannot turn an unconfined call into policy-unavailable. Wait off-loop for keyed calls' opening policy store and bound policy reads with the existing persistence deadline; preserve fail-closed handling for unreadable policies and saved fences.

Reject policy-independent untrusted shell capabilities before confinement lookup. Recheck never-configured persistence after waiting for a busy empty slot. The persistence memo test now expects the carried Some(Ok(false)) instead of discarded None; execution permissions are unchanged.

Add deterministic held-slot, slow-open, deadline and refusal-order tests. Five isolated negative controls redden only their intended tests; Linux policy/provider gates and native Windows conformance, including twenty repeats of the reported test, pass.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
…tic tests

Add a cfg(test) one-shot memory-miss hook so held empty database slots reach the blocking lookup's fallback without scheduler timing. Cover failed configured stores directly and through non-shell frame admission, opening stores after the wait budget, and genuinely unconfigured contexts.

The reviewer's unconditional Ok(false) mutation reddens each of the three configured-store tests. The inverse unconditional refusal reddens the unconfigured control; the other side remains green under each mutation. Preserve production behavior and carry the full red-run evidence in the investigation artifact.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Comment thread crates/aft/src/subc/persistence.rs Outdated
Comment thread crates/aft/src/subc/persistence.rs Outdated
ualtinok and others added 3 commits October 18, 2026 07:04
Carry the policy generation through admission waits and reject unconfined answers invalidated by a confining save, including bash admission after ledger waits. Keep eight confinement-read permits owned by the blocking closures until completion, not merely until waiter timeout, and reject expired requests before scheduling reads.

Update the exhausted-budget tests to expect immediate fail-closed refusal rather than queuing an async waiter: expired frames must no longer launch a policy read. Held-ledger, capacity, timeout-lifetime and deadline regressions were mutation-checked; generation and liveness mutants each reddened their named tests and were restored before the passing gates.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
The post-commit publication input gate identifies the new write-admission regression's filePath field as a reviewed legacy occurrence. Add only that exact test fixture to the rust-compatibility allowlist, with an explicit reason; do not regenerate or broaden the allowlist.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Explain explicitly that a worker epoch with no saved row inherits an older epoch's confinement policy. Also align informational allowlist coordinates with the audit scanner's quoted-key match; the content-keyed allowance is unchanged.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
@ualtinok
ualtinok added this pull request to the merge queue Oct 18, 2026
@ualtinok
ualtinok removed this pull request from the merge queue due to a manual request Oct 18, 2026
@ualtinok
ualtinok added this pull request to the merge queue Oct 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 18, 2026
@ualtinok
ualtinok added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit 71dbcf5 Oct 18, 2026
49 checks 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