Skip to content

Allow read-only shell during Plan mode after ask_user_question - #90

Closed
mingminghome wants to merge 1 commit into
phuryn:mainfrom
mingminghome:fix/plan-mode-readonly-shell-after-questions
Closed

Allow read-only shell during Plan mode after ask_user_question#90
mingminghome wants to merge 1 commit into
phuryn:mainfrom
mingminghome:fix/plan-mode-readonly-shell-after-questions

Conversation

@mingminghome

@mingminghome mingminghome commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Fixes the Plan-mode UX where, after the user answers an ask_user_question card, the agent continues exploring but the next read-only shell (file / sips -g / ls, etc.) is auto-rejected with a misleading notice:

Plan mode declined a execute request — approve the plan first.

Answering questions is not plan approval. While planning, inspection should keep working; only real mutations stay blocked until the plan review card is approved.

Closes #89

What changed

  • Permission gate aligns with the terminal allowlist: execute is auto-allowed when isReadOnlyCommand(command); edit / write / mutating execute still auto-reject.
  • Notice text states that answering questions is not plan approval and points users at the plan review card.
  • Allowlist polish: sips -g / --getProperty (macOS image inspect), strip harmless 2>/dev/null / 2>&1 before unsafe checks; keep real redirects blocked.
  • Unit tests for the above in test/plan-gate.test.ts.

Test plan

  • npm test (full suite green locally)
  • Manual: Plan mode → answer question card → agent runs a read-only shell explore → should not show the old decline notice
  • Manual: Plan mode → mutating command / workspace write → still blocked until plan review Approve
  • Manual: Approve plan on review card → implementation proceeds as before

Plan mode was auto-rejecting every execute permission, so after the user
answered a question card the agent’s next inspect shell (file/sips/ls)
failed with a misleading “approve the plan first” notice. Align the
permission gate with the terminal allowlist, clarify the notice, and
treat sips -g plus null redirects as safe explore.
@mingminghome

Copy link
Copy Markdown
Author

Test recommandation:

1. Force the question popup

The “You answered” UI only appears when the agent calls ask_user_question. Easiest prompts:

Direct:

Before writing any plan, use ask_user_question to ask me 2–3 multiple-choice questions about the mobile UI (nav layout, tables on mobile, PWA). Wait for my answers, then continue exploring.

2. expected result

With the fix: a read-only shell like file … && sips -g …; ls … should run, not show:

Plan mode declined a execute request — approve the plan first.

Still blocked (expected): npm install, writes, edits, etc., until you Approve on the plan review card.

@mingminghome

Copy link
Copy Markdown
Author

Thank you for solving this issue 😃

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.

Plan mode declines shell after I answer questions

1 participant