Skip to content

Read native Cursor sessions across existing workflows - #877

Merged
yansfil merged 11 commits into
mainfrom
feat/session-readers-cursor
Oct 9, 2026
Merged

yansfil merged 11 commits into
mainfrom
feat/session-readers-cursor

Conversation

@yansfil

@yansfil yansfil commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Related: #869, #870, #871

Summary

  • Read ordinary Cursor chats from native SQLite/protobuf storage with incremental paging and native identity checks.
  • Feed existing generated labels, archive/body search and desktop/phone conversation details from one shared reader.
  • Sleep/wake default-root sessions with the exact native ID; refuse known custom roots and duplicate IDs before effects.
  • Preserve recorded minute timestamps and absent facts; keep fork, tools, native titles and Memory insertion disabled.
  • Keep native files read-only and cap database work, graph traversal, discovery and returned content.

Synthetic Cursor archive: assistant body search and native detail; unknown message time stays hidden.

Synthetic duplicate-root fixture: Sleep refuses before pane closure; the live Cursor row remains.

Review

  • Judgment: known-root checks cannot certify later native exec; shell exports may select other history or fail.
  • Files to watch: hide-session/src/cursor.rs (identity/caps), herdr-core/src/live.rs (lifecycle failures).
  • Cost: lifecycle-only root audit caps directory opens at 64, entries at 10,000 and retained path bytes at 8 MiB.
  • Follow-up: inherited old-attempt pane cleanup remains unresolved in A spawn retry can close an unrelated idle shell whose pane id an earlier failed attempt used #874; its separate fix follows this PR.

Evidence

  • Confirmed: native graph fixtures cover paging, immutable source bytes, replacement refusal and consumer dispatch.
  • Confirmed: isolated browser labels, archive/body search, detail, exact wake arguments and pre-close root refusal.
  • CI repair: shared test-binary placement and isolated default-root fixtures preserve assertions and guards.
  • Checks: full Rust tests, web/desktop typecheck, lint, unit tests and builds, plus workspace Clippy passed.
  • Limits: authenticated continuation, installed desktop, physical phone and later native roots remain unverified.
  • Images: synthetic fixture observations on earlier reviewed heads; exact provenance remains in the folded record.
Verification record
  • PRD: agents/prd/session-readers-cursor/prd.md (sha256 57aa6f1c78f5603500fde8af92e25ff5670d1f2877df2f30eea5940356ef193d)

  • Base 383bbd2 → head 5a8c9d8, verified 2026-10-09T12:33:49.268Z: PASS

  • Verification report: agents/runs/session-readers-cursor/verification-report.json and agents/runs/session-readers-cursor/verification-report.md; source fingerprint bf8641a0b0901418feb4be3a925b3099e4a943904c10f22e15f123f91ecbc168

  • Suites:

    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-web.sh (exit 0)
    • S3: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Code: reviewed 5a8c9d81a01ff1a50f18670e4718f2d442c01dce; full source coverage carried through the actual current-head fixture follow-up and sealed evidence closure; test layout/default-root isolation preserve every prior assertion and guard. Both technical P1s remain: later unknown exec-root selection and A spawn retry can close an unrelated idle shell whose pane id an earlier failed attempt used #874 cleanup. Follow-ups: proof/effect race, current connector and ownership fences.

  • Code report identities (current source follow-up / sealed closure): d5c4db32067c89ec18ed5449c5b0566b19abc3513d7b94ddfff26402b392264f / 4051b5f03ab53c3b4b12e4ab98280477bbc62d579a64043d183f389a242906c5.

  • Fidelity: reviewed 5a8c9d81a01ff1a50f18670e4718f2d442c01dce; complete canonical parent/child and negative-capability coverage plus same-head evidence closure; independent resume/helper expectations and original consumer/Sleep assertions pass without contract reduction. A spawn retry can close an unrelated idle shell whose pane id an earlier failed attempt used #874 separate repair and unknown shell roots retain accepted dispositions. Follow-ups: phone currentness, remote replacement and parent aggregate.

  • Fidelity report identities (current source follow-up / sealed closure): e37196dd07258d927a2b733303e6708eda3d0bc3b95c4e80d8f0678c7571a9a5 / eeef201a96e16100457b4fc766419b62dea248288ed1c7f423c3231bc89d9bc0.

  • Security: reviewed 5a8c9d81a01ff1a50f18670e4718f2d442c01dce; complete source/privacy coverage, bounded test-child impact and actual sealed evidence closure; all36 material identities match, with no new finding. Actual exec-root equivalence and inherited past-attempt cleanup remain technically unclosed; authorization is not fix credit. Follow-ups: bounded DTO allocation and non-atomic proof/effect interval.

  • Security report identities (current source follow-up / sealed closure): a1021c7daabcc0f77461f2ac13fd619d91b1a7e879088afd18d2b02923ea1a83 / b60e21c12083c1bcb6777dff24fe7835ed2ac7b2eed4278a8f5d84e5b4f07013.

  • Evidence: 33 registered (1 api, 29 log, 1 browser, 2 screenshot); paths are local to the run directory

    • agents/runs/session-readers-cursor/native-start-resume.json
    • agents/runs/session-readers-cursor/cli-measure/negative-fork.json
    • agents/runs/session-readers-cursor/cli-measure/help.json
    • agents/runs/session-readers-common-v2/cursor-core-journey-2.log
    • agents/runs/session-readers-common-v2/cursor-web-native-3.log
    • agents/runs/session-readers-cursor/manual-browser-3/aside-body-search-complete.log
    • agents/runs/session-readers-cursor/manual-browser-3/cursor-archive-body-search.png
    • agents/runs/session-readers-cursor/manual-browser-3/cleanup.json
    • agents/runs/session-readers-common-v2/cursor-opencode-worker-before-fix.log
    • agents/runs/session-readers-common-v2/cursor-opencode-worker-fixed.log
    • agents/runs/session-readers-common-v2/cursor-p7-core-integration.log
    • agents/runs/session-readers-common-v2/cursor-p7-reader-integration.log
    • agents/runs/session-readers-common-v2/cursor-p7-integration-clippy.log
    • agents/runs/session-readers-common-v2/cursor-root-guard-reader-2.log
    • agents/runs/session-readers-common-v2/cursor-root-guard-browser-1.log
    • agents/runs/session-readers-common-v2/cursor-root-guard-browser-2.log
    • agents/runs/session-readers-common-v2/cursor-root-guard-clippy-1.log
    • agents/runs/session-readers-common-v2/cursor-root-guard-web-static-1.log
    • agents/runs/session-readers-common-v2/cursor-root-guard-web-static-2.log
    • agents/runs/session-readers-cursor/manual-browser-4/aside-refusal-final.log
    • agents/runs/session-readers-cursor/manual-browser-4/cursor-duplicate-sleep-refusal.png
    • agents/runs/session-readers-cursor/manual-browser-4/cleanup.json
    • agents/runs/session-readers-common-v2/cursor-root-main-integration-1.log
    • agents/runs/session-readers-common-v2/cursor-sealed-node-repro-1.log
    • agents/runs/session-readers-common-v2/cursor-sealed-web-repro-1.log
    • agents/runs/session-readers-common-v2/cursor-sealed-node-fixed-1.log
    • agents/runs/session-readers-common-v2/cursor-sealed-web-fixed-1.log
    • agents/runs/session-readers-cursor/delivery/ci-policy-failure.log
    • agents/runs/session-readers-common-v2/cursor-ci-layout-policy-1.log
    • agents/runs/session-readers-common-v2/cursor-ci-layout-rust-1.log
    • agents/runs/session-readers-cursor/delivery/ci-rust-failure.log
    • agents/runs/session-readers-common-v2/cursor-ci-root-repro-1.log
    • agents/runs/session-readers-common-v2/cursor-ci-root-fixed-1.log
  • Changed paths: 56 (see Files changed)

  • Delivery: mode pr, branch feat/session-readers-cursor, base main

  • Verification JSON SHA256 6780ac85d900e4993e0913314f89c737eb2745b7f41f703f8a2fd265506eabae; input fingerprint 5bcc6113b536b656e446e3ebf5c219b80b808469d2c35b645afc316dfbd00361; both post-verification drift flags false, every command mutatedTree=false.

  • S1: 3,789 passed/0 failed/23 existing ignored; S2: web141 files/1,311 passed/1 existing skipped, desktop17 files/162 passed/4 existing skipped, both typecheck/lint/build; S3: fmt/workspace all-target Clippy warnings denied. Existing jsdom/React-act/bundle warnings remain despite exit0.

  • Registry: 36 identities total,33 unchanged qualified manual objects and three automatic command logs replaced by current PASS. S1 SHA256 df7dd0c42987a9e4825b16bdb44a4750c933b403f492352c4b3949f573c6a5bb; S2 469e0998a9260f6330e93929dd62cc11732feff2c12a748ca274c12276b42b6d; S3 b8cda8538e555660c38b5c7b7be18933c1d36bc274190d4a2604cb1301f1dd6f.

  • Preserved earlier sealed attempts: genuine helper-feature/resume expectation FAIL at e373ce145, retained report SHA256 c8a01473a03d39676ff9139d516259690e95322a3bef95946d170c9c7341d623; corrected 987e4dd6f PASS retained at SHA256 4b5421c8d6844526c223fc2cf201311f18a9d97c4e3f2a6ccb8e265e6516d578. No skip, suite exclusion, timeout or production guard was relaxed.

  • First PR CI 37927765454 on 987e4dd6f completed FAIL: existing single-integration-binary policy plus two Rust fixture failures; all other lanes passed, with one existing planned skip. Actual failed-job logs remain: policy SHA256 ef544218c620c27fcd7189ff7d46cd314e79340e251882c64c98e72f3a459f1e; Rust 445f578cd31f451e9824333a83751d172e26d9b71f4dd8834b2019b4329b2240.

  • CI corrections: 640567fed moves the unchanged environment audit into tests/it, adjusting only its relative include; independent policy3/Rust audit1 pass. 5a8c9d81 isolates two default-root positives in owned self-children before startup capture, preserving their complete bodies and original5s close assertion. The same private nondefault XDG reproduces FAIL2 before and PASS3 after, including unchanged custom/XDG/duplicate/invalid-root negatives. The actual first CI runner's override value is unconfirmed; this demonstrates fixture sensitivity, not exhaustive runner attribution. Each child retains the existing60s run/drain deadline, up to10s exit-confirmation cleanup and64KiB output/stream, without a universal wall-clock or abrupt-owner guarantee.

  • Browser provenance: archive body search and native detail screenshot came from the reviewed candidate through 7a723749; duplicate-root Sleep refusal image came from root-guard source 22328f5f7 before main integration. Both use synthetic native storage, an isolated HOME and private Herdr/hided; screenshots show only the product viewport. Earlier automated browser journeys passed 6/6 and guarded-root regression passed 7/7; original failure logs remain qualified.

  • Native provenance: installed Cursor 2026.10.01-e373342 accepted first-prompt and exact resume argv under private Herdr but reached login only; --fork was rejected with exit1. Native database bytes stayed unchanged. This is not authenticated continuation acceptance.

  • Unrun limits: actual later shell execution-root equivalence, authenticated continuation/native-ID reporting, installed packaged desktop, physical phone, current remote/helper replacement, native Windows/Linux execution, idle/driven performance and RSS. Retained24 integration remains explicitly ignored pending actual payload; earlier independent compatibility fixtures retain their original scope. Parent aggregate acceptance waits the remaining reader and final integration.

@yansfil
yansfil merged commit e1f86af into main Oct 9, 2026
22 checks passed
@yansfil
yansfil deleted the feat/session-readers-cursor branch October 9, 2026 13:02
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