You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Overhaul orchestrator.js to manage a multi-step PR state machine (DEV -> REVIEW -> HUMAN_REVIEW -> MERGE).
- Integrate native GitHub PR UI human review approval gates.
- Support auto-merge label to bypass human review.
- Refactor opencode-post-step.js to correctly propagate agent refusal/triage states and override existing PR labels.
- Update orchestrator.yml triggers for pull_request_review events and configure required PR write permissions.
- Document the new phase transitions and state object schemas in AGENTS.md.
- Expand jnode-issue-resolver skill taxonomy and protocols to support PR feedback loops natively.
- Introduce unit test coverage for orchestrator and post-step scripts using Node's native test runner.
-**opencode** is the worker. It runs the agent once per trigger, posts a result, and exits.
43
-
-**orchestrator** is the foreman. It holds a JSON state in the master issue body, picks the next child task from the queue, and triggers it by posting `/oc Please proceed with this task.` on the child issue.
44
-
-`orchestrator.yml` listens for `workflow_run` from `opencode`. When a child finishes, the orchestrator advances the queue and triggers the next child via a comment (which loops back into opencode).
45
-
- The trigger is one-way: orchestrator triggers opencode by comment; opencode does NOT call orchestrator.
49
+
-**orchestrator** is the foreman. It holds a JSON state in the master issue body, picks the next child task from the queue, and tracks its phase (DEV, REVIEW, HUMAN_REVIEW, FEEDBACK, MERGE).
50
+
-`orchestrator.yml` listens for `workflow_run` from `opencode` and `pull_request_review`. It advances the phase, loops back via `/oc fix` or `/oc review`, or merges the PR.
46
51
47
-
A child task is "complete" in the orchestrator's eyes when EITHER:
52
+
For single-step tasks, a child task is "complete" in the orchestrator's eyes when EITHER:
48
53
- the child issue is closed on GitHub, OR
49
54
- the child has one of: `agent/done`, `agent/investigated`, `agent/skip`, `agent/blocked`, `agent/needs-info`.
50
55
51
-
The `agent/failed` label does NOT count as completion; it triggers a retry (max 3 attempts).
56
+
For multi-step PR tasks, completion requires reaching the `MERGE` phase (or short-circuiting on skip labels).
52
57
53
58
## Orchestrator State Machine
54
59
@@ -57,7 +62,7 @@ State lives in the master issue body as a hidden HTML comment:
|`current_task`|Task the agent is working on; `null` when idle|
78
+
|`current_task`|Object representing task state, or task number (for older one-shot tasks)|
74
79
|`queue`| Pending task numbers, in execution order |
75
-
|`completed`| Tasks that finished with a completion label or were closed|
76
-
|`failed`| Tasks that hit 3 retries without success |
80
+
|`completed`| Tasks that finished completely (merged, or short-circuited)|
81
+
|`failed`| Tasks that hit 3 retries without success, or max_turns|
77
82
|`retries`| Attempt counter for `current_task`; resets on advance |
78
83
|`history`| Append-only event log with ISO timestamps |
79
84
|`order`| Original task order from the markdown checklist; rendered top-to-bottom in the status table |
80
85
86
+
### Phases
87
+
88
+
-**DEV**: Initial agent run. Agent creates a PR. Transition to `REVIEW`.
89
+
-**REVIEW**: Agent reviews the PR. If approved and no `auto-merge` label, transition to `HUMAN_REVIEW`. If `auto-merge`, transition to `MERGE`. If changes requested, transition to `FEEDBACK`.
90
+
-**FEEDBACK**: Agent addresses review comments. Transition to `REVIEW`.
91
+
-**HUMAN_REVIEW**: Orchestrator waits for native GitHub PR review from a human maintainer. Approval → `MERGE`, Request changes → `FEEDBACK`.
92
+
-**MERGE**: Orchestrator squashes the PR and deletes the branch inline.
93
+
81
94
Initialization: on first run, the orchestrator parses the master issue's markdown checklist (`- [ ] #N`, `- [x] #N`, `- [FAIL] #N`) and builds initial state. Subsequent runs load from the hidden JSON block. If `state.order` is empty (older master), it is backfilled from status-grouped arrays.
82
95
83
96
Self-healing guard: if the orchestrator wakes up and the `current_task` is already complete (closed or has completion label), it advances immediately and exits. This handles the case where the agent finished but the orchestrator was locked out.
The `opencode-post-step.js` and `orchestrator.js` modules export a single async function taking `{ github, context, core }`. They are normally invoked from `actions/github-script@v7` and not run standalone.
176
+
177
+
### Running tests
178
+
179
+
Unit tests for the `.github/scripts/` logic use the native `node:test` framework (requires Node.js v18+). They do not require any external dependencies.
0 commit comments