Skip to content

refactor(api-client): extract cloud task transport - #3622

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

refactor(api-client): extract cloud task transport#3622
trunk-io[bot] merged 9 commits into
mainfrom
posthog-code/share-cloud-task-api-client

Conversation

@richardsolomou

@richardsolomou richardsolomou commented Jul 21, 2026

Copy link
Copy Markdown
Member

Problem

Cloud-task transport behavior needed a host-neutral API client before mobile could stop maintaining its own HTTP implementation.

Depends on #3616
Refs PostHog/posthog#76229

Changes

Phase 1 only: I added the existing cloud-task, automation, integration, sandbox, and run transport to @posthog/api-client, with normalization and contract tests. Mobile remains unchanged in this PR.

How did you test this?

  • Full monorepo typecheck at this checkpoint
  • Final stack: 711 shared, 153 API-client, 2,599 core, and 451 mobile tests

Automatic notifications

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

Created with PostHog Code

@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 787451d.

@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 533ed1f to fe1c27f Compare July 21, 2026 13:29
@richardsolomou richardsolomou changed the title refactor(cloud): share task API transport refactor(cloud): share task API transport across hosts Jul 21, 2026
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-foundations branch from c0ffe74 to 88a0684 Compare July 23, 2026 12:31
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 4478f7e to 9932264 Compare July 23, 2026 12:40
@richardsolomou richardsolomou changed the title refactor(cloud): share task API transport across hosts refactor(mobile): reuse the task API client Jul 23, 2026
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. apps/mobile/src/features/tasks/stores/taskSessionStore.ts, line 1198-1204 (link)

    P1 Resume drops permission mode

    When a terminal cloud task is resumed with a selected permission mode, this call omits runtimeAdapter; the shared serializer only emits initial_permission_mode when an adapter is present, causing the resumed run to use the backend's default permission behavior instead of the user's plan, accept-edits, or auto mode.

    Knowledge Base Used: api-client: the shared PostHog API client

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/mobile/src/features/tasks/stores/taskSessionStore.ts
    Line: 1198-1204
    
    Comment:
    **Resume drops permission mode**
    
    When a terminal cloud task is resumed with a selected permission mode, this call omits `runtimeAdapter`; the shared serializer only emits `initial_permission_mode` when an adapter is present, causing the resumed run to use the backend's default permission behavior instead of the user's plan, accept-edits, or auto mode.
    
    **Knowledge Base Used:** [api-client: the shared PostHog API client](https://app.greptile.com/posthog-org-19734/-/custom-context/knowledge-base/posthog/code/-/docs/api-client.md)
    
    How can I resolve this? If you propose a fix, please make it concise.
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/stores/taskSessionStore.ts:1198-1204
**Resume drops permission mode**

When a terminal cloud task is resumed with a selected permission mode, this call omits `runtimeAdapter`; the shared serializer only emits `initial_permission_mode` when an adapter is present, causing the resumed run to use the backend's default permission behavior instead of the user's plan, accept-edits, or auto mode.

Reviews (1): Last reviewed commit: "Merge posthog-code/share-cloud-task-foun..." | Re-trigger Greptile

@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 36ecfcf to 826b6dd Compare July 23, 2026 17:28
@richardsolomou

Copy link
Copy Markdown
Member Author

fixed the resume path so it always supplies the runtime adapter and preserves the selected permission mode.

@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-foundations branch from 01d914f to c5f360f Compare July 24, 2026 16:41
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 826b6dd to df92334 Compare July 24, 2026 16:41
@richardsolomou richardsolomou changed the title refactor(mobile): reuse the task API client refactor(api-client): extract cloud task transport Jul 24, 2026
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch 3 times, most recently from a14c3b7 to 86e2b83 Compare July 24, 2026 22:57
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 86e2b83 to 9bc38a5 Compare July 24, 2026 23:07
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
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 9bc38a5 to 12143f2 Compare July 28, 2026 09:06
Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 12143f2 to 2f0ea11 Compare July 28, 2026 09:28
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
Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
@richardsolomou
richardsolomou force-pushed the posthog-code/share-cloud-task-api-client branch from 2f0ea11 to b69d17d Compare July 29, 2026 07:58
Base automatically changed from posthog-code/share-cloud-task-foundations to main July 29, 2026 09:03
@trunk-io

trunk-io Bot commented Jul 29, 2026

Copy link
Copy Markdown

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

Generated-By: PostHog Code
Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
@trunk-io
trunk-io Bot merged commit 7d1d9d7 into main Jul 29, 2026
34 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/share-cloud-task-api-client branch July 29, 2026 09:18
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.

2 participants