Skip to content

feat(approvals): a critical request is answered in the app, and its push offers no Approve - #917

Open
OAraLabs wants to merge 27 commits into
mainfrom
feat/approval-critical-flag
Open

OAraLabs wants to merge 27 commits into
mainfrom
feat/approval-critical-flag

Conversation

@OAraLabs

@OAraLabs OAraLabs commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Beacon iOS Piece 15. Stacked on #915; retarget to main once it merges.

What this is, and what it is not

critical decides where an approval request is answered (in the app, or from a lock-screen notification), not whether. It is a UX nudge, not a security boundary, and nobody should treat the lists as a guard. Every request it touches has already been stopped by the permission checker and needs a person either way. A request wrongly judged ordinary is still read by the owner and approved on the lock screen behind Face ID, which the owner could equally do in the app.

The lists are best effort, and they are not a second permission checker. Two things ARE hard rules:

  • classifying a request never hangs or crashes request creation;
  • any error fails toward critical: CriticalRules.matches answers unreadable, and a shell line over 4 KB or 400 words is critical unread.

The same statement is in permissions/critical.py, the config template, docs/guide/api.md and the CHANGELOG.

What it does

ApprovalQueue.serialize_pending carries critical. It is computed once, so GET /api/approvals, the approval_pending frame and the push cannot disagree.

Built in (always critical):

  • a desktop prompt;
  • a request to lift a device's hold;
  • arguments cut or masked when the request was captured;
  • a description over 600 characters or 8 lines.

Owner lists: push.critical_tools, push.critical_commands and push.critical_paths. Leave a key out for the default; [] means none.

  • The defaults cover deletes, git push, commands and tools that send or spend, and changes to devices, permissions or the agent's configuration.
  • Commands match as leading words of any command in a shell line, through wrappers, inline interpreters, subshells and cd, failing toward critical on anything it can't read. Overwriting redirects count too.

The push: a critical request is pushed with no category, so the notification offers no Approve, and with "critical": true. It is never sent as false. Every other approval push keeps APPROVAL. test_approval_push_fanout gains exactly one key, critical, on purpose.

Capability: server_capabilities lists approval_critical.

Review

Independent reviews in rounds, each round's red tests committed before its fix. They found two runtime blowups, both fixed:

  • stacked wrappers were exponential;
  • nested find -exec chains were exponential.

There is now a size cap. A 4 KB line runs in about 0.1 s or less, and matches cannot raise. The remaining findings were matcher false negatives; per the decision above they are not blocking, and the rounds were stopped there.

Tests

tests/test_approval_critical.py (190). Local Mac suite: 16,102 passed, 0 failed (test_generated_reference and test_gate_manifest deselected: they fail only in a worktree). Ruff, the mypy gate and pip-audit are clean.

No released client acts on these pushes yet.

🤖 Generated with Claude Code

OAraLabs and others added 22 commits November 12, 2026 10:37
A desktop prompt's content-free push also reaches devices marked for computer
use. A store that cannot name owners sends no approval push. Three tests that
used ordinary devices or fakes without the new store method updated on purpose.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ush offers no Approve

Built in: desktop prompts, hold lifts, arguments cut or masked, long
descriptions. Owner lists push.critical_tools/commands/paths, defaulting to
deletes, git push, sends, spends and config/device/permission changes. One
value from serialize_pending for REST, the frame and the push; the fanout key
gate gains exactly 'critical', on purpose. server_capabilities: approval_critical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fig, downloads (review round 1)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mmands and bash writes into config

Wrappers with options (sudo, env -i, nice -n, xargs, find -exec), inline
interpreters (bash -c, python -c, eval), find -delete, subshells, groups and
if/then are matched; a shell line naming a config path is critical; downloads
into config are, the downloads folder is not; a relative path is judged by its
components; a call the matcher cannot read is critical. One test fake fixed
(an empty dict was never read). Review round 1 on #917.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…case, dynamic command words, cd writes (review round 2)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shells are always critical; interpreters with an inline program (grouped
flags too), '-', or fed on stdin; python -m is scanned; after a wrapper every
later word is tried and a command-line argument is matched whole; a command
word built from $, a glob or a brace is critical; names compare case-folded;
a write relative to a cd into home or config, a glob that could reach config
and XDG_CONFIG_HOME count; more senders. Review round 2 on #917.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, spends, versioned interpreters (review round 3)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd knows more deletes, sends and spends

A wrapper met inside a wrapper's scan is not scanned again (was exponential:
'env '*22 hung). Pattern words after the verb match anywhere (git reset -q
--hard); versioned interpreters (python3.12), pwsh; cd -- handled; deletes
(git checkout ., worktree remove, tag -d, docker rm/prune, npm unpublish, dd,
:), sends and spends (publish/push commands, rclone, gsutil, httpie, kubectl
and terraform changes, wrangler, vercel, fly, heroku, shortcuts), chgrp.
Review round 3 on #917.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cation and data deletes (review round 4)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es are critical

A shell line over 4 KB or 400 words is critical unread (bounds every
quadratic shape); find -exec recursion goes through the scan's guard (nested
find chains were exponential); '> f' at the head of a statement is critical;
docker volume prune / compose down, git switch --discard-changes, checkout -f
and package uninstalls added. One test corrected: a short harmless find chain
is not critical, only fast. Review round 4 on #917.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
'> f', '1> f', '>| f' to anything but /dev/null, /dev/std*, /dev/tty or a
descriptor; appends are not. The path check is skipped above the length cap
(the line is critical already). One earlier expectation updated on purpose:
'cd project && echo hi > out.txt' is now critical (an overwrite), and the
ordinary case uses '>>'. Review round 5 on #917.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Checked on the whole line, since the statement split cuts at '&'. Review
round 6 on #917.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…revoked marked device and a raising store

From the second review of this PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ices' into feat/approval-critical-flag

# Conflicts:
#	CHANGELOG.md
#	docs/reference/config-keys.md
#	src/prometheus/web/ws_server.py
…ices' into feat/approval-critical-flag

# Conflicts:
#	CHANGELOG.md
…l-flag

# Conflicts:
#	src/prometheus/web/ws_server.py
@OAraLabs
OAraLabs changed the base branch from fix/approval-pushes-to-owner-devices to main November 15, 2026 05:14
@OAraLabs
OAraLabs marked this pull request as ready for review November 15, 2026 05:14

This branch has not been deployed

No deployments
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