bug: job monitoring reports 'complete' when job is still running or failed
Summary
When Claude monitors a Databricks job run, it retries up to 3 times on errors then incorrectly reports the job as complete — even when the job is still running or has failed.
Steps to Reproduce
- Trigger a Databricks job via Claude Code (with ai-dev-kit)
- Have the job run for longer than expected, or encounter an error during monitoring
- Observe Claude retrying ~3 times then reporting the job as "complete"
Expected Behavior
- Claude should use
manage_job_runs(action='wait')to block until a terminal state is reached - A failed job (
TERMINATED+result_state=FAILED) should be clearly reported as failed, not complete - A still-running job (
RUNNING,WAITING_FOR_RETRY) should never be reported as complete
Actual Behavior
- Claude calls
manage_job_runs(action='get')(snapshot) instead ofaction='wait'(blocking poll), gets an intermediate state, retries ~3 times, then gives up and reports success - The
WAITING_FOR_RETRYlifecycle state (job task is retrying after failure) is not listed inTERMINAL_STATES, which can cause confusion about whether the run is done - The skill docs show
max_retries: 3as a job task config example — the LLM interprets this as the number of times to retry the tool call
Root Cause
Two issues:
-
No guidance in SKILL.md to always use
action='wait'for job completion monitoring instead ofaction='get'. The LLM defaults to polling withgetand gives up after a few attempts. -
max_retries: 3example in skill docs (notifications-monitoring.md) is a job task configuration parameter, but the LLM misreads it as a directive to retry the monitoring tool call 3 times before declaring success.
Relevant files:
databricks-skills/databricks-jobs/SKILL.mddatabricks-skills/databricks-jobs/notifications-monitoring.mddatabricks-tools-core/databricks_tools_core/jobs/runs.py—TERMINAL_STATESdoes not includeWAITING_FOR_RETRY
Proposed Fix
- Update
SKILL.mdto explicitly instruct: always useaction='wait'to monitor job completion; never useaction='get'in a polling loop - Clarify in
notifications-monitoring.mdthatmax_retriesis a job task config, not a tool retry directive - Consider adding
WAITING_FOR_RETRYandBLOCKEDto a documented "non-terminal" states list so the LLM understands those mean the job is still active
Impact
Customers see false "job complete" status messages, leading to incorrect downstream decisions when jobs are actually still running or have failed.
Migrated to databricks/databricks-agent-skills#235 — closing here.
Splitting this the way the root cause splits:
Skill-guidance half → databricks/databricks-agent-skills#235. Both problems you identified are still live in skills/databricks-jobs on the new repo: SKILL.md teaches databricks jobs get-run (a snapshot) for status checks with no instruction to block until a terminal state, and the max_retries: 3 example is still there unqualified. Both are captured in the new issue with current line references, including your point that TERMINATED + result_state=FAILED must be reported as a failure.
MCP half — already implemented here. manage_job_runs supports action="wait" (blocking, 3600s default), it's documented in the MCP server README, and TERMINAL_STATES in databricks-tools-core correctly excludes WAITING_FOR_RETRY. So the tool could always do the right thing; what was missing was guidance telling the agent to reach for it. That's exactly the half that moved.
Your diagnosis was right on both counts — thanks for separating the two causes so clearly, it made the split obvious.