Repository navigation
Keep typing in the clicked Agent area after an edge drag - #414
Merged
Merged
Conversation
A tab focus the operator replaced before Herdr answered it is now remembered as superseded. A session from before both requests can confirm the newer one, and Herdr's answer to the older one then names a tab Hide has left; following it as an outside move put the keyboard in the other Agent area in the middle of typed input.
The renderer input observer installed before the page left the status page, so it never recorded anything; the cause it was added to find is now fixed and covered by a core test, so it goes.
A refused superseded request is dropped, but one whose answer was lost may still have been applied by Herdr, so it keeps its claim until it expires. The late-answer record is written only where the answer would have been followed, and the cap, expiry and refusal are tested.
yansfil
added a commit
that referenced
this pull request
Oct 5, 2026
Related: follows #420 (merged); R1 of the control-order split. Issues whose cause this removes are listed under Review. ## Summary Hide sent each local Herdr tab control (focus, create, move, rename) and each pane focus from a thread of its own, so controls sent moments apart reached Herdr in either order and the screen followed the wrong one. They now travel one ordered lane in the core (`runtime/control_lane.rs`): one socket operation at a time, the rest in arrival order, at most 16 waiting. Each request is queued, in flight, superseded or settled: a queued focus is replaced without leaving a late answer, a replaced in-flight one is Hide's own late answer, and a lost answer holds back what could be overwritten by it. This includes the #414 follow-up: tab focus is serialized like pane focus. Before the change, three rapid tab clicks sent Herdr `t2, t3, t1`; they now send `t2, t1`, the second only after the first was answered. ## Review - **판단해 주세요**: a lost tab or pane focus answer drops both the queued tab focus and the queued pane focus (`tab.focus.unknown`, `pane.focus_unknown`); the next click starts a new request. - **조심해서 볼 파일**: - `herdr-core/src/runtime/control_lane.rs` - ownership of the lane; every exit path of a job (spawn failure, skipped start, lost answer) has to release what the start marked as sent. - `herdr-core/src/live.rs` (`spawn_control_lane`) - the one worker per busy lane; it carries the next job under the runtime lock and does the socket work outside it. - `herdr-core/src/runtime/session.rs` - a local tab move carries no deadline while it waits; `start_job` arms the 5 s wait when it leaves and does not send a move that is stale or no longer transmitting. - `docs/ARCHITECTURE.md` - the pending rules (queued, in flight, superseded, settled) are rewritten with the code. - **비용 검토**: no work is added per input on the lock; the lane is capped at 16 and a request past it is refused where it was asked (`control.lane_full`); one worker thread runs only while the lane is busy and ends when it drains. - **H2: the 12 "chord right after a pane click" sites (5 `close_tab` files)** are a test-ordering assumption, not a product race, judged from the code and not run on CI. `closeFocused` and `newTabFocused` read the page-local keyboard owner, which a click sets synchronously, and `close_pane` names the pane by id, so a chord after a click does not wait on a core round trip to choose its target. The real product race behind `new-tab:72` and its relatives was the created tab's placement against Herdr's events and a later click, which the lane and #420 close. The `toPass` retry in `close-subtree.spec.ts:133` hides the ordering rather than needing it; PR 2 handles those specs. - **Worker panic**: a panic inside a socket call settles the job as an unknown result (`control.worker_panicked`), so the lane cannot stay busy behind a dead worker. - **CI failures that are not the lane**: `s6.spec.ts:157` read the node-side `last` map synchronously after a key press; the page's `views:true` send was logged in the same millisecond, so the spec now polls (fixed here). `s2.spec.ts:55` (macOS: pane count 2 vs 3; Windows: `data-zoomed` stayed `true`) is the existing flaky #424: both runs show the core's update arriving 4.3 to 4.7 s after the control was sent (`close_pane` 31.947 to 36.27; `toggle_zoom` 53.387 to 58.08), past the 5 s expect. Core tests show close, zoom and resize start while the lane is busy and are not queued behind it (`a_pane_close_starts_while_an_unanswered_tab_focus_holds_the_lane`, `a_zoom_and_resize_in_other_tabs_start_while_an_unanswered_pane_focus_holds_the_lane`). The delay itself is handled in its own PR (`fix/focus-readback-blocks-ingest`). - **Closing the quarantine issues**: this PR changes the ordering the targets depend on but removes no `@flaky` tag. `new-tab:72`, `agent-tab-groups:159/:247` and `keys:116` (quarantined by `ci/quarantine-batch-2`) can be closed once the Linux and Windows `verify` runs of the PR that removes their tags pass on two consecutive main runs. `agent-close-contract:13` (#231), `agent-tab-groups:216` (#287) and `sidebar-menus:80` (#308) are split and un-tagged in the follow-up PR with the same condition. ## Evidence - **확인한 것**: - 19 deterministic core tests in `herdr-core/src/runtime/tests/control_order.rs`, where the test decides Herdr's answer order through `FakeHerdr`: late answer, superseded (replaced before sent and after), refused and unknown result for tab focus, create and pane focus, plus the cap, join order and stale move. - With the lane reverted, the rapid-focus test fails (`["t2","t3","t1"]` against `["t2","t1"]`). - `scripts/verify-cargo.sh test-scoped -p herdr-core`: 1412 passed; `fmt-check` and `clippy -D warnings` clean. - Web e2e on macOS against the pinned Herdr 0.9.1, 2 repeats each: `pane-focus-ordering`, `new-tab`, `agent-close-contract`, `agent-tab-groups`, `sidebar-menus` - 20 passed. - The shared gate (`web/e2e/herdr-gate.ts`) holds any Herdr method; `pane-focus-ordering.spec.ts` uses it as the one representative journey, and ordering rules moved to the core tests. - **확인하지 못한 것**: - Linux and Windows runs; no CI result for this head yet. - `desktop/e2e/keys.spec.ts:116` was not run locally. - The H2 classification is from reading the code, not from a failing run. - Known gaps left as follow-ups: a lost focus answer leaves `last_view_intent_serial` at a dropped focus (a created tab can be held back with a stale `tab.create.focus_superseded` note), and `ingest_pane_focus_completion` ignores a `Full` refusal when it re-queues a turn.
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.
Fixes #413
Refs #303, #400
Summary
Agent 탭을 새 영역으로 드롭한 직후 첫 영역을 클릭해 입력하면, 입력한 줄의 일부가 다른 영역의 pane으로 갔습니다.
CI에서
desktop-group-live가desktop-grouve로 실행된 실패(agent-tab-groups.spec.ts:40)가 이 결함입니다.원인은 core에 있었습니다. 드롭이 보낸
tab.focus t2에 대한 Herdr의 답이 클릭(tab.focus t1) 뒤에 도착했는데, core가 이를 외부 focus로 보고 따라갔습니다(tab.focus.followed). 그 결과 snapshot의 keyboard pane이 바뀌었고,PaneView가 입력 도중 DOM focus를 옮겼습니다.이제 core는 더 새 요청으로 대체됐지만 Herdr가 아직 답하지 않은 탭 focus 요청을 기억합니다(
superseded_tab_focus, 최대 16개, 3초). Herdr가 그런 탭으로 이동했다고 알리면 그 요청의 늦은 답으로 소비하고, 따라가지 않습니다.Review
tab.focus.late_answer로 기록됩니다.desktop/e2e/terminal-input-observation.ts(Observe terminal input and announce Windows fixture readiness #372)를 지웠습니다. 이 관측기는 페이지가 shell로 이동하기 전에 설치돼서 아무것도 기록하지 못했고(renderer-unavailable), 쓰는 곳은 이 테스트뿐이었습니다.herdr-core/src/runtime/session.rsreconcile_visible_tabs- Herdr/core ownership. 외부 focus를 따라갈지 정하는 분기를 하나 추가했습니다.FocusTab실패 처리 - failure path. 확정된 거절이면 기록을 지우고, 결과를 알 수 없으면(ambiguous) Herdr가 적용했을 수 있으니 만료까지 유지합니다.Evidence
view_authority_a_late_answer_to_a_superseded_switch_is_not_followed는 수정 전 CI와 같은 방식(t2로 이동)으로 실패하고, 수정 후 통과합니다.herdr-core전체 1370개 통과,verify-cargo.sh lint통과, desktop typecheck/lint 통과.추가 증거
tab.focus t2(드롭) 02.084,tab.focus t1(클릭) 02.158. coretab.focus.followedt1→t2 02.195, t2→t1 02.298.repository_clone1건이 전체 suite 부하에서 한 번 실패했습니다. fixture의git commit단계였고, 단독 실행과 재실행에서는 통과했습니다. 이 변경과는 무관합니다.