Skip to content

Remove NotAmbientAgent state from AmbientAgentViewModel.#9310

Merged
zachbai merged 1 commit intomasterfrom
zb/refactor-ambient-agent-view-model
Apr 29, 2026
Merged

Remove NotAmbientAgent state from AmbientAgentViewModel.#9310
zachbai merged 1 commit intomasterfrom
zb/refactor-ambient-agent-view-model

Conversation

@zachbai
Copy link
Copy Markdown
Contributor

@zachbai zachbai commented Apr 28, 2026

Description

Refactor AmbientAgentViewModel to remove NotAmbientAgent state and simplify semantics - presence of the model indicates that the parent view is rendering an ambient agent task.

@cla-bot cla-bot Bot added the cla-signed label Apr 28, 2026
@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).

Powered by Oz

@zachbai zachbai force-pushed the zb/refactor-ambient-agent-view-model branch from 60d86ff to e39f7e7 Compare April 28, 2026 22:56
@zachbai zachbai force-pushed the zb/refactor-ambient-agent-view-model branch from e39f7e7 to cc6e49d Compare April 28, 2026 22:59
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 refactors AmbientAgentViewModel so it is only constructed for cloud-mode terminal views, removes the NotAmbientAgent sentinel state, and updates terminal/input/status UI call sites to treat the ambient model as optional.

Concerns

  • Ambient shared-session viewers created through the normal shared-session viewer path can now be constructed without an AmbientAgentViewModel, so the join handler cannot enter viewing-existing-session state for ambient sessions.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

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

Powered by Oz

let sizes = compute_block_size(initial_size, ctx);

let model = if is_deferring_terminal_session_connection {
let model = if is_cloud_mode {
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.

⚠️ [IMPORTANT] The public shared-session viewer path still calls new_internal(..., false, ...), including restored/opened ambient sessions that only learn SessionSourceType::AmbientAgent after joining. Those sessions now create a normal TerminalModel and no AmbientAgentViewModel, so JoinedSuccessfully silently skips enter_viewing_existing_session and cloud-mode UI/keymap/details state stays disabled; thread is_cloud_mode = true for known ambient-session opens or create the ambient model when the ambient source type arrives.

return Err(ExitAgentViewError::AmbientAgent);
}
// But if there is a terminal backing and we're in a LRC, we should be able to escape
else if is_fullscreen_with_long_running {
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.

I think we still want this early return, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea fixed

@zachbai zachbai merged commit 71054d6 into master Apr 29, 2026
38 checks passed
@zachbai zachbai deleted the zb/refactor-ambient-agent-view-model branch April 29, 2026 16:48
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