Conversation
This was
linked to
issues
Apr 11, 2026
… histogram, TUI display, turn-boundary abort (#2883) Closes #2884, #2885, #2886, #2887, #2888, #2889 ## Phase 2A: route remaining agent-path fire-and-forget spawns - native.rs audit log write → supervisor.spawn(Telemetry, "audit-log") - sanitize.rs audit log write → supervisor.spawn(Telemetry, "audit-log-sanitize") - assembly.rs::spawn_outgoing_digest excluded: &self borrow conflicts with &mut self supervisor; documented in spec 039 ## Phase 2B: per-class bg_latency histogram - TaskResult carries spawned_at: Instant - reap() computes elapsed and calls observe_bg_task(label, duration) - observe_bg_task() added to HistogramRecorder trait - Prometheus: zeph_bg_task_duration_seconds_enrichment / _telemetry with buckets [1ms, 5ms, 10ms, 50ms, 100ms, 500ms, 1s, 5s, 30s] ## Phase 2C: TUI status bar background task display - MetricsSnapshot gains bg_inflight_enrichment + bg_inflight_telemetry - status.rs renders "bg: N enrich, M telem" when either > 0, hidden otherwise ## Phase 2D: turn-boundary abort for Enrichment class - class_handles: [Vec<AbortHandle>; 2] tracks handles per TaskClass - abort_class(class) aborts all handles of that class; clears vec - reap() prunes finished handles via retain(|h| !h.is_finished()) - Aborted tasks counted in bg_dropped metric - Turn-boundary abort gated by config.supervisor.abort_enrichment_on_turn ## Phase 2E: configurable queue depths - TaskSupervisorConfig under [agent.supervisor] in AgentConfig (enrichment_limit=4, telemetry_limit=8, abort_enrichment_on_turn=false) - with_supervisor_config() on AgentBuilder - --migrate-config step 14: adds [agent.supervisor] block with defaults - config/default.toml: commented-out [agent.supervisor] section ## Phase 2F: tracing span propagation - All spawned futures wrapped with .instrument(info_span!("bg_task", class, task)) for Jaeger/Chrome trace visibility ## Code quality - JoinError split: is_cancelled() -> debug!, panic -> warn! - observe_bg_task_called_on_reap test with CountingRecorder mock - BG_BUCKETS const moved to module level (clippy::items_after_statements) - bool-to-int replaced with usize::from() (clippy::bool_to_int_with_if)
zeph-config does not depend on zeph-core, so the link to BackgroundSupervisor resolved at doc build time. Replace with plain text reference.
ba0e63c to
d1d6388
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2883 (epic)
Closes #2884 #2885 #2886 #2887 #2888 #2889
Summary
Phase 2 expansion of
BackgroundSupervisor(Phase 1: #2816). Six sub-phases implemented in a single PR on branchfeat/2883-bg-supervisor-phase-2.Spec:
specs/039-background-task-supervisor/spec.mdChanges
2A: Route remaining agent-path spawns
native.rs:1261audit log →supervisor.spawn(Telemetry, "audit-log")sanitize.rs:161audit log →supervisor.spawn(Telemetry, "audit-log-sanitize")assembly.rs::spawn_outgoing_digestexcluded:&selfborrow conflicts with&mut selfsupervisor (documented in spec)2B: Per-class bg_latency histogram
TaskResultcarriesspawned_at: Instant;reap()computes elapsedobserve_bg_task(label, duration)added toHistogramRecordertraitzeph_bg_task_duration_seconds_{enrichment,telemetry}with 9 buckets [1ms…30s]2C: TUI status bar
MetricsSnapshotgainsbg_inflight_enrichment+bg_inflight_telemetrybg: N enrich, M telemwhen either > 0; hidden when both are 02D: Turn-boundary abort for Enrichment
class_handles: [Vec<AbortHandle>; 2]per class;abort_class(class)with atomic abortreap()prunes finished handles viaretain(|h| !h.is_finished())config.supervisor.abort_enrichment_on_turn(default:false)2E: Configurable queue depths
TaskSupervisorConfigunder[agent.supervisor](enrichment_limit=4,telemetry_limit=8)with_supervisor_config()onAgentBuilder--migrate-configstep 14 adds section with defaults2F: Tracing span propagation
.instrument(info_span!("bg_task", class, task))Testing
--features full)observe_bg_task_called_on_reapmock testcargo +nightly fmt --check: cleancargo clippy --features full --lib --bins -- -D warnings: cleanValidation summary
Follow-up issues