feat(session,operations): lifecycle signal contract + escalation routing + confidence gate (#1251 #1253 #1254)#1269
Open
ohdearquant wants to merge 2 commits into
Open
feat(session,operations): lifecycle signal contract + escalation routing + confidence gate (#1251 #1253 #1254)#1269ohdearquant wants to merge 2 commits into
ohdearquant wants to merge 2 commits into
Conversation
…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>
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.
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.
lane_forstructural projection (6 canonical states) + 3 new signals + liveNodeQueuedat real enqueue/inject pointssignal.py, bridged inengine.py:257escalation_tieronflow()/flow_stream()/Session.flow[_stream]()/run_dag()(+LIONAGI_ESCALATION_TIER); real higher-tier re-dispatch (builds child op, model override,start_soon); streaming parityflow.py,session.py,engine.pyEscalationRequest;Branch.confidence_gated_completionwrapperconfidence_gate.py,branch.pyADR-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_escalationfail for the right reason).Gate + my independent verification
SUMMARY.md— removed from the repo here, not committed).test_lifecycle_signals · test_escalation_confidence · test_flow_stream · test_engine→ 73 passed.pre-commit run ruff+ruff-formaton the full diff → Passed.Honest deferrals (documented, not hidden)
NodeAwaitingApprovallive emission — no approval-wait seam exists in the execution path yet; emitting it would be scope-creep or a stub. The lane stays projectable for a future approval-gate feature.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