Skip to content

feat(session,operations): lifecycle signal contract + escalation routing + confidence gate (#1251 #1253 #1254)#1269

Open
ohdearquant wants to merge 2 commits into
mainfrom
show/lionagi-sweep/orch-emissions
Open

feat(session,operations): lifecycle signal contract + escalation routing + confidence gate (#1251 #1253 #1254)#1269
ohdearquant wants to merge 2 commits into
mainfrom
show/lionagi-sweep/orch-emissions

Conversation

@ohdearquant

Copy link
Copy Markdown
Owner

Reactive orchestration: signal contract + escalation + confidence gate

Three linked features on the existing observer bus — the foundation for lifecycle projection and cheap-by-default/escalate-when-stuck orchestration.

Issue Shipped Mechanism
#1251 lifecycle-signal contract lane_for structural projection (6 canonical states) + 3 new signals + live NodeQueued at real enqueue/inject points signal.py, bridged in engine.py:257
#1253 EscalationRequest routing public escalation_tier on flow() / flow_stream() / Session.flow[_stream]() / run_dag() (+LIONAGI_ESCALATION_TIER); real higher-tier re-dispatch (builds child op, model override, start_soon); streaming parity flow.py, session.py, engine.py
#1254 confidence-gated completion gate blocks below-target completion → raises + emits EscalationRequest; Branch.confidence_gated_completion wrapper confidence_gate.py, branch.py

ADR-0077 (lifecycle-signal-contract) documents the projection design.

Honest history — this is an attempt-2 redo

Attempt 1 shipped a half-feature (escalation reachable only inside the executor, not the public API; streaming dropped escalation; audit payload lost; tests blind to the public path). The gate caught all four as MAJOR and held the push. This redo resolves every one — the critic adversarially mutation-tested each fix (e.g. reverting the public forwarding makes test_public_flow_higher_tier_routes_escalation fail for the right reason).

Gate + my independent verification

  • critic (redo v2): APPROVE — CRIT:0, 0 blocking MAJ (all 4 prior resolved + mutation-verified), 1 MIN (stale play SUMMARY.mdremoved from the repo here, not committed).
  • I re-ran the core suite myself: test_lifecycle_signals · test_escalation_confidence · test_flow_stream · test_engine73 passed. pre-commit run ruff + ruff-format on the full diff → Passed.

Honest deferrals (documented, not hidden)

⚠️ Core code — please review before merge

Touches session/ + operations/ execution paths. Built on the existing observer bus (no parallel abstraction). Convention-clean (Apache headers, frozen value objects, additive __all__).

Closes #1251 #1253 #1254

🤖 Generated with Claude Code

ohdearquant and others added 2 commits June 3, 2026 14:35
…ing + confidence gate

Implements three orchestration-emissions features on the local branch:

- #1251: canonical per-node lifecycle (queued -> running -> awaiting_approval ->
  succeeded | failed | escalated) with a structural projection helper
  lane_for(signals) in session/signal.py; adds NodeQueued/NodeAwaitingApproval/
  NodeEscalated signals and documents the contract in ADR-0077. Live emission of
  the queued/awaiting_approval lanes is deferred (see SUMMARY.md).
- #1253: EscalationRequest routing on the existing observer bus. ReactiveExecutor
  registers _on_bus_escalation alongside spawn; routes to higher-tier re-dispatch
  (child op with escalated model spec) or a graceful give_up signal. Public-API
  surfacing of escalation_tier and streaming/audit-payload wiring deferred.
- #1254: confidence_gated_completion operation -- self-rates across categories
  toward a target (default 0.95), blocks below-target completion by raising
  ConfidenceGateEscalated and emitting an EscalationRequest; full cross-task
  learning propagation deferred per #1254.

Tests: tests/session/test_lifecycle_signals.py +
tests/session/test_escalation_confidence.py (45 passed). ruff + pre-commit clean.

Refs #1251 #1253 #1254

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…aming parity, live NodeQueued, audit payload

Builds on 84cbea2. Resolves the four MAJOR findings from the attempt-1
critic gate (#1251 #1253 #1254):

- MAJ-1: thread public `escalation_tier` through flow()/flow_stream()/
  Session.flow()/Session.flow_stream()/run_dag() + LIONAGI_ESCALATION_TIER
  env fallback, so an emitted EscalationRequest re-dispatches at the higher
  tier via the public API (not only via direct ReactiveExecutor).
- MAJ-2: register _on_bus_escalation in execute_stream() with finally
  teardown; unify on _observer attr — streaming reaches escalation parity
  with the batch path.
- MAJ-3: emit NodeQueued live at the real enqueue/inject points, bridged
  in run_dag(). (NodeAwaitingApproval deferred — no approval-wait seam.)
- MAJ-4: NodeEscalated.escalation_request named field carries the audit
  payload (avoids the data= infinite observer loop); public-path +
  streaming escalation tests added.
- MIN-2: Branch.confidence_gated_completion wrapper for composability.

Tests: uv run pytest tests/session/test_lifecycle_signals.py
tests/session/test_escalation_confidence.py -q -> 54 passed; full related
suite 80 passed. ruff + pre-commit clean. uv.lock churn (0.26.14->0.26.15)
intentionally not staged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(emission): canonical lifecycle signals for board/observer projection

1 participant