Skip to content

[QUALITY-772] Use ancestor streams for large orchestrators#12209

Merged
cephalonaut merged 3 commits into
masterfrom
matthew/too-many-agents
Jun 6, 2026
Merged

[QUALITY-772] Use ancestor streams for large orchestrators#12209
cephalonaut merged 3 commits into
masterfrom
matthew/too-many-agents

Conversation

@cephalonaut
Copy link
Copy Markdown
Contributor

@cephalonaut cephalonaut commented Jun 4, 2026

Description

What

  • Adds a dogfood-gated OwnerOrchestrationAncestorStreamer feature flag.
  • Switches owner-side orchestrator event delivery to a parent-family ancestor_run_id&include_self=true stream when the flag is enabled.
  • Keeps child-only conversations on RunIds(self) and viewer-mode streams on include_self=false.
  • Prevents oversized legacy run_ids[] streams from retrying forever when the flag is disabled.

Why

Large orchestrations can exceed the server's 100 explicit-run-id SSE limit, causing parents to miss child lifecycle/message events. The parent-family ancestor stream keeps delivery to one ordered stream while preserving the existing cursor model.

How

  • Extends AgentEventFilter::AncestorRunId with an include_self field.
  • Adds client URL support for include_self=true only when requested.
  • Stores the connected filter shape and reconnects only when the desired filter is stale.
  • Adds regression coverage for large parent streams, limit-crossing behavior, restore, and child-only filtering.

Linked Issue

  • 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).

No linked issue; see companion server TECH spec at warp-server/specs/QUALITY-790/TECH.md.

Testing

  • ./script/format

  • PATH=/usr/local/bin:$PATH cargo clippy --workspace --all-targets --all-features --tests -- -D warnings

  • cargo test -p warp --lib run_id_limit_without_flag

  • cargo test -p warp --lib parent_with_many_children_opens_one_ancestor_include_self_stream

  • cargo test -p warp --lib restored_parent_with_children_opens_ancestor_include_self_stream

  • 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

CHANGELOG-NONE

Co-Authored-By: Oz oz-agent@warp.dev

cephalonaut and others added 2 commits June 4, 2026 14:38
Switch owner-side orchestration event delivery to a parent-family ancestor stream when the dogfood flag is enabled, while preserving child-only and viewer-mode stream behavior.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jun 4, 2026
@cephalonaut cephalonaut marked this pull request as ready for review June 5, 2026 14:44
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented Jun 5, 2026

@cephalonaut

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

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 dogfood-gated owner-side ancestor SSE stream (ancestor_run_id&include_self=true) to avoid the explicit run_ids[] limit for large orchestrations, keeps viewer streams child-only, and adds regression tests for parent/child filtering and limit behavior. I did not find security-specific issues in the changed client-side URL/filter handling.

Concerns

  • Oversized parent streams with the flag disabled set an internal sse_delivery_blocked bit, but the diff does not read that bit or emit any event/UI state from it, so the claimed visible delivery failure is not actually surfaced to users.
  • This changes user-perceivable orchestration event delivery, but the PR description has no screenshot or recording and manual local testing is unchecked. Please attach a short screen recording showing a parent orchestrator receiving child lifecycle/message events through the new path end to end.

Verdict

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

OwnerOrchestrationAncestorStreamer to deliver events for large orchestrators"
);
if let Some(stream) = self.streams.get_mut(&conversation_id) {
stream.sse_delivery_blocked = true;
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] This only sets a private flag; nothing in the diff reads it or emits a user-visible failure, so oversized parents with the flag off still just stop receiving events with no visible error.

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.

Removed

Remove misleading private delivery-blocked state and tighten comments around owner ancestor streaming.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cephalonaut cephalonaut requested a review from harryalbert June 5, 2026 20:47
Copy link
Copy Markdown
Contributor

@harryalbert harryalbert left a comment

Choose a reason for hiding this comment

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

nice

return DesiredSseFilter::NoFilter;
}
if is_parent && run_ids.len() > MAX_RUN_ID_STREAM_FILTER {
return DesiredSseFilter::UnsupportedRunIdCount(run_ids.len());
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.

OOC, why not always use the ancestor stream approach (as opposed to only using it when we have > n streams such that the number is no longer supported)

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.

We actually always do use it unless the flag is off - we'll exit at line 1582. This is just a temporary stop gap for cases where the flag is still off and we exceed 100.

@cephalonaut cephalonaut changed the title Use ancestor streams for large orchestrators [QUALITY-772] Use ancestor streams for large orchestrators Jun 6, 2026
@cephalonaut cephalonaut merged commit 1c2d4cc into master Jun 6, 2026
37 checks passed
@cephalonaut cephalonaut deleted the matthew/too-many-agents branch June 6, 2026 05:17
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