Repository navigation
feat: record the branch a mission's results go to - #2451
Merged
Merged
Conversation
A mission keeps the branch its results go to, by default the branch its checkout is on when it is made, and its plan can name another. Its workers' worktrees start from that branch, each done direct change is read against it instead of the default branch, and a destination Hide cannot find lands nothing and holds the mission's own close. A mission that records none reads against the default branch as before.
…e mission's target
…created destination can be
…lan with pull requests
…nation as they are
…talog does not list yet
This was referenced Nov 11, 2026
HyunjunJeon
pushed a commit
to HyunjunJeon/hide
that referenced
this pull request
Nov 12, 2026
Related: with-hide#2451; paired design update: with-hide/hide-private#870. ## Summary A plan can now leave one node's merge to the operator while the rest of the mission continues. That node finishes when its PR is green and approved, then appears in Your turn with its merge action. PR-scope missions keep their existing quiet readiness behavior and closing report.  Look at Your turn: the merge appears only after the PR becomes ready.  Before readiness is on the left; the ready node's operator merge is on the right.  Merge turns name the latest still-open held PR and `+N` for the others; the report names all open PRs. Map-card strips, stations and headers belong to a separate change. ## Review - **Decide**: Check the existing turn card's merge wording and the quiet PR-scope captures in Light and Dark. - **Risky files**: `mission_health.rs`, `runtime/missions.rs`, `mission_landing.rs`: completion, landing and device count. - **Risky files**: `agent_state/tally/phone/missions.rs`, `snapshot.ts`: additive phone and desktop projection. - **Cost**: Bounded reads of existing nodes/PRs during mission publication; no new worker, timer, queue or I/O. - **Risky files**: `MissionTurn.tsx`, `MissionScreen.tsx`, `missionList.ts`, sidebar and phone: use the same open PR selection, including when the last held PR settled. - **Compatibility**: Storage and wire additions are optional. Old records keep scope behavior; old builds ignore/drop the override and cannot honor it. The retained old phone bundle lists and opens a real new-core frame. ## Tests - **Layer**: Runtime completion/landing and wire tests, shared desktop/phone rules, and two fake-GitHub browser flows. - **Catches**: Readiness mistaken for merge, early/noisy turns, a missing device count, or a scope-PR readiness turn. Also catches a report/turn naming a merged or closed last PR while an earlier held PR stays open. - **Repeat**: Final candidate: 248 filtered Rust and 149 focused web tests passed. Two isolated browser scenarios passed twice each (4/4), including the open-31/merged-37 regression. [CI checks](https://github.com/with-hide/hide/pull/2459/checks) will rerun on push. - **Waits**: Existing catalog, CLI and GitHub observation helpers; poll node completion and visible UI, with no sleeps. ## Evidence - **Verified**: Plan owner/reason, readiness turn/count, quiet PR scope, report and GitHub-driven settlement. - **Verified**: Real candidate daemon, private fixture state, real git/local bare origin, and fake GitHub; two flows passed twice each. - **Verified**: Formatting, lint, design contract, enum contract, generated-type reproduction and attribution checks. - **Not verified**: Final-head CI, native window, physical phone, production relay/GitHub and Windows/Linux runtime. - **Not verified**: Operator visual approval and independent review remain with the mission's designated reviewers. <details><summary>More evidence and compatibility</summary> The plan accepts `operator_merge` on a merge-scope change delivered by PR, with a trimmed one-line reason of 1-80 characters. Omitting the value keeps it; `null` clears it. The CLI and Conductor guide name the scope exception. This stays `landing: left/merge`, never a gate; only a GitHub merge settles it. A ready exception contributes one mission Needs You item, including the device count. Scope `pr` adds no readiness turn/count/badge/notification; its pre-existing `merge_wait` landing actions remain. Record schema stays 4, with optional `operator_merge` omitted from old records. Released-state fixtures keep their published state through the first evaluation. An older build accepts a new record by ignoring the unknown field and can drop it on save; its scope rules may merge this PR. Downgrading while relying on the override is therefore not a supported safety guarantee. The wire adds optional `node.merge` (`by`, optional `why`, `state`, `prs`) and PR `base`. New enum families are added without renaming or removing old values. The phone explicitly projects these fields; old phone code ignores them, and new phone code accepts their absence. `merge.prs` carries only held PRs GitHub last read open, in held order; older cores omit it and keep their previous display. Mission rest is an existing schema gap owned by `snapshot.ts` under `web/AGENTS.md`; declared-frame generation reproduces without changes. The retained pre-change `/p/5` bundle received an actual new-core mission frame containing `merge.state=due` and `merge.prs=[31]`, then listed and opened that mission without a page error. This browser smoke served the unchanged archived bytes through the isolated daemon with direct pairing; production relay and a physical phone were not exercised. Baseline cells touched, from the supplied inventory: | Cells | Preserved behavior and extension | | --- | --- | | B-1, B-2 | PR readiness and default merge completion remain; only an explicit merge-owner exception finishes ready. | | B-7, B-8 | Unsettled landing closes `merge_wait`; GitHub merge settles it and closes without a Hide action. | | B-13, B-15 | Existing landing proof and ordering remain; merge targets and report use only still-open held PRs. | | B-20, B-21, B-22 | Stale/missing reads do not complete work; required evidence and follow-up PR behavior remain tested. | | B-40, B-42 | Add only the explicit ready-node turn; retain existing closed/merge-wait actions and report. | | B-44, B-45 | Phone uses the shared optional merge projection; existing gate and folded-step tests remain green. | | B-46, B-47, B-48, B-55 | Optional storage addition retains schema/defaults, migrations, profiles and old records. | | B-50, B-51, B-54 | Extend existing snapshots with merge owner/state/reason and PR base; do not replace prior fields. | No pull-at-close or worktree-cleanup behavior changes here. </details> <details><summary>Verification record</summary> Base: `04c0b2d3bce6`; candidate: `6c438ca61e5cd8507f66bcc1ac16fcecc9369884`. The final candidate fixes multi-PR selection in reports and merge turns; it retains the per-node readiness and quiet scope-PR rules. - Filtered `hide-core` library tests: 248 passed (mission runtime/health/landing, record/phone, wire enums). - Six focused web/map/list/sidebar/phone unit files: 149 passed. - `mission-merge-owner.spec.ts`: 4 passed (two scenarios repeated twice), real isolated daemon plus local bare origin and fake GitHub. - `fmt-check`, filtered core clippy, web typecheck/lint/bundle, design contract, timed-wait policy, harness-ignore and attribution: passed. - Declared-frame generation with install overrides unset: clean reproduction. - 18 filtered CLI formatting/contract tests passed; archived p/5 phone smoke passed against the final daemon, including the new open-PR list (one scenario). - F1 regression was observed failing before the fix: the report omitted open with-hide#31 and named only with-hide#37. All-open, last-merged and last-closed cases now pass. - The previous CI run failed on two missing wait annotations (now committed) and a Windows fixture compiler timeout before tests; the final-head run is pending. Run artifacts stay outside tracked source. Merge-order after push: stay on main; do not stack on the independent cleanup PR. </details>
HyunjunJeon
pushed a commit
to HyunjunJeon/hide
that referenced
this pull request
Nov 12, 2026
…ion (with-hide#2457) Related: PRD mission-destination (pull request 4 of 4, D-41), after with-hide#2451 (merged). Paired with with-hide/hide-private#869. ## Summary When a mission ends, the operator's own folder now gets its results without a manual pull, but only when that is safe. On a close as done or `merge_wait` (and when a waiting mission turns done), Hide fetches the project once, even with background fetch off, and fast-forwards the checkout the mission was made in to the destination. Anything else (another branch, detached, own commits, changes in the way, a fetch that fails, a device project) leaves the folder exactly as it is. The report gets one line, such as `내 폴더도 최신으로 당겨왔어요 (2커밋)` or `내 폴더 2커밋 뒤 · git pull`; nothing else is shown. A `direct` change's worktree is now cleaned up like a merged pull request's once its branch is in the destination, and the guide has the Conductor brief the mission's five options with the plan. Settings › Mission's `머지되면 워크트리 정리` hint now reads `작업이 도착 브랜치에 머지되면 그 워크트리와 빌드 캐시를 지워요. 브랜치는 남기고, 고치던 파일이 남아 있거나 쓰는 중이면 그대로 둬요.`, with the same meaning in English, Japanese and Chinese; the title stays. No screenshot: only the one-line Settings hint text changes. ## Review - **Decide**: the fast-forward is the only automatic write Hide makes to the operator's checkout. It happens only when all hold: the read right after the fetch finds the destination itself out (never the catalog's branch, which may be older than a switch), tracking `origin/<destination>`, behind it and with no commit of its own, and the host's own `받기` (`BranchCatchUp`), told that branch, finds the same `HEAD` on the same branch and nothing it would overwrite. Any other branch, including one cut from the destination's upstream (`git switch -c topic origin/main`), gets the `결과는 <dest>에 들어갔어요 · 내 폴더는 <branch>` line and is not moved. - **Decide**: skipped with no report line, only `mission.folder_pull` in the log: failed fetch (or a ref lock held), no `origin`, a branch with no upstream or another upstream, `HEAD` moved between read and fast-forward, a device project, cancel, nothing of the mission landed in the destination (D-47). A destination pushed without `-u` is skipped rather than compared with `origin/<destination>` directly: the catch-up follows the configured upstream only, and setting one would write the operator's Git config. - **Risky files**: - `hide-core/src/runtime/mission_pull.rs` - the write to the operator's checkout and every skip; chooses under the lock from memory, runs off it on one issue worker. - `hide-core/src/runtime/missions.rs` - the three close paths (`close_mission_with`, `close_if_landed`, the GitHub read's close) call `owe_folder_pull`; cancel does not. - `hide-core/src/runtime/mission_cleanup.rs` - a done direct change's branch joins the retire targets once `node_landing` is `Landed { InMain }`, no GitHub answer needed; same retire, same caps. - `hide-core/src/missions.rs` - new optional record field `folder_line` (`{text, current}`, schema 4 unchanged); a later close that finds the checkout current keeps a line whose `current` is set, so a Conductor's own close after Hide's keeps `당겨왔어요 (N커밋)`. - `hide-host/src/branch_merge.rs`, `hide-node-link/src/{protocol,branch}.rs` - `catch_up` takes an optional expected branch and answers `OtherBranch` when `HEAD` has another out; it reuses the `symbolic-ref HEAD` read it already made, so the read count and `CATCH_UP_WAIT` are unchanged. The header's `받기` and the merge flow pass none and behave as before. - `hide-host/src/worktrees.rs` - the checkout read now fills `branch` from the `# branch.head` line of the `git status` it already runs. - **Cost**: under `Mutex<Runtime>` each close adds a book/catalog lookup and a queue push; no git, fetch or file read. Off the lock: one fetch (bounded by `FETCH_TIMEOUT`), one `CheckoutGit` (4 s), at most one catch-up (`CATCH_UP_WAIT`), one pull at a time; the queue holds each mission at most once and is memory only. The cleanup pass is unchanged in shape (16 per pass, one worker). - **Record and wire**: no `contracts/` change. Node link: `CheckoutGit.branch` and `BranchCatchUp.branch` are optional and skipped when empty, and `CatchUpOutcome::OtherBranch` is answered only to a caller that named a branch, which only the closing pull does, on this machine's own node. The checkout header's facts in the snapshot carry the optional `branch`, which the web does not read. `folder_line` is optional with `skip_serializing_if`; an older build ignores and drops it on its next save, keeping the line inside `report`, so a later close then adds a second line instead of replacing it (stated in ARCHITECTURE.md and the private doc). - **Baseline cells**: B-17 changes on purpose (closing now fetches and may fast-forward). B-16 holds for pull-request nodes unchanged (`a_done_nodes_merged_worktree_is_retired_only_on_githubs_answer_and_with_the_switch_on` still passes); direct nodes are added beside it. B-59 is untouched: direct worktrees go through the same `retire_worktree`. ## Tests - **Layer**: unit (real repositories through the host's own handler), runtime, and one e2e. - `runtime::mission_pull::tests` (11): real git with a local bare `origin` inside a temp folder, through `hide_host::serve::handle_in`. - `runtime::tests::missions` (5): close hands the pull to a worker off the lock, cancel / nothing landed / device ask nothing, direct cleanup targets and kept outcomes. - `web/e2e/mission-pull.spec.ts`: the one test that crosses the CLI close, the core's worker, the node and git, with `auto_fetch` off. - **Catches**: a pull that waits under the lock or blocks the close (the runtime test takes the lock while the node is held); a pull on cancel; a fast-forward of another branch that tracks the destination's upstream, read fresh (`a_branch_cut_from_the_destinations_upstream_is_left_and_named`) or switched to between the read and the fast-forward (`a_switch_to_another_branch_after_the_read_is_not_fast_forwarded`); a second close that replaces `당겨왔어요 (N커밋)` with `이미 최신이에요` (`a_second_close_that_finds_the_checkout_current_keeps_the_pulled_line`); `HEAD` moved mid-way; reporting a checkout ahead of origin as diverged (`a_checkout_at_or_ahead_of_its_destination_on_origin_reads_current`); a pull that relies on the background fetch (the e2e's `(2커밋)` needs the close's own fetch). - **Repeat**: `mission-pull.spec.ts` x 8 in a row (`--repeat-each=8`) on the final spec, all green, locally on macOS; the CI repeat lane runs it again in `verify`. - **Waits**: the runtime test waits on `wait_for` for the worker to reach the held node and for the report line (10 s hang guard each); the e2e waits on the snapshot (`control.until`) and the core's log records (`untilLogged` on `mission.folder_pull` and `mission.worktree_retired`), no fixed sleeps. ## Evidence - **Verified**: - `runtime::mission_pull::tests` 10/10 against real repositories with a local bare `origin`; the filtered mission and upgrade runtime suites (396 tests) pass; `cargo clippy -D warnings` and `rustfmt` clean. - `web/e2e/mission-pull.spec.ts` on an isolated daemon (own state folder, own repository, nothing of the operator's): the close fetched with background fetch off, moved `feat/login` forward 2 commits to the remote's newest, wrote `내 폴더도 최신으로 당겨왔어요 (2커밋)` as the report's last line, and removed the direct change's worktree with its branch kept. With the close's fetch taken out of the source, the same spec failed (the checkout one commit short of the remote); the source was restored and rebuilt before the green runs. - `ConductorTab.test.tsx` reads the new hint, and it and the i18n tests pass (59 tests). - Review fixes (heads `70890ddd4a`, `cb368af9b8`): 54 targeted pull, catch-up, checkout-read and protocol tests across `hide-core`, `hide-host` and `hide-node-link`, then the 234 mission tests of `hide-core`, all pass; clippy `-D warnings` on the three crates, `rustfmt` and `cargo check -p hided` clean. Planted together, naming no branch to the catch-up and dropping the keep rule made `a_switch_to_another_branch_after_the_read_is_not_fast_forwarded` and `a_second_close_that_finds_the_checkout_current_keeps_the_pulled_line` fail; the source was restored before the commits. - `hide mission help` still names only commands the parser reads (`each_mission_flag_the_parser_reads_is_one_the_contract_names`). - Local gates: `check-timed-waits.py`, `check-no-attribution.py`, `check-no-workstation-identity.sh`, eslint and `check-e2e-test-size.mjs` on the spec. - **Not verified**: - The e2e was not run again on the review fixes' head: the Mac had under 500 MiB free and a daemon relink could not be risked. It passed 8/8 on `a51da82855`; the fixes change which read decides the branch, which the real-repository tests above cover through the host's own `git status`, and the CI repeat lane runs the e2e on this head. - Windows and Linux natively: the pull goes through the host's existing fetch, git read and `받기`, which their CI lanes cover; this PR's own runs were macOS only until CI. - A mission on a device project: skipped by design and listed in `docs/INSTALL.md`; not run against a real device. - A pull-request node's close through GitHub's merged answer (`closed_by_merge` path) end to end: covered by the runtime test only, not by the e2e. - Two early e2e failures were spec races, not product faults: the spec set the direct node done itself, which Hide also does on a passed line (B7), and then waited on one close path when the close can go straight to done. Both are removed; the logs of those two runs were not kept. <details><summary>Verification record</summary> </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.
Related: PRD mission-destination (D-02 to D-09, D-12 wire only, D-33, D-42), PR 1 of 4; paired with with-hide/hide-private#866
Summary
A mission's results always went to the project's default branch: workers started from whatever the checkout had out, and "is it in" was read against
main.A mission now records its destination, the branch its results go to: the branch its checkout is on when it is created, or the one a plan names.
Every worker's new worktree starts from the destination's newest commit, and a done change counts as in only once it reaches the destination.
hide mission shownames it (도착 · feat/x), a worker reads it there as its pull request's base, and the guide tells the Conductor to hand it on.A mission recorded before this has no destination and behaves exactly as before.
No screenshot: nothing is drawn yet; the snapshot only carries the name, and the card that shows it is a later pull request of this PRD.
Review
읽지 못함 · <reason>and the mission does not close itself.directchange read in it stays in while the local branch holds its commit, and a pull request follows GitHub's merged state alone.destinationwhen it saves the record; the mission then goes to the default branch again.git switch, that is the branch from before. The guide has the Conductor compare도착with the checkout's branch.hide-core/src/runtime/mission_outside.rs- the off-lock outside read now resolves each distinct base once per read.hide-core/src/missions.rs,hide-core/src/runtime/missions.rs- mission record and snapshot wire (see Compatibility).hide-core/src/coordination/executor.rs- the spawn passes the destination tonew_branch_start.hide-core/src/runtime/mission_health.rs- a lost destination holds the mission's own close.Compatibility: snapshot wire, phone bundle, mission record
Mission.destinationis one optional field; the schema stays 4 and nothing migrates. An old record reads as no destination, which stands for the default branch everywhere it is asked.MissionView.destinationis added only when set (skip_serializing_if);web/src/snapshot.tstypes it optional. An old phone bundle or page ignores the key; a new page on an old core sees none.mission_destination_invalid, onhide mission plan;hide mission show <node> --jsonaddsdestinationandunread_reasononly when present.Baseline cells touched and how they stay true
directchange with no pull request still finishes from its criteria alone; the rule is not touched.merge_waitsplit by the same landing rule; only the base it reads moves, and a lost destination never closes a mission.hide mission showand the guide's brief line.destination.Tests
mainbefore the spawn, so a start from what is out lands on another commit.web/e2e/mission-destination.spec.tsx3 locally, all green; the repeat job runs it in CI.wait-ok: daemon, two stand-ins and a spawn into a new worktree); no other new wait.Evidence
hide-coreandhidedpass locally, six of them new for a destination that is not the default branch.directbranch beside one whose branch it read in main (a stored proof), and running with nodes at work, stacked, external, verified, planned, gate asked and gate passed; this build reads each as 1.2.7 published it and its first evaluation moves none.feat/xshows도착 · feat/x, its worker's branch isorigin/feat/x's newest commit with no upstream, and the worker'sgh pr create --basereadsfeat/x.verify-cargo.sh lint, web typecheck and lint, and the policy scripts pass locally.scripts/docs/check-all.mjs) was not run locally.Verification record
Head 4cfe618 (since f672492: the two D-33 limits stated as the build behaves, and the mission's own project carries the destination when the catalog does not list it yet), merged with main 97bc97c. Local: nextest filter
mission|destination|upgrade_tests|contract|outsideonhide-coreandhided462 passed;hide-kitupgrade test passed;verify-cargo.sh lintclean; e2emission-destination.spec.ts3 of 3 (run on 3be9dd2, the spawn path changed since only for another repository). Review of 5d43a40: F1 fixed in 2b2b0da (a spawn into another repository keeps its own branch), m1 to m6 addressed, m7 stays in Not verified; review of f672492 passed, its n1 and n2 are in this head.