Repository navigation
fix(approval): let a person deny a request an earlier launch left waiting - #8679
Conversation
Add an end-to-end test asserting that a pending approval left by an earlier version cannot be approved in a later launch but can be denied, and that the denial persists across restarts. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Human verification now accepts a pending orphan from a previous launch when the choice is a denial, matching the row as listed rather than requiring it to be pending in this process. Orphan rows under review are held in a bounded map so the module can verify the denial byte for byte. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a module that detects and cleans up approval engine instances left orphaned after their owning task ends. This prevents stale engines from accumulating and holding resources. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a dismiss_orphan method to the ApprovalEngine trait that denies a pending orphan request as a person's decision, returning NotPending when the request is not one. The native engine implements it behind the legacy-import feature by delegating to its existing orphan dismissal, which was renamed to avoid clashing with the new trait method. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ovals Decision validation now returns the parked approval so the gate can tell a missing request from an orphan, and the default tenant may resolve orphaned pending approvals that are otherwise listed but undismissable. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wrapped long lines and collapsed a multi-line signature in the native approval callbacks and orphan engine so the files match rustfmt output. No behaviour changes. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Pending requests left over from an earlier launch are now recorded as orphans so they can be listed separately and only ever denied, since no host instance owns them and a decision cannot reach them. Added an orphans listing and a dismiss path that marks such requests denied with a label. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wire the new gate_orphan_tests.rs file into the approval gate test suite so its orphan-handling cases are compiled and run alongside the existing gate tests. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The orphan test no longer asserts on the result of naming an agent when denying an orphan, since the agent path's answer is irrelevant to the invariant that the orphan stays pending. Module declarations were also reordered alphabetically and a call was reformatted. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that an orphan row under review verifies only a denial of the exact listed row, that a second concurrent review is refused, and that verification fails before the review begins and after it ends. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added a row to the native approval module's file table describing engine_orphans.rs, which denies pending orphans left behind by an earlier launch, so the module overview reflects the file's role. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Explain how the legacy import carries undecided requests into TinySecurity as pending orphans owned by no host instance, and note that such rows can only be denied, never approved, until they are denied or their window closes. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(approval): let a person deny a request an earlier launch left waiting. Purpose (from the PR title): let a person deny a request an earlier launch left waiting. Previously the one-time legacy import carried undecided requests into TinySecurity as pending orphans listed by `approval_list_pending`, but `approval_decide` answered "no pending approval ever registered", so an orphan stayed listed until its window closed. This PR adds a deny-only dismissal path: the gate routes an orphan decision to `dismiss_orphan`, the native engine re-validates the row, issues a deny-only ticket and calls `Decide2`, and human verification accepts only a denial of the exact listed row. Approving an orphan remains refused. It additionally deletes eight never-compiled dead source files plus two test files only they include, and tightens the matching ratchet baselines. No findings were reported by any answering lane. Unreviewed paths
Review snapshot
Completeness: Complete Features
Tests
FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🟡 Changes recommended
The orphan test reuses a request ID left in the process-wide map by another test, causing order-dependent failures; it needs a distinct request ID.
1 open issue
What changed in this PR
Following #8657, this PR lets users dismiss pending approval requests imported from an earlier launch. It preserves the deny-only restriction because the original call cannot run in the current process.
Changes:
- Adds default-tenant orphan dismissal through the approval gate and native engine.
- Verifies denial tickets against the exact orphan row.
- Adds gate, callback, and restart-persistence tests, plus supporting documentation.
| File | Description |
|---|---|
tests/storage_default_import_e2e.rs |
Tests approval refusal and durable dismissal across restarts. |
crates/openhuman-core/src/security/approval/README.md |
Documents deny-only orphan handling. |
crates/openhuman-core/src/security/approval/native/state.rs |
Tracks orphan rows under review. |
crates/openhuman-core/src/security/approval/native/mod.rs |
Documents the orphan engine module. |
crates/openhuman-core/src/security/approval/native/engine.rs |
Registers the legacy-import orphan module. |
crates/openhuman-core/src/security/approval/native/engine_orphans.rs |
Implements audited, deny-only native dismissal. |
crates/openhuman-core/src/security/approval/native/engine_impl.rs |
Connects the engine trait to native dismissal. |
crates/openhuman-core/src/security/approval/native/callbacks.rs |
Verifies orphan denials against the reviewed row. |
crates/openhuman-core/src/security/approval/native/callbacks_tests.rs |
Tests denial-only verification and row matching. |
crates/openhuman-core/src/security/approval/gate.rs |
Includes orphan decision handling. |
crates/openhuman-core/src/security/approval/gate_tests.rs |
Registers orphan gate tests. |
crates/openhuman-core/src/security/approval/gate_state.rs |
Routes eligible default-tenant decisions to orphan handling. |
crates/openhuman-core/src/security/approval/gate_orphans.rs |
Handles dismissal and publishes the decision event. |
crates/openhuman-core/src/security/approval/gate_orphan_tests.rs |
Tests dismissal, tenant restrictions, and expiry. |
crates/openhuman-core/src/security/approval/engine.rs |
Adds the orphan dismissal trait method. |
crates/openhuman-core/src/security/approval/engine_stub.rs |
Models orphan listing and dismissal for tests. |
Review effort: Balanced
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d931950c9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The download helper now receives an already-created temp file instead of a path, so the caller opens the file and can flush it before streaming begins. This surfaces file creation errors earlier and keeps the streaming function focused on reading and hashing. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The download helper now borrows the destination file instead of taking ownership, so the caller keeps the handle and the redundant flush before streaming is gone. This avoids an unnecessary flush and keeps error cleanup in the caller's hands. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Dropped the unused `std::path::Path` import from the update download module to keep the imports clean. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The enumeration test now stubs the release module staging and expects the tinyeventqueues release path in OPENHUMAN_MODULE_PATH, since inbound_module_e2e loads that release in both modes. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Orphan detection now requires a pending row that carries a legacy history record and is not held by the host, so requests parked by this launch are no longer surfaced as orphans during the window before the host registers them or after it releases them. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The end-to-end tests now expect a keyring-less store to keep OAuth profiles whose access token may live in the keyring, and to serve the document's own token values rather than a keyring entry seeded by another store, matching the file keyring behaviour that keeps profile secrets out of the interactive keyring. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the in-process auth end-to-end tests so they match how a file keyring stores profile secrets in the encrypted document rather than the interactive keyring. A keyring-less view now withholds a possibly keyring-held OAuth row from the view while keeping it and its active pointer persisted, and a saved profile's secret is expected to live in the document, so the assertions and their comments were corrected accordingly. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The error returned when creating the download temp file now names the asset being downloaded, making it easier to tell which update failed when several are staged. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The orphan under-review test built its row with a non-hex id, which no longer matches the expected row format. Switching it to a valid hex id keeps the test exercising the intended denial-only verification path. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
History import and orphan dismissal now register their fallback posture only when no scope exists for the subject, so they no longer overwrite the posture a live check has already registered. This keeps unrelated calls from prompting or passing differently just because an import ran. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Delete the simple agent chat op, the untrusted shell sandbox gate and its tests, the native tool-trust helper, and the web chat parallel turn, turn guard, progress bridge, and run task modules along with their tests. Drop the corresponding entries from the CI boundary and ambient baselines and the gated-test allowlist so the checks stay in sync with the removed code. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The ignored test count for openhuman-core drops from 9 to 8, reflecting that one previously ignored test is now running in CI. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>

Summary
Follow-up to #8657. That PR carried requests an earlier version left waiting into TinySecurity as pending orphans and listed them in
approval_list_pending, but nothing could clear one:approval_decideanswered "no pending approval ever registered", so an orphan stayed on the list until its window closed.This PR lets a person deny (dismiss) an orphan. Approving one is still refused: nothing in this launch can run the call it was for, and TinySecurity's
Decide2accepts only a denial for a row another host instance owns.Changes
security/approval/gate_orphans.rs, hooked intoApprovalGate::decide_as):ApprovalDecidedand returns the row.dismiss_orphan. Its default answersNotPending.native/engine_orphans.rs):legacy_history_json, and be inside its window.Decide2on that scope's audit stream.denylabel, and reports a lost race asNotPending.native/callbacks.rs,native/state.rs):verify_humanaccepts only an orphan currently under review.Deny.leave_orphan,orphans,dismiss_orphan). Itsdeciderefuses an orphan, as the native engine does.README.mdand thenative/mod.rslayout table.Tests (RED → GREEN)
tests/storage_default_import_e2e.rs::a_request_an_earlier_version_left_waiting_can_be_denied_but_never_approvedno pending approval ever registered for request_id '…'. GREEN after.security/approval/gate_orphan_tests.rs(4 tests): deny dismisses; the approve decisions are refused; another profile or a named agent cannot dismiss; an expired orphan and an unknown id are not dismissed.decide_ashook disabled.native/callbacks_tests.rs::an_orphan_under_review_verifies_only_a_denial_of_the_listed_rowcargo test -p openhuman --lib -- security::approvalpasses: 223 tests, plus the new callbacks test.Notes
legacy_history_jsonback to the id from the earlier version.Also in this PR: CI gates that were red on
mainThese failed on this PR's first run, and the same way on other branches cut from current
main. They are fixed here so the PR can go green.static:storage-bypass. A self-update change moved the download temp file'sFile::createfromplatform/update/core.rstodownload.rs, so the ratchet saw one new site and one stale baseline entry. The create is back incore.rs, matching its baseline entry exactly, andstream_to_filetakes the open file. The baseline is unchanged.frontend:scripts-self-tests. The E2E runner now stages the TinyEventQueues release forinbound_module_e2e, and the self-test for that block had no stub forstage_release_module(module_platform: unbound variable). The test now stubs it and checks that the released path comes after the source-built modules.security_approval_characterization(flaky).list_pendingmerges in pending orphans, and an orphan was any pending row the host did not hold. That briefly included a request this launch had just parked, before the host registered it. A test could then pick up that copy, which has no flow context, and the decision would miss. Only the legacy import writeslegacy_history_json, and dismissal already requires it, so the orphan listing now requires it too (view::orphan). New unit test:only_an_imported_pending_row_no_live_request_owns_is_an_orphan. The characterization suite passed 3 runs out of 3 in the CI image.auth_e2ecredential-store tests. fix(credentials): keep profile secrets out of the interactive keyring on a file-keyring core #8670 keeps profile secrets out of the interactive keyring whenOPENHUMAN_KEYRING_BACKENDisfile,encrypted_fileormemory. These e2e tests still chosefileand expected keyring behaviour: keyring hits, a purge of keyring-owned rows, and a keyring entry deleted on removal. Their assertions now pin the document-held behaviour fix(credentials): keep profile secrets out of the interactive keyring on a file-keyring core #8670 defines. The product code is unchanged, and there is no headless OS keyring in the CI image to exercise the keyring path end to end. All four pass in the CI image, each run as its own process the way nextest runs them.Coverage-presence gate (
--all): 8 source files produced no coverage records. They are leftovers from an older layout that nomoddeclaration includes, so they were never compiled. Each has a live replacement:agent_chat/simple.rs→agent_chat_simple.rs,web_chat/ops/turn_guards.rs→web_chat/turn_guards/,web_chat/run_task.rs→turn_host.rs. Two fixes from 11-06 also edited the dead copies, but both edits had landed in the live files too. This PR deletes the 8 files and the two test files only they include (sandbox/untrusted_tests.rs,web_chat/run_task_tests.rs). Those tests never compiled, so no running test is lost. It also prunes the stale entries for these paths fromagent-runtime-boundary-baseline.json(-1),saas-ambient-baseline.json(-3) andcheck-gated-test-allowlist.sh(-1). Baselines only shrink. The presence gate is the regression check: it failed on the previous head and must pass on this one.Ignored-test ratchet: the dead
sandbox/untrusted_tests.rscontained one#[ignore]d test (untrusted_gate_follows_the_released_jail, which needed the released TinyBox archive). It never compiled, so deleting it lowers theopenhuman-corecount from 9 to 8, andignored-test-baseline.jsonis tightened to match.Summary by CodeRabbit