macOS: first-prompt socket fails silently on long paths; Gemini UA override dropped by old harness generations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python, typescript
Research direction
Run the two named Claude tests and inspect src/ucode/smart_routing/claude_pty.py at serve_first_prompt_socket, then trace how launch errors are surfaced. Run tests/test_e2e_user_agent.py::TestGeminiUserAgent and compare the installed header merge with packages/core/src/core/contentGenerator.ts and customHeaderUtils.ts. Done means the socket failure is diagnosable and the compatibility behavior for old Gemini generations is established without breaking routing headers.
Written by the indexing model from the issue text.
Description
Summary
Two harness-interop bugs, both reproducible on macOS via the existing suite:
- Claude smart-routing v2's first-prompt socket fails silently when the AF_UNIX path exceeds the kernel limit — the serving thread dies on a log-only branch; callers see only a missing socket file / bare
RuntimeError. - The Gemini
User-Agentoverride viaGEMINI_CLI_CUSTOM_HEADERSis silently dropped by harness generations with the old header merge order.render_env_overlay's comment claims the override works unconditionally.
Bug 1 — socket bind failure is silent
Repro (clean main, macOS, pytest tmp_path under /private/var/folders):
uv run pytest "tests/test_claude_smart_routing_v2.py::TestFirstPromptHook::test_blocks_once_then_allows_replay" \
"tests/test_claude_smart_routing_v2.py::TestPtyFlow::test_direct_switch_restore_and_replay" -q
# 2 failed
Root cause (src/ucode/smart_routing/claude_pty.py::serve_first_prompt_socket): server.bind() raises OSError: AF_UNIX path too long for the 123-char test socket path (macOS limit ~104), the except OSError branch only log(...)s (no-op by default), the thread exits, no socket file ever appears. Verified directly:
socket.socket(socket.AF_UNIX, socket.SOCK_STREAM).bind(<123-char path>)
# OSError: AF_UNIX path too long
Production sockets live under short ~/.ucode, but any long $HOME hits the same silent death, and the launch error (Smart routing could not start its local prompt-routing socket; Claude was not launched.) names no reason.
flowchart TD
A[serve_first_prompt_socket] --> B{bind AF_UNIX path}
B -->|path over kernel limit| C[OSError: AF_UNIX path too long]
C --> D[caught, log-only, thread exits]
D --> E[socket file never appears]
E --> F[hook request returns None / launch raises bare RuntimeError]
Bug 2 — Gemini UA override dropped by old harness generations
Repro (clean main, installed gemini 0.20.0-nightly.20251201):
uv run pytest tests/test_e2e_user_agent.py::TestGeminiUserAgent -q
# AssertionError: User-Agent mismatch.
# got: 'GeminiCLI/v26.8.1 (darwin; arm64)'
# expected: 'ucode/0.1.0+84.gfddf95b gemini/0.20.0-nightly.20251201.2fe609cb6'
Root cause: the installed @google/gemini-cli-core build merges headers as {...customHeadersMap, 'User-Agent': userAgent} (dist/src/core/contentGenerator.js), so a custom User-Agent from GEMINI_CLI_CUSTOM_HEADERS is overwritten by the default. Current upstream main has the fixed order ('User-Agent' first, custom spread after — see packages/core/src/core/contentGenerator.ts and customHeaderUtils.ts, feature from google-gemini/gemini-cli#10088). ucode cannot change harness behavior; the Databricks-Model-Provider-Service routing header is unaffected (distinct key, survives the spread), and gateway spend attribution in usage.py still matches on the gemini substring.
flowchart LR
subgraph old ["installed generation"]
H1[GEMINI_CLI_CUSTOM_HEADERS] --> M1["{...custom, UA: default}"] --> W1["wire: GeminiCLI/..."]
end
subgraph new ["upstream main"]
H2[GEMINI_CLI_CUSTOM_HEADERS] --> M2["{UA: default, ...custom}"] --> W2["wire: ucode/..."]
end
Environment
- macOS arm64 (Apple M4), Python 3.13, repo at
fddf95b - Full-suite baseline: 2262 passed, 7 skipped, 3 failed (the above)
- Dominant language
- Python
- Stars
- 106
- Forks
- 84
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 218
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from databricks/unity-gateway
-
feat(codex): support amazon_bedrock Model Provider Services that expose OpenAI-compatible modelsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
databricks/unity-gateway#454 ·
Maintainers usually reply within 1 day
-
ucode opencode ignores the user's own OpenCode configPossibly taken @larsmoan claimed this 40 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
databricks/unity-gateway#391 ·
Maintainers usually reply within 1 day
-
Support Custom $CLAUDE_CONFIG_DIRPossibly taken @eabrouwer3 claimed this 51 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
databricks/unity-gateway#342 ·
Maintainers usually reply within 1 day
-
pi: gpt-5/mini/nano/5-5-pro always 400 — reasoning.effort "none" sent because thinkingLevelMap is unsetPossibly taken @dgokeeffe claimed this 78 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
databricks/unity-gateway#286 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
databricks/unity-gateway#141 ·
Maintainers usually reply within 1 day
All issues in databricks/unity-gateway
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#133181 ·
Maintainers usually reply within 1 day
-
[oblt-aw][security] SEC-022 — findings (2026-10-05)Possibly taken @elastic-vault-github-plugin-prod claimed this today. Openoblt-aw/ai/fix-ready oblt-aw/detector/security oblt-aw/triage/security-secrets
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
elastic/oblt-aw#2304 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 90/100
huggingface/huggingface_hub#5083 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
deepset-ai/haystack#13107 ·
Maintainers usually reply within 1 day
-
[Bug]: index worker dies on LOG_LEVEL=info / empty / numeric before it can report a missing bootstrapPossibly taken @sxh313 claimed this today. Opentriage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
agentscope-ai/agentscope#3130 ·
Maintainers usually reply within 1 day