Repository navigation
feat(gate): minimal asynchronous polling for the Muse route - #45
Merged
Merged
Conversation
Implements docs/design/muse-async-poll.md: [passthrough] hold_mode = async answers 202 with request_id and a 128-bit poll token (sha256 stored, constant-time compare); GET /poll/<token>?wait=N returns pending or a final status (approved_and_sent, denied, expired, dropped, send_failed, send_unknown) for 60 s, then a uniform 404. Reuses the hold table, start claim, audit writer and Telegram notification; blocking stays default. Checks (macmini arm64, umask 022, ~/tmp/auth-proxy-muse-async-poll-impl-20261122105632): - cargo fmt --check: exit 0 - cargo clippy --workspace --all-targets -- -D warnings: exit 0 - cargo test --workspace: exit 0, no failures (known reds: netguard x3 under umask 0002, matrix PT-09/P1-09; not triggered)
…t refusals, drop poll rate limit - hold_mode and async_hold_secs move from [passthrough] to the route; load requires a passthrough route with a hold grant. Other held routes keep blocking, dedupe and supersede. - Detached async forwards are tracked (AsyncTasks) and included in the shutdown wait (request_deadline_secs + 2). A cut after forward_started ends as send_unknown (completed, code upstream_reset); before it, dropped. - Admission refused after the held record (cooldown, identity_cap, table_full) writes a terminal hold record for that request_id with the refusal code and status 503. - Remove the per-token poll rate limit and the 429 rate_limited response. Checks on macmini (arm64, umask 022): see PR comment / follow-up commit trailer.
chaodu-agent
marked this pull request as ready for review
November 22, 2026 16:18
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.
Draft. Not for merge until reviewed.
Implemented
hold_mode = "async", a held grant is answered at once with202and a body holding onlystatus,request_idandpoll_token(128-bit random; only its sha256 is stored, compared in constant time).GET /poll/<token>?wait=N.waitis validated before the token lookup (missing = 0, cap 25; non-numeric, negative, empty or repeated gives 400). Statuses: pending, approved/forwarded outcomes, denied, expired, send_failed, send_unknown, dropped (the design's final statuses). The poll store is read-only and has no approve path.[passthrough] hold_mode = "blocking" | "async", defaultblocking. The blocking route is unchanged;/poll/is only intercepted in async mode.async_hold_secs: hold lifetime in async mode, 5..=600, default 120.audit_unavailablebefore any token or notification. Approve versus expiry is decided on the table mutex, first wins.rate_limitedwithRetry-After: 1.Changed files
Test results (macmini arm64, umask 022)
cargo fmt --check: exit 0cargo clippy --workspace --all-targets -- -D warnings: exit 0cargo test --workspace: exit 0, 0 failedmatrix-upstreamand were not run.Known pre-existing reds (fail on base, not caused by this PR)
Review
One round, HIGH/MEDIUM only: APPROVED, no HIGH or MEDIUM findings. LOW notes: config keys sit under
[passthrough]and apply to every held grant (there is nomuse.section); poll rate limit numbers are an implementer choice.Not as designed
[passthrough], not amuse.section.limits.hold) is fixed at startup fromasync_hold_secs.