Skip to content

fix(hooks): recover Codex env sessions#72

Merged
wasabeef merged 11 commits into
mainfrom
feat/cmux-session-resolver
May 12, 2026
Merged

fix(hooks): recover Codex env sessions#72
wasabeef merged 11 commits into
mainfrom
feat/cmux-session-resolver

Conversation

@wasabeef
Copy link
Copy Markdown
Owner

@wasabeef wasabeef commented May 12, 2026

Pull Request

Summary

Recover Agent Note recording for Codex sessions running inside agent-hosted terminals such as cmux, while keeping the stricter v1 stale-session safeguards.

This PR fixes the path where CODEX_THREAD_ID is available but .git/agentnote/session is stale, missing, or points at a repo-local prompt-only session. The environment fallback now resolves the Codex transcript directly, streams large transcript files, selects only transcript rows that existed by the HEAD commit time, and ignores stale local prompt logs that would otherwise block the fresh transcript.

It also restores v0.2-style commit-level attribution for trusted Codex transcript edits: exact files_touched still requires exact transcript/file evidence, but files and AI Ratio can recover from the verified Codex transcript when the commit was made from the current Codex environment.

What Was Broken

  • cmux can preserve CODEX_THREAD_ID even when Agent Note's repo-local active-session pointer is stale.
  • The previous v1 guards correctly avoided stale pointer hijacking, but became too strict for legitimate Codex environment sessions.
  • Large Codex transcripts could fail before any note was written because the adapter eagerly read the full file.
  • git notes add failures could be swallowed, making a record attempt look successful while the PR Report still showed .
  • Late debug or verification prompts could be included when backfilling an older commit from a long transcript.

Fixes

  • Trust CODEX_THREAD_ID only for the environment fallback path, not the stale active-session pointer.
  • Stream Codex JSONL transcripts instead of loading the whole transcript into memory.
  • Bound fallback prompt selection to the HEAD commit timestamp plus a small tolerance.
  • Prefer transcript rows that cover the committed files when the environment transcript is fresh.
  • Surface git-note write failures as warnings instead of silently succeeding.
  • Keep files_touched exact-only while allowing broader verified commit-level attribution for AI Ratio.

Type of Change

  • Fix
  • Feature
  • Documentation
  • Refactor
  • Test
  • CI / release

Checklist

  • I kept structural changes separate from behavior changes where practical.
  • I added or updated tests for behavior changes.
  • I updated README / docs / website content when user-facing behavior changed.
  • I rebuilt generated bundles when bundled source changed.
  • I ran the relevant checks locally.

Verification

  • npm run build
  • npm run typecheck
  • npm run lint
  • npm test -- --test-name-pattern "environment fallback|shell-only Codex|transcript-driven Codex gives|mid-session Codex|stale local prompts|gitSafe|writeNote"
  • npm test (451 passed)
  • npm run build --prefix website
  • git diff --check
  • Manual dist CLI fallback against the current Codex transcript, including git note readback via agent-note show

Notes for Reviewers

The fallback remains intentionally conservative. Plain git hooks still do not trust prompt-only active sessions. The broader recovery only applies when the current process exposes a valid Codex environment session and the transcript evidence is bounded to the commit being recorded.

🧑💬🤖 Agent Note

Total AI Ratio: ████████ 100%
Model: gpt-5.4

Commit AI Ratio Prompts Files
6efa40c fix(hooks): recover Codex env sessions
8a61c4a chore(cli): update development dependencies
3b7d244 fix(record): restore Codex commit-level attribution █████ 100% 3 AGENTS.md 🤖, CLAUDE.md 🤖, architecture.md 🤖, agent-skill.md 🤖, agent-support-policy.md 🤖, investigations.md 🤖, cli.js 👤, codex.test.ts 🤖, record.test.ts 🤖, record.ts 🤖, agent-support.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, agent-support.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖, data-and-privacy.mdx 🤖, how-it-works.mdx 🤖
0342220 fix(record): harden Codex env transcript fallback █████ 100% 1 architecture.md 🤖, investigations.md 🤖, cli.js 👤, codex.ts 🤖, init.test.ts 🤖, record.ts 🤖, record.ts 🤖, storage.test.ts 🤖, storage.ts 🤖, git.ts 🤖
53261dd fix(record): address fallback review findings █████ 100% 2 AGENTS.md 🤖, CLAUDE.md 🤖, architecture.md 🤖, package-lock.json 🤖, cli.js 👤, package.json 🤖, init.test.ts 🤖, init.ts 🤖, record.ts 🤖, storage.test.ts 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖
3c7be03 fix(record): bound env fallback transcript window █████ 100% 1 architecture.md 🤖, investigations.md 🤖, cli.js 👤, init.test.ts 🤖, record.ts 🤖
c23bdda fix(record): tighten env fallback attribution █████ 100% 1 AGENTS.md 🤖, CLAUDE.md 🤖, architecture.md 🤖, investigations.md 🤖, cli.js 👤, codex.test.ts 🤖, codex.ts 🤖, types.ts 🤖, init.test.ts 🤖, record.ts 🤖, record.ts 🤖
2baa245 docs(record): clarify env fallback bounds █████ 100% 1 investigations.md 🤖, record.ts 🤖
008d08e fix(record): harden env fallback review cases █████ 100% 1 architecture.md 🤖, cli.js 👤, init.test.ts 🤖, record.ts 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖
675213c docs(website): clarify transcript attribution privacy █████ 100% 1 data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖, data-and-privacy.mdx 🤖
6af2d1a docs(website): polish pt-br privacy wording █████ 100% 1 data-and-privacy.mdx 🤖
💬 Prompts & Responses (12 total)

3b7d244 fix(record): restore Codex commit-level attribution

🧑 Prompt
v1 にいたるまでに変更したロジックがもうじゃまになるなら戻しても構いませんし。有用であれば仕組みを使いつつ v0.2 系のレベルにしてください

🤖 Response
了解です。今回は v1 の安全装置を全部捨てるのではなく、「関係ない古い session を拾わない」「stale pointer を信用しない」といった有用な guard は残し、その guard を通過した current session / transcript については v0.2 系のように files / AI Ratio まで広く出す形にします。
テスト期待値も「prompt-only note = AI Ratio 0」から「current Agent tool work = commit files を AI 扱い」に変えました。次に focused test を回して、既存の human-only skip や split commit の guard が壊れていないかを見ます。
フルテストは 443 件すべて通りました。ここから docs 側に「v1 の safety guard は残すが、guard を通った Agent 作業は v0.2 系のように commit-level AI attribution へ戻す」と記録します。
重要な点に気づきました。`com…

🧑 Prompt
シミュレーションで確認することも忘れずに

🤖 Response
シミュレーションも含めて確認します。ここは「拾えるように戻す」だけだと危ないので、既存の 100+ ケースに加えて、commit-level attribution がどのケースで有効になるべきかもテスト表現として固めます。
シミュレーションに「どのケースで commit-level attribution を復帰させるか」を追加しました。これで単に note が残るだけでなく、v0.2 系に戻したい価値である AI Ratio / files が戻るケースも固定できます。
Focused simulation / regression は通りました。ここからフル検証に進めます。build で dist/cli.js を同期してから、typecheck / lint / full test / website build をまとめて確認します。
フル検証で lint だけ formatter 指摘が出ました。ロジックではなく 1 行の整形なので直して、走行中の full test も最後まで確認します。
フルテスト 443 件も通りました。最後に diff の形と未追跡の混入を確認…

🧑 Prompt
そのうえで PR desc 更新して push して

🤖 Response
10 回レビューの途中で、いまの差分に大きな破綻は見えていません。次に PR 情報を取得して、レビュー結果を PR description に反映し、コミットして push まで進めます。
PR description 更新に common:pr-update の流れを使います。間違って存在しないパスを一度叩きましたが、作業ファイルには影響ありません。仕切り直して必要な手順だけ読みます。
10 観点レビューの結果、方針はこのままで良いと判断しました。小さな test simulation のモデルズレだけ先に直して再検証済みなので、これをコミットして push します。
コミットできました。今のコミットで note が作られたかも確認しつつ、push と PR description 更新に進めます。
一点、重要な確認で 3b7d244 自体はまだ note なしでした。これは「commit-level attribution の復帰」以前に、post-commit が現在の Codex session を見つけられていない可能性があるので、push 前に原因だけ切り分けます。…

0342220 fix(record): harden Codex env transcript fallback

🧑 Prompt
10回以上もレビューしてバグがないと言っていたはずなのにバグがあったということは
レビュー観点が足りなかった可能性があります。100%断定できるまで100回でもレビューをしてプッシュしてください。

なお、プッシュ後に1分待って PR に出力されたプロンプトを確認して、問題が発生しなくなるまでこの作業を自律的に行ってください。

🤖 Response
その指摘は正しいです。さっきの 10 回レビューは「recordCommitEntry の中の attribution 境界」には効いていましたが、「実際の post-commit → fallback-env → stale local prompts.jsonl → fresh transcript」という end-to-end 経路をレビュー観点に入れ切れていませんでした。ここからはその観点をテスト化して、PR 出力まで確認するループに切り替えます。
前回の見落としは「fresh な Codex transcript はあるのに、.git/agentnote/sessions 側の古い prompt window が邪魔して fallback が無効化される」ケースを end-to-end で見ていなかったのが核心です。ここからはそのケースをテストで固定して、実際にこの PR の出力まで確認するところまで閉じます。
いま確認したところ、問題の再現テスト自体はすでに差分に入っています。次は「そのテストが本当に今回の穴を塞いでいるか」と「実 PR の出力まで復旧するか」を、ビルド…

53261dd fix(record): address fallback review findings

🧑 Prompt
@packages/cli/package.json を最新に更新してコミットして

🤖 Response
packages/cli/package.json の現状を確認して、何が「最新」に追いついていないかを特定してから最小差分で直します。今の PR ブランチ上で追加 commit まで進めます。
agent-note 自体の npm latest は 1.0.0 で一致していました。更新対象は packages/cli/package.json の devDependencies で、現時点で古いのは @biomejs/biome, @types/node, publint です。package-lock も合わせて更新します。
npm install --package-lock-only で lock まで更新できましたが、Biome が元の exact pin から ^ に変わっていたので、既存方針に合わせて 2.4.15 の exact pin に戻します。
package metadata は整いました。node_modules も lock に合わせて更新してから、CLI の最低限チェックを走らせます。
依存は最新化でき、`npm…

🧑 Prompt

coderabbit-review
/Users/a12622/git/context-history/.codex/skills/coderabbit-review/SKILL.md

name: coderabbit-review
description: Fetch CodeRabbit review feedback for the current PR, classify actionable items, implement fixes, verify them, and resolve only addressed review threads.

CodeRabbit Review Workflow

Use this skill when the task asks to address CodeRabbit comments, review CodeRabbit feedback, or resolve CodeRabbit threads.

Fetch

Determin…

🤖 Response
coderabbit-review skill を使って、現在 branch の PR を特定し、未解決の CodeRabbit review thread を primary action list として確認します。修正できるものは最小差分で直し、直した thread だけ resolve します。
PR #72 を確認しました。未追跡の docs/blog/ は今回の対象外なので触らず、CodeRabbit の未解決 thread だけ見ます。
CodeRabbit の未解決 thread は 7 件あります。内訳は実装上の重要指摘が 3 件、test 安定性 1 件、website 翻訳の明確化 4 件です。まず実コードを確認して、valid なものだけ直します。
確認したところ、--fallback-env の hook template は本当に $${ENV_CODEX_THREAD_ID} になっていて valid issue です。CODEX_THREAD_ID は実運用で UUID v7 形式なので、v4 固定ではなく「UUID 形式」に締めるの…

3c7be03 fix(record): bound env fallback transcript window

🧑 Prompt
README AGENTS.md CLAUDE.md docs/ website などドキュメント類の更新が漏れていないように確認しておいて

🤖 Response
了解です。README / AGENTS / CLAUDE / docs / website を横断して、今回の修正で説明がズレていないかを確認します。特に CODEX_THREAD_ID fallback、session id validation、shell command output の privacy 文言、Node 20 typings の整合性を見ます。
ドキュメント横断チェックも終わりました。README は public user 向けの quickstart/feature なので内部 fallback 詳細は不要、AGENTS / CLAUDE / docs/architecture / docs/knowledge / website は今回の挙動と一致するよう更新済みです。full test は 446 件 pass しました。
この commit 自体がまた になると同じ罠なので、先にローカルの git hook を今の dist/cli.js から再生成します。tracked file は触らず .git/hooks だけを更新して、今…

c23bdda fix(record): tighten env fallback attribution

🧑 Prompt
その提案自体をレビューして問題がないなら作業に入ってほしい。
シミュレーションデータを活用して厳し目にテストしてください。

また、以下のレビューを claude に行ってもらったので確認して対応するか決めてください

⏺ ---
PR #72 厳しめレビュー(バグ検査重点)

CI: ✅ Test(445) / Lint / PR Report / Dashboard / Website / deploy 全 pass
CodeRabbit: skipped
Mergeable: ✅
コミット数: 4(6efa40c, 8a61c4a, 3b7d244, 0342220


全体像

PR #71 で導入した「stale-heartbeat fallback」だけでは救えなかった cmux 系の Codex 環境(CODEX_THREAD_ID
だけ生きていて .git/agentnote/session は古い)を救う --fallback-env 経路を新設。同時に v1
で過剰に厳しくなっていた Codex commit-lev…

🤖 Response
提案そのものを一度レビューした上で進めます。ポイントは「他 agent に Codex と同じ fallback を雑に広げる」のではなく、「安全に広げられる証拠がある agent だけ resolver を実装できる形にする」ことです。Claude の指摘も、false positive の可能性がある部分はそのまま飲み込まず、テストで境界を固めます。
Claude の指摘を確認しました。対応方針は次の通りです。

  • EnvironmentSessionResolver 化: 採用します。今は Codex だけ実装し、Claude / Cursor / Gemini には安全な env session 証拠が見つかるまで広げません。
  • mkdir(sessionDir) の副作用: 採用します。freshness / transcript が確認できるまで空 session dir を作らない形にします。
  • shell-only false positive: 一部採用します。env fallback の loose path は「単なる read/test tool」…

2baa245 docs(record): clarify env fallback bounds

🧑 Prompt
⏺ ---
差分レビュー: 3 新規コミット(前回レビュー指摘の対応)

PR #72 前回レビューで挙げた 3 件の懸念事項(false positive、mkdir 副作用、loose
attribution)すべてが直接対応されている。質の高い follow-up commit 群。


🎯 53261dd fix(record): address fallback review findings

修正 1: shell 展開ロジックの整理

const ENV_CODEX_THREAD_ID = "CODEX_THREAD_ID";
const SHELL_CODEX_THREAD_ID = $${ENV_CODEX_THREAD_ID}; // ← NEW
...
elif [ -n "${SHELL_CODEX_THREAD_ID}" ]; then // → 展開後: [ -n "$CODEX_THREAD_ID" ]

前回 $${ENV_CODEX_THREAD_ID} の二重 $ を直接書いていたものを定…

🤖 Response
レビュー内容を確認しました。ほぼ妥当ですが、1 点だけ事実修正があります。53261dd は UUID v4 strict ではなく、Codex の UUIDv7 系を通すための canonical UUID validation です。v4 固定に戻すと今回の本命ケースを壊すので、そこは採用しません。残っている low nit の 30 秒 tolerance の根拠コメントだけ、今のうちに source / docs に軽く足しておきます。
レビュー内容を確認しました。大筋は妥当ですが、ひとつだけ事実修正があります。53261dd は UUID v4 固定ではなく、Codex の UUIDv7 系も通すための canonical UUID validation です。v4 固定に戻すと今回の本命ケースを壊すので、そこは採用しません。残っている low nit の 30 秒 tolerance の根拠コメントだけ、source / docs に軽く足しておきます。
すでに record.tsinvestigations.md に未コミット差分があります。まず差分…

008d08e fix(record): harden env fallback review cases

🧑 Prompt

coderabbit-review
/Users/a12622/git/context-history/.codex/skills/coderabbit-review/SKILL.md

name: coderabbit-review
description: Fetch CodeRabbit review feedback for the current PR, classify actionable items, implement fixes, verify them, and resolve only addressed review threads.

CodeRabbit Review Workflow

Use this skill when the task asks to address CodeRabbit comments, review CodeRabbit feedback, or resolve CodeRabbit threads.

Fetch

Determin…

🤖 Response
coderabbit-review skill を使って、PR #72 の未解決 CodeRabbit review thread を確認します。指摘が valid なら最小差分で直し、直したものだけ resolve、採用しないものは英語で理由を返信します。
PR #72 を対象にします。作業ツリーは未追跡の docs/blog/ だけなので、今回も触らず CodeRabbit の thread だけ確認します。
未解決 thread は 7 件ありました。大きく分けると、実装側 2 件(test env の determinism、unmatched env fallback の window 境界)、docs/website 文言 5 件です。どれも修正できる内容なので、まず該当箇所を読んで最小差分で直します。
実装側の record.ts 指摘は valid ですが、CodeRabbit の suggested patch は既存 helper の fallback semantics だと古い shell row をまだ拾えるので、unmatched env fal…

675213c docs(website): clarify transcript attribution privacy

🧑 Prompt

coderabbit-review
/Users/a12622/git/context-history/.codex/skills/coderabbit-review/SKILL.md

name: coderabbit-review
description: Fetch CodeRabbit review feedback for the current PR, classify actionable items, implement fixes, verify them, and resolve only addressed review threads.

CodeRabbit Review Workflow

Use this skill when the task asks to address CodeRabbit comments, review CodeRabbit feedback, or resolve CodeRabbit threads.

Fetch

Determin…

🤖 Response
coderabbit-review skill で PR #72 の新しい未解決 thread を再確認します。前回 resolve 後に追加された指摘だけを対象にして、valid なら最小修正、不要なら英語で rationale を返します。
PR #72 の branch は clean で、未追跡は引き続き docs/blog/ だけです。CodeRabbit の未解決 thread を取得します。
新しい未解決 thread が 2 件出ています。ひとつは record.ts の意図的な「parent 前に準備済みだった同一 task を救う」設計への指摘、もうひとつは website 英語文言の整理です。前者はそのまま strict にすると既存の救済ケースを壊すので、修正ではなく rationale 返信にするか、より狭い guard を追加するかを精査します。
record.ts の新 thread は、こちらの設計意図と衝突しています。selectEnvironmentTranscriptSourceInteractions() の fallback…

6af2d1a docs(website): polish pt-br privacy wording

🧑 Prompt

coderabbit-review
/Users/a12622/git/context-history/.codex/skills/coderabbit-review/SKILL.md

name: coderabbit-review
description: Fetch CodeRabbit review feedback for the current PR, classify actionable items, implement fixes, verify them, and resolve only addressed review threads.

CodeRabbit Review Workflow

Use this skill when the task asks to address CodeRabbit comments, review CodeRabbit feedback, or resolve CodeRabbit threads.

Fetch

Determin…

🤖 Response
coderabbit-review skill で PR #72 をもう一度確認します。前回は intentionally unresolved が 1 件だけでしたが、CodeRabbit の pending 後に新規 thread が増えていないか見ます。
PR #72 は CodeRabbit も含めて checks が pass になっています。未解決 thread の中身だけ再確認して、意図的に残したもの以外がないか見ます。
新規未解決は 1 件だけで、PT-BR の Aside prose を自然にする指摘です。valid な docs 指摘なので、該当 locale を直して website build まで確認します。
PT-BR の Aside を自然な文にして、canonical technical terms は backticks に寄せました。docs-only なので website build と diff check で確認します。
website build と diff check は通りました。PT-BR だけの docs fix としてコミッ…

Summary by CodeRabbit

  • New Features

    • Environment-variable fallback to recover trusted agent transcripts when trailers are unavailable.
    • Commit-level AI attribution preserved for shell-only edits when a trusted transcript exists.
    • Streaming parsing of large transcripts for more efficient processing.
  • Bug Fixes

    • Failures writing git notes now surface warnings/errors instead of being silently ignored.
  • Documentation

    • Clarified attribution, privacy, and session-fallback guidance across locales.
  • Tests

    • Added extensive environment-fallback and attribution tests.
  • Chores

    • Updated dev dependency versions.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: da759509-2335-4cdb-8547-cd66185c3893

📥 Commits

Reviewing files that changed from the base of the PR and between 675213c and 6af2d1a.

📒 Files selected for processing (1)
  • website/src/content/docs/pt-br/data-and-privacy.mdx

📝 Walkthrough

Walkthrough

This PR adds environment-based fallback recovery for agent-note recording when CODEX_THREAD_ID is available. The post-commit hook and CLI can discover and validate fresh Codex transcripts via environment variables and record commit notes only when freshness and transcript-to-file evidence checks pass.

Changes

Environment Fallback Feature

Layer / File(s) Summary
Adapter types & contracts
packages/cli/src/agents/types.ts, packages/cli/src/agents/*
Adds mutation_tools to transcript interactions and an optional readEnvironmentSessionId() adapter hook used by env fallback.
Codex adapter: streaming & mutation detection
packages/cli/src/agents/codex.ts, packages/cli/src/agents/codex.test.ts
Stream-processes JSONL transcripts, extracts command strings, detects mutating shell commands and records mutation_tools; exposes env session id reading.
CLI record command & env resolution
packages/cli/src/commands/record.ts
Adds --fallback-env handling and recordEnvironmentFallback() that sanitizes env session ids, discovers transcripts via adapters, enforces freshness (heartbeat or transcript mtime), persists session metadata, and calls recordCommitEntry with environment fallback enabled; hook errors now warn.
Core transcript attribution & fallback logic
packages/cli/src/core/record.ts, packages/cli/src/core/record.test.ts
Adds allowEnvironmentTranscriptFallback option, commit-window filtering, environment-matched interaction selection, requireMutationTool gating, useCommitLevelAttribution promotion, and tests updated for commit-level attribution outcomes.
Commit wiring & init hooks
packages/cli/src/commands/commit.ts, packages/cli/src/commands/init.ts
Wires commit() to call recordEnvironmentFallback() when head fallback and session id are absent; generated hooks gain ENV_CODEX_THREAD_ID and set SESSION_ID=--fallback-env when CODEX_THREAD_ID is present.
Init tests & environment-fallback fixtures
packages/cli/src/commands/init.test.ts
Adds deterministic Codex JSONL fixtures, helpers, and many post-commit environment-fallback tests validating freshness, time-bounded selection, pre-parent recovery, unrelated-file/read-only rejection, mutating shell acceptance, stale/invalid-session behavior, and hook env checks.
Record tests & simulation updates
packages/cli/src/core/record.test.ts, packages/cli/src/commands/codex.test.ts
Extends shell-only fallback simulations with expected commit-level attribution, updates transcript-driven tests to assert file-level ai_ratio === 100 and by_ai: true when applicable.
Git/gitsafe and storage robustness
packages/cli/src/git.ts, packages/cli/src/core/storage.ts, packages/cli/src/core/storage.test.ts
gitSafe now returns stdout, stderr, and exitCode; writeNote checks exitCode and throws on failure; adds a test asserting writeNote rejects invalid refs.
Docs & localized website updates
AGENTS.md, CLAUDE.md, docs/architecture.md, docs/knowledge/*, website/src/content/docs/*
Document fallback precedence (trailer → stale-heartbeat → env), freshness semantics, evidence gates, commit-level attribution rules for mutating shell work, and canonical UUID input-validation wording.
CLI manifest
packages/cli/package.json
Bumps devDependencies (biome, @types/node, publint).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.90% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(hooks): recover Codex env sessions' clearly and concisely describes the main change: enabling Agent Note recording recovery for Codex sessions via environment variables (CODEX_THREAD_ID) when repo-local session pointers are stale or missing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cmux-session-resolver

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/commands/record.ts`:
- Around line 82-83: The code currently calls recordCommitEntry({
agentnoteDirPath, sessionId }) as soon as freshness passes; change this to first
verify commit-linked AI file evidence for the session before recording fallback
env. Implement a guard in the same scope that inspects the session/metadata for
AI file evidence (e.g., presence of commit-linked aiFiles/transcript entries)
and only call recordCommitEntry when that evidence is present; if not present,
skip recording and log or return a clear failure. Apply the same evidence check
at the other fallback recording site referenced (the block around lines 119-130)
so both places require commit-linked AI file/transcript evidence before invoking
recordCommitEntry.
- Around line 113-117: The sanitizeSessionId function currently accepts broad
identifiers; change it to enforce UUID v4 for environment session IDs (e.g.,
CODEX_THREAD_ID) by replacing the current SESSION_ID_SEGMENT_RE check with a
UUID v4 validation (either use a standard UUID v4 regex or a validator utility)
inside sanitizeSessionId; keep the existing trim and "."/".." null checks, and
return null unless the value strictly matches UUID v4 format so only valid v4
UUIDs are accepted as session IDs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 167b5e94-b38c-445d-a25e-a598ad49d0a5

📥 Commits

Reviewing files that changed from the base of the PR and between 1c348ee and 6efa40c.

⛔ Files ignored due to path filters (1)
  • packages/cli/dist/cli.js is excluded by !**/dist/**, !**/dist/**
📒 Files selected for processing (8)
  • AGENTS.md
  • CLAUDE.md
  • docs/architecture.md
  • docs/knowledge/investigations.md
  • packages/cli/src/commands/commit.ts
  • packages/cli/src/commands/init.test.ts
  • packages/cli/src/commands/init.ts
  • packages/cli/src/commands/record.ts

Comment thread packages/cli/src/commands/record.ts Outdated
Comment thread packages/cli/src/commands/record.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/package.json`:
- Line 54: The package currently depends on "@types/node": "^25.7.0" which
mismatches the declared runtime floor (engines.node >=20); update the dependency
in packages/cli/package.json to a Node 20-aligned types major (pin `@types/node`
to the v20 major, e.g. ^20.x) OR alternatively add Node 20 to the CI test matrix
so typings are validated against the declared minimum; change the entry for
"@types/node" and/or update CI workflow matrix entries to include node: 20 and
run the TypeScript checks there to ensure compatibility with engines.node >=20.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c11b1e0a-4aab-4e5f-89f7-c2d8a7de6089

📥 Commits

Reviewing files that changed from the base of the PR and between 6efa40c and 8a61c4a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • packages/cli/package.json

Comment thread packages/cli/package.json Outdated
wasabeef added 2 commits May 12, 2026 13:05
Why
Codex shell-only or host-mediated commits could have a trusted current transcript but no exact per-prompt file touch evidence. v1 guarded stale sessions correctly, but became too strict and lost the v0.2-era value of marking AI-assisted commit files.

User impact
Trusted current Codex tool-backed work now produces file-level AI Ratio again while keeping files_touched exact-only. Stale prompt-only active-session pointers and true human-only commits remain skipped.

Verification
npm run build
npm run typecheck
npm run lint
npm test
npm run build --prefix website
Focused Codex shell-only and mid-session regression tests
576-case Codex shell-only fallback simulation
Why
Codex sessions hosted by cmux can expose a fresh CODEX_THREAD_ID while the repository-local prompt log is stale. Large long-lived transcripts also exceeded eager read limits, and git note write failures could look like successful recording.

User impact
Codex/cmux commits can recover Agent Note output from the current transcript without reviving stale prompt windows or future debug turns. Failed note writes now surface as warnings instead of silent missing PR data.

Verification
npm run build
npm run typecheck
npm run lint
npm test
npm run build --prefix website
Focused Codex environment fallback regression tests
Manual dist CLI --fallback-env recovery for this branch

Release note: Fixes Codex environment fallback recording for cmux-hosted sessions, large transcripts, and silent git-note write failures.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

♻️ Duplicate comments (1)
packages/cli/src/commands/record.ts (1)

134-138: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enforce UUID v4 validation for environment session IDs

sanitizeSessionId() currently accepts any segment-safe token; this violates the session ID validation invariant and broadens the fallback trust boundary.

Suggested fix
+const UUID_V4_RE =
+  /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
+
 function sanitizeSessionId(value: string | undefined): string | null {
   const sessionId = value?.trim();
   if (!sessionId || sessionId === "." || sessionId === "..") return null;
-  return SESSION_ID_SEGMENT_RE.test(sessionId) ? sessionId : null;
+  return UUID_V4_RE.test(sessionId) ? sessionId.toLowerCase() : null;
 }

As per coding guidelines: “Validate input: Session IDs must match UUID v4 format”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/commands/record.ts` around lines 134 - 138,
sanitizeSessionId currently accepts any segment-safe token and must be tightened
to only accept UUID v4; update the function (sanitizeSessionId) so after
trimming it validates the value against a UUID v4 pattern (or a shared UUID v4
validator) instead of using SESSION_ID_SEGMENT_RE, returning null for
non-matching values; ensure existing callers that expect string|null behavior
remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/architecture.md`:
- Around line 391-392: The post-commit hook's fallback-env path is broken
because the hook template checks [ -n "$${ENV_CODEX_THREAD_ID}" ] (using literal
ENV_CODEX_THREAD_ID and $$) instead of the actual environment variable, so the
condition never becomes true; fix either the template substitution in init.ts so
ENV_CODEX_THREAD_ID is replaced with CODEX_THREAD_ID at render time, or change
the hook to check the real variable name (e.g., [ -n "$CODEX_THREAD_ID" ])
before setting SESSION_ID="--fallback-env" and calling agent-note record
--fallback-env; update the place that generates the script (init.ts and the
post-commit hook template) consistently so the symbol ENV_CODEX_THREAD_ID is not
left literal in the shipped hook.

In `@packages/cli/src/core/storage.test.ts`:
- Around line 87-90: The test for writeNote is matching locale/version-specific
git stderr text which makes CI flaky; update the assertion to only verify the
promise rejects (or rejects with an Error) instead of matching git output.
Locate the test using writeNote and replace the assert.rejects call that
supplies the regex (/failed to resolve|failed to write Agent Note git
note|ambiguous argument/i) with a simpler assertion such as assert.rejects(() =>
writeNote("not-a-commit", { v: 1 })) or assert.rejects(() =>
writeNote("not-a-commit", { v: 1 }), Error) so the test no longer depends on git
wording.

In `@website/src/content/docs/de/data-and-privacy.mdx`:
- Line 58: Replace the fragment on Line 58 ("Shell command output als file
evidence. Vertrauenswürdige Agent transcripts können trotzdem commit-level
attribution erzeugen.") with an explicit non-storage statement clarifying that
shell command output is not stored; e.g., reword to say that shell command
output is used as file evidence but wird nicht gespeichert / is not retained,
and keep the follow-up clause about trusted agent transcripts potentially
enabling commit-level attribution (so update the sentence containing that phrase
to read clearly and unambiguously that the data is not stored).

In `@website/src/content/docs/es/data-and-privacy.mdx`:
- Line 58: The sentence "Output de shell commands como file evidence. Los Agent
transcripts confiables aún pueden producir commit-level attribution." is
ambiguous; update it to explicitly state that shell command output is not stored
as file evidence by negating the claim and clarifying attribution limits (e.g.,
replace that fragment with a clear sentence such as "Shell command output is not
stored as file evidence; trusted Agent transcripts may still produce
commit-level attribution."). Ensure the revised line preserves the distinction
between "shell command output" and "Agent transcripts" and matches surrounding
locale and tone.

In `@website/src/content/docs/fr/data-and-privacy.mdx`:
- Line 58: Replace the fragment "Les outputs de shell commands comme file
evidence. Des Agent transcripts fiables peuvent quand même produire une
commit-level attribution." with an explicit French sentence stating that shell
command outputs are not stored as file evidence (e.g., "Les sorties des
commandes shell ne sont pas stockées comme pièces justificatives de fichier")
and then append the clarification that reliable agent transcripts can still
enable commit-level attribution; ensure the phrasing is natural French, matches
locale/tone of surrounding docs, and clearly separates user-facing privacy
guidance from maintainer details.

In `@website/src/content/docs/pt-br/data-and-privacy.mdx`:
- Line 58: Replace the fragment "Output de shell commands como file evidence."
with an explicit non-storage statement that makes clear these outputs are not
retained — e.g., change it to "Output de shell commands como file evidence não
são armazenados." Ensure the updated sentence appears in the pt-BR privacy
bullet and preserves locale/tense consistency with surrounding text.

---

Duplicate comments:
In `@packages/cli/src/commands/record.ts`:
- Around line 134-138: sanitizeSessionId currently accepts any segment-safe
token and must be tightened to only accept UUID v4; update the function
(sanitizeSessionId) so after trimming it validates the value against a UUID v4
pattern (or a shared UUID v4 validator) instead of using SESSION_ID_SEGMENT_RE,
returning null for non-matching values; ensure existing callers that expect
string|null behavior remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b2515b78-00f6-4127-8ecb-65d4edbc4091

📥 Commits

Reviewing files that changed from the base of the PR and between 8a61c4a and 0342220.

⛔ Files ignored due to path filters (1)
  • packages/cli/dist/cli.js is excluded by !**/dist/**, !**/dist/**
📒 Files selected for processing (41)
  • AGENTS.md
  • CLAUDE.md
  • docs/architecture.md
  • docs/knowledge/agent-skill.md
  • docs/knowledge/agent-support-policy.md
  • docs/knowledge/investigations.md
  • packages/cli/src/agents/codex.ts
  • packages/cli/src/commands/codex.test.ts
  • packages/cli/src/commands/init.test.ts
  • packages/cli/src/commands/record.ts
  • packages/cli/src/core/record.test.ts
  • packages/cli/src/core/record.ts
  • packages/cli/src/core/storage.test.ts
  • packages/cli/src/core/storage.ts
  • packages/cli/src/git.ts
  • website/src/content/docs/agent-support.mdx
  • website/src/content/docs/data-and-privacy.mdx
  • website/src/content/docs/de/data-and-privacy.mdx
  • website/src/content/docs/de/how-it-works.mdx
  • website/src/content/docs/es/data-and-privacy.mdx
  • website/src/content/docs/es/how-it-works.mdx
  • website/src/content/docs/fr/data-and-privacy.mdx
  • website/src/content/docs/fr/how-it-works.mdx
  • website/src/content/docs/how-it-works.mdx
  • website/src/content/docs/id/data-and-privacy.mdx
  • website/src/content/docs/id/how-it-works.mdx
  • website/src/content/docs/it/data-and-privacy.mdx
  • website/src/content/docs/it/how-it-works.mdx
  • website/src/content/docs/ja/agent-support.mdx
  • website/src/content/docs/ja/data-and-privacy.mdx
  • website/src/content/docs/ja/how-it-works.mdx
  • website/src/content/docs/ko/data-and-privacy.mdx
  • website/src/content/docs/ko/how-it-works.mdx
  • website/src/content/docs/pt-br/data-and-privacy.mdx
  • website/src/content/docs/pt-br/how-it-works.mdx
  • website/src/content/docs/ru/data-and-privacy.mdx
  • website/src/content/docs/ru/how-it-works.mdx
  • website/src/content/docs/zh-cn/data-and-privacy.mdx
  • website/src/content/docs/zh-cn/how-it-works.mdx
  • website/src/content/docs/zh-tw/data-and-privacy.mdx
  • website/src/content/docs/zh-tw/how-it-works.mdx

Comment thread docs/architecture.md Outdated
Comment thread packages/cli/src/core/storage.test.ts
Comment thread website/src/content/docs/de/data-and-privacy.mdx Outdated
Comment thread website/src/content/docs/es/data-and-privacy.mdx Outdated
Comment thread website/src/content/docs/fr/data-and-privacy.mdx Outdated
Comment thread website/src/content/docs/pt-br/data-and-privacy.mdx Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/cli/src/agents/codex.ts (1)

167-170: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Suggested fix introduces UTF-8 decoding errors; issue scope is limited by 256-file bound.

readTranscriptSessionId() does load entire files into memory before slicing, but the discovery is already bounded to 256 files maximum in a breadth-first scan. The real risk is if a single transcript file is extremely large (>100s MB).

However, the suggested fix is incorrect: readSync(fd, buf, 0, TRANSCRIPT_PREVIEW_CHARS, 0) reads exactly 4096 bytes, not characters. Decoding this with toString("utf-8") will fail if a multi-byte UTF-8 character (e.g., "世" = 3 bytes) is split across the buffer boundary, causing UnicodeDecodeError.

A safer approach would read more bytes than needed (e.g., 8KB) to ensure partial characters don't truncate critical metadata, or use a streaming line-by-line parser to avoid loading anything beyond the first complete line containing session_meta. The current pattern works in practice for JSONL transcripts since metadata appears near the start, but the memory principle is worth addressing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/agents/codex.ts` around lines 167 - 170, The suggested
change to use readSync into a byte buffer causes UTF-8 decoding errors when
multi-byte characters are split; update readTranscriptSessionId to read a safe
byte window instead of exactly TRANSCRIPT_PREVIEW_CHARS bytes: compute a
byteLimit = max(8192, TRANSCRIPT_PREVIEW_CHARS * 4) (or similar) and read that
many bytes from the file descriptor, then decode the buffer with utf-8 and slice
by characters for preview; alternatively implement a lightweight streaming
line-by-line read that stops after the first line containing "session_meta" to
avoid loading large files — locate and modify readTranscriptSessionId, the
TRANSCRIPT_PREVIEW_CHARS usage, and any temporary readSync/readFileSync logic
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/architecture.md`:
- Around line 391-392: Update the `pre-push` row to reflect that note pushing is
synchronous: change the description that currently says "Auto-pushes
`refs/notes/agentnote` to the actual remote (`$1`) in background" to indicate
the hook waits for the `push-notes` operation to complete (no backgrounding),
while retaining mention of the recursion guard via the `AGENTNOTE_PUSHING` env
var and that it targets `refs/notes/agentnote`; ensure the wording matches the
implemented `push-notes` behavior and remove any reference to background
execution.

In `@packages/cli/src/commands/init.test.ts`:
- Around line 31-35: Tests currently inherit process.env causing flakiness when
CODEX_THREAD_ID is present; update the test suite to use a sanitized environment
by default by calling or applying withoutCodexThreadEnv() as the default env
wrapper for the suite (e.g., use it in beforeEach or pass it into helper
invocations like runCli/init calls), and change only the env-fallback-specific
tests to explicitly set CODEX_THREAD_ID (opt-in) instead of relying on the real
process.env; locate usages around withoutCodexThreadEnv and the init tests (and
the region referenced 467-899) and replace direct process.env usage with the
sanitized env or pass sanitized env through helper functions that spawn the CLI.

In `@packages/cli/src/core/record.ts`:
- Around line 516-525: The fallback branch is using allInteractions directly
which can pick old mutating shell rows; before calling
selectTranscriptFallbackInteractions, filter allInteractions through
selectEnvironmentTranscriptSourceInteractions using parentCommitTimestampMs to
limit the source window to parent→HEAD. Replace the
selectTranscriptFallbackInteractions call to use the filtered list (e.g. let
envSource = selectEnvironmentTranscriptSourceInteractions(allInteractions,
parentCommitTimestampMs); then call
selectTranscriptFallbackInteractions(envSource, commitFileSet,
currentUnattributedToolPromptIds, { requireMutationTool:
opts.allowEnvironmentTranscriptFallback === true })). Ensure you preserve the
same requireMutationTool flag and assign the result back to interactions.

In `@website/src/content/docs/fr/data-and-privacy.mdx`:
- Line 58: Reformulez la phrase identifiée ("Les outputs de shell commands ne
sont pas stockés comme file evidence. Des Agent transcripts fiables peuvent
quand même produire une commit-level attribution.") en français naturel tout en
conservant le sens : indiquez clairement que les sorties de commandes shell ne
sont pas conservées comme preuves de fichier, mais que des transcriptions
d'agent fiables peuvent néanmoins permettre une attribution au niveau des
commits; remplacez le texte par une version fluide (par ex. « Les sorties des
commandes shell ne sont pas conservées comme preuves de fichier, mais des
transcriptions d'agent fiables peuvent toutefois permettre une attribution au
niveau des commits. »), assurez la cohérence de ton et de vocabulaire avec le
reste de la documentation FR et gardez la séparation nette entre conseils
destinés aux utilisateurs et éventuelles notes techniques destinées aux
mainteneurs.

In `@website/src/content/docs/id/data-and-privacy.mdx`:
- Around line 57-58: Merge the two redundant bullets about shell command output
in the "Yang tidak disimpan" list into a single, clear bullet that preserves the
clarification about commit-level attribution; update the bullet that currently
says "Semua output shell command." and the subsequent bullet mentioning that
shell output is not stored but trusted agent transcripts can produce
commit-level attribution by combining them into one sentence or a main bullet
with a short sub-note so the list is concise and the attribution caveat remains
visible.

In `@website/src/content/docs/it/data-and-privacy.mdx`:
- Around line 57-58: The two consecutive bullets that both mention shell command
output are redundant; update the bullet list in data-and-privacy.mdx by either
merging the two lines into one clear bullet that states "Shell command outputs
are not saved as evidence files, but reliable agent transcripts can still
provide commit-level attribution" or make the second line a sub-bullet/note
under the first to clarify it is an elaboration; locate the existing bullet
texts ("Tutti gli output dei shell command." and "Output dei shell command non
viene salvato come file evidence. Agent transcripts affidabili possono comunque
produrre commit-level attribution.") and apply the chosen merge or hierarchy
change.

In `@website/src/content/docs/pt-br/data-and-privacy.mdx`:
- Around line 57-58: Remove the redundant bullet "Todos os outputs de shell
command." and keep the more detailed bullet that starts "Output de shell
commands não é salvo como file evidence. Agent transcripts..." (or merge them
into a single concise bullet that states outputs of shell commands are not saved
and clarifies they are not stored as file evidence but may still produce
commit-level attribution); update the remaining bullet to be a single clear
Portuguese sentence without repeating the "not saved" message.

---

Outside diff comments:
In `@packages/cli/src/agents/codex.ts`:
- Around line 167-170: The suggested change to use readSync into a byte buffer
causes UTF-8 decoding errors when multi-byte characters are split; update
readTranscriptSessionId to read a safe byte window instead of exactly
TRANSCRIPT_PREVIEW_CHARS bytes: compute a byteLimit = max(8192,
TRANSCRIPT_PREVIEW_CHARS * 4) (or similar) and read that many bytes from the
file descriptor, then decode the buffer with utf-8 and slice by characters for
preview; alternatively implement a lightweight streaming line-by-line read that
stops after the first line containing "session_meta" to avoid loading large
files — locate and modify readTranscriptSessionId, the TRANSCRIPT_PREVIEW_CHARS
usage, and any temporary readSync/readFileSync logic accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f48a6ad4-4455-452c-beae-aeab30055794

📥 Commits

Reviewing files that changed from the base of the PR and between 0342220 and c23bdda.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • packages/cli/dist/cli.js is excluded by !**/dist/**, !**/dist/**
📒 Files selected for processing (20)
  • AGENTS.md
  • CLAUDE.md
  • docs/architecture.md
  • docs/knowledge/investigations.md
  • packages/cli/package.json
  • packages/cli/src/agents/codex.test.ts
  • packages/cli/src/agents/codex.ts
  • packages/cli/src/agents/types.ts
  • packages/cli/src/commands/init.test.ts
  • packages/cli/src/commands/init.ts
  • packages/cli/src/commands/record.ts
  • packages/cli/src/core/record.ts
  • packages/cli/src/core/storage.test.ts
  • website/src/content/docs/de/data-and-privacy.mdx
  • website/src/content/docs/es/data-and-privacy.mdx
  • website/src/content/docs/fr/data-and-privacy.mdx
  • website/src/content/docs/id/data-and-privacy.mdx
  • website/src/content/docs/it/data-and-privacy.mdx
  • website/src/content/docs/pt-br/data-and-privacy.mdx
  • website/src/content/docs/ru/data-and-privacy.mdx

Comment thread docs/architecture.md Outdated
Comment thread packages/cli/src/commands/init.test.ts
Comment thread packages/cli/src/core/record.ts
Comment thread website/src/content/docs/fr/data-and-privacy.mdx Outdated
Comment thread website/src/content/docs/id/data-and-privacy.mdx Outdated
Comment thread website/src/content/docs/it/data-and-privacy.mdx Outdated
Comment thread website/src/content/docs/pt-br/data-and-privacy.mdx Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
website/src/content/docs/fr/data-and-privacy.mdx (1)

57-57: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Lisser la phrase FR pour éviter le franglais en prose

La formulation de la Line 57 est exacte sur le fond, mais reste hybride FR/EN et moins naturelle pour la documentation utilisateur.

✏️ Proposition
-- Les sorties des commandes shell ne sont pas stockées comme file evidence. Des Agent transcripts fiables peuvent quand même produire une commit-level attribution.
+- Les sorties des commandes shell ne sont pas conservées comme preuves de fichier. Des transcriptions d’agent fiables peuvent toutefois permettre une attribution au niveau du commit.

As per coding guidelines website/**: Review documentation for implementation accuracy, natural language, locale parity, and clear separation between user-facing guidance and maintainer details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@website/src/content/docs/fr/data-and-privacy.mdx` at line 57, La phrase "Les
sorties des commandes shell ne sont pas stockées comme file evidence. Des Agent
transcripts fiables peuvent quand même produire une commit-level attribution."
mélange anglais et français ; remplace-la par une formulation entièrement en
français et naturelle (par ex. : « Les sorties des commandes shell ne sont pas
conservées comme éléments de preuve ; des transcriptions d'agents fiables
peuvent toutefois permettre une attribution au niveau des commits. »). Modifie
le texte correspondant dans le document (la phrase actuelle) en remplaçant
l'anglais par la version française proposée ou une variante équivalente, en
conservant le sens technique (shell outputs, agent transcripts, commit-level
attribution).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/core/record.ts`:
- Around line 814-820: selectEnvironmentTranscriptSourceInteractions currently
falls back to returning all interactions when
filterTranscriptInteractionsAfterParent yields an empty bounded set; change it
so it never expands scope — return the bounded array as-is (even if empty) to
ensure evidence is strictly limited to the parent-window filter. Update the
function selectEnvironmentTranscriptSourceInteractions to remove the fallback to
interactions and always return the result of
filterTranscriptInteractionsAfterParent, preserving attribution correctness.

In `@website/src/content/docs/data-and-privacy.mdx`:
- Line 69: Split the mixed sentence in the "What Is Not Stored" bullet so it
only states the negative fact that shell command output is not stored (e.g.,
keep "It does not store shell command output as file evidence"), then add a
separate explanatory Aside after the list clarifying transcript-based
attribution (use an <Aside> with text like the suggested refactor: explain that
trusted agent transcripts (e.g., Codex) may still enable commit-level
attribution by validating fresh transcript evidence recorded at commit time,
without relying on shell command output); update the "What Is Not Stored" bullet
and add the <Aside> element accordingly to preserve the section pattern and
avoid mixing negatives with capability notes.

---

Duplicate comments:
In `@website/src/content/docs/fr/data-and-privacy.mdx`:
- Line 57: La phrase "Les sorties des commandes shell ne sont pas stockées comme
file evidence. Des Agent transcripts fiables peuvent quand même produire une
commit-level attribution." mélange anglais et français ; remplace-la par une
formulation entièrement en français et naturelle (par ex. : « Les sorties des
commandes shell ne sont pas conservées comme éléments de preuve ; des
transcriptions d'agents fiables peuvent toutefois permettre une attribution au
niveau des commits. »). Modifie le texte correspondant dans le document (la
phrase actuelle) en remplaçant l'anglais par la version française proposée ou
une variante équivalente, en conservant le sens technique (shell outputs, agent
transcripts, commit-level attribution).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5650e744-a255-4cd0-b83e-3e4b5b625553

📥 Commits

Reviewing files that changed from the base of the PR and between 2baa245 and 008d08e.

⛔ Files ignored due to path filters (1)
  • packages/cli/dist/cli.js is excluded by !**/dist/**, !**/dist/**
📒 Files selected for processing (15)
  • docs/architecture.md
  • packages/cli/src/commands/init.test.ts
  • packages/cli/src/core/record.ts
  • website/src/content/docs/data-and-privacy.mdx
  • website/src/content/docs/de/data-and-privacy.mdx
  • website/src/content/docs/es/data-and-privacy.mdx
  • website/src/content/docs/fr/data-and-privacy.mdx
  • website/src/content/docs/id/data-and-privacy.mdx
  • website/src/content/docs/it/data-and-privacy.mdx
  • website/src/content/docs/ja/data-and-privacy.mdx
  • website/src/content/docs/ko/data-and-privacy.mdx
  • website/src/content/docs/pt-br/data-and-privacy.mdx
  • website/src/content/docs/ru/data-and-privacy.mdx
  • website/src/content/docs/zh-cn/data-and-privacy.mdx
  • website/src/content/docs/zh-tw/data-and-privacy.mdx

Comment thread packages/cli/src/core/record.ts
Comment thread website/src/content/docs/data-and-privacy.mdx Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@website/src/content/docs/pt-br/data-and-privacy.mdx`:
- Around line 60-62: Replace the current Portuguese Aside text with a more
natural PT-BR sentence that keeps canonically technical terms in crases;
specifically update the <Aside> content so non-technical words are translated to
natural Portuguese while preserving terms like `Agents`, `transcripts`, `Agent
Note`, `commit-level attribution`, `transcript evidence` and `shell command` in
backticks, and rephrase to something concise and idiomatic (e.g., "Com `Agents`
que expõem `transcripts` confiáveis, o `Agent Note` ainda pode gerar
`commit-level attribution` a partir de `transcript evidence` recentes
registradas no momento do commit, sem salvar o output de `shell command`.").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d1088928-6486-4e2f-8f0a-52313195cdfb

📥 Commits

Reviewing files that changed from the base of the PR and between 008d08e and 675213c.

📒 Files selected for processing (12)
  • website/src/content/docs/data-and-privacy.mdx
  • website/src/content/docs/de/data-and-privacy.mdx
  • website/src/content/docs/es/data-and-privacy.mdx
  • website/src/content/docs/fr/data-and-privacy.mdx
  • website/src/content/docs/id/data-and-privacy.mdx
  • website/src/content/docs/it/data-and-privacy.mdx
  • website/src/content/docs/ja/data-and-privacy.mdx
  • website/src/content/docs/ko/data-and-privacy.mdx
  • website/src/content/docs/pt-br/data-and-privacy.mdx
  • website/src/content/docs/ru/data-and-privacy.mdx
  • website/src/content/docs/zh-cn/data-and-privacy.mdx
  • website/src/content/docs/zh-tw/data-and-privacy.mdx

Comment thread website/src/content/docs/pt-br/data-and-privacy.mdx
@wasabeef wasabeef merged commit 75318b8 into main May 12, 2026
11 checks passed
@wasabeef wasabeef deleted the feat/cmux-session-resolver branch May 12, 2026 09:52
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