Skip to content

fix(omp): preserve recorded transcript paths when resuming - #20634

Merged
nwparker merged 1 commit into
mainfrom
nwparker/omp-resume-transcript-locator
Sep 19, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/omp-resume-transcript-locator

Conversation

@nwparker

@nwparker nwparker commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​156 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​154
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32

ELI5

OMP cannot resume a conversation by ID when its file lives outside the normal session folder. Orca already remembers the file path, but dropped it while building the resume command. It now uses that recorded path.

What Changed

Select the OMP resume target in this order: explicit launch override, recorded provider transcript path, session ID. Reuse existing shell quoting and keep conversation ownership keyed by ID.

Why

Actual OMP runtime validation reproduces ID lookup failure for a custom session folder. The absolute path and corrected Orca command both resume the original conversation.

Linked Issue

Related PR #16276 by @CodeHourra; credits its resume-locator proposal. This is a bounded correction from that proposal, not adoption of its replay-based command injection or title changes.

Visual Proof

N/A — resume command construction only. Actual before/after runtime evidence: custom-root ID lookup throws not-found; absolute-path and generated-argv resume both return the original session identity, with zero model calls. No rendered terminal-launch proof claimed.

Testing

  • Actual OMP SessionManager/CLI parser smoke on macOS with disposable home/config/data roots.
  • Five regressions failed before the correction; 116 targeted tests, node/web types and full changed-code quality passed.
  • Independent parent review reran 58 focused tests and the actual runtime smoke successfully.
  • Tests cover explicit/recorded/ID precedence, blank metadata, stable ownership after path hydration, Windows cmd/PowerShell quoting and remote POSIX paths.
  • Reproduce: ORCA_BACKGROUND_LAUNCH=1 bun tests/tools/omp-resume-transcript-locator-smoke.mjs /path/to/oh-my-pi.

Review

Independently reviewed. The upstream OMP checkout was read-only.

Agent skill upstream boundary

  • Not applicable; no skill-installer material copied.

Notes

No new wire fields, execution-host routing or reattach behavior. Older metadata without a transcript path retains ID fallback. Native Windows/SSH execution was not rerun; shell selection is covered by builder tests.

Checklist

  • Small, focused change with ELI5 and runtime evidence
  • Self-reviewed and independently reviewed
  • Cross-platform, SSH and compatibility implications considered
  • Focused tests, node/web types and changed-code quality passed; CI covers broader checks

Merge dependency discovered in final review

This consumer is not a standalone end-to-end fix at 8618cbfe4e14. The production OMP transcript-path producer is in #20615, stacked on #20611. Merge order: #20611 → #20615 → #20634. The runtime smoke proves the resume consumer with populated metadata; it does not establish that this branch alone produces that metadata. The original #16276 also contains broader sleep/replay/title behavior that this bounded replacement does not adopt.

Contributor credit for the resume-locator proposal in #16276 (@CodeHourra), verified against its Git commit author:

Co-authored-by: stevelliu [email protected]

Based on the resume-locator proposal in #16276 by @CodeHourra. Retains UUID-based ownership and existing reattach behavior.
@nwparker
nwparker marked this pull request as ready for review September 14, 2026 14:17
@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The OMP resume argument now falls back from an explicit transcript path to the recorded provider transcriptPath, then to the session ID. Tests cover trimming, precedence, session claim stability, Windows shell quoting, and remote SSH paths. A smoke test validates resume behavior in an isolated session environment. Reference documentation describes the resolution order and test scope.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 8618c

OMP sessions stored outside the default session location can still fall back to UUID resumption and fail. Propagate the recorded transcript path before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 5 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving recorded OMP transcript paths during resume.
Description check ✅ Passed The description is mostly complete and covers the change, rationale, testing, compatibility considerations, review status, and checklist. The Linked Issue section is incomplete because it does not pro…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
src/shared/agent-session-resume.ts (1)

229-230: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Propagate the OMP session_file locator.

The OMP extension currently posts only session_id (src/main/pi/agent-status-extension-source.ts:64-87), and the runtime-routed OMP path also omits session_file (:38-47). When an OMP payload does contain session_file, extractAgentProviderSession still drops it (src/shared/agent-session-resume.ts:227-230), so the resume builder falls back to the UUID and cannot resume sessions outside the default store.

Emit session_file from the OMP hook, pass it through with withTranscriptPath(..., ['session_file']), and add hook-emission and extraction tests.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 9e63cdda-8ead-4d4e-a806-3905790974c2

📥 Commits

Reviewing files that changed from the base of the PR and between 93c3702 and 8618cbf.

📒 Files selected for processing (6)
  • docs/reference/omp-resume-transcript-locator.md
  • src/renderer/src/lib/resume-sleeping-agent-session-provider-claim.test.ts
  • src/renderer/src/lib/sleeping-agent-session-launch-windows-quoting.test.ts
  • src/shared/agent-session-resume.test.ts
  • src/shared/agent-session-resume.ts
  • tests/tools/omp-resume-transcript-locator-smoke.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The new OMP fallback cannot fire as written: nothing in the tree ever populates providerSession.transcriptPath for agent: 'omp', so this change does not fix the custom-session-folder resume the PR describes. It is behavior-preserving (falls back to the id), but it lands a dead branch plus a doc asserting a hook flow that does not exist.

Reviewed changes

  • OMP resume precedence — getAgentResumeArgv now selects ompResumeFilePath?.trim() → providerSession.transcriptPath?.trim() → session id (src/shared/agent-session-resume.ts:279).
  • Builder tests — a precedence table for explicit/recorded/blank/UUID (agent-session-resume.test.ts), Windows cmd/PowerShell quoting and a remote POSIX path that must not use the local shell (sleeping-agent-session-launch-windows-quoting.test.ts), and provider-claim stability when a later record adds a path (resume-sleeping-agent-session-provider-claim.test.ts).
  • Reference doc + smoke tool — docs/reference/omp-resume-transcript-locator.md and tests/tools/omp-resume-transcript-locator-smoke.mjs, which drives a real OMP SessionManager and asserts the generated argv round-trips the original session.

ℹ️ Nitpicks

  • resume-sleeping-agent-session-provider-claim.test.ts:147-153 passes with the source change reverted: getProviderSessionClaimKey only folds transcriptPath in for pi/prime-agent (sleeping-agent-pane-ownership.ts:13-18), so the OMP equality holds trivially. Fine as an invariant guard, but it is not coverage for this change.
  • docs/reference/omp-resume-transcript-locator.md is not added to the .gitignore allow-list; this matches repo norms and is non-blocking.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

? [
'omp',
'--resume',
ompResumeFilePath?.trim() || providerSession.transcriptPath?.trim() || id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This fallback is unreachable for OMP in the current tree: no production path ever sets transcriptPath on an OMP providerSession, so the branch cannot address the custom-session-folder resume the PR describes. The OMP hook extractor drops any transcript field, and the bundled OMP extension deliberately sends only session_id.

Technical details
# OMP transcript path has no producer

## Affected sites
- `src/shared/agent-session-resume.ts:228-231` — `case 'omp'` returns `{ key: 'session_id', id }`; `withTranscriptPath` is only invoked for claude/codex (`:192`) and pi/prime-agent (`:215`).
- `src/main/pi/agent-status-extension-source.ts:64-82` — the `kind === 'omp'` branch builds `{ session_id }` only; `updateRuntimeOmpSessionMetadata` (`:43`) also strips `session_file`, and `:83` documents "OMP resumes directly by session id (#8962)". `agent-status-extension-source.test.ts:266` asserts `session_file` is absent.
- `src/renderer/src/lib/ai-vault-resume-command.ts:253-268` — `getAiVaultAgentProviderSession` attaches `transcriptPath` only for pi/prime-agent; OMP's locator travels separately as `ompResumeFilePath` (`:178-180`).
- `src/main/runtime/agent-session-claim-identity.ts:67` and `src/renderer/src/lib/sleeping-agent-pane-ownership.ts:13-18` — both also special-case only pi/prime-agent.
- `normalizeAgentProviderSession` (`:145-162`) and the sleeping schema are pass-through hydration, not producers.

## Required outcome
- Either land a producer with this change (e.g. the OMP extension reports `session_file` and `extractAgentProviderSession('omp', …)` captures it, the resume-locator portion of PR #16276), or have the AI Vault OMP path populate `transcriptPath`; or
- Drop/annotate the dead branch so the change does not imply a fix it cannot deliver.

## Open questions for the human
- Which code path populates `providerSession.transcriptPath` for OMP in the runtime validation you ran? The bundled extension and extractor in this commit both exclude it.
- If a producer is landing in a separate PR, is this meant to merge ahead of it as a no-op prep step?

Comment on lines +3 to +6
A sleeping OMP session can retain its transcript path from a hook without an
explicit `launchConfig.ompResumeFilePath`. Both cold-restore startup and generic
sleeping-session launch already forward the provider metadata to
`getAgentResumeArgv`; that builder must keep the recorded path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This premise does not hold in this commit: the bundled OMP extension sends only session_id (agent-status-extension-source.ts:64-82) and extractAgentProviderSession('omp', …) ignores transcript fields (agent-session-resume.ts:228-231), so a sleeping OMP record never has a transcriptPath to retain. If a producer is landing separately, describe the fallback as forward-compatible; otherwise this claim is inaccurate.

@nwparker

Copy link
Copy Markdown
Contributor Author

Risk-reduction review at 8618cbfe4e14dc65b136ecaf836662a7bf96b33e: Hold — dependency.

58 tests + actual OMP custom-root path smoke pass; main and #20611/#20615 inspected to confirm missing producer.

Remaining user-facing consequence: Cannot deliver the complete resume fix alone. Producer dependencies remain in the excluded native-chat group; no automatic expansion of scope.

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