Skip to content

fix(plan): accepting a plan switches to auto-accept mode by default - #714

Merged
edenreich merged 3 commits into
mainfrom
fix/plan-accept-auto-mode
Jul 2, 2026
Merged

edenreich merged 3 commits into
mainfrom
fix/plan-accept-auto-mode

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

Accepting a plan dropped the agent into standard mode, forcing per-action approval during execution — the friction reported in #710. The default Accept now switches to auto-accept mode, so an already-reviewed plan executes without re-approving every step.

Behavior

The plan-approval prompt now offers:

Option Key Result
Accept (default) Enter / y auto-accept mode (no per-action approval)
Approve Each Step s standard mode (approve every action)
Reject n ends the session (unchanged)

The cautious per-step path is preserved as an explicit choice, so no capability is lost. The mode is set on the StateManager rather than the conversation, so it survives the post-approval context compaction + fresh session from #705.

Note: the secondary keybinding changed from a to s.

Changes

  • applyPlanDecision (approval coordinator): Accept → AutoAccept; new AcceptStandard → Standard.
  • Renamed the enum PlanApprovalAcceptAndAutoApprove → PlanApprovalAcceptStandard.
  • UI: relabeled the third button to "Approve Each Step", updated the plan-approval hint text, and rekeyed a → s.
  • Updated the RequestPlanApproval tool result + prompt copy to describe the new options.
  • Updated the coordinator tests for the swapped semantics.

Testing

  • task test — full suite passes
  • task lint — 0 issues (golangci-lint + markdownlint)

Closes #710

The default Accept action now switches to auto-accept mode so an
already-reviewed plan executes without per-action approval. A new
'Approve Each Step' option (key: s) keeps standard mode for cautious
runs; Reject is unchanged.
@edenreich
edenreich requested a review from a team as a code owner July 2, 2026 09:17
@edenreich

Copy link
Copy Markdown
Contributor Author

@claude Is it ready for merge?

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @edenreich's task in 5m 55s —— View job


Merge-readiness review: PR #714

  • Read the full diff vs origin/main
  • Check semantics of the plan-accept mode switch
  • Verify enum rename is consistent across the codebase
  • Check keybinding change (a → s) for conflicts
  • Run tests + build + vet
  • Post merge-readiness verdict

Verdict: Code is solid, but there are stale docs to fix first ⚠️

The implementation is correct, consistent, and well-tested. The only thing blocking a clean merge is that the user-facing markdown docs still describe the old behavior.

What I verified ✅

  • Enum rename fully propagated. No leftover references to PlanApprovalAcceptAndAutoApprove / plan_approval_accept_and_auto_approve / handlePlanApprovalAcceptAndAutoApprove anywhere. All 7 touched files line up.
  • Enum ordering is safe. Values are unchanged (Accept=0, Reject=1, AcceptStandard=2); only the name/semantics at index 2 changed. The wraparound nav bounds (newIndex > int(PlanApprovalAcceptStandard)) and the render order in conversation_view.go (Accept · Reject · Approve Each Step) all stay consistent.
  • Index-driven Enter handler is correct. handlePlanApprovalAccept casts SelectedIndex → action, so Enter on the highlighted button routes correctly (idx 2 → standard, idx 1 → reject), while y still force-accepts. No regression.
  • No keybinding conflict. s is bound only inside ViewStatePlanApproval (modal context), and no other {"s"} binding exists in actions.go.
  • No serialization/migration concern. PlanApprovalAction is a transient UI event, not persisted; conversation.go maps both accept variants to the same PlanApprovalAccepted status.
  • Build + tests + vet: go build ./... clean, go vet clean, full go test ./... passes (incl. the updated approvalcoord coordinator tests). golangci-lint needs flox (not runnable in this sandbox) but the author reports it green and vet is clean.

Needs fixing before merge: stale documentation 📄

The in-code copy (config/prompts.go, input_view.go, button labels) was updated, but these docs were missed and now contradict the new behavior:

File Line Problem
docs/plan-mode.md 38-40 "accepted → flips back to Standard (or Auto-Accept if you chose 'Accept & Auto-Approve')" — now Accept defaults to Auto-Accept
docs/plan-mode.md 123-129 Lists old three options ("Accept → Standard", "Accept & Auto-Approve")
docs/plan-mode.md 137-138 References "Accept & Auto-Approve"
docs/commands-reference.md 301-303 "Accept: … (stays in Plan Mode)" + "Accept & Auto-Approve (a)" — wrong label and stale a key
docs/tools-reference.md 537 "shows … Accept, Reject, and Accept & Auto-Approve options"

These should read: Accept (Enter/y) → Auto-Accept; Approve Each Step (s) → Standard; Reject (n) → ends session.

Fix the stale docs →

One heads-up (by design, not a blocker) 🔎

The default Accept (Enter) now drops into Auto-Accept mode. Per this repo's model that means the bash allow-list becomes the .* sentinel (unrestricted) and per-action approval is off for the whole execution — a real increase in the default's blast radius. This is exactly what #710 asked for and mirrors Claude Code's own "accept plan → auto-accept" UX, and the system_prompt_auto destructive-action policy is swapped in as the guardrail (mode-driven via getSystemPromptForMode, so it kicks in automatically). Flagging only so the escalation of the default is a conscious choice.

Recommendation

Not quite ready — the code is merge-quality, but update the 3 doc files above (or file a fast-follow) so the docs match shipped behavior. Want me to push the doc fixes to this branch?
· branch fix/plan-accept-auto-mode

Accepting a plan (Enter/y) now switches to Auto-Accept mode; a new
'Approve Each Step' option (s) keeps Standard mode. Update plan-mode,
commands-reference, and tools-reference to match the shipped UX.
@edenreich
edenreich merged commit 7b0befc into main Jul 2, 2026
1 check passed
@edenreich
edenreich deleted the fix/plan-accept-auto-mode branch July 2, 2026 10:20
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 2, 2026
## [0.127.0](v0.126.0...v0.127.0) (2026-07-02)

### 🚀 Features

* **plan:** compact context and start a fresh session when a plan is approved ([#705](#705)) ([28ddba7](28ddba7))
* **memory:** configurable git sync backend ([#707](#707)) ([6a68c3d](6a68c3d)), closes [#670](#670) [#670](#670)
* **history:** each subagent gets its own history file ([#711](#711)) ([16c8fa1](16c8fa1)), closes [#699](#699)

### 🐛 Bug Fixes

* **plan:** accepting a plan switches to auto-accept mode by default ([#714](#714)) ([7b0befc](7b0befc)), closes [#710](#710)
* **tools:** guard concurrent gitignore and screenshot caches ([#713](#713)) ([0ff4276](0ff4276)), closes [#712](#712)
* **tools:** guard Registry.tools with RWMutex against concurrent MCP registration ([#709](#709)) ([8a70871](8a70871)), closes [#708](#708)
* **ui:** update dim color from [#565f89](https://github.com/inference-gateway/cli/issues/565f89) to [#7a7f9a](https://github.com/inference-gateway/cli/issues/7a7f9a) for improved contrast ([#706](#706)) ([b2ee67e](b2ee67e))

### 🔧 Build System

* **deps:** bump github.com/go-telegram/bot from 1.21.0 to 1.22.0 in the gomod group ([#703](#703)) ([3de5136](3de5136))
* **deps:** bump the github-actions group with 5 updates ([#704](#704)) ([80221f7](80221f7))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.127.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jul 2, 2026
edenreich added a commit that referenced this pull request Jul 2, 2026
## Summary

Fixes the flood of `unknown keybinding action` warnings in
`~/.infer/logs/app-<date>.log` - about **84 lines per `infer chat`
launch** (42 warn + 42 error), even with a stock `infer init` config.

## Root cause

- **Structural drift (the flood).** `config.GetDefaultKeybindings()`
includes 41 namespace-path actions (`chat_focus_attachments`, all
`diff_viewer_*`, all `explorer_*`) that are consumed directly via
`config.ResolveNamespaceBindings` and are never registered in the
runtime `Registry`. `(*Registry).ApplyConfigOverrides` warned for every
config ID absent from the registry, so it false-flagged all 41 on every
launch. The CLI validator `getValidActionIDs()` shared the same blind
spot.
- **Logger misuse (doubled the noise).** `registry.go:364` called
`logger.Warn("... '%s' ...", actionID)`, but `logger.Warn(msg, args...)`
forwards to zap's key/value sugared API (`Warnw`). So `%s` never
expanded and the trailing `actionID` became a dangling key - which is
why zap added a second, `error`-level `Ignored key without a value.`
line.

## Fix

- New `config.DefaultKeybindingActionIDs()` - the config-side valid-ID
set.
- `ApplyConfigOverrides` now warns only for IDs in **neither** the
registry **nor** the defaults (exact-ID match, so genuine typos and
stale/removed IDs still warn once), and logs structured (`"action",
id`). The sibling misuse at `registry.go:36` is fixed too.
- New `Registry.KnownActionIDs()` (registry union defaults); the CLI
validator uses it so `infer keybindings validate/set/enable/disable`
agree with the runtime.
- Regression tests: a stock config is silent; a genuine/namespace typo
warns exactly once with a structured `action` field and zero `Ignored
key` lines; the validator includes namespace-path IDs.

## Verification

- `task build`, `task lint` (0 issues), `go test ./...` all pass.
- `infer keybindings validate` against a real stale config: **42 -> 1**
unknown ID (only the genuinely-removed
`plan_approval_..._accept_and_auto_approve` from #714). Runtime flood
drops from 84 lines/launch to at most 1 clean structured warning.

## Notes

- No config regeneration - `GetDefaultKeybindings()` output is
unchanged.
- The doubled `plan_approval_plan_approval_` prefix is intentionally
left as-is (identical between registry and defaults; renaming would
break existing user configs).
- The same printf-style structured-logger misuse exists at ~18 other
call sites (same defect class, malformed logs); tracked separately in
#723.

Closes #722
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 3, 2026
## [0.128.0](v0.127.0...v0.128.0) (2026-07-03)

### 🚀 Features

* **chat:** make status indicators selectable with /tools and /a2a views ([#732](#732)) ([6882de0](6882de0)), closes [#717](#717) [#717](#717)

### 🐛 Bug Fixes

* **agent:** drop redundant Idle transition that errored on every run ([#726](#726)) ([469ec64](469ec64)), closes [#722](#722) [#725](#725)
* **agent:** report session-cumulative total_turns in completion logs ([#728](#728)) ([0d8fb08](0d8fb08)), closes [#727](#727)
* **a2a:** route active A2A reads and HasPending through the job supervisor ([#693](#693)) ([#721](#721)) ([dcd0670](dcd0670)), closes [#718](#718) [#719](#719) [#720](#720)
* **keybindings:** stop "unknown keybinding action" log flood ([#724](#724)) ([c828426](c828426)), closes [#714](#714) [#722](#722)
* **a2a:** unify background-job liveness, clear, and cancel on the supervisor contract ([#730](#730)) ([eb37fd0](eb37fd0)), closes [#693](#693) [#720](#720) [#718](#718) [#719](#719)
* **logging:** use structured key/value form at misused call sites ([#729](#729)) ([cd96028](cd96028)), closes [#722](#722) [#724](#724) [#724](#724) [#723](#723)
* **tools:** wait for pipe readers before reaping detached bash shells ([#716](#716)) ([e1d0d84](e1d0d84)), closes [#696](#696)

### ⚡ Performance Improvements

* **tui:** cache per-entry rendering and keep the Update loop responsive ([#731](#731)) ([8c9db0d](8c9db0d))

### 📚 Documentation

* **a2a:** add SKILL.md documentation for Agent2Agent protocol ([defcd57](defcd57))

### 🔧 Build System

* **deps:** bump golang.org/x/net from 0.47.0 to 0.55.0 in /examples/mcp/mcp-server ([#715](#715)) ([990803b](990803b))

### 🧹 Maintenance

* **flox:** bump dev deps ([d0c8f6b](d0c8f6b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Accepting the Plan should switch to auto mode by default

1 participant