[BUG] Self-hosted runner: resumed session comes back in plan mode although the session wrapper passes --permission-mode auto
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
On a self-hosted environment (claude self-hosted-runner), a session that is released (idle release) and later resumes on a fresh runner comes back in plan mode. The user had not asked for plan mode, and the session had left plan mode before it was released.
The runner's --exec-path wrapper appends --permission-mode auto to every session it starts:
exec "$CLAUDE_RUNNER_CLAUDE_BIN" "$@" --permission-mode auto
so the expected mode on every resume is auto. Observed over one session with four resumes:
| Resume | Mode on resume |
|---|---|
| 1 | plan (re-enabled) |
| 2 | not in plan mode |
| 3 | plan (re-enabled) |
| 4 | not in plan mode |
Each plan-mode resume needed an ExitPlanMode round trip and user re-approval before work could continue.
This looks related to the 2.1.132 change that re-applies plan mode when resuming a plan-mode session (see #56883). If the restored mode is taken from an earlier point in the transcript, it overrides both the session's current mode and the wrapper's explicit flag.
What Should Happen?
A resumed session keeps the permission mode it had when it was released. An explicit --permission-mode passed by the runner's wrapper is not silently overridden.
Error Messages/Logs
No error. The resume turn shows plan mode active.
Steps to Reproduce
- Run
claude self-hosted-runnerwith--release-idle-session-min 10and an--exec-pathwrapper that appends--permission-mode auto. - Start a session, enter plan mode, have the plan approved (
ExitPlanMode), and continue working in auto mode. - Leave the session idle past the release timeout.
- Send a message so it resumes on a fresh runner.
- The session is in plan mode again.
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.294 (runner image built from the latest apt channel)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
The runner runs one session per Kubernetes pod with a fresh --base-dir per pod, so nothing local carries over between resumes. A related report covers the pending ExitPlanMode approval being orphaned when the session is released while waiting on it.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗