Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

macOS: first-prompt socket fails silently on long paths; Gemini UA override dropped by old harness generations

Aperta
#511 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #512 di @zhulinchng — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, typescript
Ambito
backend, cli, testing

Direzione di ricerca

Esegui i due test Claude nominati e ispeziona src/ucode/smart_routing/claude_pty.py in corrispondenza di serve_first_prompt_socket, quindi segui come vengono esposti gli errori di avvio. Esegui tests/test_e2e_user_agent.py::TestGeminiUserAgent e confronta l’unione degli header installata con packages/core/src/core/contentGenerator.ts e customHeaderUtils.ts. L’attività è completata quando il fallimento del socket è diagnosticabile e il comportamento di compatibilità per le vecchie generazioni di Gemini è stabilito senza compromettere gli header di routing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Two harness-interop bugs, both reproducible on macOS via the existing suite:

  1. 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.
  2. The Gemini User-Agent override via GEMINI_CLI_CUSTOM_HEADERS is 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)
Lingua principale
Python
Stelle
111
Fork
92
Merge medio
1g 11h
PR unite (30g)
239

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di databricks/unity-gateway

Tutte le issue di databricks/unity-gateway

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.