Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

refactor(shared): extract task contracts and model policy - #3616

Merged
trunk-io[bot] merged 7 commits into
mainfrom
posthog-code/share-cloud-task-foundations
Jul 29, 2026
Merged

refactor(shared): extract task contracts and model policy#3616
trunk-io[bot] merged 7 commits into
mainfrom
posthog-code/share-cloud-task-foundations

Conversation

@richardsolomou

@richardsolomou richardsolomou commented Jul 21, 2026

Copy link
Copy Markdown
Member

Problem

Desktop task contracts and model policy were tied to agent-specific modules, preventing other hosts from reusing them without duplicating behavior. Two current-main UI tests also asserted before asynchronous tab and Markdown content mounted under CI load.

Refs PostHog/posthog#76229

Changes

Phase 1 only: I moved the existing desktop contracts and model policy into @posthog/shared. Mobile remains unchanged. The UI test changes only wait for rendered behavior and do not change product behavior.

How did you test this?

  • Full monorepo typecheck
  • Full UI suite: 2,113 tests
  • Full mobile suite: 451 tests
  • Repeated the two CI-racing UI tests 10 times

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

@trunk-io

trunk-io Bot commented Jul 21, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit b4e9084.

@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-foundations branch from 8c39d0e to f08bac5 Compare July 21, 2026 12:30
@richardsolomou richardsolomou changed the title refactor(cloud): share portable task foundations refactor(cloud): share task contracts and model policy Jul 21, 2026

@jonathanlab jonathanlab left a comment

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.

shared can be used for exporting contract types, but now we're also moving a ton of logic in to there, which should move to core.

The aim is to make core a reusable set of logic by different surfaces, web, mobile, desktop, which does not rely on any platform dependencies. If we move too much logic into shared it risks becoming this unstructured dependency layer, which can bypass all the strict architectural boundaries we're enforcing around core.

@richardsolomou richardsolomou changed the title refactor(cloud): share task contracts and model policy refactor(mobile): reuse task contracts and model policy Jul 23, 2026
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-foundations branch from c0ffe74 to 88a0684 Compare July 23, 2026 12:31
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
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/tasks/composer/options.ts:84-89
**Reasoning options ignore selected model**

When a user selects Claude Sonnet 4.6, the picker still exposes the Opus-derived `xhigh` and `max` levels, and the selected value is sent directly in the run payload or `set_config_option` command. Shared policy supports only `low`, `medium`, and `high` for Sonnet 4.6, so these selections produce an unsupported configuration that is rejected or misapplied.

Reviews (1): Last reviewed commit: "Merge main into shared task foundations" | Re-trigger Greptile

Comment thread apps/mobile/src/features/tasks/composer/options.ts Outdated
@richardsolomou

Copy link
Copy Markdown
Member Author

moved the composer policy into core in #3637, so shared is back to contracts and primitives.

@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-foundations branch from 01d914f to c5f360f Compare July 24, 2026 16:41
@richardsolomou richardsolomou changed the title refactor(mobile): reuse task contracts and model policy refactor(shared): extract task contracts and model policy Jul 24, 2026
Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
Keep the extracted domain declaration as the single source after rebasing onto current main.

Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-foundations branch from fe7ba5d to 3f608f2 Compare July 28, 2026 09:06
Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
Preserve the shared model-policy extraction while incorporating current main's Modal model support.

Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
@trunk-io

trunk-io Bot commented Jul 29, 2026

Copy link
Copy Markdown

GitHub considers this PR to be a part of a stack - GitHub has not rolled out support for Trunk to work with these stacks yet, so our merge queue will be unable to merge this PR. Until GitHub does, you must tear down a PR's stack before submitting it to the merge queue (see here). For more help, please raise this with GitHub.

@trunk-io
trunk-io Bot merged commit c6de03f into main Jul 29, 2026
35 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/share-cloud-task-foundations branch July 29, 2026 09:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants