Skip to content

Throttle ambient agent task fetch based on RTC invalidation message.#11236

Merged
zachbai merged 1 commit into
masterfrom
zb/throttle-ambient-agent-task-refetch
May 18, 2026
Merged

Throttle ambient agent task fetch based on RTC invalidation message.#11236
zachbai merged 1 commit into
masterfrom
zb/throttle-ambient-agent-task-refetch

Conversation

@zachbai
Copy link
Copy Markdown
Contributor

@zachbai zachbai commented May 18, 2026

Description

Throttles task re-fetching triggered by RTC invalidation messages to maximum of 1 fetch every 5 seconds. Prevents spammy task list fetching in common scenarios where members of a team have access to all other teammate's agent runs, an update to each of which triggers an RTC invalidation message

@cla-bot cla-bot Bot added the cla-signed label May 18, 2026
Copy link
Copy Markdown
Contributor Author

zachbai commented May 18, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@zachbai zachbai requested a review from bnavetta May 18, 2026 21:52
@zachbai zachbai marked this pull request as ready for review May 18, 2026 21:53
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 18, 2026

@zachbai

I'm starting a first review of this pull 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

@zachbai zachbai requested a review from ianhodge May 18, 2026 21:54
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 a leading/trailing throttle around RTC-triggered ambient agent task refreshes in AgentConversationsModel, aborts any pending throttle timer on reset, and adds helper-level unit coverage for earliest timestamp coalescing.

Concerns

  • No blocking correctness, security, or spec-alignment concerns found in the changed lines.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

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

Powered by Oz

Copy link
Copy Markdown
Member

@ianhodge ianhodge left a comment

Choose a reason for hiding this comment

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

lgtm

@zachbai zachbai force-pushed the zb/throttle-ambient-agent-task-refetch branch from 13d64d8 to e948712 Compare May 18, 2026 22:21
@zachbai zachbai force-pushed the zb/throttle-ambient-agent-task-refetch branch from e948712 to 85564e4 Compare May 18, 2026 22:59
@zachbai zachbai merged commit 84f817c into master May 18, 2026
39 of 42 checks passed
@zachbai zachbai deleted the zb/throttle-ambient-agent-task-refetch branch May 18, 2026 23:39
lawsmd pushed a commit to lawsmd/cortex that referenced this pull request May 22, 2026
…arpdotdev#11236)

## Description

Throttles task re-fetching triggered by RTC invalidation messages to
maximum of 1 fetch every 5 seconds. Prevents spammy task list fetching
in common scenarios where members of a team have access to all other
teammate's agent runs, an update to each of which triggers an RTC
invalidation message

<!--
## Changelog Entries for Stable

The entries below will be used when constructing a soft-copy of the
stable release changelog. Leave blank or remove the lines if no entry in
the stable changelog is needed. Entries should be on the same line,
without the `{{` `}}` brackets. You can use multiple lines, even of the
same type. The valid suffixes are:

- NEW-FEATURE: for new, relatively sizable features. Features listed
here will likely have docs / social media posts / marketing launches
associated with them, so use sparingly.
- IMPROVEMENT: for new functionality of existing features.
- BUG-FIX: for fixes related to known bugs or regressions.
- IMAGE: the image specified by the URL (hosted on GCP) will be added to
Dev & Preview releases. For Stable releases, see the pinned doc in the
#release Slack channel.
- OZ: Oz-related updates. Use `CHANGELOG-OZ`. At most 4 Oz updates are
shown in-app per release.
- NONE: Explicitly opt out of changelog inclusion. Use `CHANGELOG-NONE`
for PRs that should never appear in the changelog (e.g. refactors,
internal tooling, CI changes). This prevents the changelog agent from
inferring an entry.

CHANGELOG-NEW-FEATURE: {{text goes here...}}
CHANGELOG-IMPROVEMENT: {{text goes here...}}
CHANGELOG-BUG-FIX: {{text goes here...}}
CHANGELOG-BUG-FIX: {{more text goes here...}}
CHANGELOG-IMAGE: {{GCP-hosted URL goes here...}}
CHANGELOG-OZ: {{text goes here...}}
CHANGELOG-NONE
-->
liliwilson added a commit that referenced this pull request May 22, 2026
## Description
<!-- Please remember to add your design buddy onto the PR for review, if
it contains any UI changes! -->
This PR updates the client-side RTC logic to only refetch data for a
task on an RTC invalidation if:
- The task is actively being viewed in a given task (using the `task_id`
from the RTC notification)
- We have the agent management view or conversation sidebar open

Right now, whenever we get _any_ RTC invalidation, we discard the task
ID and do a refetch. The throttling introduced in
#11236 limits this fetch to once
per every 5s, but we really shouldn't be refetching on _every_ RTC
invalidation if we don't need to.

## Testing
<!--
How did you test this change? What automated tests did you add? If you
didn't add any new tests, what's your justification for not adding any?

Manual testing is required for changes that can be manually tested, and
almost all changes can be manually tested. If your change can be
manually tested, please include screenshots or a screen recording that
show it working end to end.

You can run the app locally using `./script/run` - see WARP.md for more
details on how to get set up.
-->

- [x] I have manually tested my changes locally with `./script/run`

Tested locally, loom:
https://www.loom.com/share/c4b23aaab2c4447c8839631941bbcce2

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
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