Files
claude-agent-acp/docs
Hussain Hammad 9d71d12336 fix: offer clearing the context on plan approval only when Claude Code's setting is on (#1627)
Refs #1077

Claude Code's plan-approval dialog offers "clear context" only when
`showClearContextOnPlanAccept` is on (the SDK's `Settings` docs: "When
true, the plan-approval dialog offers a "clear context" option. Defaults
to false."). The adapter offered it on every ExitPlanMode request, and
#1077 shows what a cleared context then loses on `session/load`.

- `SettingsManager.getShowClearContextOnPlanAccept` resolves the setting
as the CLI does: managed settings, then the `--settings` override, then
the user/project/local files; false otherwise.
- `buildClaudePermissionOptions` offers the clear-context option only
when it is on, for v1 and v2.

Tests cover the default, the v1 wiring and the settings precedence; the
existing clear-context tests and the exit-plan scenarios turn the
setting on. Checked with a real session: without the setting, Approve
Plan offers `exit-plan-default`, `exit-plan-auto` and `reject`; with
`showClearContextOnPlanAccept: true` in the project's
`.claude/settings.json`, `exit-plan-clear-auto` is back and the plan
runs.

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-11-17 11:22:59 +00:00
..