Repository navigation
Conversation
xsh310
force-pushed
the
first-prompt-switch-in-pane
branch
2 times, most recently
from
November 24, 2026 17:04
027e324 to
6a62e3c
Compare
2 tasks
…uted without the socket Claude Code reads 64 or more bytes that arrive together as a paste. ug cleared a held first prompt and typed /model in one write, so a long prompt's clear was ignored, the switch timed out, and the replay ran next to the held prompt: twice, plus the /model text, on the default model. ug now types the clear and the model command in 16 byte writes 20 ms apart, forwarding Claude's output in between. When the prompt routing socket can't start, ug now launches Claude without Smart Routing and warns, through the existing routing setup fallback, instead of exiting. Co-authored-by: Isaac <no-reply@databricks.com>
xsh310
force-pushed
the
first-prompt-switch-in-pane
branch
from
November 25, 2026 18:19
6a62e3c to
5a8fb8f
Compare
xsh310
changed the base branch from
automation-first-prompt-orch-preset
to
omni-pinned-model-first-prompt-routing
November 25, 2026 18:22
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.
What and why
Two fixes for Claude's first prompt routing when another program types into Claude's terminal. Both showed up when the first prompt of a run was long, and when a launch can't route.
/model <pick>and Enter, all in one write. Claude Code reads 64 or more bytes that arrive together as a paste, so it ignored the Ctrl-U presses and the Enter and kept/model <pick>as text. The switch then timed out, and ug pasted the prompt next to the held one. Claude ran the prompt twice, followed by the/modeltext, on the default model. A 3,900 character prompt in a 160 column terminal needs 103 presses.ug claudestopped without starting Claude. It now starts Claude without Smart Routing and says so.First user: Omnigent automation runs ("first prompt in an Omnigent pane", item 7 of the Automations design). The runner launches Claude without
--modelso ug routes the run's first prompt, then pastes that prompt, which is often thousands of characters. An unattended run that exits never runs.Stacked on #1887, on top of #1848, which adds the preset these runs use (stack: #1848, #1887, #1860).
Contract
Keys ug types into Claude's input box:
Setup failure:
The fallback launch is the existing one for routing files ug can't write, which now prints the same warning.
What happens now, in order
[Pasted text #1 +N lines]./model <pick>and Enter the same way. The switch timeout starts after the command is typed.PASTE_SUBMIT_DELAY_Safter the paste, not after the start of the step.ug claudecatchesClaudeRoutingSetupError, prints the warning and starts Claude normally with routing off.Tests
tests/test_claude_pty_replay.py: a new fake TUI reads a burst of 64 or more bytes as a paste, like Claude Code 2.1.325. With a 2,407 character held prompt, Claude must receive exactly/model sonnetand then the prompt. Onmainit receives the mangled prompt instead.tests/test_claude_smart_routing_v2.py: the socket failure raisesClaudeRoutingSetupError, and a setup failure starts Claude once, with both routing flags0and the warning.test_catalog_browsing.py,test_desktop_mdm.pyandtest_integration_contract.pyfail the same way without this change, and the 8 collection errors come from my local venv missing OpenTelemetry.ruff check src/ tests/andruff format --check src/ tests/pass.ty check src/reports only the 8 OpenTelemetry import errors of my local venv, the same as onmain.ug claudewithfirst_prompt_and_subagent_orch_v0_claude_onlyin a tmux pane, and a 3,900 character first prompt delivered by Omnigent's own runner code (bridge.inject_user_message)./modeltext on the default model./modelswitched the model, the prompt ran once, and it carried the orchestrator workflow./integration-test).Checklist before requesting review
/ug-reviewand address the comments./integration-testand address any failures.This pull request and its description were written by Isaac.