Skip to content

Grok 세션을 직접 읽어 제목, 재우기, fork, 질문과 계획 승인 대기를 보인다 - #868

Merged
yansfil merged 18 commits into
mainfrom
feat/session-readers-grok
Oct 9, 2026
Merged

yansfil merged 18 commits into
mainfrom
feat/session-readers-grok

Conversation

@yansfil

@yansfil yansfil commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Related: PRD agents/prd/session-readers-grok/prd.md · 세션 리더 공통 #804, Pi #826, omp #865 다음 순서 · Grok 훅 #811, Pi/omp 확장 #838

Summary

Grok 1.0.46 세션을 hide가 직접 읽습니다.
~/.grok/sessions/<URL 인코딩한 cwd>/<id>/의 summary.json이 id, cwd, 제목을, updates.jsonl이 대화를 맡습니다.
그래서 Grok 행이 Claude Code, Codex, Pi, omp처럼 자기 제목, 재우기와 깨우기(--resume <id>), fork(--resume <id> --fork-session), 폰 대화, 질문과 계획 승인 대기를 갖습니다.
Grok은 편지 hook이 없어 Settings에서 기본(Basic) 칩은 그대로입니다.
화면 구성은 바뀌지 않고, Grok 행에 다른 에이전트와 같은 표시가 생깁니다.

Review

  • 판단해 주세요: 줄 상한(256 KiB)을 넘는 Grok 기록을 본문 없이 읽습니다. 이미지 붙여넣기와 큰 도구 출력이 흔해서, 예전 규칙(읽기 중단)이면 그 세션의 기능이 계속 꺼집니다. 본문이 빠진 질문은 글과 선택지 없는 질문으로 기다리고, 큰 답변과 도구 출력의 글과 PR 링크는 읽지 않습니다(body_capacity로 셈).
  • 판단해 주세요: /rewind로 버린 대화를 걸러내지 않고 기록된 역사로 보여 줍니다. 버린 요청에 답이 전혀 없으면 같은 promptIndex의 새 요청과 한 메시지로 합쳐질 수 있습니다.
  • 조심해서 볼 파일: hide-session/src/grok.rs - 형식 해석과 큰 기록 스캐너(LargeLine), checkpoint에 실리는 상태.
  • 조심해서 볼 파일: hide-session/src/conversation_cursor.rs - 고빈도 폴링 경로. Grok은 폴마다 summary.json, plan_mode.json, plan.md를 읽고 그 바이트를 폴 예산에 셉니다.
  • 조심해서 볼 파일: hide-session/src/native_file.rs, herdr-core/src/live.rs - 경로 증명. Grok 그룹은 정규화한 cwd의 인코딩이어야 하고, fork와 깨우기는 증명된 파일 경로로만 갑니다.
  • 조심해서 볼 파일: hided/src/mobile/conversation.rs - 나뉜 메시지를 페이지 경계 너머로 합치고, 이어지는 기록이 오면 페이지를 다시 엽니다.
  • 비용 검토: 새 프로세스 없음. 폴당 추가 읽기는 세 파일, 각각 상한(요약 256 KiB, plan_mode.json 4 KiB, plan.md 8 KiB)과 폴 예산 안. 큰 기록 스캔은 checkpoint에 고정 개수의 작은 필드만 남깁니다.

Evidence

  • 확인한 것: hide-session 계약 테스트 Grok 10개(공통 사실, 조각 합치기, 질문, 계획 승인, 제목, 소유자 증명, 경로, 목록과 링크, 잘린 줄, 상한 넘는 기록)와 스캐너 단위 테스트 3개(픽스처 모든 줄 대조, 모든 바이트 분할과 checkpoint 왕복, 반복 키).
  • 확인한 것: herdr-core의 fork/resume 인자, 증명된 파일로 Grok fork(성공, 거절, 요약 변경, 실행 변경), 재우기 가능 판정, 보관함 상세 합치기. hided 폰 페이징과 재시작.
  • 확인한 것: Playwright session-readers.spec.ts 3/3(pi, omp, grok)을 고정 Herdr 0.9.3과 이 hided에서. Grok은 제목, 계획 승인 사실과 approval 표시, 해제, 재우기, --resume <id> 깨우기. 같은 조건에서 grok-cursor-hooks.spec.ts 5/5(공유 e2e 대역이 세션 설정 없이도 평범한 대역으로 실행됨).
  • 확인한 것: 실제 grok 1.0.46(별도 HOME)이 픽스처 세션을 grok sessions list로 제목과 함께 나열하고 grok export로 읽음. /tmp로 들어가도 그룹 이름은 /private/tmp 기준(정규화한 cwd)임을 확인.
  • 확인한 것: agent-live-check --agents grok에서 Herdr가 Grok 세션을 kind: id로 보고함.
  • 확인하지 못한 것: 실제 바이너리의 이어서 시작과 fork. 로그인되지 않아 헤드리스는 "Not signed in"으로 끝났고, 화면 모드는 로그인 화면에서 멈췄습니다(not_authenticated). 인자는 1.0.46 --help의 --resume, --fork-session 설명을 따릅니다.
  • 확인하지 못한 것: 실제 바이너리가 쓴 agentTimestampMs, promptIndex, promptId, x.ai/tool 종류, hideFromScrollback, turn_completed, plan_mode.json, plan.md 모양. 픽스처는 공개된 grok-build 소스에서 만들었습니다. 255바이트 넘는 cwd의 해시 그룹은 거절만 합니다.
  • 확인하지 못한 것: 부모 PRD의 다섯 리더 묶음 e2e와 B16 전체는 마지막 자식 PR에서 닫습니다. 노드 경계(본문 검색, 보관함 재개) Grok 전용 테스트는 없습니다.
후속 개선(이 PR 밖)
  • /rewind 기록 걸러내기와 그에 따른 u:N 합침
  • 폴 경계를 넘는 라벨 이벤트 합치기(폰은 합침), Memory 분석 경로의 조각 이벤트
  • 상한 넘는 typed prompt를 빈 Human 이벤트로 남길지
  • links::candidates가 세션 폴더 안까지 내려가며 다른 에이전트와 방문 상한을 공유하는 문제, 하위 에이전트 세션 후보
  • 대화 없는 Grok 폴더가 사용할 수 없는 목록 행으로 보이는 문제, 목록 제목 실패 이유가 사라지는 문제
  • summary.json 중복 읽기, id 없는 locate의 예산, plan.md 없는 계획 승인의 빈 내용, 충돌 뒤 남는 승인 대기 표시
  • 노드 경계와 종 보류의 Grok 테스트, docs/PERFORMANCE_TESTING.md의 폴당 읽기 목록
  • Pi와 omp의 256 KiB 넘는 기록은 여전히 읽기를 멈춤(Grok은 자체 스캔으로 해결, 같은 방식 적용 검토)
  • UUID가 아닌 Grok id를 resume/fork에서 거절할지(--resume은 UUID 모양이 아니면 제목으로 찾음)
  • 큰 기록 대조 테스트에 질문, interjection, hostTurn, 깨우기 줄과 답변 part 비교 추가
  • 세션 설정을 빠뜨린 네이티브 e2e가 대역 오류 대신 시간 초과로 실패하는 문제(실패는 그대로, 진단만 약해짐)
Verification record
  • PRD: agents/prd/session-readers-grok/prd.md (sha256 745654f89e0f13bd8027bbeb085c43e45b2f2a08e45225d0a756592a7f19947d)
  • Base 39efc67 → head 0eeb17a, verified 2026-10-09T08:38:40.330Z: PASS
  • Verification report: agents/runs/session-readers-grok/verification-report.json and agents/runs/session-readers-grok/verification-report.md; source fingerprint b46295c8b30d8f4069516f9dbc2db0d28540387621d6720c5ac831a0b55a73b5
  • Suites:
    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Reviews:
    • Fidelity (9c2a0aa, 3fe7f6d, bcf77c1): Fix now 1, 실제 CLI resume/fork와 형식 미측정. 실제 grok 1.0.46으로 형식과 그룹 이름을 확인하고 resume/fork는 미측정으로 명시해 닫음. Fix now 2, 경로 증명 변경 뒤 e2e 재실행 요구. 3fe7f6d와 e51a7c4에서 3/3 통과로 닫음. 마지막 회차 Fix now 없음.
    • Code (9c2a0aa, 3fe7f6d, bcf77c1, e51a7c4, 01e1d26, 0eeb17a): 큰 기록이 읽기를 멈춤, 보관함 상세 미결합, 재우기 테스트가 엉뚱한 이유로 통과, 쓰이지 않는 id 경로 분기, 큰 질문이 여전히 멈춤의 5건을 모두 고침(4f8c3c5, 45a0129, bcf77c1). main 병합 정리, checkpoint 박스화, CI e2e 대역 수정(0eeb17a) 재검토에서 Fix now 없음.
    • Follow-up improvements: 위 '후속 개선' 접힌 목록.
  • Evidence: 5 registered (5 log); paths are local to the run directory
    • agents/runs/session-readers-grok/evidence/e2e-session-readers.log
    • agents/runs/session-readers-grok/live-grok-1314/report.md
    • agents/runs/session-readers-grok/evidence/e2e-session-readers-3fe7f6dd6.log
    • agents/runs/session-readers-grok/evidence/e2e-session-readers-merged.log
    • agents/runs/session-readers-grok/real-grok-format/findings.md
  • Changed paths: 42 (see Files changed)
  • Delivery: mode pr, branch feat/session-readers-grok, base main

yansfil added 18 commits October 9, 2026 12:30
… prompt blocks and answer runs, questions and plan approval
Grok keeps its own body-less read of an oversized record; other agents use main's native-id discard.
# Conflicts:
#	hide-session/src/conversation_cursor.rs
…s configured

The Grok and Cursor hook spec launches the grok stand-in without a
session configuration; it now runs as before instead of exiting.
@yansfil
yansfil merged commit b0effdc into main Oct 9, 2026
22 checks passed
@yansfil
yansfil deleted the feat/session-readers-grok branch October 9, 2026 08:57
yansfil added a commit that referenced this pull request Oct 9, 2026
Related: PRD `agents/prd/pi-omp-extension/prd.md` · #838 (Pi, omp 확장, 이
PR이 그 위에 Memory를 얹음) · P6 Pi reader #826, omp reader #865 (둘 다 머지됨) ·
#849의 Security 8(Memory 전 프롬프트 본문 전달)을 닫음, 나머지 항목은 열린 채

## Summary

#838은 Pi와 omp에 Hide 확장(편지, 안내, 실행 가드)을 붙였고 Memory는 P6의 두 세션 리더가 머지된 뒤로
미뤘습니다(PRD D-09).
이 PR은 그 Memory를 붙입니다: 확장이 프롬프트마다 helper에 묻고, helper는 `claude-code` 훅과 같은
Memory 캡슐과 서명된 receipt를 숨은 메시지에 함께 실어 보냅니다.
Memory receipt는 호스트의 `getSessionId()`(세션 파일 헤더 id)로 서명하고, 편지는 지금처럼 세션 파일
경로로 묶습니다.
코어는 Pi와 omp 세션 파일에서 Hide 자신의 `custom_message`(`customType: hide`)만
provider가 넣은 문맥으로 읽어 receipt를 받아들입니다. 사용자가 친 receipt 문자열, 다른 확장의 메시지, 부모
세션을 fork한 파일의 receipt는 받지 않습니다.
그래서 설정의 Pi와 omp 행의 기능 표에 Memory가 켜집니다(D-08, D-09). 벨은 두 에이전트 모두 계속 꺼져
있습니다.

## Review

- **판단해 주세요**: Memory의 SessionStart 캡슐은 helper가 주고 호스트가 그 메시지를 기록할 때까지 매
프롬프트 다시 묻습니다(안내와 따로 추적). `claude-code` 훅의 SessionStart 한 번과 다르지만 쓰이지 않은
캡슐을 준 것으로 세지 않기 위해서입니다.
- **판단해 주세요**: 확장 버전이 1에서 2로 올라 설치된 v1 확장은 kit이 다시 설치할 때까지 helper가 `{}`로
답해 아무것도 하지 않습니다. v1은 릴리스에 실린 적이 없습니다(#838은 v0.3.0 뒤).
- **판단해 주세요**: Pi와 omp 세션의 `message` 항목은 이제 어떤 것도 provider-injected로 읽지
않습니다(전에는 reminder로 감싼 user 메시지가 그렇게 읽힐 수 있었음). 사용자가 붙여넣은 receipt가
Memory를 열지 못하게 하는 변경입니다.
- **조심해서 볼 파일**: `hide-session/src/native_file.rs` - Memory의 신뢰 경계.
Hide의 `custom_message`만 `with_provider_injected(true)`로 읽습니다.
- **조심해서 볼 파일**: `hide-agent-hooks/src/plugin/helper.rs`,
`src/pi_extension/extension.js` - 운영자 프로세스 안의 확장과 그 helper.
`native_session`은 1~4096자 문자열만 받고, 없으면 Memory 없이 편지만 보내며 `plugin` 원인으로
진단합니다.
- **판단해 주세요**: #849의 Security 8은 이 PR로 닫힌다고 봅니다. helper가 받는 프롬프트 본문은 이제
로컬 Memory 검색에 쓰이고 32KiB로 잘리며 로그에 남지 않습니다. 849의 다른 항목은 다루지 않아 issue는 열어
둡니다.
- **비용 검토**: 프롬프트당 helper 호출 수는 그대로(1회)이고, 그 안에서 Memory 검색 1회(프롬프트 32KiB
상한, 로그에 남기지 않음)가 더해집니다. 코어 쪽은 기존 Memory 투영 경로에 Pi, omp 세션 파일 읽기가 붙을 뿐 새
상주 작업은 없습니다.

## Evidence

- **확인한 것**: sealed `verify-cargo.sh test`와 `lint` PASS(head f657312,
#868과 #870을 병합한 main a41bc1a 위).
- **확인한 것**: helper 단위 테스트(Memory에 넉넉한 기한)로 Pi와 omp receipt가 호스트 세션 id로는
검증되고 파일 경로로는 검증되지 않음, OpenCode는 자기 세션 id로 서명, `memory_first:false`면 첫
프롬프트에도 시작 캡슐을 주지 않음. Pi의 세션을 파일로 서명하게 바꾸는 결함을 심으면 실패함을 확인.
- **확인한 것**: 빌드된 helper 통합 테스트로 75 ms Memory 예산과 무관한 결과만: 시작 뒤 프롬프트, 쓸 수
없는 id(`-x`), Memory 꺼짐에서 `memory_start` false와 receipt 없음, 편지는 매번 도착.
- **확인한 것**: 코어 테스트로 Pi와 omp 각각 SessionStart receipt가 세션 파일에 남기 전에는 프롬프트
Memory가 Unavailable, 남은 뒤에는 열리고, 부모의 receipt를 가진 fork 파일은 열지 못함.
- **확인한 것**: hide-session 테스트로 Hide의 `custom_message`만
provider-injected, 사용자가 친 receipt와 reminder로 감싼 receipt는 아님, 다른 확장의
`custom_message`는 읽지 않음(Pi, omp 둘 다).
- **확인한 것**: 확장 Node 테스트로 Memory의 SessionStart 캡슐이 안내와 함께든 따로든 기록된 메시지
하나에 실리고, 기록된 뒤에만 시작된 것으로 셈.
- **확인한 것**: 실제 Pi 1.0.4, omp 18.7.0 TUI를 pty로 띄워(비공개 HOME, 가짜 provider,
대역 helper) 확장이 보낸 `native_session`이 세션 파일 헤더 id와 같고, 숨은 항목이 `type:
custom_message`, `customType: hide`로 남음을 실측.
- **확인하지 못한 것**: 실제 Memory가 켜진 프로젝트에서 로그인된 Pi, omp로 캡슐이 모델에 닿는 끝까지의
흐름(로그인 금지, issue 850), 기기에서 도는 Pi와 omp, compaction이나 resume 뒤 Memory
재전송.
- **확인하지 못한 것**: 전체 nextest 한 번에서 이 PR이 건드리지 않은 `hide-host
gh::tests::timed_out_gh_and_its_pipe_holding_helper_are_terminated`가 부하
기한으로 실패했고 단독으로는 통과했습니다.
- **확인하지 못한 것**: load 약 64에서 돈 sealed 실행 한 번에서 이 PR이 건드리지 않은
`codex_trust` 7개가 app-server initialize 기한으로 실패했고, 단독으로는 통과했습니다.

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

- PRD: `agents/prd/pi-omp-extension/prd.md` (sha256
676a51347370bcc57965ce68ef407ee2585d2fdab6d3c30b64a5ce9ff7113f7d)
- Base a41bc1a → head f657312, verified 2026-10-09T09:49:58.785Z: PASS
- Verification report:
`agents/runs/pi-omp-extension/verification-report.json` and
`agents/runs/pi-omp-extension/verification-report.md`; source
fingerprint
4d05fea261dcca011e5f277a3a966f42b3e3cf8b14eefabcba9c05b7903f7601
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews (advisory):
- Fidelity, Code, Security on 207b402: Fix now = omp 문서 줄에 Memory 누락,
Memory의 SessionStart 캡슐이 안내 시작과 묶여 안내만 기록되면 다시 묻지 않음(Fidelity) ->
193993047에서 고침. Code, Security는 Fix now 없음; 정확한 단언, helper 테스트, `plugin`
진단, fixture helper, fork 음성 테스트, provider-injected 규칙 좁히기, 낡은 문장 -> 같은
커밋. Security: #849의 Security 8 닫힘.
- Follow-up on 1939930: Fix now 없음; 재시도 문서, `plugin` 원인 문장, 이후 프롬프트와
Memory 꺼짐의 helper 테스트 -> 849a8d6.
  - Closure on 849a8d6: 닫힘, Fix now 없음.
- Follow-up on 849a8d6 (Memory 세션 id 실측 증거 7개 등록): 증거가 README의 주장(두
호스트의 `native_session` = 헤더 id, 숨은 항목 모양)을 보임, Fix now 없음; helper가 대역이라
실제 receipt 서명까지는 보이지 않음(그 부분은 helper 통합 테스트가 맡음)
- Follow-up on 4dd2b57 (#868 Grok 리더 병합): Fix now 없음; Grok은 `memory` 선언이
없어 서명되는 receipt가 없고 Pi, omp 경로와 기능 표는 그대로.
- Follow-up on d44ee0e (CI의 workstation-identity 실패로 테스트 경로 수정, 부하에서 75
ms 예산을 넘긴 테스트에 넣은 재시도, #870 병합): Fix now 없음; 재시도는 docs/TESTING.md가 금지 ->
262ac05에서 helper의 Memory 단계를 deadline 인자로 빼고 단위 테스트로 바꿈.
- Follow-up on 262ac05: Fix now = 테스트 문단에 새 단위 테스트 미기재 -> f657312;
override 단위 케이스도 추가.
  - Closure on f657312: 닫힘, Fix now 없음.
- Follow-up improvements: 첫 receipt만 파싱하는 경로의 큰 입력 비용, Memory가 필요 없을 때도
프롬프트 본문 전송, Pi `/export`에 캡슐이 보임, compaction이나 resume 뒤 안내와 Memory 재전송
없음, Memory 켜기 게이트가 `claude-code`, `codex` 버전만 확인(기존, OpenCode도 같음), v1
확장은 kit 재설치 전까지 동작 안 함, ARCHITECTURE의 receipt 권한 목록에 Grok의
`hideFromScrollback` provider-injected는 표시용일 뿐이라는 한 구절,
`trusted_memory_receipt`가 `memory` 선언 없는 에이전트를 구조적으로 거절., 실제 바이너리의
`prompt`가 캡슐과 편지를 합치는 배선은 Rust에서 Memory 캡슐과 함께 검사되지 않음(Node와 e2e는 스크립트
쪽만), `windows_hook_command.rs`의 기존 재시도도 같은 seam으로 바꿀 수 있음.
- Evidence: 20 registered (15 log, 5 file); paths are local to the run
directory
  - agents/runs/pi-omp-extension/evidence/host-smoke/README.md
- agents/runs/pi-omp-extension/evidence/host-smoke/pi-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke/pi-session-hidden-entry.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke/omp-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke/omp-session-hidden-entry.jsonl
  - agents/runs/pi-omp-extension/evidence/host-smoke-tui/README.md
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/pi-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/pi-session-hidden-entry.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/omp-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/omp-session-hidden-entry.jsonl
  - agents/runs/pi-omp-extension/live-check-1/report.md
  - agents/runs/pi-omp-extension/evidence/host-smoke-tui-head/README.md
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui-head/omp-ctx-mode.txt
  - agents/runs/pi-omp-extension/evidence/memory-session-id/README.md
-
agents/runs/pi-omp-extension/evidence/memory-session-id/pi-session-header.jsonl
-
agents/runs/pi-omp-extension/evidence/memory-session-id/pi-prompt-call.jsonl
-
agents/runs/pi-omp-extension/evidence/memory-session-id/pi-hide-entry.jsonl
-
agents/runs/pi-omp-extension/evidence/memory-session-id/omp-session-header.jsonl
-
agents/runs/pi-omp-extension/evidence/memory-session-id/omp-prompt-call.jsonl
-
agents/runs/pi-omp-extension/evidence/memory-session-id/omp-hide-entry.jsonl
- Changed paths: 19 (see Files changed)
- Delivery: mode pr, branch `feat/pi-omp-extension`, base `main`

</details>
yansfil added a commit that referenced this pull request Oct 9, 2026
Grok's large-line scan (#868) failed the read on a record it could not
follow. It now marks the scan invalid and the record is skipped as
conversation_capacity with an unreadable turn mark, like the Claude Code
and Codex CLI readers.
yansfil added a commit that referenced this pull request Oct 9, 2026
Related: #860

## Summary

256 KiB가 넘는 기록 중 큰 기록 판정이 도구 기록으로 확인하지 못한 것은 세션 읽기를 실패시켰고, 커서가 그 자리에 영구히
멈췄습니다.
그러면 그 세션의 라벨이 굳고, 그 패널로 가는 벨이 모두 `session_unread`로 보류되다 편지가 undelivered가
됩니다.
#860 이후 남은 경우는 스크린샷을 붙인 사람 메시지입니다(wCQ:p1이 2026-10-01 389 KB 메시지에서 멈춰
있음).

이제 그런 기록은 본문을 잃고 읽기는 계속됩니다.
- 대화 기록: 구조로 확인한 도구 turn 기록(질문, 답)은 그대로 접고, 본문은 버리고
`conversation_capacity`로 셉니다.
본문만 줄 수 있는 turn 기록(사람 메시지, 중단)은 대기를 지우거나 끝낼 뿐 만들지 않습니다. 그래서 잃어도 벨이 메뉴에
들어가지 않고, 보류될 수만 있습니다.
- 구조를 읽을 수 없는 기록(모르는 봉투, escape된 판별자, 64단계 넘는 중첩)은 `unreadable` 표시를
접습니다. 다음 turn이 시작되거나 사람이 쓸 때까지 대기는 "모름"이고 벨은 보류됩니다.
- 검색도 이 기록을 건너뛰고 뒤를 계속 읽습니다. 전에는 읽기 거부로 그 파일의 검색 행이 빠졌습니다.
- main에 들어온 Grok 읽기(#868)도 따라갈 수 없는 큰 기록(64단계 넘는 중첩, 깨진 줄)에서 읽기를 멈췄습니다.
같은 방식으로 건너뛰게 했습니다.

## Review

- **판단해 주세요**: 사람 메시지 하나의 본문이 라벨과 검색에서 사라집니다. 대신 세션 전체가 멈추지 않습니다. 잃은 개수는
`read.lines_skipped` 진단에 `conversation_capacity`로 남습니다.
- **판단해 주세요**: 질문이 대기 중일 때 이미지를 붙여 답하면, 그 메시지가 지웠을 대기가 남아 다음 답·turn까지
`awaiting_operator`로 보류됩니다. 반대 방향(대기를 놓쳐 메뉴에 벨)은 생기지 않습니다.
- **조심해서 볼 파일**: `hide-session/src/conversation_cursor.rs` - failure
path. 실패하던 자리가 skip으로 바뀌었고, 체크포인트에 직렬화되는 분류기에 `overflow` 필드가 생겼습니다(옛
체크포인트는 기본값 0으로 읽힘).
- **조심해서 볼 파일**: `hide-session/src/turns.rs` - 기기 helper와 오가는 tracker에
`unreadable` 필드가 생겼습니다. 옛 core는 이 필드를 무시합니다(`question_capacity` 때와 같은
방식).

## Evidence

- **확인한 것**: 바뀐 테스트 6개가 모두 수정 전 커서에서 실패하고 수정 후 통과합니다. main 병합 후
`hide-session` 165개 통과(Grok 중첩 기록 경우 추가).
- **확인한 것**: 새 user-turn 테스트가 `Claude Code`·`Codex CLI` 각각 확인합니다. 스크린샷
메시지 뒤 대기는 "없음"으로 읽히고, 모르는 봉투 뒤에는 "모름"이며, 사람 메시지가 오면 풀립니다.
- **확인한 것**: 운영 중 멈춘 wCQ:p1의 실제 체크포인트(`labels.json` 복사)로 실제 12 MB 세션을
읽었습니다. 10번에 파일 끝까지 0.16초 걸렸고, 대화 기록 1개와 도구 기록 5개를 건너뛰었으며, 대기는 "없음"입니다.
- **확인한 것**: `herdr-core`·`hide-host`·`hide-node-link`의
label/turn/question/session/doorbell/waiting 테스트 455개 통과(main 병합 후, grok
포함). `hide-session` clippy(`-D warnings`)와 fmt 통과.
- **확인하지 못한 것**: 이 빌드를 설치한 앱에서 wCQ:p1 라벨이 다시 움직이는 것. 운영자 앱 교체가 필요해 하지
않았습니다.
- **확인하지 못한 것**: `OpenCode`·`Pi`·`omp`의 큰 도구 기록 판정은 범위 밖입니다. 이들의 큰 기록은
모두 `unreadable`이 됩니다(전에는 읽기가 멈춤).
yansfil added a commit that referenced this pull request Oct 9, 2026
Related: PRD `agents/prd/session-readers-opencode/prd.md` · 세션 리더 공통
#804, Pi #826, omp #865, Grok #868, Cursor #877 다음의 마지막 child

## Summary

- OpenCode 1.18.30의 세션을 세션 파일이 아니라 OpenCode 자신의 SQLite DB에서 읽기 전용으로
읽습니다.
- 읽을 때마다 같은 transaction 안에서 id가 root session(`parent_id` 없음)이고 기록된
`directory`가 정확히 그 checkout임을 증명합니다.
- 그 증명 위에서 native 제목, `question` 도구 대기, 재우기/깨우기(`opencode -s <id>`),
fork(`-s <id> --fork`)를 켭니다.
- 프로젝트 아카이브 목록/검색/상세와 폰 대화도 `opencode/<id>` locator로 같은 증명을 거쳐 읽습니다.
- lifecycle gate는 `requires_native_proof`(native-file reader 전부 +
OpenCode) 하나로 모았고, 증명 참조는 OpenCode만 id, 나머지는 path입니다.

![OpenCode의 native question이 행의 질문 상태와 pane header의 Answer 태그로
보인다](https://github.com/yansfil/pr-assets/blob/main/hide/session-readers-opencode/023cd90/opencode-native-question.png?raw=true)

![재운 OpenCode 세션이 opencode -s <id>로 새 pane에서 같은 제목으로
깨어난다](https://github.com/yansfil/pr-assets/blob/main/hide/session-readers-opencode/023cd90/opencode-exact-wake.png?raw=true)

## Review

- **판단해 주세요**: DB를 열 수 없을 때 OpenCode 행만 빠지고 화면에는 아무것도 띄우지 않으며 core
로그(`sessions.store_unreadable`)에만 남깁니다(원칙 #13).
- **판단해 주세요**: 그 refusal은 기존 ProjectSessions 답의 한
행(`{"agent","store_refused"}`)으로 옵니다. 옛 core는 refused row 하나로 셉니다.
protocol bump 없이 택한 방식입니다.
- **조심해서 볼 파일**: `hide-agent-adapter/src/lib.rs` - Herdr/core ownership.
`requires_native_proof`가 Grok/Cursor/Pi/omp gate를 그대로 덮는지.
- **조심해서 볼 파일**: `hide-session/src/opencode.rs` - failure path. 모든 SQL은
progress handler 작업 상한과 행 크기 가드 아래에서 돕니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/memory.rs` - Memory 분석이 Memory
reader 있는 agent만 읽도록 바뀌었습니다(OpenCode, Cursor 제외).
- **비용 검토**: 상시 경로 추가 없음. 읽기는 기존 label/activity 요청 때만, 한 번에 1 MiB,
message 200개, part 512개, SQL step 상한 안에서 끝납니다.

## Evidence

- **확인한 것**: sealed verify PASS(cargo test 249 s, lint 4 s), 최종 head에서
clippy workspace clean, nextest 10 crate 3463 통과.
- **확인한 것**: e2e `session-readers.spec.ts` 8/8. DB를 쓰는 OpenCode 대역으로 제목,
child 제목 제외, question 대기/해제, 재우기, `-s <id>` 깨우기, DB+WAL 무변경.
- **확인한 것**: 설치된 OpenCode 1.18.30 실물(로그인 없음, private HOME과 격리 Herdr)로
`-s <id>` 정확 재개, `-s <id> --fork`가 parent 없는 새 root, 실제 WAL DB 읽기.
- **확인한 것**: web typecheck/lint/test 1312 통과, design contract 통과.
- **확인하지 못한 것**: `agent-live-check.py --agents opencode`는 도구 sandbox에서
agent 시작이 timeout, 모든 장면 not_tested, verdict unknown.
- **확인하지 못한 것**: windows check의 `web/e2e/windows-sockets.unit.ts`가
powershell 30 s ETIMEDOUT로 실패(이 PR과 무관, quarantine #880), 실패 잡만 재실행.
- **확인하지 못한 것**: 로그인한 실제 모델 턴의 question 호출, 설치된 OpenCode의 Herdr 세션 자동
보고, 패키지 앱 UI, 실제 폰.

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

- PRD: `agents/prd/session-readers-opencode/prd.md` (sha256
25e35a2b30c918aa5a78c796d0be819bd0eb3de537f002e48a40fc220126b479)
- Base f2ad76a → head 023cd90, verified 2026-10-09T13:20:21.197Z: PASS
- Verification report:
`agents/runs/session-readers-opencode/verification-report.json` and
`agents/runs/session-readers-opencode/verification-report.md`; source
fingerprint
76065e2461def954a490d75420ab1e8fde62f12c7ee7ba0e7ed65a0bdae735b2
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews (advisory):
- Fidelity+Code 1차 (1e7ab02): Fix now 8건 모두 수정. catalog가 DB 실패로 전체 이력을
비우던 것, SQL work cap 누적, pending question, Memory 분석 정지, 폰 newest page
누락, 건너뛴 message의 witness, question 크기 admission, 문서.
- follow-up (fb39ca3): Fix now 3건 수정. DB 단위 실패의 진단 누락(store refusal
row + `sessions.store_unreadable`), json_valid 앞 크기 가드, budget admission
테스트.
- follow-up (0c82c74): Fix now 1건 수정. NotFound 이외 stat 오류를 missing으로
읽던 것. page cap 초과 refusal row도 함께 수정.
- follow-up (merge 후 최종 head 023cd90): Fix now 없음. Low 1건(mode 000 테스트가
root runner에서 실패할 수 있음)은 Follow-up.
- Follow-up: 로그 per-poll 중복, catalog cap에서 refusal 분리, stat 두 번의 race,
OpenCode 3 s follow-up poll 없음(설계), Cursor Memory 제외 테스트, Factory guard
테스트에 Grok/Cursor 추가, 다음 protocol bump에서 typed `{sessions, refusals}` 답.
- Evidence: none registered separately.
- Changed paths: 51 (see Files changed)
- Delivery: mode pr, branch `feat/session-readers-opencode`, base `main`

</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