Skip to content

feat: add phase 3 hybrid orchestration policy kernel - #17

Merged
wryan2986 merged 34 commits into
masterfrom
feature/policy-kernel-phase-3
Jul 23, 2026
Merged

wryan2986 merged 34 commits into
masterfrom
feature/policy-kernel-phase-3

Conversation

@wryan2986

@wryan2986 wryan2986 commented Jul 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Implements the hybrid orchestration kernel through phase 3 while keeping semantic workflow decisions with the orchestration model.

Phase 1 — shadow

  • evaluates and records the decision the kernel would make
  • returns allow and issues permits so work is not blocked
  • exposes advisory evidence gaps for measuring model/kernel disagreements

Phase 2 — invariants

  • enforces approval records, stable task identity, terminal budgets, one-time permits, fix-cycle limits, staged-candidate presence, review binding, and candidate integrity
  • leaves risk-specific gates advisory

Phase 3 — risk

  • enforces low/medium/high/critical minimum evidence
  • lets the model propose risk while allowing the kernel to elevate but never lower it
  • supports baseline or justified skips for ordinary work, stronger integration/recovery evidence for high risk, and isolation/human checkpoints for critical work

Hybrid authority boundary

  • the model chooses planning, decomposition, validation strategy, next action, replanning, escalation, and user communication
  • the kernel validates policy and issues one-time action/mode permits
  • agent_loop consumes a matching permit and records runtime evidence
  • orchestration_commit rechecks the staged candidate hash before committing

Persistence and observation

  • stores policy state under .opencode/agent-loop-state/policy.json
  • records policy proposals, decisions, permits, execution evidence, and commits in the structured event log
  • binds final test/review evidence to a SHA-256 digest of the staged candidate
  • adds npm run policy:report to summarize denials, evidence requests, risk elevations, reaction delays, and the orchestrator's next proposed action

Flexible action graph

  • replaces fixed-pipeline instructions with agent-selected actions such as baseline, justified skip, build, test-only, review, fix, replan, ask-user, escalation, commit, or stop
  • preserves sequential shared-worktree safety and prohibits direct task delegation or direct orchestrator commits

Validation

  • deterministic tests cover all three modes, risk elevation, candidate drift, terminal budgets, durable fix limits, single-use permits, and reaction reporting
  • plugin integration verifies permit-required worker calls, runtime evidence, permit reuse rejection, and recursion blocking
  • CI passes on Node 18, 20, and 22
  • cross-platform runtime passes on Ubuntu, macOS, and Windows with Node 20 and 22

This PR intentionally implements a policy-constrained action graph rather than a fixed workflow state machine.

wryan2986 added 30 commits July 23, 2026 05:56
@wryan2986
wryan2986 marked this pull request as ready for review July 23, 2026 10:44

Copy link
Copy Markdown
Owner Author

Phase 1 through phase 3 implementation is complete and ready to merge. Final validation passed on Node 18, 20, and 22 and on Ubuntu, macOS, and Windows. The protected merge is blocked only because the branch rule requires one approving review from a reviewer with write access. After approval, squash-merge this PR. To inspect how the orchestrator adapts to the kernel after deployment, run npm run policy:report -- --task <task-id> or query policy.proposed and policy.decision events.

@wryan2986
wryan2986 merged commit cdce1cb into master Jul 23, 2026
11 checks passed
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.

1 participant