Skip to content

fix: preserve remote Herdr selection and recover services on retry - #1722

Merged
yansfil merged 3 commits into
mainfrom
fix/device-herdr-socket-retry
Oct 27, 2026
Merged

yansfil merged 3 commits into
mainfrom
fix/device-herdr-socket-retry

Conversation

@yansfil

@yansfil yansfil commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #1702, #1700

Summary

  • 기기에 서버가 없어도 Herdr가 고른 소켓을 유지하고, 못 읽으면 기기의 소켓·세션 환경 설정을 따릅니다.
  • 서버 시작 실패의 Retry는 연결을 다시 열어 pane 서비스와 터미널 경로도 복구합니다.
  • 보내기로 한 Herdr의 전송 실패는 기기 행의 설치 실패로 전달하고, 이전 유효 사본과 링크를 보존합니다.

Review

  • 판단해 주세요: 시작 실패 뒤 연결 전체를 다시 여는 복구 범위와, 필수 Herdr 전송 실패의 재시도 경로.
  • 조심해서 볼 파일: runtime/kit.rs의 연결 복구, ssh/host.rs의 전송 오류, hide-host/src/kit.rs의 링크 교체 순서.
  • 기존 연결 worker를 사용하며 Runtime 잠금이나 session-sync에 I/O를 추가하지 않습니다.

Evidence

  • 확인한 것: 세 항목 모두 현재 main에서 확인했고, 수정 전 회귀 테스트가 각각 실패했습니다.
  • 확인한 것: host/node 및 core Retry 테스트, 플랫폼 소켓 선택 검사와 전용 계정·소켓의 실제 SSH 6개가 통과했습니다.
  • 확인한 것: 실패 뒤 재연결에서 pane 소켓 접속, 터미널 제어권, 입력한 명령의 출력까지 확인했습니다.
  • 확인한 것: 최종 head의 계획된 CI lane 전체와 verify가 통과했습니다. 세 OS 계약, Rust, 원격 SSH, Linux/Windows 웹 및 macOS/Windows 데스크톱 E2E를 포함합니다.
  • 한계: 별도 core-move 검사 두 개는 기존 이슈와 같은 오류 뒤 CI 재시도에서 통과했습니다. 아래 기록에서 구분합니다.
  • 확인하지 못한 것: 실제 외부 기기와 네이티브 기기 행 클릭은 검증하지 않았습니다.
  • 화면 파일과 문구 변경은 없습니다.
Verification record

Base: 16f2f066b09b2ec7d95a3ede3ea7859c3447e092.
Head: f5274f1d278c582a7ad07786050172171a5e2bdf.
CI checkout: 69892251f4591d0ae165c389ccc7e2d5ed866ea9, the merge of that head with main c88c8c470e14a712245fa6e3cc27c2faedc7aada.
The three original regression checks failed before production fixes.
Focused hide-host (140 unit + 67 integration) and hide-node (214 unit + 1 integration) suites passed, with existing ignored tests unchanged.
The core failed-start retry regression and platform host tests passed.
At preceding head 9df8bf1b3, the complete platform integration rerun passed 233 tests (2 existing ignored).
The final resolver change passed 22 platform host tests and the pinned binary socket/session comparison; that comparison runs on every OS contract lane.
All 6 isolated real-SSH bootstrap tests passed serially on the final candidate, including environment socket/session selection, required upload failure/re-send and usable terminals after failed startup.
The initial platform and parallel SSH attempts hit ENOSPC; the parent freed space, and their final reruns above passed.
The pinned schema contract, core machine-boundary check, pin single-source, attribution, design contract and diff whitespace checks passed.
Full local lanes are deferred to CI at the parent's request because disk space is shared with concurrent work.
Independent Code and Fidelity re-reviews passed the final head with no Fix now findings; the initial Code review's environment-session gap is resolved.
Optional follow-up: direct pin-file upload and final rename fault injection; the current required-error propagation and preservation checks cover their shared failure path.
Full final-head CI run 40445618782 and its required verify passed.
Executed lanes: Rust (5,822 tests plus 7 separate checks), Windows workspace/checks, remote mailbox/SSH, OS and SDK contracts on macOS/Linux/Windows, Linux web E2E (383), Windows web E2E (64), macOS desktop E2E (117) and Windows desktop E2E (19).
All 6 real SSH bootstrap tests and the pinned socket/session comparison on every OS passed on their first attempt.
All web and desktop E2E logs reported no flaky tests.
Package and agent-journey lanes were not selected by the plan; this PR does not claim they ran.
The remote lane also classified two core-move tests as flaky after helper-readiness timeouts; both passed their one CI retry.
The same failures were already tracked from main in #1663 and #1428; CI appended this run to those issues.
Issue #1428 is past its recorded expiry; this PR does not claim those two flows are stable.

@yansfil
yansfil marked this pull request as ready for review October 27, 2026 03:32
@yansfil
yansfil merged commit e21d4bb into main Oct 27, 2026
67 checks passed
@yansfil
yansfil deleted the fix/device-herdr-socket-retry branch October 27, 2026 04:36
yansfil added a commit that referenced this pull request Oct 27, 2026
Related: #1722, #1725

## Summary

main의 `verify`가 #1722 머지(e21d4bb) 뒤로 `rust workspace`의 기기 통계 테스트 하나에서
계속 실패합니다.
두 PR이 따로 초록인 채 머지되며 생긴 충돌입니다: #1722는 Herdr 시작 실패 뒤 Retry를 kit 재적용에서 기기
재연결로 바꿨고, #1725의 테스트는 옛 kit 경로로 Retry를 흉내 냈습니다.
제품 동작은 맞습니다: 재연결이 새 연결 시도를 열고, 그 연결의 kit 보고(`Started`)가 성공 한 번으로 기록됩니다.
그래서 코드는 그대로 두고, 테스트가 Retry 뒤 재연결의 결과를 공급하도록 고쳤고, `docs/ARCHITECTURE.md`의
통계 계약에 이 Retry가 재연결의 시도로 세어진다는 문장을 더했습니다.

## Review

- **판단해 주세요**: 되돌리기(revert #1722) 대신 테스트 수정을 택했습니다. Retry 성공이 연결 한 번으로
세어진다는 계약은 재연결 경로(`spawn_host_start`의 `begin_device_connect` ->
`ingest_host_established`의 claim/complete)에서 그대로 지켜집니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/tests/device_kit.rs` - fixture에
SSH transport가 없어, 바깥 worker가 하는 시도 등록과 연결 결과를 테스트가 직접 넣습니다(바로 위 통계 테스트와
같은 방식).

## Evidence

- **확인한 것**: 수정 전 main(e22c924)에서 CI와 같은 단언(device_kit.rs:2897, 두 번째
`Ready(Started)` 없음)으로 로컬 실패를 재현했습니다.
- **확인한 것**: 수정 뒤 `verify-cargo.sh nextest -p herdr-core -E
'test(/device_kit|device_analytics|device_connect/)'` 56개 통과,
`fmt-check` 통과.
- **확인한 것**: 테스트는 Retry가 기존 연결을 닫는지, Retry 자체는 통계를 늘리지 않는지, 재연결 성공이 한 번만
기록되는지를 봅니다.
- **확인하지 못한 것**: 디스크 여유가 4GB 아래라 로컬 clippy와 다른 crate는 돌리지 않았습니다. CI
`verify`에 맡깁니다.
- **확인하지 못한 것**: 실제 기기로 Retry 뒤 PostHog 이벤트가 오는지는 보지 않았습니다.

<details><summary>Verification record</summary>

Base: `e22c924b67a630e04e4c907d9d28bb021ef22c07`.
Failing main runs: 40450672875, 40453581851, 40455435250; last green
main a1bed1f (run 40449782460).

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant