Skip to content

feat(mobile): add configurable default effort level#2406

Merged
Gilbert09 merged 2 commits into
mainfrom
posthog-code/mobile-default-effort-level
May 28, 2026
Merged

feat(mobile): add configurable default effort level#2406
Gilbert09 merged 2 commits into
mainfrom
posthog-code/mobile-default-effort-level

Conversation

@Gilbert09
Copy link
Copy Markdown
Member

Summary

  • Ports desktop PR feat(settings): add configurable default effort level #2116 to the mobile app: adds a "Default effort level" preference that pre-fills the reasoning pill on the new-task composer.
  • The setting accepts the five effort levels mobile's composer already supports (low/medium/high/xhigh/max) plus last_used, which remembers the user's most recent pick.
  • New lastUsedReasoningEffort is updated whenever the user picks a reasoning level in either composer, so the last_used default has something to fall back on.
  • All persisted in the existing preferencesStore. UI added under Settings > Input below "Initial task mode".

Test plan

  • pnpm --filter @posthog/mobile test (preferences store unit tests + existing suite)
  • Manually verify in the app: pick "Max" as default, open the new-task screen, confirm reasoning pill shows "Max"
  • Switch the setting to "Last used", change the pill to "Low" while composing, reopen the new-task screen, confirm it remembers "Low"
  • Setting persists across app restart

Adds a "Default effort level" setting that lets users choose a fixed
reasoning effort (low/medium/high/xhigh/max) or "Last used" for new
tasks. Mirrors the existing defaultInitialTaskMode pattern and the
desktop implementation.

Changes:
- Add DefaultReasoningEffort type plus defaultReasoningEffort and
  lastUsedReasoningEffort state to the mobile preferences store
  (persisted; defaults to "last_used" / "high")
- Pre-fill the new-task composer's reasoning pill from the default,
  falling back to lastUsedReasoningEffort when set to "last_used"
- Persist the user's choice to lastUsedReasoningEffort whenever they
  pick a reasoning level in the new-task or per-task composer
- Add "Default effort level" row in the Settings > Input section

Generated-By: PostHog Code
Task-Id: c9a0b0d8-fd48-4cd1-a18f-b7a2cfa93020
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/mobile/src/features/preferences/stores/preferencesStore.test.ts:24-39
The setter tests only spot-check one or two values each, missing "low", "medium", "high", and "xhigh" for `setDefaultReasoningEffort` and all values except "xhigh" for `setLastUsedReasoningEffort`. The team's convention is to prefer parameterised tests — using `it.each` here would cover every valid effort level without the repetition.

```suggestion
  it.each(["low", "medium", "high", "xhigh", "max", "last_used"] as const)(
    "updates defaultReasoningEffort to %s via setter",
    (effort) => {
      usePreferencesStore.getState().setDefaultReasoningEffort(effort);
      expect(usePreferencesStore.getState().defaultReasoningEffort).toBe(
        effort,
      );
    },
  );

  it.each(["low", "medium", "high", "xhigh", "max"] as const)(
    "updates lastUsedReasoningEffort to %s via setter",
    (effort) => {
      usePreferencesStore.getState().setLastUsedReasoningEffort(effort);
      expect(usePreferencesStore.getState().lastUsedReasoningEffort).toBe(
        effort,
      );
    },
  );
```

Reviews (1): Last reviewed commit: "feat(mobile): add configurable default e..." | Re-trigger Greptile

Comment on lines +24 to +39
it("updates defaultReasoningEffort via setter", () => {
usePreferencesStore.getState().setDefaultReasoningEffort("max");
expect(usePreferencesStore.getState().defaultReasoningEffort).toBe("max");

usePreferencesStore.getState().setDefaultReasoningEffort("last_used");
expect(usePreferencesStore.getState().defaultReasoningEffort).toBe(
"last_used",
);
});

it("updates lastUsedReasoningEffort via setter", () => {
usePreferencesStore.getState().setLastUsedReasoningEffort("xhigh");
expect(usePreferencesStore.getState().lastUsedReasoningEffort).toBe(
"xhigh",
);
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The setter tests only spot-check one or two values each, missing "low", "medium", "high", and "xhigh" for setDefaultReasoningEffort and all values except "xhigh" for setLastUsedReasoningEffort. The team's convention is to prefer parameterised tests — using it.each here would cover every valid effort level without the repetition.

Suggested change
it("updates defaultReasoningEffort via setter", () => {
usePreferencesStore.getState().setDefaultReasoningEffort("max");
expect(usePreferencesStore.getState().defaultReasoningEffort).toBe("max");
usePreferencesStore.getState().setDefaultReasoningEffort("last_used");
expect(usePreferencesStore.getState().defaultReasoningEffort).toBe(
"last_used",
);
});
it("updates lastUsedReasoningEffort via setter", () => {
usePreferencesStore.getState().setLastUsedReasoningEffort("xhigh");
expect(usePreferencesStore.getState().lastUsedReasoningEffort).toBe(
"xhigh",
);
});
it.each(["low", "medium", "high", "xhigh", "max", "last_used"] as const)(
"updates defaultReasoningEffort to %s via setter",
(effort) => {
usePreferencesStore.getState().setDefaultReasoningEffort(effort);
expect(usePreferencesStore.getState().defaultReasoningEffort).toBe(
effort,
);
},
);
it.each(["low", "medium", "high", "xhigh", "max"] as const)(
"updates lastUsedReasoningEffort to %s via setter",
(effort) => {
usePreferencesStore.getState().setLastUsedReasoningEffort(effort);
expect(usePreferencesStore.getState().lastUsedReasoningEffort).toBe(
effort,
);
},
);
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile/src/features/preferences/stores/preferencesStore.test.ts
Line: 24-39

Comment:
The setter tests only spot-check one or two values each, missing "low", "medium", "high", and "xhigh" for `setDefaultReasoningEffort` and all values except "xhigh" for `setLastUsedReasoningEffort`. The team's convention is to prefer parameterised tests — using `it.each` here would cover every valid effort level without the repetition.

```suggestion
  it.each(["low", "medium", "high", "xhigh", "max", "last_used"] as const)(
    "updates defaultReasoningEffort to %s via setter",
    (effort) => {
      usePreferencesStore.getState().setDefaultReasoningEffort(effort);
      expect(usePreferencesStore.getState().defaultReasoningEffort).toBe(
        effort,
      );
    },
  );

  it.each(["low", "medium", "high", "xhigh", "max"] as const)(
    "updates lastUsedReasoningEffort to %s via setter",
    (effort) => {
      usePreferencesStore.getState().setLastUsedReasoningEffort(effort);
      expect(usePreferencesStore.getState().lastUsedReasoningEffort).toBe(
        effort,
      );
    },
  );
```

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!

Use it.each to cover every reasoning effort level in the setter tests,
matching the convention used across the desktop test suite.

Generated-By: PostHog Code
Task-Id: c9a0b0d8-fd48-4cd1-a18f-b7a2cfa93020
@Gilbert09 Gilbert09 added the Stamphog This will request an autostamp by stamphog on small changes label May 28, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, additive mobile preference feature. The bot's outdated it.each suggestion is already addressed in the final test file. No data integrity, API contract, or security concerns.

@Gilbert09 Gilbert09 merged commit 5daaae2 into main May 28, 2026
20 checks passed
@Gilbert09 Gilbert09 deleted the posthog-code/mobile-default-effort-level branch May 28, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant