Skip to content

perf(ai): skip live-only subscriptions for restored AI blocks#13115

Open
acarl005 wants to merge 2 commits into
andy/long-convo-latency-imported-commentsfrom
andy/long-convo-latency-reduce-subscriptions-restored
Open

perf(ai): skip live-only subscriptions for restored AI blocks#13115
acarl005 wants to merge 2 commits into
andy/long-convo-latency-imported-commentsfrom
andy/long-convo-latency-reduce-subscriptions-restored

Conversation

@acarl005

@acarl005 acarl005 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Part of a stack of performance fixes for #9799.

This PR: When restoring a large conversation, each AI block subscribed to several models (AISettings autonomy/permissions, SafeModeSettings, AIExecutionProfilesModel, ActiveSession, GetRelevantFilesController, AIRequestUsageModel, CLISubagentController, ModelEventDispatcher) that are only meaningful for live, actively-streaming blocks. For 3000+ restored blocks, these subscriptions added significant overhead and spurious re-renders.

Moves all live-only subscriptions inside an if !model.is_restored() guard. ThinkingDisplayMode and OrchestrationMessageDisplayMode remain unconditionally subscribed (moved outside the guard) since they affect how AI output is rendered for all blocks including restored ones. FontSettings and InputModeSettings were already unconditional.

Linked Issue

Fixes #9799

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

Manually loaded a conversation with 3014 AI exchanges and verified that restored blocks still re-render correctly when thinking/orchestration display mode settings change.

  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

acarl005 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@oz-for-oss

This comment was marked as resolved.

oz-for-oss[bot]

This comment was marked as resolved.

@acarl005 acarl005 force-pushed the andy/long-convo-latency-imported-comments branch from e64e970 to 9512de5 Compare June 26, 2026 23:49
@acarl005 acarl005 force-pushed the andy/long-convo-latency-reduce-subscriptions-restored branch from 9e7ca1a to f683f59 Compare June 26, 2026 23:49
@acarl005 acarl005 force-pushed the andy/long-convo-latency-imported-comments branch from 9512de5 to a513085 Compare June 27, 2026 00:15
@acarl005 acarl005 force-pushed the andy/long-convo-latency-reduce-subscriptions-restored branch from f683f59 to 5acf131 Compare June 27, 2026 00:15
@acarl005

Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss

oz-for-oss Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

@acarl005

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for 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

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

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.

Overview

This PR reduces restored AI block overhead by moving several subscriptions behind a !model.is_restored() guard while keeping display-mode subscriptions active for restored output. No approved spec context was provided, so the review focused on the annotated diff, correctness, performance, and security/privacy behavior.

Concerns

  • Restored blocks still render secrets using the current safe-mode/secret-display settings; moving SafeModeSettings behind the live-only guard can leave restored secrets visible until an incidental re-render after the user enables hiding/redaction.
  • Restored blocks can own imported review comments, but their CWD-dependent open buttons will no longer update on ActiveSessionEvent::UpdatedPwd once the active session changes directories.
  • This is a user-facing behavioral/rendering change, but the PR description does not include screenshots or a short screen recording demonstrating restored blocks reacting correctly to the affected settings. Please attach visual evidence for the restored-conversation path.

Verdict

Found: 0 critical, 3 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

.agent_mode_execute_read_only_commands;
} else {
me.autonomy_setting_speedbump = AutonomySettingSpeedbump::None;
}

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] [SECURITY] SafeModeSettings controls secret redaction at render time for restored blocks too; behind this guard, enabling hide/redact secrets can leave restored block contents visible until some unrelated re-render. Keep this subscription unconditional or otherwise notify restored blocks on safe-mode changes.

..
} => {
*selected_option = match *settings_model
.as_ref(ctx)

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] Restored blocks can contain imported review comments, so gating the ActiveSession subscription prevents their open-comment buttons from enabling/disabling when the user changes directories. Keep the CWD update path active for restored blocks that render imported comments.

@acarl005 acarl005 force-pushed the andy/long-convo-latency-reduce-subscriptions-restored branch from cba4aba to cad1523 Compare June 27, 2026 01:21
@acarl005 acarl005 force-pushed the andy/long-convo-latency-imported-comments branch from a513085 to 62a1c1a Compare June 27, 2026 01:21
@acarl005 acarl005 force-pushed the andy/long-convo-latency-reduce-subscriptions-restored branch from cad1523 to 8e9c602 Compare June 27, 2026 02:13
@acarl005 acarl005 force-pushed the andy/long-convo-latency-imported-comments branch from 62a1c1a to 7cb4072 Compare June 27, 2026 02:13
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.

1 participant