Skip to content

Conversation

@eLysgaard
Copy link
Contributor

Adds OAuth confirmation UI that prompts users to authenticate when tool calls encounter credential errors, with login and retry functionality.

Tested using https://eng-ml-inference.staging.cloud.databricks.com/ml/endpoints/agents_main-bbqiu-oauth?o=1653573648247579. Also added unit tests to cover new behavior.

chatbot-oauth-confirmation-demo.mov

eLysgaard and others added 7 commits December 3, 2025 15:32
When an agent tool call fails due to missing OAuth credentials,
the chat now displays a friendly inline UI instead of a raw error.
Users can click to open the OAuth login page, then retry the
failed tool call without losing context.

- Add oauth-error-utils.ts for detecting and parsing credential errors
- Add MessageOAuthError component with Login/Retry buttons
- Update message.tsx to render OAuth errors inline (not in error list)
- Add tool-call schema support for retry with pending tool calls
- Skip stream resume when OAuth errors are detected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add unit tests for oauth-error-utils.ts (22 tests)
  - isCredentialErrorMessage detection
  - findLoginURLFromCredentialErrorMessage extraction
  - findConnectionNameFromCredentialErrorMessage extraction
  - Integration tests for full error parsing
- Add E2E tests for OAuth error UI components (4 tests)
  - Pattern detection in browser context
  - UI rendering verification
- Add OAuth error fixtures for test mocking
- Update Playwright config with 'oauth' test project

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The previous approach tried to include tool-call parts in the user message,
but the backend converter only handles tool-calls in assistant messages.

Instead, we now simply resend the original user text message and let the
agent make the tool call again. Since the user is now authenticated after
clicking Login, the tool call should succeed on retry.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The spec requires sending both the user message and the failed tool call
when retrying after OAuth authentication. This commit:

- Updates responses-convert-to-input.ts to handle tool-call parts in
  user messages by converting them to function_call items in the input
- Restores the frontend logic to include tool-call parts in retry message
- Re-adds tool-call schema to allow tool calls in user message parts

The backend now correctly converts:
  { role: "user", parts: [text, tool-call] }
Into the Databricks API format:
  [{ role: "user", content: [...] }, { type: "function_call", ... }]

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Resolved conflicts in:
- client/src/components/chat.tsx (keep both clearError and addToolResult/regenerate)
- client/src/components/message.tsx (keep deleteTrailingMessages and MCP approval imports)
- client/src/components/messages.tsx (removed duplicate sendMessage prop)
- Move OAuth retry logic from message.tsx into MessageOAuthError
- MessageOAuthError now extracts loginUrl and connectionName internally
- Simplify message.tsx by removing OAuth-specific logic
- Clean up unused imports (findLoginURLFromCredentialErrorMessage,
  findConnectionNameFromCredentialErrorMessage, deleteTrailingMessages)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Revert responses-convert-to-input.ts to upstream main (remove OAuth
  retry flow changes from user message handling)
- Apply Biome formatting to chat.tsx and message.tsx (quote style)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@eLysgaard eLysgaard self-assigned this Jan 16, 2026
Copy link
Contributor

@bbqiu bbqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks for working on this

@bbqiu bbqiu changed the title Feature/auth confirmation Feature/oauth confirmation Jan 17, 2026
@eLysgaard eLysgaard merged commit 6f220f8 into databricks:main Jan 19, 2026
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