Skip to content

fix(mobile): persist selected execution mode across prompts#2558

Open
dmarticus wants to merge 1 commit into
mainfrom
posthog-code/mobile-persist-execution-mode
Open

fix(mobile): persist selected execution mode across prompts#2558
dmarticus wants to merge 1 commit into
mainfrom
posthog-code/mobile-persist-execution-mode

Conversation

@dmarticus

Copy link
Copy Markdown
Contributor

Problem

In the mobile app, the execution mode reverts to plan after every subsequent prompt, even when the user changes it (e.g. to "accept edits") at task creation. The selected mode should persist for the duration of the session.

Root cause

The new-task screen (apps/mobile/src/app/task/index.tsx) let the user pick a mode and passed it as initialPermissionMode to the first cloud run — but never wrote that choice into taskStore.composerConfigByTaskId[task.id].

So on the task detail screen, composerConfig for that task was undefined and composerMode fell back to DEFAULT_EXECUTION_MODE = "plan". Since each agent turn completes its run on the cloud, every follow-up prompt goes through the resume-after-terminal path, which starts a fresh run with initialPermissionMode: composerMode — i.e. "plan". That's why it reverted on every subsequent prompt.

(The agent retains the mode correctly within a single run — the reversion was purely the mobile client sending "plan" to each new run.)

Fix

When a task is created, seed the per-task composer config with the mode/model/reasoning the user selected:

setComposerConfig(task.id, { mode, model, reasoning });

Now the detail screen reflects the chosen mode, and every subsequent resume run reuses it for the duration of the session. This also keeps model and reasoning selections consistent across follow-ups, which had the same gap.

Changing the mode mid-session via the detail-screen pill already persisted correctly (handleModeChange calls setComposerConfig), so that path is unaffected.

Notes

  • Tasks created before this fix (no stored config) still default to "plan", which is the intended fallback.

🤖 Generated with Claude Code

When creating a task, the new-task screen passed the user's chosen execution
mode as `initialPermissionMode` to the first cloud run but never seeded
`taskStore.composerConfigByTaskId[task.id]`. As a result, the task detail
screen read `composerConfig` as `undefined` and fell back to
`DEFAULT_EXECUTION_MODE` ("plan"). Since each agent turn completes its run,
every follow-up prompt went through the resume-after-terminal path and started
a fresh run with `initialPermissionMode: "plan"`, reverting the session to plan
mode regardless of the user's initial choice.

Seed the per-task composer config with the selected mode/model/reasoning at
task creation so the detail screen reflects them and every subsequent run
reuses the selected mode for the duration of the session.

Generated-By: PostHog Code
Task-Id: 6d87d732-7ac9-4633-89e2-d2be6efdcd67
@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(mobile): persist selected execution ..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 2716f16.

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.

1 participant