Skip to content

fix: release the runtime lock before recording a stale bell - #2392

Merged
yansfil merged 6 commits into
mainfrom
fix/remote-delivery-credential-wait
Nov 10, 2026
Merged

yansfil merged 6 commits into
mainfrom
fix/remote-delivery-credential-wait

Conversation

@yansfil

@yansfil yansfil commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

알림을 준비하는 사이 수신자의 상태가 바뀌면, 거절 기록과 편지 읽기가 서로 기다리던 문제를 고칩니다.
거절 판정과 그 기록을 분리해 다른 편지 요청도 계속 처리합니다.

이 PR은 잠금 문제만 수정합니다.
읽기가 디스크 저장을 기다리다 시간 초과되는 문제는 별도 이슈로 남기며 #173은 열린 채로 유지합니다.

Refs with-hide/hide-private#173
Refs with-hide/hide-private#831
Refs with-hide/hide-private#823

Review

  • 조심해서 볼 파일: hide-core/src/delivery/doorbell.rs, 예약 이후 거절 경로가 Mutex<Runtime> 아래 blocking I/O 금지 규칙을 지키도록 판정 값을 먼저 꺼내 잠금을 해제합니다. 새 벨과 잃어버린 벨의 Enter 처리가 같은 수정 경로를 씁니다.
  • 순서 검증: 기존 벨 fixture가 실제 예약 완료를 확인한 뒤 입력을 도착시킵니다. 거절 기록 완료, 입력 미전송, 편지 보류를 확인합니다. 기존 원격 테스트의 기대값과 대기 예산은 그대로입니다.
  • 인접 경로 검토: 알림·composer 주변의 임시 잠금과 동기 기록 경로를 확인했습니다. 같은 잠금을 보유한 채 저장 응답을 기다리는 추가 경로는 찾지 못했습니다.
  • 비용 검토: 새 작업자·큐·주기 작업·알림 발행을 추가하지 않습니다. 기존 판정 결과의 잠금 범위만 줄입니다.

Evidence

  • 확인한 것: 상태 전이를 고정한 회귀 검사는 수정 전 doorbell.transaction_failed: delivery_timeout으로 실패했습니다. 수정 후 관련 벨 처리 검사 63개와 최종 커밋의 회귀 검사 1개가 통과했고, 관련 정적 검사와 전체 포맷 검사가 통과했습니다.
  • 반복 검증: 원격 mailbox ARM 실행에서 대상 검사 connected_remote_panes_receive_once_and_disconnect_keeps_the_same_letter_pending는 재시도 0으로 20 PASS, 0 FAIL입니다. 전체 nextest 요약은 20/20 stress run iterations: 18 passed, 2 failed이며 실패 목록은 다른 두 검사입니다. #823 때문에 실행 색은 증거로 쓰지 않습니다.
  • 남은 범위: 저장 지연 이슈에 전송 2ms, 자격 확인 0ms, 저장 1,926ms, hook 시간 초과 1,248ms의 측정과 crash 후 재전달 정책의 결정 필요성을 기록했습니다. 이 PR은 해당 저장 경계를 변경하지 않습니다.
  • 확인하지 못한 것: 이전 전체 CI의 Linux·Windows e2e가 재시작된 core와 저장된 Workspace를 기다리다 실패했습니다. 공유 재시작 fixture 수정 #2398이 main에 반영되어, 수정된 main을 포함한 새 merge commit으로 CI를 다시 확인합니다. 아직 전체 통과로 주장하지 않습니다. 화면 변경이 없어 네이티브 화면 검사는 실행하지 않았습니다.
Verification record
  • Base: 10723b6412b857261ba0cb7df43fc780b6799eb8.
  • Head: f78492feed12258788d0a86803e0b33815d5b45b.
  • 수정 전 회귀 검사: 1 failed, exit 101, delivery_timeout, 5.29s.
  • 수정 후 관련 검사: 63 passed, 0 failed, 1.64s.
  • 최종 커밋의 회귀 검사: 1 passed, 0 failed, 0.27s, exit 0.
  • scripts/verify-cargo.sh clippy -p hide-core --lib --tests -- -D warnings: exit 0.
  • scripts/verify-cargo.sh fmt-check: exit 0.
  • ARM 반복 대상: 1/20부터 20/20까지 각 1 PASS, FAIL 목록에 대상 검사 없음. 전체 lane의 두 실패는 node_contract::a_device_s_pane_socket_lives_with_its_link와 remote_delivery::a_spawn_with_machine_starts_the_agent_on_the_device_under_its_caller입니다.
  • 수정 전 진단 실행: 대상 검사 2회 실패. rd-6UCRRp는 상태 검사 완료 후 저장 1,926ms, rd-ukmkNU는 상태 재검사 진입 후 미완료로 두 원인을 보여줍니다.
  • 계측 코드와 임시 artifact 보존 설정은 모두 제거했습니다. 최종 변경은 벨 처리 코드와 전달 동작 문서 두 파일입니다.
  • 공유 fixture 수정의 main merge: 330094332f0d5c446102e9d24d0a12dd4313d926 (fix: read the engine state under its current name in the restart wait #2398). 본문 갱신으로 새 CI를 요청하며 실제 checkout SHA와 포함 관계를 확인합니다.
  • 독립 검토: 위 head에서 통과. 잠금 수정, 수정 전후 회귀 근거와 대상 ARM 20회 재시도 0을 확인했습니다.

@yansfil
yansfil marked this pull request as ready for review November 10, 2026 14:38
@yansfil
yansfil marked this pull request as draft November 10, 2026 14:44
@yansfil
yansfil marked this pull request as ready for review November 10, 2026 15:27

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

첫 리뷰. head f78492feed12258788d0a86803e0b33815d5b45b, 실제 merge-base 10723b6412b857261ba0cb7df43fc780b6799eb8.
판정: pass. 운영자가 확정한 잠금 수정 범위에서 차단 의견 없습니다. #173 전체 해결 판정은 아닙니다.

  • 정확성·경계: reserve의 delivery_bell_current는 참조가 없는 Result<(), Hold>를 반환합니다. 별도 let 문의 세미콜론에서 임시 Runtime guard가 해제되므로 뒤의 held -> record -> Client::submit이 같은 잠금을 필요로 하는 writer를 기다려도 Runtime을 붙잡지 않습니다. 기존 if-let은 거절 분기 실행 동안 guard를 유지해 writer의 처리·발행을 막고 5초 저장 응답 한도에 도달할 수 있었습니다. 제품의 잠금 범위를 고쳤으며 원격 테스트의 기대값이나 hook 예산을 완화하지 않았습니다.
  • 공통화·단순성: 새 벨의 deliver와 잃어버린 벨의 Enter를 처리하는 after_lost 모두 reserve를 사용합니다. record_brief, resubmit_brief, type_answer, composer 읽기와 호출 경로도 확인했습니다. 앞의 둘은 and_then 내부로 guard를 소비해 반환 전에 해제하며, 나머지도 외부 호출 전에 guard 범위를 끝냅니다. 이 주변에서 같은 결함을 추가로 찾지 못했습니다. 별도 helper나 writer를 만들지 않았습니다. engineering 원칙 7·13과 저장소의 Runtime 잠금 아래 blocking I/O 금지 규칙에 부합합니다.
  • 소유권·비용: 새 상시 작업·큐·타이머·알림 발행이 없고 기존 writer와 정리를 유지합니다. 기존 저장·hook 시간 한도, 재시도와 중복 전달 정책은 바뀌지 않았습니다. 문서도 판정과 기록의 잠금 경계를 설명합니다.
  • 회귀 검사: 기존 Bell fixture에서 durable 예약이 보인 다음 key 전이를 한 번 주입합니다. 수정 없이는 거절 기록이 delivery_timeout으로 실패하는 경로를 고정하고, 수정 후에는 입력 미전송·예약 종료·편지 Pending·정확한 input_after_verdict와 maybe_typed=false를 확인합니다. 작업자의 보관 로그에서 수정 전 1 failed/5.29s, 수정 후 관련 63 passed, 최종 head 회귀 1 passed/0.27s를 확인했습니다. 제가 로컬에서 재실행한 결과로 표현하지 않습니다.
  • 실제 CI: ARM job 129894979444의 checkout SHA가 검토 head와 일치하고 REPEAT=20, --stress-count 및 --retries 0을 확인했습니다. 대상 connected_remote_panes_receive_once_and_disconnect_keeps_the_same_letter_pending는 1/20부터 20/20까지 20 PASS, 0 FAIL입니다. nextest Summary는 18 passed, 2 failed iterations이고, 실패한 검사는 node_contract::a_device_s_pane_socket_lives_with_its_link와 remote_delivery::a_spawn_with_machine_starts_the_agent_on_the_device_under_its_caller입니다. 실행의 녹색 표시를 전체 통과 증거로 사용하지 않았습니다.
  • 범위·본문: 최신 c1-c3에 따라 #173을 닫지 않고 Refs #173/#831/#823을 명시했습니다. 저장 1,926ms 때문에 hook 1,248ms 예산을 넘는 별도 문제는 #831에 남으며 이 변경으로 해결됐다고 판단하지 않습니다. 이는 최초 Closes 요구 대신 적용하는 명시적 운영자 범위 결정입니다. 템플릿과 attribution 제한도 충족합니다.
  • 최종 diff는 제품 코드·그 안의 회귀 검사와 전달 문서 2개 파일뿐입니다. 임시 계측과 workflow 변경은 남지 않았고 git diff --check 통과했습니다. 최종 전체 CI 성공은 별도 ci 줄에서 확인해야 합니다. 앱 조작이나 코드 변경은 하지 않았습니다.

@yansfil
yansfil enabled auto-merge November 10, 2026 15:33
@yansfil

yansfil commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Closing and reopening only to recompute the merge ref against main 3300943 (it stayed on 4ec32fd), so CI checks this head on the fixed main. No change to the branch.

@yansfil yansfil closed this Nov 10, 2026
auto-merge was automatically disabled November 10, 2026 15:58

Pull request was closed

@yansfil yansfil reopened this Nov 10, 2026
@yansfil
yansfil enabled auto-merge November 10, 2026 15:59
@yansfil yansfil closed this Nov 10, 2026
auto-merge was automatically disabled November 10, 2026 19:20

Pull request was closed

@yansfil yansfil reopened this Nov 10, 2026
@yansfil
yansfil enabled auto-merge November 10, 2026 19:20
@yansfil
yansfil added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit dda1ed4 Nov 10, 2026
282 of 334 checks passed
@yansfil
yansfil deleted the fix/remote-delivery-credential-wait branch November 10, 2026 19:47
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