Skip to content

Show who asked on tool-approval cards - #66

Draft
sohanmaheshwar wants to merge 2 commits into
mainfrom
fix/approval-card-requester
Draft

sohanmaheshwar wants to merge 2 commits into
mainfrom
fix/approval-card-requester

Conversation

@sohanmaheshwar

Copy link
Copy Markdown

Motivation

A tool-approval card tells the approver why the agent wants a call, what the call does and which permission it needs. It does not say who asked. The runner already resolves a requester and puts it on the ask payload, and pipeline_wiring.go says the approver must see it ("alice's widget wants to delete X"). buildToolCallPending never read it, so no card showed it.

Found while running a Slack demo where Alice's request needed Bob's approval: Bob's card gave no sign that Alice was the one asking.

Wiring the field up exposed a second problem. On the LLM path, the value names the person who started the session, not the person asking. internal/cmd/runner never assigns LastInboundExternalID, so the runner always fell back to the started-by annotations. One runner serves a whole multiplayer thread. When Alice starts a thread and Bob asks for a call, the card would read "Requested by @alice", lending Bob Alice's credibility on a security decision.

Summary of changes

  • Tool-call approval cards lead with a Requested by row. The requester travels as a structured identity in InteractionField.Mentions, the seam that permission_request's "From" row already uses. Slack's existing resolveFieldMentions turns it into a live mention, and Value is the plain fallback for local, browser and fake. The resolved Approved/Denied card keeps the row.
  • On the LLM path, the requester is the author of the turn the agent is answering (lastInboundAuthor), not the session starter.
  • A recorded speaker who is not an addressable person (an agent-authored turn, a raw passthrough) gets no row. The starter did not ask, so naming them would be a guess. Only a session with no recorded speaker (a scheduled wake) falls back to the started-by annotations. With no identity at all, the row is omitted and the card looks as it did before.
  • The app-tool (proxy-exec) path is unchanged: it names the widget viewer.
  • Comments that described the LLM-path requester as "the session's LastInbound requester" now describe the current speaker.

Two behaviors for reviewers to weigh:

  • Email on non-Slack surfaces. The row's plain fallback is the requester's email when one is known, so approvers on local and browser surfaces now see the requester's email address. Before this PR there was no row at all.
  • Batched messages. When several messages are drained into one turn, the card names the author of the last one. This is the same last-wins rule advanceRequester documents for the authorization subject.

Not in this PR: the admin console's "requested by" column stays empty. pkg/web/admind/aggregator.go notes that the generic interaction list carries no requester.

Alternatives considered

  • Name the session starter, which is what the payload carried. This is wrong in a shared thread, as described above.
  • Use authSubject. Under startedBy authorization mode it stays frozen at the starter. That is exactly the case where Bob's call runs on Alice's grants, and the approver most needs to see that Bob asked.
  • Fall back to the starter when the speaker is an agent or a raw passthrough. This was the first version of this branch. Review rejected it for the same reason as the first alternative.
  • Compose Slack mention markup in the runner. Unnecessary, because the Mentions seam needs no Slack, relay or interaction-model change.

Provenance

  • Author (person, or model and version): Claude Opus 5.5 (claude-opus-5-5), directed by Sohan Maheshwar
  • Harness or tooling, with version: Claude Code 2.1.311
  • Person who read the diff: not yet. This PR stays a draft until someone has.

Ship gate

  • mage test:unit
  • mage test:integration
  • mage test:e2e

Results (branch head 96d17da):

mage test:unit         exit 0  567 packages ok, 0 failed
mage test:integration  exit 0  506 packages ok, 0 failed
mage test:e2e          exit 0   64 packages ok, 0 failed

The first integration run had one failure, TestWorkspaceSource_ScheduledRefresh
("condition not met within 10s"), on a machine at load ~12. The test is in a
package this PR does not touch. It passed 3/3 when run alone, and a full
integration rerun at the same head was green (above).

Regeneration

  • Changed a +kubebuilder:rbac marker or a CRD-shaping field: n/a
  • Edited anything under config/**: n/a
  • Changed a cobra command or a CRD schema: n/a
  • Formatting: mage fmt:check covers only Markdown and TypeScript, and this PR changes neither. gofmt -l on the changed Go files is clean.

Coverage

  • This adds user-visible behavior (the new row), and no bundle exercises it. Bronzethread bundles can count approval prompts (assert.approvalPrompts) but cannot read a card's fields. Adding that to the bundle format is a separate change. Coverage here comes from:
    • pkg/agent/runner/tool_approval_requester_test.go: who the row names, for each speaker shape
    • pkg/agent/runner/apptool_viewer_authz_test.go: the LLM path ignores the viewer argument
    • pkg/agent/runner/host_approval_tool_leakage_test.go
    • pkg/channels/channelkinds/slack/interaction_requested_by_test.go: live mention, resolved card
    • pkg/channels/channelkinds/local/interaction_test.go
  • This touches what an approver sees, not an authorization decision, and mage test:integration + mage test:e2e are green.

Before requesting review

  • The PR holds a single change. It has two commits that cannot land separately: the first adds the row, and the second corrects whose name goes in it. The first alone would name the session starter.
  • A person has read every line of the diff.

The tool-approval card told an approver why the agent wanted a call,
what it does and which permission it needs, but not who asked. The
runner already resolves the requester (the app-tool widget viewer, or
the session's started-by identity) and puts it on the ask payload;
buildToolCallPending never read it.

The card now leads with a "Requested by" row. The requester travels as
a structured identity in InteractionField.Mentions, with Value as the
plain fallback (email, else the channel-native id). The runner composes
no mention markup: Slack's existing resolveFieldMentions turns a slack
identity into a live <@U...> mention, and the cached request carries it
through to the Approved/Denied card. Local, browser and fake render
Value as plain text. When no requester is known (a kubectl-started
session, a cron run) the row is omitted and the card is unchanged.

No Slack, relay or interaction-model change was needed; the Mentions
seam channelsd's permission_request "From" row already uses fits.
…l cards

The "Requested by" row named whoever STARTED the session. On the LLM path
the runner fell back to the started-by annotation every time, because
internal/cmd/runner never assigns LastInboundExternalID. One runner serves
a whole multiplayer thread, though (advanceRequester's doc): when Alice
starts a thread and Bob asks for a call, the owner's card read "Requested
by @alice" -- lending Bob Alice's credibility on a security decision.

The requester is now the author of the turn the agent is answering
(lastInboundAuthor, the designated "who is speaking right now" field,
set on turn 0, on cold start and on every drained inbox turn). It is
deliberately not authSubject: under startedBy mode that stays frozen at
the starter, which is exactly when Bob's call runs on Alice's grants and
the approver most needs to see that Bob asked. When several messages are
drained into one turn, the last one's author is named, the same
last-wins rule advanceRequester documents.

The speaker rides as a Subject passthrough plus the session's human
channel Kind, the shape info_leakage's recipient rows already use, so
Slack resolves the mention from the speaker's own canonical: by address
for an email canonical, directly and with no API call for a synthetic
slack:<team>:<id> one. Only a user subject that the platform encoded
qualifies. A recorded speaker that does not (an agent-authored turn, a
raw passthrough) gets no row at all: the starter did not ask, so naming
them would be a guess. Only a session with no recorded speaker falls
back to the started-by identity.

The row's plain fallback is now the person's email when one is known
(decoded from the speaker's canonical, or the started-by email
annotation, stamped as a pair with the external id), so non-Slack
surfaces stop showing a raw Slack user id. Approvers on those surfaces
therefore see the requester's email address.
@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

Deployment failed for project openagentprimitives with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: openagentprimitives.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@sohanmaheshwar

sohanmaheshwar commented Nov 13, 2026 •

Copy link
Copy Markdown
Author

Here's a screenshot of how it looks. The Approve/Deny message doesn't mention who is asking for access. Could be a Ux issue especially if the request is coming from a different app (say Acme Drive) and the Approver sees it on Slack.

Screenshot 2026-11-13 at 12 21 33

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