jonah-fleet 1.4.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/dist/commands/daemon.d.ts +1 -0
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/run.d.ts +1 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/index.js +929 -127
- package/dist/lib/daemon.d.ts +35 -0
- package/dist/lib/daemon.d.ts.map +1 -1
- package/dist/lib/evals.d.ts +56 -1
- package/dist/lib/evals.d.ts.map +1 -1
- package/dist/lib/presets.d.ts +1 -1
- package/dist/lib/runner.d.ts +3 -0
- package/dist/lib/runner.d.ts.map +1 -1
- package/dist/lib/telemetry.d.ts +13 -0
- package/dist/lib/telemetry.d.ts.map +1 -1
- package/dist/lib/terminal-card.d.ts +99 -0
- package/dist/lib/terminal-card.d.ts.map +1 -0
- package/package.json +4 -4
- package/templates/evals/ambiguity-benchmark.json +92 -0
- package/templates/prompts/ORCHESTRATION.md +25 -9
- package/templates/prompts/_prompt-template.md +13 -1
- package/templates/prompts/autowork.md +33 -7
- package/templates/prompts/optimizer.md +3 -0
- package/templates/workflows/autowork-cron.yml +33 -0
- package/templates/workflows/trigger-autowork-manual.yml +2 -0
- package/templates/workflows/trigger-autowork-on-bug.yml +2 -0
- package/templates/workflows/trigger-autowork-on-merge.yml +2 -0
|
@@ -10,12 +10,12 @@ This routine runs in two modes (Step 0): **Targeted** (a fire named an issue) an
|
|
|
10
10
|
|
|
11
11
|
In **Scan mode**, the run is SUCCESS only if ALL of these are true:
|
|
12
12
|
|
|
13
|
-
- [ ] Checked all open PRs for unresolved or unaddressed review comments
|
|
13
|
+
- [ ] Checked all open PRs for unresolved or unaddressed review comments; if actionable findings were found, claimed the PR before writing fixes (see the Phase 1 PR Claim protocol), confirmed sole ownership, and pushed fixes
|
|
14
14
|
- [ ] Closed any issues whose corresponding PRs are all merged
|
|
15
15
|
- [ ] If no open PRs needed attention: picked the highest-priority *unclaimed* issue (P1 > P2 > P3); if it turned out to be already-done (step 10 — all its PRs merged), closed it and moved on to the next-priority candidate rather than stopping there; otherwise **claimed it before starting work** (see the Claim protocol), and either implemented a fix and **opened a draft pull request on GitHub via `gh pr create --draft`** or left a comment explaining why autonomous completion is blocked and released the claim, then repeated candidate selection for the next-priority issue per step 12's infeasible-continuation cap
|
|
16
16
|
- [ ] If an issue was implemented: successfully opened a draft pull request on GitHub via `gh pr create --draft` referencing the issue (`Closes #N`) in its body, verified the PR exists (a returned PR URL is mandatory), updated the issue's `## Tasks` checkboxes (`- [ ]` → `- [x]`) for every deliverable the PR ships, marked the PR ready for review (`gh pr ready <PR>`), and executed step 15's in-session review wait (never stop at merely pushing the branch or editing the issue; a pushed branch with no open PR on GitHub is a fatal invariant violation and must be logged as FAILURE)
|
|
17
17
|
- [ ] Did not open a new PR while any existing PR by this routine has unaddressed review comments (a finding you have replied to with a rationale counts as *addressed*, even if the thread is still technically unresolved) — **Targeted mode is exempt**
|
|
18
|
-
- [ ] Never worked an issue that was already actively claimed (assigned) by another live run, and confirmed sole ownership of the claim before writing any code — reclaiming a *stale* claim (a dead run's orphaned assignment, per step 10a) is permitted
|
|
18
|
+
- [ ] Never worked an issue or PR that was already actively claimed (assigned) by another live run, and confirmed sole ownership of the claim before writing any code — reclaiming a *stale* claim (a dead run's orphaned assignment, per step 10a / `ORCHESTRATION.md`) is permitted
|
|
19
19
|
- [ ] If work was an umbrella slice/batch (step 12a): the child issue created for it carries the required Summary/Tasks/Why/Complexity template and exactly one type/size/priority label, and the `🧭 Decomposition plan` markers were left `🔍 in review` until the child PR merges
|
|
20
20
|
|
|
21
21
|
If any criterion cannot be met, stop immediately and log FAILURE with the reason.
|
|
@@ -26,7 +26,7 @@ If any criterion cannot be met, stop immediately and log FAILURE with the reason
|
|
|
26
26
|
- **Max scope**: at most one issue may be **implemented** per run. Do not pick up a second, unrelated issue to implement after finishing (or abandoning mid-implementation) the first. (Umbrella slice batching up to 3 slices per step 12a is allowed).
|
|
27
27
|
- **No mid-run context switch**: priorities are evaluated ONCE, at the start of the run (Phase 1 → Phase 2). Finish the issue you started; the next run's Phase 1 will pick up newly surfaced work.
|
|
28
28
|
- **No speculative work**: only take actions directly required by the Definition of Done. Do not refactor adjacent code, open bonus issues, or add improvements not requested by the issue.
|
|
29
|
-
- **Single-flight per issue**: multiple autowork runs can execute concurrently.
|
|
29
|
+
- **Single-flight per issue & PR**: multiple autowork runs can execute concurrently. Both issues and pull requests are shared resources — never begin implementing an issue without first claiming it (see Claim protocol in Phase 2), and never begin addressing findings on an open PR without first claiming it (see PR Claim protocol in Phase 1).
|
|
30
30
|
- **Language Requirement**: All GitHub issue titles, descriptions, task checklists, and comments MUST be written in **English**.
|
|
31
31
|
- **Session link footer**: sign every GitHub post (issue comments, PR comments, PR descriptions) with the Antigravity run footer (`_Generated by [Antigravity](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})_`). Inline review-thread line comments are exempt.
|
|
32
32
|
|
|
@@ -34,6 +34,7 @@ If any criterion cannot be met, stop immediately and log FAILURE with the reason
|
|
|
34
34
|
|
|
35
35
|
- Do not address a subset of review findings and stop — handle ALL findings in one run before stopping or marking the PR as ready.
|
|
36
36
|
- Do not mark a PR as ready for review without first re-fetching review threads *and PR-level comments* and confirming every finding matching step 2's trust & noise rules has been handled.
|
|
37
|
+
- Do not start addressing review findings on a PR before claiming it (both PR assignment AND claim comment).
|
|
37
38
|
- Do not strand a PR in draft because you disagree with a finding — reply with your rationale, mark the PR ready, and let peer-review re-evaluate.
|
|
38
39
|
- Do not push a branch and stop without running `gh pr create --draft` to actually open the pull request — a pushed branch with no open PR cannot be picked up by the peer-review routine.
|
|
39
40
|
- Do not open a new PR if you already have 3+ open PRs — converge before creating more (**Scan mode only**; Targeted mode is exempt).
|
|
@@ -66,7 +67,15 @@ b. **Eligible → claim, then implement.** Call `get_me` once to learn your own
|
|
|
66
67
|
### Phase 1: Converge on open work (Scan mode; skipped in Targeted mode)
|
|
67
68
|
|
|
68
69
|
1. List all open PRs authored by this routine.
|
|
69
|
-
|
|
70
|
+
1a. **PR Claim Protocol (Single-Flight PR Convergence)**:
|
|
71
|
+
- For each open PR needing attention (bounced to draft with actionable findings, or open with unaddressed review comments):
|
|
72
|
+
- **Check eligibility**: re-read candidate PR (`gh pr view <PR> --json assignees,comments`). Skip PRs currently assigned to another live runner or carrying an active claim comment posted within the last 2 hours (unless stale claim per `ORCHESTRATION.md`).
|
|
73
|
+
- Call `get_me` once to learn your own login if not already known.
|
|
74
|
+
- **Claim atomically**: assign yourself to the PR (`gh pr edit <PR> --add-assignee <login>`) AND post a claim comment on the PR:
|
|
75
|
+
- In **Cloud Actions**: `🔒 Addressing review findings by autowork run {run_url} {timestamp}`
|
|
76
|
+
- In **Local Agent**: `🔒 Addressing review findings by local autowork session (host: {hostname}) {timestamp}`
|
|
77
|
+
- **Confirm sole ownership**: fetch comments on the PR. Earliest `created_at` among competing claim comments in this round wins. If you lost the race, unassign yourself (`gh pr edit <PR> --remove-assignee <login>`), annotate your comment, and evaluate the next PR (or proceed to Phase 2 if none left).
|
|
78
|
+
2. For the claimed PR, fetch ALL review threads and PR-level comments. Filter for actionable findings matching trust & noise rules (author login matching `get_me`, non-noise). Address every single one in this run — push fixes for actionable findings, reply to clarifying questions, and comment on deferred items.
|
|
70
79
|
3. For PRs where you have addressed all findings:
|
|
71
80
|
3a. **Pre-ready self-audit** (run before marking ready):
|
|
72
81
|
- **Automated review passes**: run `/code-review` (evaluating along Standards in `AGENTS.md` and Spec in the issue's `## Tasks`) and security review over the diff. Fix what they flag.
|
|
@@ -75,10 +84,14 @@ b. **Eligible → claim, then implement.** Call `get_me` once to learn your own
|
|
|
75
84
|
- **Documentation accuracy**: update relevant docs (`ARCHITECTURE.md`, `CODEMAP.md`, `API.md`, `CHANGELOG.md` if maintained by repo).
|
|
76
85
|
- **Build & type-check verification**: run the repository's test, type-check, and lint commands from `AGENTS.md` (e.g. `npm test`, `npm run type-check`, `npm run lint`, `pytest`, `cargo test`). Confirm zero errors and zero test failures.
|
|
77
86
|
- **Clean-merge gate**: verify `git merge-tree origin/main HEAD` reports no conflicts.
|
|
87
|
+
- **Release claim on ready**: mark the PR ready (`gh pr ready <PR>`) and unassign yourself (`gh pr edit <PR> --remove-assignee <login>`) so Peer Review can evaluate without holding stale agent reservation locks.
|
|
78
88
|
Only mark the PR ready after passing every check above.
|
|
79
89
|
3b. **Ping-pong cap**: If this same PR has bounced between draft and ready 3 or more times over the same substantive finding, stop re-marking it ready. Post a comment summarizing the disagreement for human resolution and leave the PR in draft.
|
|
80
90
|
3c. **Orphaned Ready PR Recovery**: If an open PR authored by this routine is `ready_for_review`, has passing CI, no unaddressed review comments, and has received no review activity for over 2 hours (e.g. because peer review crashed or encountered quota limits), kickstart the review routine by posting `/review` comment or toggling draft and ready (`gh pr ready <PR> --undo && gh pr ready <PR>`).
|
|
91
|
+
- **Passing CI Verification Gate**: Verify via `gh pr view <PR> --json statusCheckRollup,mergeStateStatus` that all required and existing checks have completed with `conclusion: "SUCCESS"` and `mergeStateStatus` is `CLEAN` (neither `UNSTABLE`, `BLOCKED`, nor `DIRTY`).
|
|
92
|
+
- **Unapproved/Pending Workflow Invariant**: NEVER post `/review` or toggle draft state if checks are in-progress, failing, or awaiting approval (`conclusion: "ACTION_REQUIRED"`). Doing so creates an infinite comment storm while workflows remain paused awaiting human permissions.
|
|
81
93
|
4. Check open issues that have linked merged PRs — close them.
|
|
94
|
+
|
|
82
95
|
5. If any PR was updated in this phase, STOP — run is SUCCESS.
|
|
83
96
|
|
|
84
97
|
### Phase 2: New work (only if Phase 1 had nothing to do)
|
|
@@ -126,13 +139,14 @@ b. **Eligible → claim, then implement.** Call `get_me` once to learn your own
|
|
|
126
139
|
- Open draft PR via `gh pr create --draft --head <branch> --base main --title "<title>" --body "<body referencing Closes #N>"`.
|
|
127
140
|
- **PR Priority Label Mirroring**: If the issue carried a priority label (`priority/P0`, `priority/P1`, `priority/P2`, `priority/P3`), add the identical priority label to the PR (`gh pr edit <PR> --add-label "<label>"` or via `--label` in create) so downstream review workflows can filter triggers immediately.
|
|
128
141
|
- Verify PR URL returned. Update issue `## Tasks` checkboxes.
|
|
142
|
+
- **Warm Context Assignment**: Assign yourself to the newly opened PR (`gh pr edit <PR> --add-assignee <login>`) to hold the reservation across Step 15's in-session review wait so parallel Scan routines recognise the PR as actively held by a live session.
|
|
129
143
|
- Mark PR ready (`gh pr ready <PR>`).
|
|
130
144
|
14. If run aborts before opening PR, release claim (unassign).
|
|
131
145
|
15. **In-Session Peer Review Wait & Immediate Convergence (Warm Context):**
|
|
132
146
|
- Poll PR status for up to 10–12 minutes.
|
|
133
|
-
- If merged: record terminal SUCCESS and exit cleanly.
|
|
147
|
+
- If merged: unassign yourself, record terminal SUCCESS and exit cleanly.
|
|
134
148
|
- If bounced to draft with findings: fetch review comments, apply fixes in active worktree, run tests, push fix commit, re-mark ready (`gh pr ready <PR>`), and complete run.
|
|
135
|
-
- If timeout (>12m): exit cleanly; scheduled cron will handle subsequent rounds.
|
|
149
|
+
- If timeout (>12m): unassign yourself from the PR (`gh pr edit <PR> --remove-assignee <login>`) and exit cleanly; scheduled cron will handle subsequent rounds.
|
|
136
150
|
|
|
137
151
|
## Logging
|
|
138
152
|
|
|
@@ -142,4 +156,16 @@ After completing (SUCCESS or FAILURE), write a log file to `.github/prompts/logs
|
|
|
142
156
|
- Full execution trace with tool calls
|
|
143
157
|
- If FAILURE: root cause, category, and suggested fix
|
|
144
158
|
|
|
145
|
-
**
|
|
159
|
+
**Log Delivery Protocol & Invariants**:
|
|
160
|
+
- **Negative Rule**: NEVER commit or push run logs to a feature branch or open PR branch. Doing so emits a `pull_request: synchronize` event under bot credentials, triggering GitHub Actions workflow approval gates (`action_required`) that stall CI.
|
|
161
|
+
- **Mandatory `[skip ci]`**: Always append `[skip ci]` to any log commit message.
|
|
162
|
+
- **Direct Push to `main`**: Commit the log file directly to `main` and push — explicitly permitted for files under `.github/prompts/logs/**`:
|
|
163
|
+
```bash
|
|
164
|
+
git checkout main
|
|
165
|
+
git pull origin main
|
|
166
|
+
git add .github/prompts/logs/autowork/{timestamp}.md
|
|
167
|
+
git commit -m "docs(log): record autowork run {timestamp} [skip ci]"
|
|
168
|
+
git push origin main
|
|
169
|
+
```
|
|
170
|
+
Follow the Log delivery fallback in `ORCHESTRATION.md` if direct push fails.
|
|
171
|
+
|
|
@@ -59,6 +59,8 @@ If any criterion cannot be met, stop immediately and log FAILURE with the reason
|
|
|
59
59
|
- **Iteration Ceiling Exhaustion**: >20% of runs in a routine terminate at the `token_limit` / max iteration cap.
|
|
60
60
|
- **Review Loop Burn**: Pull requests experiencing >= 3 bounce rounds between autowork and peer-review over unresolved or recurring findings.
|
|
61
61
|
- **Feedback Loop Stagnation**: A downstream processing routine (e.g. impact measurement, verification, or triage) records 0 intake (`filed: 0` or 0 new items processed) across $\ge 2$ consecutive runs while upstream PRs merge or roadmap/feature issues close in the same window. Flags that discovery sweeps have stalled or become overly coarse.
|
|
62
|
+
- **Passive Order-Taking Anomaly ("Yes-Man Blindspot")**: The Ambiguity Gate trigger rate across intake runs in `autowork` or `triage` is <5% despite elevated PR review bounces ($\ge 2$) or high iteration usage ($\ge 35$), indicating agents are silently guessing requirements and building flawed implementations rather than interrogating underspecified issues.
|
|
63
|
+
- **Speculative Runaway Waste**: An agent run consumed >50k tokens on an underspecified issue with 0 clarifying questions asked, and subsequently failed, bounced, or required post-merge rework.
|
|
62
64
|
6. **Analyze resolved bugs & review comments**: Examine closed bug issues, merged bug-fix PRs, and review feedback for missing checks in authoring (`autowork.md`) or review (`peer-review.md`).
|
|
63
65
|
|
|
64
66
|
### 2. Formulate preventative improvements
|
|
@@ -69,6 +71,7 @@ Translate findings into concrete preventative improvements and remediation trigg
|
|
|
69
71
|
- **Iteration Ceiling & Self-Audit Tuning**: For Iteration Ceiling Exhaustion, adjust max iteration bounds or tighten pre-ready self-audits in `autowork.md` to catch defects before review cycles start.
|
|
70
72
|
- **Ping-Pong Convergence**: For Review Loop Burn, tighten reviewer trust & noise filtering, enforce clean-merge gates, and apply ping-pong caps to prevent endless bounce cycles.
|
|
71
73
|
- **Loop Discovery Mechanical Audits**: For Feedback Loop Stagnation, tighten discovery sweeps by mandating deterministic per-issue matching tables and itemized reconciliation against upstream closed issues/PRs rather than allowing un-itemized generic summary assertions.
|
|
74
|
+
- **Ambiguity Gate & Benchmark Eval Feeding**: For Passive Order-Taking and Speculative Runaway Waste, tighten Step 12 criteria in `autowork.md` and `triage.md` to mandate clarifying questions, and automatically extract the problem issue into a `BenchmarkIssue` test case to feed the automated ambiguity benchmark eval suite (`tests/evals.test.ts`), ensuring future agent prompts are continuously tested against real failure cases.
|
|
72
75
|
- **Verification & Invariant Tests**: Add automated test cases in `tests/` verifying prompt invariant preservation and schema conformity.
|
|
73
76
|
|
|
74
77
|
### 3. Open Fix PR (Local or Upstream Bridge)
|
|
@@ -36,6 +36,8 @@ jobs:
|
|
|
36
36
|
uses: actions/checkout@v4
|
|
37
37
|
with:
|
|
38
38
|
fetch-depth: 0
|
|
39
|
+
token: ${{ secrets.GH_PAT || github.token }}
|
|
40
|
+
|
|
39
41
|
|
|
40
42
|
- name: Setup Node.js
|
|
41
43
|
uses: actions/setup-node@v4
|
|
@@ -170,3 +172,34 @@ jobs:
|
|
|
170
172
|
fi
|
|
171
173
|
fi
|
|
172
174
|
fi
|
|
175
|
+
|
|
176
|
+
- name: Commit and push run log directly to main
|
|
177
|
+
if: always()
|
|
178
|
+
env:
|
|
179
|
+
GH_TOKEN: ${{ secrets.GH_PAT || github.token }}
|
|
180
|
+
run: |
|
|
181
|
+
LATEST_LOG=$(ls -t .github/prompts/logs/autowork/*.md 2>/dev/null | head -n 1)
|
|
182
|
+
if [ -n "$LATEST_LOG" ] && [ -f "$LATEST_LOG" ]; then
|
|
183
|
+
TMP_LOG_FILE=$(mktemp)
|
|
184
|
+
cp "$LATEST_LOG" "$TMP_LOG_FILE"
|
|
185
|
+
LOG_REL_PATH="$LATEST_LOG"
|
|
186
|
+
LOG_NAME=$(basename "$LATEST_LOG" .md)
|
|
187
|
+
|
|
188
|
+
git fetch origin main:main || git fetch origin main || true
|
|
189
|
+
git checkout main || git checkout -B main origin/main || true
|
|
190
|
+
|
|
191
|
+
mkdir -p "$(dirname "$LOG_REL_PATH")"
|
|
192
|
+
cp "$TMP_LOG_FILE" "$LOG_REL_PATH"
|
|
193
|
+
rm -f "$TMP_LOG_FILE"
|
|
194
|
+
|
|
195
|
+
git add "$LOG_REL_PATH"
|
|
196
|
+
if ! git diff --cached --quiet; then
|
|
197
|
+
git commit -m "docs(log): record autowork run ${LOG_NAME} [skip ci]" || true
|
|
198
|
+
if [ -n "$GH_TOKEN" ]; then
|
|
199
|
+
git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" main || git push origin main || true
|
|
200
|
+
else
|
|
201
|
+
git push origin main || true
|
|
202
|
+
fi
|
|
203
|
+
fi
|
|
204
|
+
fi
|
|
205
|
+
|