Skip to content

QUALITY-928: Orchestration unified stack — core tracker + family stream (M1) - #14473

Open
cephalonaut wants to merge 3 commits into
masterfrom
matthew/orch-unified-m1
Open

QUALITY-928: Orchestration unified stack — core tracker + family stream (M1)#14473
cephalonaut wants to merge 3 commits into
masterfrom
matthew/orch-unified-m1

Conversation

@cephalonaut

@cephalonaut cephalonaut commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

Introduces the orchestration child tracking foundation for the unified orchestration stack (QUALITY-928).

What

  • OrchestrationChildTracker: a single observe_child entry point for every child signal — discovery, session link, lifecycle, REST seed, and in-band registration. Started kicks off a deduped metadata fetch; the TrackedChild is inserted when that resolves.
  • FamilyDrainMode (Primary / Observer) is the sole mode axis. Primary delivers parent-self events and writes the server cursor; Observer drops parent-self events and persists the cursor locally only.
  • TrackedChild holds no conversation_id. ChildSignal::Registered is a unit variant.
  • ensure_remote_child_placeholder creates a local is_remote_child placeholder on child_agent_started, with a child-lifecycle backstop for missed discovery events.
  • drain_family_events classifies each event on the family SSE stream and routes it to the tracker or to parent-self delivery.
  • FeatureFlag::OrchestrationUnifiedStack gates all flag-ON code paths; flag-OFF falls back to the existing per-conversation and ancestor-only drains unchanged.

Why

A single observer entry point with a clear Primary/Observer distinction makes child tracking auditable and race-safe. The unified tracker is the foundation M2 builds on for pane materialization and task-driven restore.

Linked Issue

QUALITY-928

Testing

  • orchestration_child_tracker_tests.rs: observe_child idempotency, tombstone skip, fetch dedup, lifecycle-first discovery, and viewer child placeholder behavior.

  • orchestration_event_streamer_tests.rs: FamilyEvent classification, drain routing, Primary parent delivery, Observer local-only cursor, and child-status routing.

  • 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

@cla-bot cla-bot Bot added the cla-signed label Jul 29, 2026
@cephalonaut
cephalonaut marked this pull request as ready for review July 31, 2026 15:54
@oz-for-oss

oz-for-oss Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@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

@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 adds the dogfood-gated unified orchestration child tracker, family-stream event classification/drain paths, placeholder hydration wiring, and tests.

Concerns

  • The metadata-fetch guard in OrchestrationChildTracker is never cleared after an async cache miss, so later Started/Lifecycle re-drives return before consulting the now-populated task cache. This prevents out-of-band child discovery/status routing from completing after the first miss.
  • This is a user-facing behavior change to orchestration child tracking/pill state, but the PR description has no screenshots or screen recording. For this user-facing change, please include screenshots or a screen recording demonstrating it working 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

run_id: &str,
ctx: &mut ModelContext<OrchestrationEventStreamer>,
) {
if !self.metadata_fetches.insert(run_id.to_string()) {

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] After the first async cache miss this guard stays set forever: get_or_async_fetch_task_data only emits TasksUpdated when the fetch completes, and nothing calls apply_seeded or removes metadata_fetches. Subsequent Started/Lifecycle re-drives hit this early return and never consult the warmed cache, so out-of-band children can remain undiscovered and never receive status updates.

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.

Fixed: when a re-drive hits the existing guard, spawn_metadata_fetch now immediately re-polls the cache via get_or_async_fetch_task_data. On a warm cache it calls apply_seeded and removes the guard inline (lines 430–436); on a miss the shared in-flight fetch will complete and a later TasksUpdated re-drive picks it up. The guard exists only to deduplicate concurrent dispatches, not to block re-polling.

… event consumer

Introduces the client-side orchestration child tracking architecture:

- OrchestrationChildTracker: single observe_child entry point for all child
  signals (child_agent_started, session_linked, lifecycle, seeded, registered).
  Inserts a TrackedChild immediately on Started so subsequent signals race-safe.
- FamilyDrainMode replaces OrchestrationEventConsumer as the sole mode axis:
  Primary pushes the server cursor and forwards child lifecycle to handle_event_batch;
  Observer persists the cursor locally only.
- TrackedChild holds no conversation_id (removed race risk); run_id is the
  stable identity key.
- ChildSignal::Registered is a unit variant; stamp_conversation_id_for_run removed.
- ensure_remote_child_placeholder creates a local is_remote_child placeholder on
  child_agent_started so the pill bar reflects the child immediately.
- drain_family_events classifies every SSE event as ParentSelf, ChildStarted,
  ChildSessionLinked, ChildLifecycle, or Opaque and routes accordingly.
- OrchestrationUnifiedStack feature flag gates all flag-ON code paths.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cephalonaut
cephalonaut force-pushed the matthew/orch-unified-m1 branch from d957cd3 to cedb591 Compare August 2, 2026 20:03
Describe the unified orchestration child stack as it exists in the
committed code: discovery via the parent ancestor SSE, the child tracker
state machine, task-driven pane materialization, the ancestor-list
restore seed, observer-mode discovery, the flag-off path, and the
invariants each depends on. Adds a breakdown of discovery and
materialization for each parent/child locality combination.

Co-Authored-By: Warp Agent <agent@warp.dev>
@cephalonaut

Copy link
Copy Markdown
Contributor Author

For the demo, see the Loom on M2 (https://www.loom.com/share/5feec7c256044f03a5d63d2c46fe4a75) which covers the full end-to-end flow including pill bar, child attribution, and restore. M1 is the tracker foundation — the user-visible behavior lands together with M2.

@cephalonaut
cephalonaut requested a review from vkodithala August 5, 2026 16:57
Master added execution_location to AmbientAgentTask after M1 branched.
CI tests the merge commit (M1 + master), so the struct literals in our
tracker and streamer tests need this field.

Co-Authored-By: Oz <oz-agent@warp.dev>
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