Skip to content

fix: link a session to a pull request only when it made, named or branched on it - #1649

Merged
yansfil merged 3 commits into
mainfrom
fix/pr-sessions-direct-reference
Oct 23, 2026
Merged

yansfil merged 3 commits into
mainfrom
fix/pr-sessions-direct-reference

Conversation

@yansfil

@yansfil yansfil commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Summary

PR 카드 타임라인에 그 PR과 상관없는 세션이 붙어 있었습니다(#1628에 연습 모드 리뷰 세션 9개).
원인은 도구 출력에 PR 주소가 지나가기만 해도 "작업한 세션"으로 묶은 것입니다. 브라우저 탭 목록을 읽은 세션에 열려 있던 #1628 탭 주소가 찍혀 그대로 붙었습니다.
이제 세션은 세 경우에만 PR에 붙습니다: PR이 만들어지는 순간 주소를 출력했을 때(만든 세션), 그 브랜치에서 일했을 때, 도구 호출이 그 PR을 직접 가리켰을 때(gh pr view/diff/review/comment/merge N, gh api .../pulls/N, PR 주소 열기). 리뷰 세션은 그래서 남습니다.

스크린샷 없음: 화면 코드는 바뀌지 않았고, 타임라인에 붙는 세션을 정하는 core와 세션 리더만 바뀝니다.

Review

  • 판단해 주세요: 바뀐 기준은 "PR을 직접 가리키는 호출"입니다. aside repl "openTab('…/pull/N')"처럼 문자열 속 주소, python3 scripts/premerge-check.py N처럼 gh가 아닌 명령, gh pr view <브랜치이름>은 연결하지 않습니다. 넓히고 싶은 게 있으면 말씀해 주세요.
  • 판단해 주세요: 이전 기록(v9)을 열면 최근 90일 세션 파일을 처음부터 한 번 다시 읽습니다. 그래야 이미 기록된 리뷰 세션이 연결을 잃지 않습니다. 첫 채움 표시는 켜지지 않습니다.
  • 조심해서 볼 파일: herdr-core/src/links/store.rs - pr_lines의 연결 규칙, 스키마 10 마이그레이션, project_paths가 배우는 폴더(이제 만든 세션의 폴더만).
  • 조심해서 볼 파일: hide-agent-hooks/src/spawn_guard.rs → hide-shell/ - spawn guard의 셸 파서를 동작 변경 없이 새 crate로 옮겼습니다(훅 테스트 387개 통과). 세션 리더가 같은 파서를 씁니다.
  • 조심해서 볼 파일: hide-session/src/named_prs.rs - 번호만 있는 호출의 저장소 판단. cd와 도구 작업 폴더를 따라가고, 따라갈 수 없는 cd(~, -, 변수)면 연결하지 않습니다.
  • 비용 검토: 링크 워커(상시 작업)의 읽기마다 도구 호출 입력을 한 번 더 파싱합니다. 세션당 200개, 한 번 읽을 때 200개까지만 기록하고 넘으면 진단 로그(session.named_limit, read.named_capped)를 남깁니다. Mutex<Runtime> 밖에서만 일합니다. 업그레이드 직후 한 번 90일치를 다시 읽는 것은 처음 채울 때와 같은 속도 제한(20 ms 일하고 30 ms 쉼)을 따릅니다.

Evidence

  • 확인한 것: 7개 에이전트 형식 모두 같은 검사를 통과합니다(Claude Code, Codex, Grok, Pi, omp, agy, OpenCode 1.18/2.0). 각 fixture의 bash scripts/ship.sh 호출은 PR 12를 "봄"으로만, 같은 호출을 gh pr view 12로 바꾸면 "가리킴"으로 읽힙니다(hide-session/tests/it/links.rs).
  • 확인한 것: store 테스트 3개.
    • 탭 목록을 읽은 세션은 붙지 않고, 리뷰 세션은 Worked, 만든 세션은 Created로 붙습니다.
    • 번호만 있는 호출은 실행된 폴더의 프로젝트 PR에만 붙습니다.
    • v9 기록을 열면 cursor·listed_at이 초기화되고, 다시 읽은 뒤 리뷰 세션이 붙습니다.
  • 확인한 것: 셸 해석 단위 테스트 6개. heredoc 본문, 커밋 메시지, 편지 본문, gh pr list/create는 아무것도 가리키지 않는 것으로 읽힙니다.
  • 확인한 것: 워크스페이스 전체 cargo nextest에서 5799개 중 5798개가 통과했습니다. 실패한 1개(session_sync::...a_timed_out_agent_read_keeps_the_stream...)는 이 변경과 무관한 timeout 테스트이고, 단독 재실행에서 통과했습니다. clippy -D warnings, fmt --check, hakari도 통과했습니다.
  • 확인하지 못한 것:

The spawn guard's lexer reads a shell line the way a shell does (words,
quotes, redirections, heredoc bodies, lists). The session reader needs the
same reading for the calls a session file recorded, and hide-session cannot
depend on the hook crate, so the lexer moves to hide-shell, which both use.
…nched on it

A tool's output prints whatever it lists, so a session that read the
browser's open tabs, `gh pr list` or a log sat on every pull request whose
address passed by, as if it had worked on it. A printed address now counts
only as the session's making of the pull request, when it is printed as
GitHub makes it. A session works on a pull request when it worked on its
branch or one of its tool calls named it: a `gh pr` command given its
number or address, a `gh api` path under its `pulls/<number>`, a command or
tool that opens its address, or a GitHub tool given its owner, name and
number. Every format Hide reads passes its calls in, and a number named
alone belongs to the project whose folder the call ran in.

The link record moves to version 10 with the named pull requests, and an
older record reads its last 90 days again once so sessions it already holds
find theirs.
@yansfil
yansfil merged commit a3a3920 into main Oct 23, 2026
36 checks passed
@yansfil
yansfil deleted the fix/pr-sessions-direct-reference branch October 23, 2026 18:38
yansfil added a commit that referenced this pull request Oct 23, 2026
…the right lane (#1643)

Related: #1632 (base), mission-2 ch6

## Summary

연습 창에 6편 "프로젝트 한눈에"를 더합니다.
에이전트가 일하는 옆에서 오른쪽 레인을 프로젝트 도구로 열고, 현황 타일 네 개와 할 일을 읽습니다.
이어서 ⇧⌘E 탐색기에서 에이전트가 바꾼 파일을, ⇧⌘L Memory에서 결정·규칙·교훈 카드를 보고 ⌘E로 닫습니다.
PR 목록은 셸에서 사이드바(⇧⌘R)에 있어 열지 않고, 현황의 PR 타일과 할 일의 PR 두 줄만 보여 줍니다. 그 PR
제목에는 `예시` 칩이 붙습니다.
Hide AI 모델 고르기는 운영자 결정대로 뺐습니다(설정 화면 몫).

리뷰 뒤 고친 것:
- 1단계에서 학습자가 탐색기를 먼저 열어도 ⏎가 프로젝트 도구에 닿습니다. 단계가 ⌘E 대신 프로젝트 도구 아이콘을 누르기
때문입니다(⌘E는 마지막에 보던 도구를 되살리는 셸 규칙 그대로). ⌘E는 닫기 단계에서 가르칩니다.
- Memory 단계에서 Memory가 이미 열려 있어도 ⏎가 멈추지 않습니다(아이콘 누르기, ⇧⌘L도 그대로 안내).
- 타일, PR 줄, 파일을 열어 보라던 문구를 "Hide에서는 열리지만 이 연습은 보기만 한다"로 고쳤습니다(네 언어).
- 닫기 문구가 ⌘E로 닫으면 보던 도구로, ×로 닫으면 탐색기로 다시 열린다는 셸 규칙을 말합니다.
- 레일의 핀이 실제처럼 켜지고 꺼집니다. 끄면 레인이 에이전트 위에 떠서 그려집니다.

![1단계: ⏎가 프로젝트 도구 아이콘을 눌러, 다른 도구를 먼저 열었어도 프로젝트에
닿습니다](https://github.com/yansfil/pr-assets/blob/main/hide/practice-ch6/a370228/pr-lane.png?raw=true)
![현황: 여기서는 타일이 열리지 않고 보기만 한다고
말합니다](https://github.com/yansfil/pr-assets/blob/main/hide/practice-ch6/a370228/pr-status.png?raw=true)
![닫기: ⌘E와 ×가 다시 열 때 다르게 돌아오는 규칙을
말합니다](https://github.com/yansfil/pr-assets/blob/main/hide/practice-ch6/a370228/pr-close.png?raw=true)

## Review

- **판단해 주세요**: 1단계가 ⌘E 대신 프로젝트 아이콘 누르기로 바뀐 것(말풍선은 "표시된 곳을 누르세요", 퀘스트 카드에
키 없음). ⌘E는 8단계 닫기에서 처음 키캡으로 나옵니다.
- **알려진 한계**: 읽기 단계(현황, 할 일, 바뀐 파일, 카드)에서 학습자가 레인을 직접 닫거나 다른 도구로 바꾸면 ⏎가
대상 없이 다음 단계로 넘어갑니다. 모든 장의 읽기 단계에 해당하는 공용 문제라, 1.0.0 뒤 `needs` 필드 같은 공용
코치 규칙으로 고칩니다(Conductor 결정). 탐색기 단계에 탐색기가 이미 열린 채 들어오면 ⏎가 두 번(닫고 열기)
필요합니다.
- **조심해서 볼 파일**: `web/src/practice/worlds/project.ts` - `workspace_view`
패치를 core(`apply_workspace_view`, `show_tool`)와 같게 따랐는지(이번에 `pinned` 추가),
현황 숫자가 `tally/project_status.rs` 규칙과 맞는지.
- 공용 파일은 이 PR에 없습니다. 세계가 탐색기 목록, Git 변경, Memory를 보내는 `WorldFrames` 칸 3개는
practice-foundation에 있습니다(bc6d9b7).

## Evidence

- **확인한 것**: 개발 서버에서 en/ko/zh-CN/ja 모두 ⏎만으로 9단계를 끝까지 진행(lane > status >
todo > explorer > changes > memory > cards > close > end).
- **확인한 것**: 리뷰의 이탈 경로가 ⏎로 회복됨. 1단계에서 탐색기를 먼저 열고 ⏎ 한 번에 프로젝트 도구로 status
단계 도착. 바뀐 파일 단계에서 Memory를 먼저 열고 ⏎로 Memory 단계에 들어가도 ⏎ 두 번에 cards 도착.
- **확인한 것**: 핀이 on/off로 바뀌고 다시 on. Memory를 ×로 닫은 뒤 ⌘E를 누르면 탐색기가 열려 닫기
문구와 맞음.
- **확인한 것**: web typecheck·lint·build, web test 2098
passed(`worlds.test.ts` 포함), desktop typecheck,
`check-design-contract.mjs` 통과.
- **확인하지 못한 것**: `web/e2e/practice.spec.ts`를 로컬에서 돌리지 못했습니다. 복제해 쓸 hided
디버그 빌드가 foundation 병합 전 Rust(#1641, #1649, `hided-ws.schema.json` 변경
포함)로 만들어져 지금 head와 달라서, 지시대로 CI `verify`로 대신합니다.
- **확인하지 못한 것**: 패키지된 데스크톱 앱의 실제 연습 창, Windows·Linux 단축키 표기의 화면.

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

- base: practice-foundation 5bab3e1, head: a370228
- local gates: web typecheck/lint/test(246 files, 2098 passed, 1
skipped)/build, desktop typecheck, design contract
- browser: vite dev server,
`/?practice=1&lang={en,ko,zh-CN,ja}&host=electron&platform=darwin`,
⏎-only walk and deviation paths
- e2e `e2e/practice.spec.ts`: CI only (local hided clone differed from
head's Rust)

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