Skip to content

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

Open
richardsolomou wants to merge 1 commit into
posthog-code/share-cloud-task-foundationsfrom
posthog-code/share-cloud-task-api-client
Open

refactor(api-client): extract cloud task transport#3622
richardsolomou wants to merge 1 commit into
posthog-code/share-cloud-task-foundationsfrom
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 #2416

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 9bc38a5.

@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
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 86e2b83 to 9bc38a5 Compare July 24, 2026 23:07
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