Skip to content

fix(agent-resume): resume Claude sessions at their own effort level - #33765

Merged
Jinwoo-H merged 2 commits into
mainfrom
sta-11705-resume-effort
Oct 26, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
sta-11705-resume-effort

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What

A resumed Claude terminal session now keeps the effort level it was running at. This covers every resume path: account-switch restart, reboot/cold restore, waking a sleeping pane, and paired-host resumes.

Before this change, Orca only replayed the original launch flags. Claude saves effort as one default per model, so a resume ran at whatever that default was, not the session's own level. Model already behaves this way on resume (Claude reads it from the transcript), so this PR only changes effort.

How

  • Claude 2.1.133+ sends the live level in hook input (effort.level) on PreToolUse, PostToolUse and Stop. SessionStart and UserPromptSubmit omit it. readPaneProviderSession reads it next to cwd. Both values now share one continuation rule: keep the previous value for the same session, and also across /clear and compact, which restart Claude in the same process. Subagent hooks are ignored because they report their own effort.
  • It travels on providerSession.effort through the existing normalizer (relay, WSL, SSH) and the saved-workspace schema. The value must be a lowercase token, so it is safe to put in argv.
  • getAgentResumeArgv emits claude --effort <level> --resume <id>. Claude keeps the last --effort it parses, so a stale --effort in the saved launch args no longer wins. The saved launch recipe itself is unchanged.
  • recoveryRecordMatches now compares effort, so an effort change in the middle of a turn refreshes the saved record. Session identity (agentProviderSessionsEqual, claims) ignores effort.
  • Compat: older Claude versions don't send the field, so they keep today's behaviour. ensureAgentSession is strict on older hosts, so effort is sent only to hosts that advertise agent-session.resume-effort.v1.

Verification

Real before/after: hidden dev build (ORCA_BACKGROUND_LAUNCH=1), isolated profile, Claude 2.1.310. Flow: launch Claude, /effort max, run one turn, kill the app and its own daemon, relaunch, cold restore resumes the pane, run one turn. The level comes from the effort Claude records on each transcript line.

resumed command effort of the resumed turn
main claude … --resume <id> medium (the saved default)
this PR claude … --effort max --resume <id> max

Tests: hook parse (subagent, omitted field, /clear, a different session), normalize argv safety, saved-workspace round-trip, and the resume command on posix/powershell/cmd with a stale --effort in launch args. I re-ran the cold-restore flow on the final commit with a fresh profile: claude --effort max --resume <id>, and the resumed turn ran at max.

Known limits

  • Session History resume of a session Orca never saw through hooks still uses Claude's default. Claude does write effort on transcript lines, so a follow-up could read it from there.
  • The level is learned on the first tool or Stop hook. If a pane was just resumed into a new pane key and is closed again before its first turn finishes, the level falls back to the default.
  • If a skill or turn sets its own effort, the hooks report that turn's level until the next turn reports the session's level again.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 164ebd26-b8a1-4aa6-bcf9-d6fa355d4b5b
Commits

Reviewing files that changed from the base of the PR and between 5aaf55c and 82a5f8f.

Files selected for processing: 10
  • src/renderer/src/runtime/agent-session-ensure-provider-session.ts
  • src/shared/agent-effort-level.ts
  • src/shared/agent-hook-listener-claude-turn-state.test.ts
  • src/shared/agent-hook-listener/pane-provider-session.ts
  • src/shared/agent-resume-launch-command.spec.ts
  • src/shared/agent-resume-record-equivalence.ts
  • src/shared/agent-session-resume.test.ts
  • src/shared/rpc-contract/agent-session-params.ts
  • src/shared/workspace-session-schema.sleeping-agent.test.ts
  • src/shared/workspace-session-sleeping-agents.ts
Files with no reviewable changes: 3
  • src/shared/agent-resume-record-equivalence.ts
  • src/shared/agent-session-resume.test.ts
  • src/shared/agent-resume-launch-command.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

The changes capture Claude effort from hook payloads, validate and store it in provider-session metadata, and include it in resume arguments. Runtime session-ensure paths use an environment-specific adapter that includes effort only when the host supports the resume-effort capability. The changes also update RPC and sleeping-agent schemas, resume-record comparison, and tests for metadata handling and generated resume commands.

Priority: Normal

Merge Risk: Minimal · up to 82a5f

No specific merge-blocking defect is established; merge after normal validation.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the change, implementation, verification, and known limits, but it omits several required template sections, including the linked issue, Visual Proof or an explicit N/A, Testi… Add the missing template sections. Include an actual issue reference under "Fixes #", state N/A with a reason for Visual Proof if no UI change exists, document the testing platforms and required commands, complete the applicable checkboxe…
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 16 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: resuming Claude sessions at their saved effort level.
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.
Full details: Description check

Explanation

The description explains the change, implementation, verification, and known limits, but it omits several required template sections, including the linked issue, Visual Proof or an explicit N/A, Testing checklist, AI Disclosure, Review, Notes, Agent skill upstream boundary, and Checklist.

Resolution

Add the missing template sections. Include an actual issue reference under "Fixes #", state N/A with a reason for Visual Proof if no UI change exists, document the testing platforms and required commands, complete the applicable checkboxes, and address AI Disclosure, Review, cross-platform impact, and the Agent skill upstream boundary.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@Jinwoo-H
Jinwoo-H merged commit a1da3c0 into main Oct 26, 2026
55 checks passed
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