Skip to content

Add feature flag, API binding scaffolding for cloud->cloud handoff.#9313

Merged
zachbai merged 1 commit intomasterfrom
zb/cloud-cloud-handoff-scaffolding
Apr 29, 2026
Merged

Add feature flag, API binding scaffolding for cloud->cloud handoff.#9313
zachbai merged 1 commit intomasterfrom
zb/cloud-cloud-handoff-scaffolding

Conversation

@zachbai
Copy link
Copy Markdown
Contributor

@zachbai zachbai commented Apr 28, 2026

Description

Add feature flag and scaffolding for cloud->cloud handoff, incl bindings for follow-up API and abstracting formerly-task-specific public API on AmbientAgentViewModel into getters backed by now-execution-specific data.

@zachbai zachbai force-pushed the zb/reattachable-session-share branch from de84226 to e809b83 Compare April 28, 2026 22:56
@zachbai zachbai force-pushed the zb/cloud-cloud-handoff-scaffolding branch from 004a070 to 6c976cb Compare April 28, 2026 22:56
@zachbai zachbai force-pushed the zb/reattachable-session-share branch from e809b83 to c1e697d Compare April 28, 2026 22:59
@zachbai zachbai force-pushed the zb/cloud-cloud-handoff-scaffolding branch 2 times, most recently from 9f26d7d to 7ebd2fc Compare April 28, 2026 23:08
@zachbai zachbai force-pushed the zb/reattachable-session-share branch from c1e697d to da4fcc6 Compare April 28, 2026 23:08
@zachbai zachbai force-pushed the zb/cloud-cloud-handoff-scaffolding branch 2 times, most recently from 73f4edc to c7794fd Compare April 28, 2026 23:41
@zachbai zachbai marked this pull request as ready for review April 28, 2026 23:46
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented Apr 28, 2026

@zachbai

I'm starting a first review of this pull request.

You can follow along in the session on Warp.

I completed the review and posted feedback on this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

I completed the review and posted feedback on this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@zachbai zachbai requested a review from harryalbert April 28, 2026 23:48
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds disabled cloud-to-cloud handoff scaffolding: a new feature flag/Cargo feature, a typed follow-up API request and path helper, and run/execution-aware accessors that preserve the current flattened ambient task behavior.

Concerns

  • The Rust code changes look behavior-preserving and the new API call goes through the existing authenticated public API helper.
  • The PR body does not document testing performed; the author should fill that in before merge.
  • The added spec has a broken internal spec path reference.

Security

  • The added specs include local home-directory worktree paths. Replace them with portable references to avoid exposing local user/path details and to keep the spec usable by other developers.

Verdict

Found: 0 critical, 0 important, 2 suggestions

Approve with nits

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread specs/APP-4318/TECH.md
Cloud Mode ambient conversations currently treat one ambient task/run as one shared-session execution. The first Cloud Mode pane is created as a deferred shared-session viewer in `app/src/terminal/view/ambient_agent/mod.rs:35`; the ambient model emits `SessionReady`, and the viewer manager joins the session. This branch adds the foundation needed to reuse that same terminal view/model for later sessions: `TerminalManager::attach_followup_session` can replace the active viewer `Network` and join a fresh shared session in append mode in `app/src/terminal/shared_session/viewer/terminal_manager.rs:338`.
The hotswap foundation is documented separately in `specs/REMOTE-1478/TECH.md`. The important shipped boundary is that session IDs are transport-scoped, while the visible ambient conversation, terminal view, terminal model, and task/run identity remain stable across follow-up executions. The event loop already has a follow-up load mode, and `TerminalModel::append_followup_shared_session_scrollback` appends only unknown block IDs instead of replacing the blocklist in `app/src/terminal/shared_session/viewer/event_loop.rs:29`, `app/src/terminal/model/terminal_model.rs:1481`, and `app/src/terminal/model/blocks.rs:759`.
The remaining client work is broader than a small change. It touches the public API client, ambient task/run data models, ambient spawn/follow-up state transitions, the cloud conversation tombstone, terminal input behavior, and tests. This should be implemented as a stack of mergeable PRs rather than one large PR.
The server-side public API now exposes `POST /api/v1/agent/runs/{runId}/followups`, which accepts `RunFollowupRequest { message }` and returns an empty success object when the follow-up is accepted. The server contract says clients should observe readiness by fetching `GET /api/v1/agent/runs/{runId}` until the run exposes an active shared session. The route and handler are in `/Users/zachbai/.warp-dev/worktrees/warp-server/cloud-agent-task-name/router/handlers/public_api/agent_webhooks.go:181` and `/Users/zachbai/.warp-dev/worktrees/warp-server/cloud-agent-task-name/router/handlers/public_api/agent_webhooks.go:608`; the OpenAPI schema is in `/Users/zachbai/.warp-dev/worktrees/warp-server/cloud-agent-task-name/public_api/openapi.yaml:644`.
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.

💡 [SUGGESTION] [SECURITY] Avoid checking in local worktree paths that include a developer home directory; replace these with repo-relative references, server PR links, or stable source references so the spec is portable and does not expose local user/path details.

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.

seems like a fine call

Comment thread specs/APP-4319/TECH.md
The master cloud-to-cloud handoff plan needs an initial mergeable PR that adds the scaffolding required by later follow-up orchestration and UI work without changing end-user behavior. PR 1 should make the client aware of the `HandoffCloudCloud` rollout boundary, add a typed client method for the server follow-up API, and start isolating task/run identity from execution/session-scoped data in the client model.
This PR intentionally does not add the tombstone Continue entrypoint, does not submit follow-ups from the UI, and does not attach a follow-up shared session to an existing terminal. Those behaviors belong in later PRs after the foundational APIs exist.
## Current state
The current branch already adds the UI/model layer needed to attach a new backing shared session to an existing shared-session viewer; that foundation is documented in `specs/REMOTE-1478/TECH.md`. The broader sequencing and intended user flow are documented in `specs/handoff-cloud-cloud/TECH.md`.
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.

💡 [SUGGESTION] This references specs/handoff-cloud-cloud/TECH.md, but the PR adds the master spec as specs/APP-4318/TECH.md; update the path or add the referenced file.

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds disabled cloud-to-cloud handoff scaffolding: the new feature flag, a typed follow-up API client method, run/execution-aware accessors, targeted tests, and tech specs for the stack.

Concerns

  • The implementation changes look behavior-preserving and I found no blocking correctness or security issues in the changed code.
  • Two added specs still refer to the hotswap/base work as the current branch or point at a spec path that is not present, which can misdirect follow-up implementers.

Verdict

Found: 0 critical, 0 important, 2 suggestions

Approve with nits

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread specs/APP-4318/TECH.md
13. Steps 5-12 can repeat for additional follow-up executions.
## Increment plan
### PR 0: shared-session hotswap foundation
This is the current branch and can stand alone. It keeps reusable viewer resources across networks, adds `attach_followup_session`, adds append-mode scrollback loading, and prevents ambient `SessionEnded` from permanently poisoning the pane. The existing `specs/REMOTE-1478/TECH.md` covers this increment.
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.

💡 [SUGGESTION] This branch is PR 1; describe PR 0 as the base hotswap branch so the increment plan stays accurate.

Suggested change
This is the current branch and can stand alone. It keeps reusable viewer resources across networks, adds `attach_followup_session`, adds append-mode scrollback loading, and prevents ambient `SessionEnded` from permanently poisoning the pane. The existing `specs/REMOTE-1478/TECH.md` covers this increment.
This is the base hotswap foundation branch and can stand alone. It keeps reusable viewer resources across networks, adds `attach_followup_session`, adds append-mode scrollback loading, and prevents ambient `SessionEnded` from permanently poisoning the pane. The existing `specs/REMOTE-1478/TECH.md` covers this increment.

Comment thread specs/APP-4319/TECH.md
The master cloud-to-cloud handoff plan needs an initial mergeable PR that adds the scaffolding required by later follow-up orchestration and UI work without changing end-user behavior. PR 1 should make the client aware of the `HandoffCloudCloud` rollout boundary, add a typed client method for the server follow-up API, and start isolating task/run identity from execution/session-scoped data in the client model.
This PR intentionally does not add the tombstone Continue entrypoint, does not submit follow-ups from the UI, and does not attach a follow-up shared session to an existing terminal. Those behaviors belong in later PRs after the foundational APIs exist.
## Current state
The current branch already adds the UI/model layer needed to attach a new backing shared session to an existing shared-session viewer; that foundation is documented in `specs/REMOTE-1478/TECH.md`. The broader sequencing and intended user flow are documented in `specs/handoff-cloud-cloud/TECH.md`.
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.

💡 [SUGGESTION] Point this PR-specific spec at the master spec this PR adds instead of a path that is not in the diff.

Suggested change
The current branch already adds the UI/model layer needed to attach a new backing shared session to an existing shared-session viewer; that foundation is documented in `specs/REMOTE-1478/TECH.md`. The broader sequencing and intended user flow are documented in `specs/handoff-cloud-cloud/TECH.md`.
The base branch already adds the UI/model layer needed to attach a new backing shared session to an existing shared-session viewer; that foundation is documented in `specs/REMOTE-1478/TECH.md`. The broader sequencing and intended user flow are documented in `specs/APP-4318/TECH.md`.

Comment thread specs/APP-4318/TECH.md
5. emit a setup/loading event so the terminal shows the existing Cloud Mode setup UI;
6. call the follow-up API;
7. poll for the new session;
8. emit `FollowupSessionReady { session_id }` when ready;
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.

not sure if this is already implemented, but it would probably make sense to have some timeout + error in case it hangs indefinitely

@zachbai zachbai force-pushed the zb/reattachable-session-share branch 2 times, most recently from fadd66b to 5b9c748 Compare April 29, 2026 16:50
@zachbai zachbai force-pushed the zb/cloud-cloud-handoff-scaffolding branch from c7794fd to a488b58 Compare April 29, 2026 18:45
@zachbai zachbai force-pushed the zb/reattachable-session-share branch from 5b9c748 to 873ccb3 Compare April 29, 2026 18:45
@zachbai zachbai changed the base branch from zb/reattachable-session-share to graphite-base/9313 April 29, 2026 19:23
@zachbai zachbai force-pushed the graphite-base/9313 branch from 873ccb3 to ca42aac Compare April 29, 2026 19:24
@zachbai zachbai force-pushed the zb/cloud-cloud-handoff-scaffolding branch from a488b58 to 757d5b5 Compare April 29, 2026 19:24
@graphite-app graphite-app Bot changed the base branch from graphite-base/9313 to master April 29, 2026 19:24
@zachbai zachbai force-pushed the zb/cloud-cloud-handoff-scaffolding branch from 757d5b5 to 61b3a3c Compare April 29, 2026 19:24
@zachbai zachbai force-pushed the zb/cloud-cloud-handoff-scaffolding branch from 61b3a3c to 9e0ab1e Compare April 29, 2026 21:32
@zachbai zachbai merged commit 5762baa into master Apr 29, 2026
25 checks passed
@zachbai zachbai deleted the zb/cloud-cloud-handoff-scaffolding branch April 29, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants