Fix Copilot allow all mode fallback#1240
Conversation
When Copilot rejects the allow_all ACP config because its permission service is not ready, fall back to Copilot's /allow-all command and keep Paseo's mode state in sync. Fixes getpaseo#1239 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
| Filename | Overview |
|---|---|
| packages/server/src/server/agent/providers/copilot-acp-agent.ts | Core logic change: wraps setSessionConfigOption in try/catch, adds /allow-all fallback with guards for concurrent turns and non-end_turn stop reasons. New helpers are straightforward and correct. |
| packages/server/src/server/agent/providers/acp-agent.ts | Adds hasActiveTurn and suppressUserEcho to ACPProviderModeWriterContext; wired up correctly from existing session fields. |
| packages/server/src/server/agent/providers/acp-agent.test.ts | Adds prompt mock to shared harness and three new regression tests covering all new branches. |
Sequence Diagram
sequenceDiagram
participant P as Paseo (applyConfiguredOverrides)
participant C as Copilot (ACP)
P->>C: "setSessionConfigOption(allow_all=on)"
alt Success
C-->>P: configOptions[]
P->>P: update currentMode + configOptions
else PermissionServiceUnavailable error
C-->>P: throws -32603 error
alt "activeForegroundTurnId !== null"
P->>P: log warn, re-throw
else no active turn
P->>P: suppressUserEcho(fallbackMessageId)
P->>C: prompt("/allow-all")
C-->>P: "PromptResponse {stopReason}"
alt "stopReason === end_turn"
P->>P: setCopilotAllowAllConfigValue(on) locally
P->>P: "update currentMode = ALLOW_ALL"
else other stopReason
P->>P: log warn, re-throw original error
end
end
end
Reviews (2): Last reviewed commit: "Address PR review for Copilot allow-all ..." | Re-trigger Greptile
- Refuse the /allow-all fallback while a foreground turn is active to avoid issuing a concurrent prompt on the same ACP session; surface the original error instead. - Suppress the user echo for the synthesized /allow-all message so the slash command does not appear in the visible thread. - Inspect the prompt response and surface the original error if the fallback turn ends with a non-end_turn stop reason rather than optimistically marking allow_all as on. - Extend ACPProviderModeWriterContext with hasActiveTurn and a suppressUserEcho hook to wire the above without leaking session internals into providers. - Add regression tests for both the active-turn refusal and the non-end_turn stop reason paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Fixes #1239
Test plan