Repository navigation
fix: keep headless Claude and Codex stdout clean - #1007
Merged
Merged
Conversation
david-siqi-liu
approved these changes
Oct 6, 2026
Pzharyuk
pushed a commit
to Pzharyuk/unity-gateway
that referenced
this pull request
Oct 8, 2026
…s#1008) ## Summary Headless Claude/Codex launches fail when an existing OS-managed file overrides UG's gateway settings. Allow those conflicting files to be repaired using one-shot `sudo -n` with stdin disconnected. Authorization failures still block launch; there is no password-prompt fallback. Reuse the existing backup, policy-preserving composition, atomic write, and verification. Leave absent/compatible files unchanged. Headless creation, revert, and managed MCP writes remain out of scope. This PR targets `main`; the separate stdout/JSON fix (databricks#1007) is already merged. Preventing Isaac from replacing UG's `apiKeyHelper` and propagating harness exit codes remain separate Isaac work. ## Validation - Reproduced end-to-end against a local Isaac build pinned to this branch: opened Isaac Omni (interactive) to establish the OS-managed-settings state, then ran headless Isaac with JSON output (`isaac -p ... --output-format json`). The headless launch — which fails on `main` — succeeded and returned JSON, confirming the fix. - 610 managed-file, Claude, Codex, managed-model lifecycle, and managed-resolve component tests passed. - Ruff check/format, type checking, and `git diff --check` passed. - The automated suite mocks the privileged write, so no live inference, real sudo, or `/etc` writes run there; those paths were exercised by the local Isaac repro above. This pull request description was written with AI assistance. --------- Co-authored-by: Isaac <no-reply@databricks.com>
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.
Stack
main, merges independently.Problem
isaac --claude -p --output-format json … > out.jsonproduces invalid JSON because UG prints status lines to stdout before the agent's output. Reported with Isaac2.0.0-20261005192727-d3c9edb/ UG0.1.0+0857d42(Slack).The thread also contains a second, separate failure: when the OS-managed settings differ on a UG-owned key (e.g. Isaac's
jq … model-serving-token.jsonapiKeyHelper), headless launches stop withcannot be applied non-interactively. That is #1008, not this PR.Changes
-p/--printand Codexexec/e/app-server, send UG status and bootstrap/install output to stderr. The agent's own stdout is untouched.--(no Codex option parser). Matching an option value only moves UG diagnostics to stderr.Validation
--p --output-format jsonandexec --jsonproduce valid jsons.| Case |
main@4c1b866| this PR @39f2d12||---|---|---|
|
ug claude -- -p --output-format json| ❌ | ✅ ||
ug claude -- --print --output-format json| ❌ | ✅ ||
ug claude -- -p --output-format stream-json --verbose| ❌ | ✅ ||
ug claude -- -p(text) | ❌ | ✅ ||
ug claude -- --output-format json --model sonnet -p| ❌ | ✅ ||
ug claude -- -p … \| python3 -m json.tool| ❌ | ✅ ||
ug codex exec --json| ❌ | ✅ ||
ug codex e --json| ❌ | ✅ ||
ug codex -c … exec --json| ❌ | ✅ ||
ug codex exec(text) | ❌ | ✅ ||
ug codex exec --output-schema …(stdout) | ❌ | ✅ ||
ug codex exec --output-schema … -o file(file) | ✅ | ✅ |Scope
No managed-settings, sudo, or Isaac changes (e.g. Isaac exit-code propagation, Isaac replacing
apiKeyHelper).This pull request and its description were written by Isaac.