Repository navigation
fix: take a started agent's input only once it reads keys - #2114
Merged
Merged
Conversation
A Windows pane holder could not tell when a started program turned line input off, so a start was typed into on the settle alone. The holder now starts itself in a helper mode attached to the pane's console for the start wait only, and reports what the helper reads; the holder itself never attaches, so the console's close cannot end it.
OpenCode 2.0.29 reads keys and draws its composer before its model loads, and refuses the Enter of a line typed before then. A definition can now name the idle screen rule that shows its program ready ([start] ready), and the engine types a start's first input only once the screen has matched it. OpenCode names the model line under its composer. A start that settles while the holder cannot say whether its program reads keys is now logged once.
The holder no longer compiled on Windows (an import only Unix used). A Windows pane now starts its console helper on the first recheck of a program, so a short command starts none, asks it only on rechecks, and reads a program still editing lines past the start deadline as not known instead of freezing it as editing. The helper ignores Ctrl+Break as well as Ctrl+C from before it attaches. A ready screen read before the screen drew anything else, such as a woken agent's last screen, counts only while it lasts.
…gram once A program still editing lines past the start deadline was read not known only on a recheck, so a facts read could keep it frozen as editing; the bound now holds on every read, without a log line, since every long command edits lines that long. A program that keeps writing is never rechecked, so its first facts read past the recheck interval asks the console, and a start whose screen moved past its settle and then stopped in the line is read editing it, not unknown.
The start's settle was latched on the facts before the current ones, which for a program that just showed said nothing of its terminal. An agent with no screen rules (omp) that showed past its settle therefore settled at once, its terminal still editing lines read as not known, and a brief could be typed into its line.
# Conflicts: # docs/INSTALL.md
…helper is attached
# Conflicts: # docs/INSTALL.md
This was referenced Nov 6, 2026
HyunjunJeon
pushed a commit
to HyunjunJeon/hide
that referenced
this pull request
Nov 9, 2026
…hide#2144) Closes with-hide/hide-private#600 ## Summary 쉬고 있는 Codex에 Hide가 편지 알림을 막 친 순간, 입력창 버전 확인이 그 화면을 읽고 "입력창에 글이 있다"고 판단해 1분을 기다렸습니다. 확인이 고르는 "입력창이 비어 있는 순간"(지난 턴이 끝나고 아무 키도 없던 때)이 Hide 자신이 친 글을 모르고 있었기 때문입니다. 이제 pane은 Hide가 마지막으로 친 시각을 기억하고, 그 뒤의 hook이 연 턴이 끝나기 전에는 그 순간을 비어 있는 순간으로 고르지 않습니다. 지연이나 문자열 비교를 더하지 않고, Hide의 입력을 pane의 사실로 둡니다. ## Review - **판단해 주세요**: 에이전트가 받지 않은 입력이 있으면 그 pane의 버전 확인은 다음 hook까지 미뤄집니다. 확인이 늦어질 뿐 잘못된 miss는 생기지 않습니다. - **조심해서 볼 파일**: `herdr-core/src/runtime/delivery.rs` - `composer_check_due`의 조건 하나와 `note_hide_typing`, runtime mutex 안에서 시각만 적습니다. - **조심해서 볼 파일**: `herdr-core/src/delivery/doorbell.rs` - 편지 알림, 미션 답, brief 재입력/Enter가 치기 직전에 같은 lock 안에서 기록합니다. `runtime/strays.rs`의 마무리 맡기기도 같습니다. - **조심해서 볼 파일**: `a_new_version_is_checked_once_at_a_known_empty_moment`는 같은 pass에서 알림을 친 뒤 바뀌지 않는 가짜 화면을 확인해 통과하고 있었습니다(이 버그의 순서). 그 순간에 편지를 치지 않도록 고쳤습니다. ## Evidence - **확인한 것**: 새 테스트 `a_bell_hide_typed_is_never_read_as_a_known_empty_composer`는 Codex 0.163.0 캡처(`codex-0-empty`, `codex-1-typed`)로 입력창을 그립니다. 고치기 전 코드에서는 CI 로그와 같은 `input.rung typed` 뒤 `composer.version_checked not_empty not_placeholder retry_after_ms=60000`으로 실패하고, 고친 뒤 통과합니다. - **확인한 것**: `herdr-core` delivery/composer 단위 테스트 210개 통과, `clippy -p herdr-core --all-targets -D warnings`, `fmt-check` 통과. - **확인한 것**: fake-model journey `--agents codex`를 macOS에서 격리 후보로 5번 연속 실행: 5번 모두 Codex 15칸 전부 통과, `letter_menu`의 버전 확인은 매번 `empty`·`misses 0`, 편지는 알림 한 번에 전달. - **확인하지 못한 것**: Linux, Windows의 fake journey는 이 PR의 CI 레인에 맡깁니다(변경은 플랫폼 공통 core 코드). 워크스페이스 전체 테스트도 CI에 맡겼습니다. - **확인하지 못한 것**: with-hide#2114 브랜치에서 더 자주 났던 이유는 스케줄 차이로 보고 더 쫓지 않았습니다. <details><summary>Verification record</summary> - base: main `b78948d0a`, head: `542101140` - 재현 근거: run 42076466613 fake macOS `hided.log` 488-492줄, pane `h6:p2`. </details>
HyunjunJeon
pushed a commit
to HyunjunJeon/hide
that referenced
this pull request
Nov 9, 2026
…one that never lands (with-hide#2159) Closes with-hide/hide-private#587 Related: with-hide#2114, with-hide#2144 ## Summary 막 시작한 에이전트에 Hide가 친 브리프가 입력창에 닿지 않으면, 누가 그 화면에 답하기 전에는 다시 치지 않았고, 끝까지 안 닿아도 실패로 알리지 않았습니다. 이제 세 경우를 처리합니다. - 입력창이 비어 있고 그 뒤로 에이전트 상태가 전혀 움직이지 않았으면(시작 중에 글을 떨어뜨린 경우), 키를 읽는 프로그램에 다시 칩니다. - 입력창에 에이전트 자신의 붙여넣기 표시가 브리프와 같은 줄 수로 남아 있으면(예: OpenCode `[Pasted ~18 lines]`), 빠진 Enter만 누릅니다. - 세 번 다 받지 않으면 부모에게 실패와 이유를 알리고, 한 번 `input.undelivered` 로그를 남깁니다. 알림 첫 두 줄: ``` worker did not get its brief: Hide tried 3 times and the agent recorded none of them, so Hide does not type it again. Read its screen with `hide pane read <pane>`; `hide agent show` names what it waits on. Once its screen shows its input box, type it there yourself with `hide pane send <pane> <text> --enter`, or stop the agent and start the work again. ``` (한 번의 시도는 다시 치기이거나, 입력창에 남은 브리프에 누른 Enter입니다.) ## Review - **판단해 주세요**: "움직이지 않음"은 기존 상태만 봅니다(Herdr 상태와 core 턴의 마지막 변경 시각, 마지막 working 시작 시각을 `typed_at`과 비교). 그 사이 상태가 바뀌었는데 아무도 답하지 않았으면 예전처럼 기다립니다(`moved_unanswered`). - **판단해 주세요**: omp는 붙여넣기 표시(`📄 #1`)에 줄 수가 없어 표시를 선언하지 않았습니다. 붙여넣기를 글 그대로 보여 주는 에이전트(Codex CLI)는 필요 없습니다. - **조심해서 볼 파일**: `herdr-core/src/delivery/typed.rs` - `retype_due`/`unmoved_since_typing`. 받은 글을 두 번 넣지 않는 조건이 여기 있습니다(working을 읽었거나 상태가 움직이면 다시 치지 않음, 기록 출처가 없는 에이전트는 예전처럼 다시 치지 않음). - **조심해서 볼 파일**: `hide-agent-adapter/src/composer.rs` - `Composer::holds`가 붙여넣기 표시를 읽습니다. 입력창 영역에 그 표시 한 줄만 있고 줄 수가 맞을 때만 참입니다. - **조심해서 볼 파일**: `herdr-core/src/runtime/typed_input.rs` - runtime mutex 안에서 실패 판단과 로그 한 번(`plans.input_undelivered`, 열린 입력 수로 상한). I/O 없음. - 범위: `agents.rs`의 `Live::started`는 건드리지 않았습니다. 새 시계 없음. 작업 첫 프롬프트(`type_first_prompt`)와 편지 알림 벨은 그대로입니다(편지는 자기 마감 상태가 실패를 알립니다). ## Evidence - **확인한 것**: Windows fake journey 41951563729의 OpenCode spawn-48이 실제 사례입니다. 화면은 `[Pasted ~18 lines]`, 로그에 `input.retype_held composer_not_empty`가 두 번 찍혔습니다. 그 화면 캡처를 픽스처로 넣었고 새 판단은 Enter를 누릅니다. - **확인한 것**: doorbell 테스트 `a_brief_a_starting_agent_dropped_is_typed_again_and_one_it_holds_as_a_paste_gets_its_enter`(가짜 엔진, 실제 ledger store)에서 빈 입력창(Codex CLI)은 `prompt_agent` 1번으로 다시 치고, 붙여넣기 표시(Claude Code)는 `send_keys` Enter 1번만 누릅니다(타이핑 0번). 고치기 전 조건으로 되돌리면 `Err("moved_unanswered")`로 실패합니다. - **확인한 것**: 상태가 움직인 경우(답 없으면 안 침, 답하면 침)와 working을 읽은 경우(안 침)는 runtime 테스트로, 세 번 다 쓴 경우의 실패 알림 문구와 `input.undelivered` 1번은 `a_brief_whose_typings_are_spent_tells_its_parent_it_failed_and_logs_it_once`로 확인했습니다. 붙여넣기 표시는 다섯 에이전트 캡처로 맞는 줄 수만 참, 다른 줄 수는 거짓입니다. - **확인한 것**: macOS에서 `cargo test -p herdr-core -p hide-agent-adapter` 전부 통과(herdr-core 3932, adapter 8 + 41), `clippy -D warnings`, `fmt-check`, attribution과 workstation identity 검사 통과. - **확인하지 못한 것**: 격리 후보로 실제 시작 중 드롭을 재현하지 않았습니다. 확인은 CI journey 산출물과 단위/doorbell 테스트까지입니다. Linux와 Windows 레인은 이 PR의 CI에 맡깁니다(변경은 플랫폼 공통 core와 adapter 코드). - **확인하지 못한 것**: 끝 줄바꿈이 있는 붙여넣기를 어떻게 세는지 Claude Code 쪽에서 실측하지 않았습니다(캡처는 끝 줄바꿈 없는 12줄). 틀리면 표시가 맞지 않아 예전처럼 `composer_not_empty`로 기다릴 뿐 잘못 치지는 않습니다. - **확인하지 못한 것**: 로컬 `verify-cargo.sh test`가 워크스페이스 전체를 돌릴 때 hide-holder 테스트가 실패했습니다. test xterm이 설치되지 않은 환경 문제이고 이 PR은 그 crate를 건드리지 않습니다. <details><summary>Verification record</summary> - base: main `9fd114863`, head: `c427f0b52` - 재현 근거: run 41951563729 fake windows `hided.log` spawn-48 / pane `hD:p2`; run 42076471627 agy spawn-84는 외부 편집기가 글을 받은 경우라 범위 밖. </details>
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#545
Related: #2087 (이 PR이 대체합니다), 후속 with-hide/hide-private#579 (fork의 쉬는지 확인과
/fork사이 틈), with-hide/hide-private#587 (닿지 않은 입력 다시 보내기와 실패 보고)Summary
막 시작했거나 깨운 에이전트에 브리프나 재개 프롬프트를 치는 시점이 "시작하고 3초 뒤"에 기대고 있어서, Windows에서 글자가 사라지곤 했습니다.
이제 프로그램이 키를 읽기 시작했다는 신호를 받고서야 칩니다.
ENABLE_LINE_INPUT)를 읽습니다. 콘솔에는 홀더 자신이 아니라, 시작을 기다리는 동안만 사는 helper 프로세스가 붙습니다.[start] ready).agent.start_settled_unread로 한 번 남깁니다.Review
hide-holder --console-input <shell pid>)가 합니다.CTRL_CLOSE_EVENT) 핸들러가 뭐라 답하든 끝납니다. 홀더가 붙지 않으면 이 일은 구조상 홀더에 일어날 수 없습니다.line_editing을 읽어 보냅니다.agent.start_settled_unread를 남깁니다.┃ Build · <model>)을 바꾸면 매 시작이 120초 마감까지 기다립니다. 입력은 잃지 않습니다. journey와 canary의 OpenCode 칸이 이것을 잡습니다.based_on)에서args없는[start]는 이제 원본의 args를 물려받습니다. 전에는 빈 목록이었습니다.ready만 쓴[start]가 원본의 args를 지우지 않게 하려는 변경입니다.hide-holder/src/console_input.rs: helper 수명, 상한, 실패 경로. 아직 묻지 않은 프로그램은 "줄 편집 중"이고, helper를 못 얻었거나 120초를 넘겼을 때만 "모름"이 되어 3초 규칙으로 돌아갑니다.hide-platform/src/process/console_input.rs: Win32AttachConsole,CONIN$,unsafe블록.herdr-core/src/engine/own/agents.rs: 시작 규칙settled(),Live::ready. 프로그램이 다른 화면을 그리기 전에 보인 준비 화면(깨운 pane에 남은 지난 화면일 수 있음)은 그 화면이 이어지는 동안만 준비로 봅니다.hide-agent-adapter/agents/opencode.toml: 새model_line_idle규칙. 화면 규칙 버전도 올렸습니다.holder.console_input_unread를 남깁니다.Evidence
hide-holdermacOS 126/126. 새 테스트: 계속 출력하다 입력 줄에서 멈추는 프로그램이 출력하는 동안 이미 "줄 편집 중"으로 읽힘(세 시스템), "앞의 프로그램이 줄 편집을 끄면 watch가 알린다"는 테스트가 세 시스템에서 돌고 이제 프로그램을 처음 말하는 facts가 "줄 편집 중"인지도 봅니다. Windows에서는 helper가 콘솔에 붙고 홀더는 붙지 않는 것도 확인합니다.left: Unknown, right: Edits로 실패하고, 이 수정으로 44/44 통과합니다. 머지 판정은 이 head의 Windows CI입니다.hide-agent-adapter47/47. OpenCode 2.0.29 실제 화면 캡처 4장으로 모델 줄 규칙을 확인했습니다. 모델 로드 전 화면은 맞지 않고, 로드 뒤 화면 3장은 맞습니다.herdr-core엔진과 시작 관련 469/469. 첫 facts 판단을 빼면 새 omp 테스트가 실패합니다. 준비 대기를 빼면 새 테스트가 실패하는 것도 확인했습니다.HIDE_*없음, 가짜 모델): Claude Code 2.1.318을 pane 메뉴로 재우고 Wake agent로 깨우자 3.2초 뒤 준비로 표시됐고, 그때 친 재개 프롬프트가 온전히 들어가 같은 대화에서 답했습니다. OpenCode 2.0.29는 재우면 pane이 닫히고 잠든 세션 행이 남는데, 그 행에서 깨우자 8.5초 뒤(모델 줄을 기다림) 준비로 표시됐고 재개 프롬프트가 온전히 들어가 답했습니다. 위 캡처 둘. 후보 프로세스는 모두 pid로 끝냈습니다.vt (windows), headb93ca71f9): Windows watch 테스트 셋(helper가 붙고 홀더는 붙지 않음, 콘솔을 읽는 동안 끝나는 프로그램 5번, 출력하다 멈추는 프로그램)과 120초 경계 단위 테스트가 통과했습니다.b93ca71f9, 세 시스템): 시작·brief·신뢰 안 된 시작·재우고 깨우기·재개 칸이 Linux 99/99, macOS 99/99, Windows 96 통과·2 측정 안 함·1 실패였습니다. 실패 1개는 agy 시작으로, Windows에서 agy가 색 답을 키로 읽어 프롬프트 편집기를 여는 기존 문제(with-hide/hide-private#405)입니다.letter_menu2회(입력창 확인이 Hide가 방금 친 편지를 읽어 60초 대기, with-hide/hide-private#600), Windows Codexguidance_memory1회(프롬프트는 다 들어갔고 가짜 모델이 메모 카드 없이 "OK"로 답함).agents/runs아래가 아니라/tmp의 짧은 폴더에 두었습니다. worktree 경로가 길어 pane 소켓 경로가 macOS 한도(104바이트)를 넘기 때문입니다. 로그는 실행 폴더로 옮긴 뒤 지웠습니다.Verification record