Repository navigation
fix: wake and ring a resting Codex CLI cleanly - #1823
Merged
Merged
Conversation
Sleep pressed the quit key a second time 150 ms after the first. Codex CLI 0.165.0 quits on the first press when its composer is empty, so the second press reached the shell still kitty-encoded (ESC[99;5u) and left `9;5u` in front of the resume line the wake typed later (with-hide/hide-private#37). Sleep now presses the quit key again only while the agent asks for it: its own "again" hint appears, or the press emptied a draft. It stops as soon as the shell holds the terminal, at most three presses. A wake or reopen in the pane its agent ended in abandons the shell's line with a raw interrupt before typing, which clears it in zsh, bash and fish whatever the line editing mode. Herdr keeps an ended agent's keyboard and screen modes for the shell that takes the pane back; with-hide/hide-private#320 carries that upstream.
A Codex CLI turn its provider refused with 429 Too Many Requests waits minutes before its retry, so the cell timed out and read as a product failure (with-hide/hide-private#38). A failed Codex CLI cell now reads the CLI's own log database in its CODEX_HOME for a 429 retry logged since the step began, and settles that cell and the agent's open cells not measured with the provider's reason.
A bell whose reservation the delivery store refused or did not answer in time typed nothing, but the doorbell treated it like a prompt that may have been typed and waited for the pane to move. A resting agent's pane has no reason to move, so the letter stayed pending until its deadline; the v1.0.3 local journey met it with a resting Codex CLI (with-hide/hide-private#307). A failure before agent.prompt now retries on the doorbell's backoff timer, each try spending one of the letter's three bells, and only a failed prompt waits for the pane to move. doorbell.failed says which it was, and doorbell.reservation_failed keeps the store's own code, which the old record dropped. The failure type the mission answers already used is now shared by both.
The wake sent a raw Ctrl+C as soon as the shell wait passed, before Herdr's own busy check, so a prompt hook or another program that took the terminal in between, or a Windows child Herdr does not name, could receive it. The interrupt now goes only when a read made right before it shows the shell alone in the foreground and its terminal out of line mode, which a Unix shell's line editor sets only while it reads at its prompt. A Windows console, a terminal in line mode, another foreground program or a read that failed keep the line, log agent_start.line_kept and start as before. Only a wake asks for it, since the sleep record keeps Hide's input gate closed; a Reopen keeps the line. The first-press quit test now ends its stand-in only after the sleep has read it quitting, instead of after a fixed 600 ms.
The journey turned every failed Codex CLI cell into not measured when any 429 had been logged since the second the step began: a session mismatch, a transport failure or a 429 already retried past read as a provider limit, and a 429 from earlier in the same second counted. Verdicts now carry their kind, and only a turn the agent never answered after its prompt asks the provider's log. The log is read from a row-id cursor taken as the step begins, for the agent's own conversation only, and only when that conversation's newest retry since is a 429.
… key against real Herdr The sleep's second Ctrl+C was the cause of the stray 9;5u (with-hide/hide-private#37), and it is no longer sent. The wake's raw interrupt could still reach a program that took the foreground after its read, so it goes. A real-Herdr test sleeps and wakes a stand-in Codex CLI that turns the kitty keyboard protocol on and quits on its first Ctrl+C; on the old sleep its resume line ran as 9;5ucodex in zsh and bash.
A start whose Herdr session report failed beside an unanswered turn read the turn's failure first, and a 429 then made the whole start not measured.
…after a delay The stand-in now hands its terminal back only when the test opens its FIFO: after a screen read shows it quitting, or after a second press is answered, so the old sleep fails every run instead of racing a 600 ms sleep. The first start waits for the shell as every product start does: fish 4 runs its completion generator in its own foreground group after the first prompt, and the fixture now also makes fish 4's marker folder. The Windows cell says why the test runs on Unix shells only.
It read its input in one call, so two presses queued together were both consumed and the old sleep's second key never reached the shell. It now reads a byte at a time and stops at the first whole Ctrl+C.
The Windows sleep step ran only the node-end test, so the press decision the pull request and docs/INSTALL.md cite had no Windows run.
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.
Closes with-hide/hide-private#37
Closes with-hide/hide-private#38
Closes with-hide/hide-private#307
Summary
A resting Codex CLI was hard to wake and to write to.
9;5ubefore the resume line. Sleep pressed Ctrl+C twice. Codex CLI quits on the first, so the second reached the shell. Sleep now presses again only when the agent asks for it.not measured. A check that failed on its own beside that turn stays a failure.스크린샷 없음: 화면을 바꾸지 않는 변경입니다 (셸 입력, 편지 재시도, journey 판정).
Review
agent_sleep.exit_keys_unanswered, and no measured run reached it;docs/INSTALL.md).openai-oss-forks/crosstermated1cdab3) answersPushKeyboardEnhancementFlagswith an unsupported error on a Windows console.ESC[99;5u. The press decision is the same code, with unit tests in the Windows lane.agent_pane_busy, a fixture fault:~/.cache/fish/generated_completionsexists; fish 3 checked~/.local/share/fish.agent.startwithout the shell wait every product start has, and Herdr refused. It now starts throughstart_within, and the fixture makes both folders.SHELL_WAIT). The generator runs only on a user's first fish start; how long it takes over a full set of man pages is not measured.herdr-core/src/agent_sleep_herdr.rs- failure path: quit presses follow the screen and the foreground group.herdr-core/src/delivery/doorbell.rs- failure path: only a failure beforeagent.promptretries on the timer.scripts/agent_journey/cells.py,journey.py- only aNO_ANSWERverdict asks the provider log, and a start prefers any other failure.herdr-core/src/agent_start/real_herdr_tests.rs- the stand-in's release (Release,Watched).Evidence
9;5ucodex resume slept-session; also 10 of 10 when both presses are queued before the stand-in reads (a local-only hold).not measuredbefore the fix).codexrow alone (codex-cli 0.163.0): 12 of 12 cells; sleep ended Codex CLI by its own key (noexit_keys_unanswered).Verification record
pr.ymlchanged);windows checkstep "Agent sleep ends the agent's process tree" 4 of 4, the three quit press tests included.rust workspace5560 of 5560, real-Herdr shell step 10 of 10 (sleep and wake on zsh, bash and fish).web e2e windows, in setup before any test (spawnSync powershell.exe ETIMEDOUT); attempt 2 green, 21 pass, 10 skipping;rust workspace5560 of 5560, real-Herdr shell step 10 of 10 (sleep and wake on zsh, bash and fish).rust workspace5560 of 5560 tests, real-Herdr shell step 10 of 10.nextest -p herdr-core -p hide-agent-adapter: not run since 923c430 (3461 of 3461); the build at 698b118 hit a full disk, and CI covers it.test_agent_journey_provider_limitandtest_agent_journey_cells36 OK;test_agent_live_protection53 OK alone (it timed out in a full run while the disk filled).fmt-check,clippy -p herdr-core --all-targets -D warningsat 391c939: clean.codexrow, at 698b118: 12 of 12 pass.