Added a hook to handle AskUserQuestion#201
Draft
riley-mete-db wants to merge 3 commits intodatabricks-solutions:mainfrom
Draft
Added a hook to handle AskUserQuestion#201riley-mete-db wants to merge 3 commits intodatabricks-solutions:mainfrom
riley-mete-db wants to merge 3 commits intodatabricks-solutions:mainfrom
Conversation
rportilla-databricks
approved these changes
Mar 3, 2026
calreynolds
reviewed
Mar 4, 2026
Collaborator
calreynolds
left a comment
There was a problem hiding this comment.
pausing this PR for now in favor of adding the claude-native skill to the approved tools!
…oned in the skills
… allow poller to read all events before clean-up
riley-mete-db
commented
Mar 4, 2026
| ) | ||
|
|
||
| # First check in-memory streams for this conversation (always works) | ||
| # Check in-memory streams for this conversation. Prefer a running stream; |
Author
There was a problem hiding this comment.
When testing locally, the poller (Lemma) would sometimes miss final events because the endpoint previously ignored completed streams, falling through to the DB before persist_loop had flushed them. This change falls back to the most recently completed in-memory stream (which lingers for 5 minutes before cleanup), giving the poller time to drain all events. It doesn't affect the stream itself, just adds robustness to polling.
This race condition mostly surfaces locally where slower calls widen the timing window, but can still occur in prod under load.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a PreToolUse hook to block the AskUserQuestion tool in the headless Builder App agent, redirecting it to ask questions as plain text in the response instead of failing silently.
Files Modified
databricks-builder-app/server/services/agent.py— New _create_ask_user_hook() factory that denies AskUserQuestion via PreToolUse hook with a system message redirecting the agentto ask via text; hook registered in _run_agent_in_fresh_loop() for all executions; ruff formatting fixes (single quotes, line wrapping, import sorting)
databricks-builder-app/client/src/pages/ProjectPage.tsx— Minor refactor: extracted toolName variable in tool_use event handler to avoid duplicate castsTest Plan
[x] Tested locally using
./scripts/setup.shand./scripts/start_dev.shwith my databricks workspace.[x] Verified hook itercepts
AskUserQuestion- agent asks via text instead of failing[x] Verified agent continues normally after hook
[x] Verified agent executes normally when no
AskUserQuestionis usedScreenshots