Skip to content

Fix Windows: agent launch corruption and POSIX apiKeyHelper (#173, #116)#177

Merged
rohita5l merged 3 commits into
mainfrom
fix/windows-claude-codex-launch-and-auth
Jun 26, 2026
Merged

Fix Windows: agent launch corruption and POSIX apiKeyHelper (#173, #116)#177
rohita5l merged 3 commits into
mainfrom
fix/windows-claude-codex-launch-and-auth

Conversation

@rohita5l

Copy link
Copy Markdown
Collaborator

Two Windows-only bugs broke ucode claude/ucode codex:

#173 — garbled, split-screen terminal input. Both agents launched via os.execvp, but Windows has no real exec: the CRT spawns a new process and kills the parent, so the launching shell resumes and fights the agent for the console. New launcher.exec_or_spawn() keeps execvp on POSIX and spawns+waits (propagating exit code / SIGINT) on Windows, matching the pattern the token-refreshing agents already use.

#116 — apiKeyHelper failed with a POSIX shell error. build_auth_shell_command emitted if [ -n ... ]; ... | jq and Codex ran it via sh -c; neither sh nor jq exists on Windows. Replaced with a hidden ucode auth-token command that prints the bearer via get_databricks_token (which already owns the DATABRICKS_BEARER short-circuit and PAT path). Claude's apiKeyHelper and Codex's auth block now invoke that executable directly as argv — no shell, no jq, identical on every platform.

Also hardens the --use-pat path: ensure_pat_bearer() treats an empty DATABRICKS_BEARER as absent (setdefault would let it shadow the PAT and force OAuth, which can't serve a PAT-only profile), and auth-token --use-pat fails closed with an actionable error instead of silently trying OAuth.

Two Windows-only bugs broke `ucode claude`/`ucode codex`:

#173 — garbled, split-screen terminal input. Both agents launched via
os.execvp, but Windows has no real exec: the CRT spawns a new process and
kills the parent, so the launching shell resumes and fights the agent for
the console. New launcher.exec_or_spawn() keeps execvp on POSIX and
spawns+waits (propagating exit code / SIGINT) on Windows, matching the
pattern the token-refreshing agents already use.

#116 — apiKeyHelper failed with a POSIX shell error. build_auth_shell_command
emitted `if [ -n ... ]; ... | jq` and Codex ran it via `sh -c`; neither sh
nor jq exists on Windows. Replaced with a hidden `ucode auth-token` command
that prints the bearer via get_databricks_token (which already owns the
DATABRICKS_BEARER short-circuit and PAT path). Claude's apiKeyHelper and
Codex's auth block now invoke that executable directly as argv — no shell,
no jq, identical on every platform.

Also hardens the --use-pat path: ensure_pat_bearer() treats an empty
DATABRICKS_BEARER as absent (setdefault would let it shadow the PAT and
force OAuth, which can't serve a PAT-only profile), and `auth-token --use-pat`
fails closed with an actionable error instead of silently trying OAuth.

Co-authored-by: Isaac
@rohita5l rohita5l requested a review from AarushiShah-db June 26, 2026 15:31
rohita5l and others added 2 commits June 26, 2026 08:34
The MLflow tracing e2e races async trace ingestion against the poll
timeout and fails intermittently in CI. Skip it pending a more robust
verification path.

Co-authored-by: Isaac
@rohita5l rohita5l merged commit 1051b1a into main Jun 26, 2026
2 checks passed
@rohita5l rohita5l deleted the fix/windows-claude-codex-launch-and-auth branch June 26, 2026 20:09
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.

2 participants