Repository navigation
Add a persisted "mode after plan approval" setting #3728
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { | |||||||||||||||||||||||||||
| Robot, | ||||||||||||||||||||||||||||
| ShieldCheck, | ||||||||||||||||||||||||||||
| } from "@phosphor-icons/react"; | ||||||||||||||||||||||||||||
| import type { ExecutionMode } from "@posthog/shared"; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export interface ModeStyle { | ||||||||||||||||||||||||||||
| icon: React.ReactNode; | ||||||||||||||||||||||||||||
|
|
@@ -66,3 +67,14 @@ export const MODE_LABELS: Record<string, string> = { | |||||||||||||||||||||||||||
| "read-only": "Read-only", | ||||||||||||||||||||||||||||
| "full-access": "Full access", | ||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Concrete modes `buildExitPlanModePermissionOptions` (packages/agent) can | ||||||||||||||||||||||||||||
| // offer when a plan is approved, excluding "plan" itself. Kept here, next to | ||||||||||||||||||||||||||||
| // the label map settings/approval UI already share, so both pick modes from | ||||||||||||||||||||||||||||
| // one list. | ||||||||||||||||||||||||||||
| export const PLAN_APPROVAL_MODES: readonly ExecutionMode[] = [ | ||||||||||||||||||||||||||||
| "auto", | ||||||||||||||||||||||||||||
| "default", | ||||||||||||||||||||||||||||
| "acceptEdits", | ||||||||||||||||||||||||||||
| "bypassPermissions", | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
|
Comment on lines
+70
to
+80
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PLAN_APPROVAL_MODES hardcodes Claude-only mode ids, breaking the pinned setting for the Codex adapterWhy we think it's a valid issue
Issue description
Suggested fixMake the offered pin choices adapter-agnostic and derived from what can actually be offered, e.g. include Prompt to fix with AI (copy-paste)
Comment on lines
+75
to
+80
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codex offers
Suggested change
Rule Used: When implementing new features, ensure that the UI... (source) Learned From Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/ui/src/features/sessions/modeStyles.tsx
Line: 75-80
Comment:
**Codex Full Access Is Missing**
Codex offers `full-access` after plan approval when bypass is allowed, but this list controls the new settings menu and omits that mode. Codex users can select Full access during approval but cannot pin it as their default.
```suggestion
export const PLAN_APPROVAL_MODES: readonly ExecutionMode[] = [
"auto",
"default",
"acceptEdits",
"bypassPermissions",
"full-access",
];
```
**Rule Used:** When implementing new features, ensure that the UI... ([source](https://app.greptile.com/posthog-org-19734/-/custom-context?memory=5d57f0af-0be1-44de-8885-055f27e2885f))
**Learned From**
[PostHog/posthog#32595](https://github.com/PostHog/posthog/pull/32595)
[PostHog/posthog#32677](https://github.com/PostHog/posthog/pull/32677)
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When persisted settings hydrate after mount, or the mounted selector receives a new approval with different options,
initialModerecomputes but the followinguseState(initialMode)retains the old selection. Approving can therefore submit the pre-hydration mode or a mode that is not offered by the current approval request.Prompt To Fix With AI