Skip to content

Added a hook to handle AskUserQuestion#201

Draft
riley-mete-db wants to merge 3 commits intodatabricks-solutions:mainfrom
riley-mete-db:riley/feature/ask_user_question
Draft

Added a hook to handle AskUserQuestion#201
riley-mete-db wants to merge 3 commits intodatabricks-solutions:mainfrom
riley-mete-db:riley/feature/ask_user_question

Conversation

@riley-mete-db
Copy link

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 agent
    to 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 casts

Test Plan

[x] Tested locally using ./scripts/setup.sh and ./scripts/start_dev.sh with 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 AskUserQuestion is used

Screenshots

image

Copy link
Collaborator

@calreynolds calreynolds left a comment

Choose a reason for hiding this comment

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

pausing this PR for now in favor of adding the claude-native skill to the approved tools!

@calreynolds calreynolds marked this pull request as draft March 4, 2026 02:41
)

# First check in-memory streams for this conversation (always works)
# Check in-memory streams for this conversation. Prefer a running stream;
Copy link
Author

Choose a reason for hiding this comment

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

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.

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.

3 participants