Repository navigation
[agentbricks] Keep the databricks CLI's own output out of --output json stdout - #762
Merged
elainewang-db merged 2 commits intoOct 16, 2026
Conversation
…on stdout Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
jamesbxwu
approved these changes
Oct 16, 2026
jamesbxwu
left a comment
Contributor
There was a problem hiding this comment.
to help understand the behavioral change better, can you include a before / after screenshot in the PR description?
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
agentbricks --output json deployprinted more than its JSON payload on stdout, so a script reading the payload failed withJSONDecodeError: Extra data. Two sources:deployrunsdatabricks syncanddatabricks apps deploywithout capturing their output, so the sync progress (Action: PUT: …,Uploaded …,Initial Sync Complete) and the App objectapps deployprints went to stdout.deployrelayed the App objectapps create/create-updateprinted throughReporter.echo, which writes to stdout.The fix sends both to stderr:
databricksCLI runner gets ato_stderrflag that sends an uncaptured command's output to stderr.sync,apps deploy,apps start,apps stopandapps deleteuse it, sodeployanddeployments start/stop/deletekeep stdout for their--output jsonpayload.apps logsandapps run-localstill print to stdout, since their output is what the user asked for.AppProvisionerrelays theapps create/create-updateoutput withReporter.note(stderr) instead ofReporter.echo.In normal output, all of this still shows in the terminal.
Before / after
The same project deployed with
agentbricks --output json deploy ab762demo --source <project>, stdout and stderr captured to separate files, then stdout parsed withjson.load.Before (
mainat966efe7): stdout is 117 lines. The App object fromapps create, then thedatabricks syncprogress, then the deploy payload:After (this PR at
6f5555a, redeploying the same App): stdout is only the deploy payload, and it parses. The sync progress and the App object fromapps deploygo to stderr:The before run was the App's first deploy (full upload); the after run was a redeploy, so its sync is shorter.
Testing
pytest tests/unit_tests: 1878 passed. New tests: the runner sends output to fd 2 whento_stderris set; each of the five lifecycle commands sets it; the provisioner relays theapps createandcreate-updateoutput withnote, notecho. Two existing tests' expectedapps deletecall now includeto_stderr=True.tyreports the same diagnostics asmain.deploy --output json: without this PR, every deploy test failed to parse deploy's output. With it, all 6 tests pass (test_deploy,test_memory,test_sessions,test_tracing,test_dev,test_tools_remove) in 6 min 5 s.This pull request and its description were written by Isaac.