Skip to content

feat: local to cloud handoff#1618

Merged
jonathanlab merged 2 commits into
mainfrom
04-13-feat_local_to_cloud_handoff
Apr 23, 2026
Merged

feat: local to cloud handoff#1618
jonathanlab merged 2 commits into
mainfrom
04-13-feat_local_to_cloud_handoff

Conversation

@jonathanlab
Copy link
Copy Markdown
Contributor

@jonathanlab jonathanlab commented Apr 13, 2026

Now let's do it the other way around as well, local to cloud

MERGE THIS PR IN THE MONOREPO BEFORE MERGING THIS ONE: PostHog/posthog#54540

Copy link
Copy Markdown
Contributor Author

jonathanlab commented Apr 13, 2026

@jonathanlab jonathanlab force-pushed the 04-10-feat_use_checkpoints_for_handoff branch from be5dbb2 to f84880f Compare April 14, 2026 10:41
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch from d008d03 to d0a40fd Compare April 14, 2026 10:41
@jonathanlab jonathanlab marked this pull request as ready for review April 14, 2026 19:32
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch from d0a40fd to a5c2efd Compare April 15, 2026 13:43
@jonathanlab jonathanlab force-pushed the 04-10-feat_use_checkpoints_for_handoff branch from f84880f to 073e13c Compare April 15, 2026 13:43
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch from a5c2efd to 0420f7e Compare April 15, 2026 13:54
@jonathanlab jonathanlab force-pushed the 04-10-feat_use_checkpoints_for_handoff branch from 073e13c to 39b5ea9 Compare April 20, 2026 12:42
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch from 0420f7e to b57ff63 Compare April 20, 2026 12:42
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch from b57ff63 to 7895eac Compare April 23, 2026 11:48
@jonathanlab jonathanlab force-pushed the 04-10-feat_use_checkpoints_for_handoff branch from 39b5ea9 to 461ff8a Compare April 23, 2026 11:48
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch 3 times, most recently from 52f9496 to 2b50997 Compare April 23, 2026 13:48
Copy link
Copy Markdown
Contributor Author

jonathanlab commented Apr 23, 2026

Merge activity

  • Apr 23, 2:04 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 23, 2:17 PM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 23, 2:19 PM UTC: Graphite couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'build').
  • Apr 23, 3:02 PM UTC: @jonathanlab merged this pull request with Graphite.

@jonathanlab jonathanlab changed the base branch from 04-10-feat_use_checkpoints_for_handoff to graphite-base/1618 April 23, 2026 14:05
@jonathanlab jonathanlab changed the base branch from graphite-base/1618 to main April 23, 2026 14:16
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch 3 times, most recently from cbce0b4 to 83e6dcc Compare April 23, 2026 14:34
@jonathanlab jonathanlab enabled auto-merge (squash) April 23, 2026 14:37
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch from 83e6dcc to 2daddc8 Compare April 23, 2026 14:41
@jonathanlab jonathanlab force-pushed the 04-13-feat_local_to_cloud_handoff branch from 2daddc8 to 4cf90ab Compare April 23, 2026 14:42
auto-merge was automatically disabled April 23, 2026 14:43

Pull request was closed

@jonathanlab jonathanlab reopened this Apr 23, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Comments Outside Diff (2)

  1. apps/code/src/renderer/hooks/useFeatureFlag.ts, line 19-27 (link)

    P2 All feature flags enabled in dev, not just the cloud-handoff flag

    IS_DEV || ... short-circuits for every call to useFeatureFlag, enabling every flag across the whole app when running locally — not just CLOUD_HANDOFF_FLAG. Any other flag that is intentionally gated (e.g. a half-finished feature, a risky rollout) will silently become active in development. Consider passing the override at the call site, or maintaining a specific allowlist of dev-overridden flags rather than enabling all of them unconditionally.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/code/src/renderer/hooks/useFeatureFlag.ts
    Line: 19-27
    
    Comment:
    **All feature flags enabled in dev, not just the cloud-handoff flag**
    
    `IS_DEV || ...` short-circuits for every call to `useFeatureFlag`, enabling every flag across the whole app when running locally — not just `CLOUD_HANDOFF_FLAG`. Any other flag that is intentionally gated (e.g. a half-finished feature, a risky rollout) will silently become active in development. Consider passing the override at the call site, or maintaining a specific allowlist of dev-overridden flags rather than enabling all of them unconditionally.
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. apps/code/src/main/services/handoff/handoff-to-cloud-saga.ts, line 354-356 (link)

    P2 Side-effectful killSession wrapped in readOnlyStep

    readOnlyStep signals "no rollback needed", but terminating the local agent is an irreversible side effect. If the subsequent update_workspace step fails and rolls back (setting the mode back to local), the local agent is already dead, leaving the workspace in an inconsistent state where the mode says local but no agent is running. Consider making this a normal step with a no-op or reconnect attempt as the rollback, or at minimum swapping the order so update_workspace runs before the session is killed.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/code/src/main/services/handoff/handoff-to-cloud-saga.ts
    Line: 354-356
    
    Comment:
    **Side-effectful `killSession` wrapped in `readOnlyStep`**
    
    `readOnlyStep` signals "no rollback needed", but terminating the local agent is an irreversible side effect. If the subsequent `update_workspace` step fails and rolls back (setting the mode back to `local`), the local agent is already dead, leaving the workspace in an inconsistent state where the mode says `local` but no agent is running. Consider making this a normal `step` with a no-op or reconnect attempt as the rollback, or at minimum swapping the order so `update_workspace` runs before the session is killed.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/code/src/main/services/handoff/service.ts
Line: 337

Comment:
**Incorrect return value inflates `processedLineCount`**

`flushLocalLogs` returns `lines.length` — the total count of non-empty lines in the file, including the `seed_boundary` marker and any seeded cloud entries from a previous run. Only `entries` (lines after the boundary that parse as valid JSON) are actually appended to the cloud log. When the return value flows through `flushedLogEntryCount``logEntryCount``processedLineCount` on the session, the cloud watcher starts reading the cloud log offset by those extra lines and will skip valid new entries that were just flushed.

```suggestion
        return entries.length;
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: apps/code/src/renderer/hooks/useFeatureFlag.ts
Line: 19-27

Comment:
**All feature flags enabled in dev, not just the cloud-handoff flag**

`IS_DEV || ...` short-circuits for every call to `useFeatureFlag`, enabling every flag across the whole app when running locally — not just `CLOUD_HANDOFF_FLAG`. Any other flag that is intentionally gated (e.g. a half-finished feature, a risky rollout) will silently become active in development. Consider passing the override at the call site, or maintaining a specific allowlist of dev-overridden flags rather than enabling all of them unconditionally.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: apps/code/src/main/services/handoff/handoff-to-cloud-saga.ts
Line: 354-356

Comment:
**Side-effectful `killSession` wrapped in `readOnlyStep`**

`readOnlyStep` signals "no rollback needed", but terminating the local agent is an irreversible side effect. If the subsequent `update_workspace` step fails and rolls back (setting the mode back to `local`), the local agent is already dead, leaving the workspace in an inconsistent state where the mode says `local` but no agent is running. Consider making this a normal `step` with a no-op or reconnect attempt as the rollback, or at minimum swapping the order so `update_workspace` runs before the session is killed.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "chore: trigger ci" | Re-trigger Greptile

Comment thread apps/code/src/main/services/handoff/service.ts
@jonathanlab jonathanlab merged commit 678007c into main Apr 23, 2026
16 of 20 checks passed
@jonathanlab jonathanlab deleted the 04-13-feat_local_to_cloud_handoff branch April 23, 2026 15:02
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