8.0 KiB
Created
Created by tickets.sh create.
Plan
Preflight implementation plan
Classification: implementation-ready.
No product/API decision is needed before coding. ScopeSubDelegated remains a valid typed PodEvent for registry side effects and upward propagation, but must not enter the agent-visible notification/history/auto-kick lane.
Current code map:
crates/protocol/src/lib.rs:PodEventvariants and protocol roundtrip tests.crates/pod/src/controller.rs: idleMethod::PodEventhandler applies side effects, pushes notification, and auto-kicks; running-path handler applies side effects and pushes intoNotifyBuffer.crates/pod/src/ipc/event.rs: transport helpers andapply_event_side_effects;ScopeSubDelegatedregisters grandchild and re-emits upward.crates/pod/src/ipc/notify_buffer.rs: agent-visible notification/history lane.crates/pod/src/ipc/interceptor.rs: drainsNotifyBufferinto session history/context.- Existing tests: controller tests for visible
TurnEnded, pod events tests forScopeSubDelegatedregistry/re-emission, protocol roundtrips.
Implementation phases:
- Add
PodEvent::should_notify_agent()classification inprotocol: true forTurnEnded,Errored,ShutDown; false forScopeSubDelegated. - Gate idle-path notification/auto-kick in
controller.rs: always apply side effects; only push notify and scheduleRunForNotificationwhenshould_notify_agent()is true. - Gate running-path notification buffering the same way.
- Update comments/docs in protocol/controller/notify/event modules to distinguish control-plane side effects from agent-visible notifications.
- Add focused tests.
Critical risks:
- Never skip
apply_event_side_effectsforScopeSubDelegated. - Gate both idle and running receive paths.
- Do not change wire serialization or remove the event.
- Do not demote
ShutDown; it remains agent-visible. - Do not use rendering availability as the visibility decision.
Validation plan:
- Protocol test for
should_notify_agentclassification. - Controller test: idle
ScopeSubDelegatedupdates side effects as needed but creates noSystemItem::PodEvent, no auto-started LLM request, and parent remains idle. - Keep/verify existing positive
TurnEndedauto-kick test. - Existing
pod_events_testshould still pass for registry/re-emission. - Run
cargo test -p protocol pod_event,cargo test -p pod --test pod_events, focused controller pod-event tests, andcargo fmt --check.
Review: approve
Approve.
The implementation keeps PodEvent::ScopeSubDelegated on the typed IPC/control plane while removing it from the agent-visible notification/history/auto-run lane. The core change is an explicit PodEvent::should_notify_agent() classifier used by both controller event receive paths after side effects have already been applied.
Blocker findings: none.
Requirement coverage:
ScopeSubDelegatedside effects are still applied in both idle and running paths.- Upward re-emission remains in
apply_event_side_effects. ScopeSubDelegatedno longer entersNotifyBuffer, does not appendSystemItem::PodEvent, and does not auto-kickRunForNotification.TurnEnded,Errored, andShutDownremain agent-visible.- Wire serialization/protocol shape is unchanged.
- No new hidden history/context injection path was introduced.
Non-blocking follow-ups:
- Consider making misuse harder later by renaming/gating lower-level
push_pod_event_notify/NotifyBuffer::push_pod_eventAPIs or adding debug assertions. - Idle-path test does not directly assert registry side effect, but running-path and pod event side-effect tests cover it and the idle path calls the same side-effect function before gating.
Validation reviewed from coder report:
cargo fmt --check— passed.cargo test -p protocol pod_event— passed.cargo test -p pod --test pod_events_test— passed.cargo test -p pod --test controller_test pod_event— passed.- focused running-path tests for control-only and visible events — passed.
Final verdict: approve.
Closed
id: 20260529-163047-pod-event-scope-subdelegation-control-only slug: pod-event-scope-subdelegation-control-only title: Keep scope sub-delegation PodEvent out of agent notifications status: closed kind: bug priority: P2 labels: [pod, events, orchestration, context] created_at: 2026-05-29T16:30:47Z updated_at: 2026-05-30T05:04:26Z assignee: null legacy_ticket: null
Background
Nested Pod orchestration currently emits a visible notification when a child Pod sub-delegates scope to its own child, for example:
pod `orchestrate-nix-manifest-profiles` sub-delegated scope to `manifest-profiles-audit-20260529`
This comes from PodEvent::ScopeSubDelegated. The event itself is useful as control-plane data: parent Pods need it to update spawned-child registry state, preserve delegated scope ownership, and propagate the child/grandchild relationship upward. However, it does not usually require the parent LLM to take action.
At the moment all PodEvent values are pushed into the notification buffer and can trigger RunForNotification when the receiving Pod is idle. That makes scope delegation a model-visible semantic notification, adds noise to history/context, and can cause unnecessary auto-kicked LLM turns during nested orchestration.
Requirements
- Keep
PodEvent::ScopeSubDelegatedas a control-plane event.- Existing registry side effects must still run.
- Scope ownership/reclaim behavior must not regress.
- Upward propagation to higher-level parents must still happen when needed.
- Do not expose scope sub-delegation as an agent notification.
- Do not push
ScopeSubDelegatedinto the Pod notification buffer. - Do not persist it as model-visible notification history.
- Do not trigger
PendingRun::RunForNotificationsolely because scope was sub-delegated.
- Do not push
- Preserve agent-visible notifications for events that need orchestration attention.
TurnEndedshould remain agent-visible.Erroredshould remain agent-visible.ShutDownshould remain agent-visible unless a later design explicitly separates it.
- Make the event visibility boundary explicit in code.
- Prefer a small helper such as
PodEvent::should_notify_agent()or an equivalent visibility classification. - Keep side effects and agent notification decisions separate so future control-plane events do not accidentally become model-visible.
- Prefer a small helper such as
- Keep context/history principles intact.
- Control-plane-only events must not be injected into LLM context without first becoming intentional history content.
- Avoid extra prompt-cache churn and token use for events that are not actionable by the model.
Suggested implementation notes
Likely areas:
crates/protocol/src/lib.rs: add an explicit visibility/helper onPodEvent.crates/pod/src/controller.rs: afterapply_event_side_effects, only callpod.push_pod_event_notify(event)and setPendingRun::RunForNotificationwhen the event is agent-visible.crates/pod/src/ipc/event.rs: keepScopeSubDelegatedside effects unchanged.crates/pod/tests/controller_test.rs: update/add coverage for control-only scope delegation and agent-visible lifecycle events.
Acceptance criteria
ScopeSubDelegatedstill updates/propagates spawned-child registry state exactly as before.ScopeSubDelegatedno longer produces[Notification] ... sub-delegated scope ...in the parent Pod's agent-visible output/history.ScopeSubDelegateddoes not auto-kick an idle parent Pod into a model run.TurnEnded,Errored, andShutDownstill produce agent-visible notifications and can still wake an idle parent when appropriate.- Tests cover both the control-only
ScopeSubDelegatedpath and at least one agent-visiblePodEventpath. cargo fmt --check- Relevant pod/protocol tests pass.