Skip to content

[Plugin] Mark run_tool read-only when HITL gates it#5

Merged
swarup-padhi-glean merged 2 commits into
mainfrom
run-tool-readonly-when-hitl
Jun 17, 2026
Merged

[Plugin] Mark run_tool read-only when HITL gates it#5
swarup-padhi-glean merged 2 commits into
mainfrom
run-tool-readonly-when-hitl

Conversation

@swarup-padhi-glean

Copy link
Copy Markdown
Contributor

What

When ENABLE_HITL is on and the client supports elicitation, the plugin's own run_tool approval prompt is the gate. This PR advertises run_tool with readOnlyHint: true at list-tools time in that case, so the client (e.g. Codex's "Allow run_tool?" / Claude's tool-approval) won't add a second, redundant native approval prompt on top of our elicitation.

Both conditions are required (ENABLE_HITL && getClientCapabilities()?.elicitation):

  • If the client can't elicit, the HITL gate is skipped at runtime — so run_tool must stay gated by the client (no read-only hint). Claiming read-only there would let write actions run with no approval at all (fail-open).

Implemented as a pure runToolAnnotations(enableHitl, clientSupportsElicitation) helper (in run-tool.ts), called from the list_tools handler with the live client capabilities; unit-tested.

Independent of #4 (the HITL display/timeout fix) — applies directly on top of main.

Notes / caveats

Test plan

  • npm run typecheck && npm test && npm run build — 136 tests incl. runToolAnnotations.
  • Manual: with ENABLE_HITL=true in Codex/Claude, run a run_tool call and confirm the client's native "Allow run_tool?" prompt no longer appears (only the HITL elicitation does). With HITL off, the client gate still appears.

@swarup-padhi-glean swarup-padhi-glean force-pushed the run-tool-readonly-when-hitl branch from 73a4496 to 9ddfd3e Compare June 15, 2026 06:35
When ENABLE_HITL is on and the client supports elicitation, our own
approval prompt is the gate for run_tool. Advertise readOnlyHint on the
tool in that case so the client suppresses its native run-tool
confirmation and the user isn't double-prompted. Without HITL we leave
annotations unset and defer to the client.

Adds runToolAnnotations() (pure, unit-tested) and wires it into the
ListTools handler.
@swarup-padhi-glean swarup-padhi-glean force-pushed the run-tool-readonly-when-hitl branch from 9ddfd3e to dd73775 Compare June 15, 2026 07:03
Adopt the glean-vnext rename from #7 in the three plugin manifests and
bump version to 0.2.21 (above main's 0.2.20). run_tool readOnlyHint
change and dist are unaffected by the rename.
@swarup-padhi-glean swarup-padhi-glean merged commit f4a5673 into main Jun 17, 2026
2 checks passed
swarup-padhi-glean added a commit that referenced this pull request Jun 17, 2026
Adopt the glean-vnext rename from #7 in the three plugin manifests and
bump version to 0.2.22 (above #5's 0.2.21 / main's 0.2.20). The
formatArguments pretty-print change and dist are unaffected by the rename.
swarup-padhi-glean added a commit that referenced this pull request Jun 17, 2026
#5 landed on main first (readOnlyHint, v0.2.21). Integrate it: keep both
formatArguments (#6) and runToolAnnotations (#5) — they live in separate
parts of run-tool.ts and tests. Resolve the 3 manifests to glean-vnext
v0.2.22, keep both test suites, rebuild dist.
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.

2 participants