feat(webapp): attribute console approvals to a reviewer identity#556
Conversation
kb.list_* moved from a bare array to a `{items, _meta}` dict envelope
(server deprecation, remove_in 1.4.0), but the webapp still typed and
consumed these as flat arrays — so `r.data.map` in Shell and PendingView
threw "map is not a function", crashing the whole tree through the error
boundary on every page, the pending queue included.
unwrap `items` once in rpc(), scoped to kb.list_* methods, tolerating the
old bare-array shape and leaving kb.list_sessions ({sessions}) and non-list
object results untouched. one central change fixes the pending page and
every list view; the fan-out, optimistic caches, and views are unaffected.
a human approving in the review console was anonymized to the tokenless
`unknown-agent` default, which collides with proposals filed under the same
sentinel and trips the self-approval gate — so the owner literally could not
approve their own KB's captured claims from the UI ("if not me, who?").
the console now carries a reviewer identity: rpc() sends it as X-Vouch-Agent
(which the server already reads into the request actor), the dev proxy
forwards that header, and a small topbar input lets the reviewer set their
name, defaulting to `console`. approvals are attributed to a distinct human
reviewer, pass the gate for every proposal, and the audit log records who
approved — the review gate working correctly, not loosened.
|
this PR changes UI (web/, src/vouch/web/, or webapp/) but has no before/after screenshots in the description. UI changes are reviewed by screenshot, not by running the app. add before and after screenshots, then reopen. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
WalkthroughThe web console now stores a reviewer identity, sends it as ChangesReviewer identity and RPC compatibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Reviewer
participant Shell
participant rpc
participant vouch-proxy
participant VouchEndpoint
Reviewer->>Shell: Enter reviewer identity
Shell->>rpc: Persist reviewer identity
rpc->>vouch-proxy: Send RPC request with x-vouch-agent
vouch-proxy->>VouchEndpoint: Forward x-vouch-agent
VouchEndpoint-->>vouch-proxy: Return response
vouch-proxy-->>rpc: Return proxied response
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
this PR changes UI (web/, src/vouch/web/, or webapp/) but has no before/after screenshots in the description. UI changes are reviewed by screenshot, not by running the app. add before and after screenshots, then reopen. |
|
this PR changes UI (web/, src/vouch/web/, or webapp/) but has no before/after screenshots in the description. UI changes are reviewed by screenshot, not by running the app. add before and after screenshots, then reopen. |
lets a human approving in the review console be attributed to a reviewer identity, so the self-approval gate stops wrongly blocking the KB owner.
the problem: the console approves through the server's
kb.approve, which stamps the approver as the request actor — and with no identity supplied, that falls back to the tokenlessunknown-agentdefault. proposals captured under the sameunknown-agentsentinel then collide with it, so approving them tripsforbidden_self_approval. the owner could approve their own KB's claims from the CLI (where the OS user is a distinct actor) but not from the UI. "if not me, who?" — it should be them; the fix is to give them an identity, not to loosen the gate.the server already reads an
X-Vouch-Agentheader into the request actor; the console just never sent it. now:rpc()sendsx-vouch-agent: <reviewer>on every callconsoleapprovals are attributed to a distinct human reviewer, pass the gate for every proposal, and the audit log records who approved.
verified end-to-end against a running
vouch serve: approving a previously-blockedunknown-agentproposal in the UI now succeeds, and the audit event recordsactor: console. tests add proxy header-forwarding and rpc reviewer-header cases. full webapp suite green (156), tsc clean.note: stacks on #555 (the
{items}envelope render fix) — the pending page can't render to approve from without it. rebases to just this change once #555 merges.Summary by CodeRabbit
New Features
Bug Fixes