-
Notifications
You must be signed in to change notification settings - Fork 303
callOnce() should forward the OAuth-suppression option (disableOAuth from #198) #201
Copy link
Copy link
Open
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
callOnce()is the one-shot library convenience exported frommcporter:It drops every
CallOptionsknob the underlyingruntime.callToolexposes. Once #198 landsdisableOAuthonRuntime.callTool(andlistTools/listResources/readResource),callOncewill be the only public call surface that can't suppress the interactive OAuth flow — headless callers will have to drop down tocreateRuntime+callTool+closejust to set one boolean.Why this matters
The README explicitly points
callOnceat headless use cases (line 257 today):"Agent tool hook" is non-interactive. Today on
main, if the cached token is expired or missing,callOncereachesopenExternaland tries to spawn a browser from a context the user can't see — the exact failure mode #197 reports and #198 closes forRuntime.callTool. The convenience function the README promotes for headless work cannot enforce headless safety.Security / operational impact
Strictly additive and safe-by-default:
disableOAuthdefaults toundefined→ behavior identical to today.disableOAuth: trueis more restrictive than the default — suppresses interactive OAuth at the transport layer and short-circuits the unauthorized-fallback path that could otherwise re-enter OAuth.--no-oauthpath (added in fix(runtime): preserve disableOAuth across headless paths #198) uses. Missing or expired token → server returns 401, call fails cleanly. No hanging browser launch.The flag only narrows what the runtime is allowed to do; no scenario widens an attacker's reach.
Proposed API
Add one optional field; forward it:
export async function callOnce(params: { server: string; toolName: string; args?: Record<string, unknown>; configPath?: string; + disableOAuth?: boolean; }): Promise<unknown> { const runtime = await createRuntime({ configPath: params.configPath }); try { return await runtime.callTool(params.server, params.toolName, { args: params.args, + disableOAuth: params.disableOAuth, }); } finally { await runtime.close(params.server); } }Forward only
disableOAuth. Per #198's design,disableOAuth: truealready implies cached-token use, so explicitallowCachedAuthisn't required.CallOptions.timeoutMsandConnectOptions.oauthSessionOptionsare deliberately left to the fullRuntimesurface — callers needing them should not be on the convenience function. AddingtimeoutMslater is a reasonable separable expansion.README follow-up
Update the README line above in the same PR to mention
disableOAuthand cross-reference the CLI's--no-oauthflag.Backward compatibility
Strictly additive. Every existing caller keeps working with the same default behavior.
Scope
callOnceonly. Not in scope: revisitingcallOnce's broader design, forwarding the fullCallOptions/ConnectOptionssurface.Related & dependency
Becomes actionable when #198 lands; could also be folded into #198's PR.
disableOAuthconnect option —maxOAuthAttempts: 0defeats the connection cache #197 — reports the underlying headless-safety requirement.disableOAuthtoRuntime.callTooland the matching CLI flags (--no-oauth).callOncewas the one public call surface not updated.Runtime.connect's options surface so consumers can name the shape. This issue closes the matching gap for the convenience function: not just naming the posture, but being able to use it.Priority
P3 / impact:auth-provider — same class as #199. The functional workaround (
createRuntime+callTool+close) will exist once #198 lands; the gap is that the README documents a use case its convenience API cannot fully support.