diff --git a/.agents/coordination.md b/.agents/coordination.md index edf304ac..a510f8ae 100644 --- a/.agents/coordination.md +++ b/.agents/coordination.md @@ -69,6 +69,25 @@ interactive session remains responsive: `send_message` **only once** upon terminal completion or an unresolvable blocker. - **Re-Entrancy Guard**: If the executing agent is already the spawned `Holon Flow Subagent`, it proceeds directly to flow execution without spawning another nested subagent. +- **4-Flow Concurrency Cap & Merge Backfill (maintainer, 2026-11-24)**: On hosted runtimes, up to **4 concurrent + `holon-flow` background subagents** may run at once, each in its own dedicated `flow-` worktree and honouring + dependencies, solo-sweep rules, and disjoint touch sets. Once a target-repo PR merges, backfill open slots up to 4 by + launching the next highest-priority ready bean via `holon-flow`. + - **Slots must always be doing work (maintainer, 2026-11-26)**: only flows that are executing, reviewing or + calibrating count toward the 4; check this on every progress report and after every merge. + - **Park blocked flows**: a flow refused at Stage 3 admission on a touch-set overlap, or otherwise waiting on another + flow's PR, does not hold a slot. Stop only that flow's own wrapper/poll loop, keep its worktree, branches and + checkpoint, note on its bean + `parked : blocked by on ; resume from checkpoint when `, and end its subagent. + - **Backfill at once** with the next highest-priority ready bean whose touch set is disjoint from every live and + parked flow. + - **Resume from checkpoint**: once the blocker merges or releases the files, resume the parked flow with + `--checkpoint` (never a fresh launch, which re-runs intent and plan and leaves duplicate `I-*` branches). Resuming + takes the next free slot ahead of new beans. + - **Intent goal carries the invariant (maintainer, 2026-11-27)**: every intent written for a backfilled or new flow + includes this sentence in its `goal`: "Code is self-explaining: no docstrings and no comments except '# why:' + comments that record a reason the code cannot show." Before reporting a PR ready, scan its diff for docstrings and + non-`# why:` comments. ### 4. Generic Subagent Protocol (Any Coding Agent) @@ -99,10 +118,11 @@ When executing within the **Antigravity (AGY)** environment: child sessions. If credit, quota, or session allowance runs out on the higher-level model (for either **Claude** or **Antigravity**), automatically fall back to the next lower tier that has available credit (`Model: "inherit"` / `"pro"` $\rightarrow$ `"flash"` $\rightarrow$ `"flash_lite"` in AGY `invoke_subagent`; `claude-opus-5-5` $\rightarrow$ - `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5` in `claude-agent`; `gemini-4-argon` $\rightarrow$ - `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` in `antigravity-agent`, or switch `--agent` across `claude-agent` - $\leftrightarrow$ `antigravity-agent` if an account-wide session limit is reached) and continue the in-progress flow - or review loop from its current stage/iteration without losing completed work. + `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5` in `claude-agent`; `gemini-4-neon` $\rightarrow$ `gemini-4-argon` + $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` in `antigravity-agent`; never switch `--agent` + across runners on your own: if an account-wide session limit exhausts the runner's ladder, stay on it and ask the + maintainer before switching) and continue the in-progress flow or review loop from its current stage/iteration without + losing completed work. - **Reactive Wakeup (Zero Polling)**: AGY resumes parent execution automatically upon child message arrival or task completion. **Never poll, sleep, or loop on task status.** @@ -123,7 +143,9 @@ answer and no tool call), and a constrained host can be pushed into swap or cras The rule: -- **Hosted runtime** -- dispatch independent children concurrently (the default in `pr-reviewer` and `pr-review-loop`). +- **Hosted runtime** -- dispatch independent children concurrently (the default in `pr-reviewer` and `pr-review-loop`); + for target-repo `holon-flow` executions, up to **4 concurrent background flow subagents** are permitted (with + automatic highest-priority bean backfill upon PR merge). - **Local runtime** -- dispatch LLM-inference children **serially**: launch one child, wait for it to finish, then launch the next. Concurrency for LLM work is capped at 1. Serialising changes **only the launch schedule**: - Each pass still runs in its **own fresh child context**, with its own prompt, its own report file and its own vote. @@ -144,3 +166,25 @@ The rule: - Review the subagent's report upon reactive resumption. - In multi-turn workflows, inspect output artifacts (e.g. `.subagent/_pr_dry_run_review_iter_*.md`, namespaced per the `pr-review-loop` skill's artifact convention) and verify commits before proceeding to subsequent phases. + +### 7. Skill Subagents and Delegation (maintainer rules) + +- **Harness operations run through their skills in subagents, never inline** (maintainer, 2026-11-23): flows + (`holon-flow`), conflict resolution (`resolve-conflict`), review loops and calibration (`pr-review-loop`). A quick + manual check does not excuse skipping the skill. When a resolve-conflict subagent escalates a code conflict, spawn a + new one a tier up with the decision in its prompt; the main session only decides and delegates. +- **Name every subagent**: description `# - ` (or `bean - ` before a PR exists), and set its name + field too (`pr-` or `bean-`, letters, digits, `_` and `-` only). +- **Keep the main thread for coordination** (maintainer, 2026-11-24): diagnosing failures, measuring, reading across + several files and editing or testing harness code go to subagents on the lowest tier that fits. Inline only: status + checks, briefing subagents, single small edits and replies. + +### 8. Coordinator failure ledger + +`.agents/ledger/coordinator-failures.jsonl` records the coordinator's own mistakes (maintainer, 2026-11-27); the target +repositories' ledgers stay for flows and never reference harness paths. It is append-only, one JSON object per line; +corrections are new lines with `supersedes`. Fields: `id` (`CF-0001`...), `created_at` (ISO UTC), `session_date`, +`category` (brief, readiness-check, overlap-scheduling, intent-scope, measurement, conflict-handling, bookkeeping, +verification), `failure`, `my_part`, `cost`, `rule`, `refs`. Append an entry for every halt, park, wasted run, false +readiness or wrong brief before moving on. Check every brief, readiness check and launch against its rules. Validate +with `uv run python .agents/scripts/check_failure_ledger.py`. diff --git a/.agents/engineering-rules.md b/.agents/engineering-rules.md index 5e906b0d..759c5de3 100644 --- a/.agents/engineering-rules.md +++ b/.agents/engineering-rules.md @@ -31,18 +31,27 @@ sizing. Moved verbatim from `AGENTS.md`. `ACT-POST`, tool operations) and lifecycle summaries (`entry_type: "summary"`, such as `E-...`, `REV-...`) MUST be interleaved chronologically inside `executions.jsonl` under `LedgerLock`. Auxiliary ledgers fragment the provenance trail, break downstream query engines, and are strictly prohibited. + - **Per-Flow Pending Fragments and CI Promotion (maintainer, 2026-11-23; Bean 0371)**: Per-flow pending fragments + (`holon-knowledge/ledger/pending//.jsonl`) are the same three ledgers split by flow, not + auxiliary ledgers: each fragment holds rows of exactly one of `intents`, `plans` or `executions`, in the canonical + row format. Once Bean 0371 lands, flows append only to their own fragments and never write the canonical `*.jsonl` + files; readers merge canonical rows and all fragments by `created_at`; and only the CI promotion job on push to + `main` folds fragments into the canonical ledgers (append-only, idempotent, ledger-only commit). Until then, flows + keep writing the canonical files and the conflict rules below apply. - **Ledger-Only Conflict Resolution (No Tests Required)**: When syncing or merging `origin/main` into a flow branch results in conflicts strictly confined to ledger files (`holon-knowledge/ledger/*.jsonl`), **do NOT run the test - suites**. Simply interleave or append the JSONL records chronologically by their `created_at` timestamp, verify - that all lines parse cleanly as valid JSON, commit the resolved merge, and push. + suites**. Keep `origin/main`'s ledger file exactly as it is on main, in main's order, and append only the rows the + branch adds (ordered by `created_at` among themselves); never move or re-sort a row already on main (the one-time + chronological sort is a separate, deliberate change tracked in the harness beans). Verify that all lines parse + cleanly as valid JSON, commit the resolved merge, and push. - **Mandatory Target-Branch Conflict Resolution Before Review & Calibration**: Prior to posting an approved consensus review to GitHub or executing Stage 5 calibration, agents and loop orchestrators **MUST** verify that the PR is clean and mergeable against the target branch (`gh pr view --json mergeable,mergeStateStatus`). If `mergeable == "CONFLICTING"` or `mergeStateStatus == "DIRTY"` (which frequently occurs when concurrent PRs merge new entries into `holon-knowledge/ledger/`), the agent **MUST immediately fetch `origin/main`, merge `origin/main` - into the PR execution branch, resolve the conflicts (interleaving ledger entries chronologically), commit, and - push to origin**. Never post an approved review, never calibrate, and never report a PR as ready to merge while it - is in a conflicting state against the target branch. + into the PR execution branch, resolve the conflicts (ledgers: main's rows unchanged in main's order, then the + branch's own rows appended), commit, and push to origin**. Never post an approved review, never calibrate, and + never report a PR as ready to merge while it is in a conflicting state against the target branch. 15. **Modular File Sizing & 200-Line Sizing Guideline**: Source files exceeding **200 lines** should generally be decomposed into modular packages and focused single-responsibility modules (e.g. `flow/`, `cli/commands/`, `proxy/`, `executor/`, `calibration/`). This is a recommended guideline and best practice rather than a rigid hard rule, @@ -51,3 +60,26 @@ sizing. Moved verbatim from `AGENTS.md`. files where sensible. --- + +16. **Module Budgets Force a Split** (maintainer, 2026-11-20): a module line budget is a ceiling that forces a big + module to be divided, never a number to raise. A change that would push a module over budget splits the module. + Never raise, lower, add or delete a budget entry (or label a PR `module-budget-change`) without the maintainer's + explicit instruction for that change; an unauthorised budget change is a Critical review finding. +17. **Tests Isolate Their Own Setup; No Shared Directory conftest** (maintainer, 2026-11-26): "all test should isolate + as much set up as possible so different tests don't rely on the same conftest.py". A test module owns its setup. A + fixture or stub that only some tests need lives in the test module, or in a small helper module (plain install + function plus a non-autouse fixture) that the module imports and applies with `pytest.mark.usefixtures`. A + `conftest.py` holds only universal safety guards (hermetic git config, ambient credentials, home, network and `gh` + write guards, checkout write guards), stays under 200 lines, and a directory `conftest.py` below `tests/` is not + added. No autouse fixture unless every test needs it, and no `pytest_plugins` in a test module (it applies to every + module collected after it). A new fixture never goes into a shared `conftest.py`; a flow that needs one adds it to + the module under test or an imported helper, so conftests stop being touch-set magnets. A new autouse fixture, or a + new fixture in a directory `conftest.py`, is an Important review finding; an autouse fixture that hides a real call + (a stub that makes a test pass) is Critical. The existing conftests are split by the series in the harness bean for + `conftest.py` (0540). +18. **Self-Explaining Code** (maintainer, 2026-11-27): code carries no docstrings and no explanatory comments in any + language; names state intent, and the only allowed comment is a `# why:` comment recording a reason the code cannot + show (full text: rule 5 in [rules.md](rules.md)). Machine directives (shebangs, encoding lines, `# noqa`, `# type:`, + `# pragma`, `# fmt:`, shellcheck) stay. Every intent the coordinator writes carries this sentence in its goal: "Code + is self-explaining: no docstrings and no comments except '# why:' comments that record a reason the code cannot + show." The review flags a docstring or a non-`# why:` explanatory comment added in the diff as an Important finding. diff --git a/.agents/holon-flow.md b/.agents/holon-flow.md index f86b4e4a..1798ad92 100644 --- a/.agents/holon-flow.md +++ b/.agents/holon-flow.md @@ -56,26 +56,43 @@ stepping down model tiers, always resume through `holon flow --fro halt and report the blocker instead of bypassing the stage or hand-applying the diff as a workaround. - **Automatic Model & Runner Fallback on Credit / Quota Exhaustion**: If a stage or subagent fails due to model credit exhaustion, session quota limits, or rate-limit caps (e.g. `You've hit your session limit`, `insufficient_quota`, - `RESOURCE_EXHAUSTED`, or HTTP 429/quota errors), **do not stop or block** as long as a lower-tier model or alternate - configured runner still has available credit. Automatically step down the fallback ladder and **continue the flow from - the current stage/checkpoint** (reusing any already-pushed `I-.../_`, `P-.../_`, or `E-.../_` branch): - - **Claude (`claude-agent`) fallback ladder**: `claude-fable-5` (or `fable`) $\rightarrow$ `claude-opus-5-5` (or - `opus`) $\rightarrow$ `claude-sonnet-4-6` (or `sonnet`) $\rightarrow$ `claude-haiku-4-5` (or `haiku`). Fable is the - preferred top tier for flow stages (maintainer, 2026-11-05); `holon` passes `--model` through to the runner - verbatim, so no engine change is needed. - - **Antigravity (`antigravity-agent` in `holon` CLI) fallback ladder** (maintainer, 2026-11-22): use - `antigravity-agent` with `gemini-4-argon` for all Holon coding tasks until tokens run out, then fall back along - `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` (use bare model IDs without - `-high` because `AntigravityRunner` passes `--effort ${HOLON_AGENT_EFFORT:-medium}`). + `RESOURCE_EXHAUSTED`, or HTTP 429/quota errors), **do not stop or block** as long as a lower-tier model on the same + runner still has available credit. Automatically step down the fallback ladder and **continue the flow from the + current stage/checkpoint** (reusing any already-pushed `I-.../_`, `P-.../_`, or `E-.../_` branch): + - **Claude (`claude-agent`) fallback ladder**: `claude-fable-5-2` (Fable 5.2; never the bare alias `fable`, which the + engine maps to `claude-opus-5-5`) $\rightarrow$ `claude-opus-5-5` (or `opus`) $\rightarrow$ `claude-sonnet-4-6` (or + `sonnet`) $\rightarrow$ `claude-haiku-4-5` (or `haiku`). Fable is the preferred top tier for flow stages + (maintainer, 2026-11-05); `holon` passes `--model` through to the runner verbatim, so no engine change is needed. + - **Antigravity (`antigravity-agent` in `holon` CLI) fallback ladder** (maintainer, 2026-11-24): use + `antigravity-agent` with `gemini-4-neon` for all Holon coding tasks until tokens run out, then fall back along + `gemini-4-neon` $\rightarrow$ `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` + (use bare model IDs without `-high` because `AntigravityRunner` passes `--effort ${HOLON_AGENT_EFFORT:-medium}`). - **Antigravity (`invoke_subagent` in AGY runtime) fallback ladder**: `Model: "inherit"` / `"pro"` $\rightarrow$ `"flash"` $\rightarrow$ `"flash_lite"`. - - **Cross-Runner Fallback**: If all model tiers on the active runner (`claude-agent` or `antigravity-agent`) share an - exhausted account-wide session limit, automatically switch `--agent` to the other runner (`antigravity-agent` or - `claude-agent`) at its highest available tier with credit and continue the remaining flow stages on the existing - flow branch. + - **No Cross-Runner Switch** (maintainer, 2026-11-23): on a stuck or exhausted runner, stay on that runner's ladder + and ask the maintainer before switching `--agent` between `claude-agent` and `antigravity-agent`. Never switch on + your own; report the exhausted ladder and wait for the go-ahead. - The only permitted exception is an explicit, unambiguous user instruction to make a specific edit outside the flow, and that exception must be named in the commit message and in the bean summary. +## Flow principles (maintainer, 2026-11-24) + +These rules are partly implemented in the engine; the rest is tracked in the harness beans. + +- **Fail early** (hard rule): "failures should be recognised as soon as possible and actions should be taken as soon as + possible. this is a hard rule. fail early". A failure is acted on the moment it can be known, in every stage; nothing + waits for the rest of a pipeline or the end of a stage once the outcome is already a failure. +- **Resolve a conflict the moment it is found**: "as soon as you find a conflict resolve it straight away". Whichever + stage finds it resolves it at once; it is never deferred to posting time or the next stage. +- **Only success postings wait for the pipeline**: "only sucess posting is waiting for the pipeline to pass. every + failure is existed or posted early." The consensus approval and the "calibration done" result wait; every failure + exits or is posted early. +- **At the end of the review only two things matter**: the pipeline passes and the consensus passes. Everything else is + churn, and a step stays on the critical path only if it helps reach those two. +- **On a pipeline failure, fix at once and in one push**: do not idle on a run that has already failed; start the next + fixing iteration on the first failed check, and give the resolver every failure of that run so one push answers them + all. + **Harness exception & operational branches (control plane only).** The `holon-agentic-coder-ref-metadata` control plane itself (`.beans/`, `.agents/`, `AGENTS.md`) is the coordination harness rather than a flow-managed target repository. Those harness files stay directly editable. Furthermore, **harness branches (such as `docs/harness-YYYYMMDD` or task @@ -92,3 +109,30 @@ merges for regular harness updates; merging harness branches into `main` is an i `holon flow ` runner directly** (or `--from-stage` / `--checkpoint` when resuming); never use ad-hoc wrapper scripts like `holon-stage.sh` or manual disconnected stage commands. See [🔒 Sole Change Path: The Holon Flow](#-sole-change-path-the-holon-flow). + +--- + +## Intent Authoring and Running Rules + +Maintainer rules that every session follows when writing or running a flow: + +- **Intent `scope` lists files, never directories** (maintainer, 2026-11-20): name each source and test file, plus new + files by name or their exact parent package file. A directory becomes planner touch-set globs, and Stage 3 admission + then refuses every unrelated concurrent flow. `run_holon_flow.py` refuses an intent whose scope has such an entry. +- **Intent text names no harness paths, bean ids or review ids** (maintainer, 2026-10-29), not even in a "never + reference X" constraint: `holon intent` copies it verbatim into the target's append-only `intents.jsonl`. Say + "harness-specific directories and task-tracker ids". Grep the JSON for `.beans`, `todo/`, `.agents` and bean ids + before launching. +- **Slugs are descriptive and at most 32 characters** (maintainer, 2026-11-20; see the ref-length rule in + [rules.md](rules.md)). +- **Never stop a running flow on your own judgment** (maintainer, 2026-10-28), even when the plan splits into + sub-intents that look undeliverable. Monitor and report; stopping needs an explicit maintainer instruction. Never + delete the branches a flow produced unasked: completed runs are audit evidence. +- **No stage before the merge halts for a human** (maintainer, 2026-10-26). A `halted_for_human` before the merge is a + bug: log it, never work around it by hand. +- **Diagnose a failed flow, stage or subagent immediately** (maintainer, 2026-11-12): read the log, checkpoint and + worktree, reproduce if cheap, and report a confirmed root cause with the fix; never report the failure and ask whether + to look. Separate confirmed from suspected. +- **A flow whose PR conflicts with `main` at the end is not done** (maintainer, 2026-11-23): resolve it and rerun + (`--from-stage calibrate` after a mechanical ledger merge, `--from-stage review` if the PR's own diff changed) until + the PR is MERGEABLE and CLEAN. Never report it ready while it conflicts. diff --git a/.agents/instructions.md b/.agents/instructions.md index b97cc023..bc489945 100644 --- a/.agents/instructions.md +++ b/.agents/instructions.md @@ -13,8 +13,9 @@ system safety, and clean documentation. Follow these core guidelines in every se over-engineering solutions. 3. **Be Communicative**: Inform the user (or parent agent) of your plan before executing complex steps. Use artifacts to outline detailed multi-step plans. -4. **Preserve Context**: Maintain original documentation, comments, and structure unless explicitly tasked with changing - them. Do not delete comments or rename files without justification. +4. **Preserve Context**: Maintain original documentation and structure unless explicitly tasked with changing them. Do + not rename files without justification. Code comments follow the self-explaining-code invariant in + [rules.md](rules.md); only `# why:` comments are kept. 5. **Avoid Absolute Paths**: Never use absolute file paths in code references, comments, tasks, or documentation. Always use paths relative to the project root (e.g. `.agents/instructions.md`) to ensure portability across developer workspaces. @@ -74,14 +75,14 @@ system safety, and clean documentation. Follow these core guidelines in every se restarting completed stages: - **Claude (`claude-agent` / Claude Code)**: `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5`. - - **Antigravity (`antigravity-agent` in `holon` CLI)**: `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` - $\rightarrow$ `gemini-3.8-flash` (default to `gemini-4-argon` for all Holon coding tasks until tokens run out). + - **Antigravity (`antigravity-agent` in `holon` CLI)**: `gemini-4-neon` $\rightarrow$ `gemini-4-argon` $\rightarrow$ + `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` (default to `gemini-4-neon` for all Holon coding tasks until + tokens run out). - **Antigravity (`invoke_subagent` in AGY runtime)**: `Model: "inherit"` / `"pro"` $\rightarrow$ `"flash"` $\rightarrow$ `"flash_lite"`. - - **Cross-Runner Continuation**: If an entire runner's session quota is exhausted across all its model tiers (e.g. - Claude OAuth session limit), switch `--agent` to the alternate runner (`antigravity-agent` or `claude-agent`) and - continue the flow from the current stage (`holon plan `, `holon execute `, - `holon review `, or `holon calibrate `). + - **No Cross-Runner Switch** (maintainer, 2026-11-23): if an entire runner's ladder is exhausted or stuck (e.g. + Claude OAuth session limit), stay on that runner's ladder and ask the maintainer before switching `--agent` + between `antigravity-agent` and `claude-agent`. Never switch on your own; report and wait for the go-ahead. - Never poll or sleep in a loop; AGY wakes the parent agent automatically when child tasks finish. - Generic coding agents (such as Claude Code, Codex, Pi, OpenCodeInterpreter) can execute child tasks using their native subagent or child process delegation mechanisms following the same prompt contracts. @@ -129,15 +130,15 @@ system safety, and clean documentation. Follow these core guidelines in every se - **Strict 3-Ledger Triad**: All Holon provenance and lifecycle events are strictly confined to three canonical ledgers: `intents.jsonl`, `plans.jsonl`, and `executions.jsonl`. - **NEVER Create Auxiliary Ledgers**: Never create `actions.jsonl`, `reviews.jsonl`, or any secondary ledger file. -- **Interleaved Actions**: All discrete action records (`entry_type: "action"`) and lifecycle summaries +- **Recorded Actions**: All discrete action records (`entry_type: "action"`) and lifecycle summaries (`entry_type: "summary"`) must be appended exclusively to `executions.jsonl` under advisory file locking (`LedgerLock`). - **Ledger-Only Conflict Resolution (No Tests Required)**: When resolving merge conflicts between a flow branch and - `origin/main` where only files under `holon-knowledge/ledger/` conflict, do NOT run the test suite. Simply sort and - interleave the JSONL records chronologically by `created_at` timestamp, ensure all lines are valid JSON, commit, and - push. + `origin/main` where only files under `holon-knowledge/ledger/` conflict, do NOT run the test suite. Keep main's ledger + file exactly as on main, in main's order, and append only the branch's own rows (ordered by `created_at` among + themselves); never move or re-sort a row already on main. Ensure all lines are valid JSON, commit, and push. - **Mandatory Target-Branch Conflict Resolution**: Prior to posting an approved consensus review to GitHub or running Stage 5 calibration, agents and orchestrators MUST check `gh pr view --json mergeable,mergeStateStatus`. If `mergeable == "CONFLICTING"` or `mergeStateStatus == "DIRTY"`, the agent must immediately merge `origin/main` into the - PR branch, resolve the conflicts (interleaving ledger entries chronologically), and push to `origin`. Never leave - merge conflicts for the human maintainer. + PR branch, resolve the conflicts (ledgers: main's rows unchanged, the branch's own rows appended), and push to + `origin`. Never leave merge conflicts for the human maintainer. diff --git a/.agents/ledger/coordinator-failures.jsonl b/.agents/ledger/coordinator-failures.jsonl new file mode 100644 index 00000000..b2a550d1 --- /dev/null +++ b/.agents/ledger/coordinator-failures.jsonl @@ -0,0 +1,15 @@ +{"id":"CF-0001","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"measurement","failure":"Launched two macOS-leg performance flows without replaying the rule over history; replay showed 0/62 and 1/62 PRs skipped.","my_part":"Did not run a read-only measurement of the expected saving before launching the speed flows.","cost":"Two performance flows run for negligible saving.","rule":"Before any speed or cost flow, have a read-only subagent measure the expected saving from history; fix the design choices that decide the saving in the intent.","refs":["PR #315","PR #319","bean 0482"]} +{"id":"CF-0002","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"intent-scope","failure":"Told the 0400 subagent its files were disjoint while its intent listed .github/workflows/README.md, which the 0371 flow held.","my_part":"Asserted disjointness without checking live flows' intents and plans.","cost":"Flow parked about 5 h.","rule":"Verify disjointness against live and parked flows' intents and plans, and run holon intent-check, before claiming it.","refs":["bean 0400","bean 0371"]} +{"id":"CF-0003","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"readiness-check","failure":"Called PR #321 ready on flow gates only; it would have broken main's frozen budgets after #317 merged.","my_part":"Equated passing flow gates with readiness.","cost":"Near-miss: main budgets would have broken.","rule":"Readiness = flow gates + budgets against current main + merge-tree against main and other open PRs + effect on running flows.","refs":["PR #321","PR #317"]} +{"id":"CF-0004","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"conflict-handling","failure":"Briefed the #340 and #343 conflict fixes with --from-stage review instead of calibrate and did not stop those subagents when the PRs were queued.","my_part":"Wrote the wrong resume stage and left subagents running past queueing.","cost":"Reruns ran past the merge, were orphaned, and a worktree vanished.","rule":"Resume mechanical ledger/KB conflicts with --from-stage calibrate; the moment a PR is queued or merged, stop every subagent working on it before post-merge starts.","refs":["PR #340","PR #343"]} +{"id":"CF-0005","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"overlap-scheduling","failure":"Kept launching backfill pickers into a file graph that was already blocked.","my_part":"Picked new beans without checking admission against live and parked touch sets.","cost":"4 of 5 parked at first admission; about 29 flow-hours parked.","rule":"Dry-run admission against live and parked touch sets before a pick; when the graph is blocked, prioritise the unblocking bean (e.g. hub files) over new picks.","refs":[]} +{"id":"CF-0006","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"readiness-check","failure":"Reported #350 ready without asking what changing the review loop's environment does to other flows.","my_part":"Did not assess the flow-engine change's effect on running and parked flows.","cost":"Its env overlay halted three flows' resolver pre-push tests.","rule":"For changes to the flow engine itself, check the effect on running and parked flows (run the affected suite in the review environment) before calling it ready.","refs":["PR #350"]} +{"id":"CF-0007","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"bookkeeping","failure":"A post-merge brief carried the previous batch's figures, a post-merge launch was announced but not started, and the audit count was wrong.","my_part":"Copied from a prior brief and did not confirm dispatch.","cost":"Wrong briefs, a missed launch, an incorrect audit count.","rule":"Build briefs from live state (gh/git), not from a previous brief; after announcing a launch, confirm the subagent was dispatched.","refs":[]} +{"id":"CF-0008","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"verification","failure":"Relayed subagent claims without checking (#321 \"unaffected\", shared git config \"shows thomashan\", #330 \"loop.py untouched\").","my_part":"Passed unverified claims to the maintainer.","cost":"Maintainer given unverified merge and config claims.","rule":"Verify any claim passed to the maintainer that affects a merge or a config.","refs":["PR #321","PR #330"]} +{"id":"CF-0009","created_at":"2026-11-27T00:00:00Z","session_date":"2026-11-26","category":"intent-scope","failure":"Intents listing shared hubs (flow/lazy_exports.py, docs/*.md, conftest.py) or letting plans widen into them serialised flows for hours.","my_part":"Wrote intent scopes that included hub files.","cost":"Flows serialised for hours.","rule":"Keep hub files out of intent scope where possible; when a bean must touch one, schedule it alone and before dependants.","refs":[]} +{"id":"CF-0010","created_at":"2026-11-26T22:36:23Z","session_date":"2026-11-26","category":"bookkeeping","failure":"Concurrent post-merge subagents each ran git add -A on the shared harness branch, so one commit (89a2e56, titled for PR #355) swept in another post-merge's bean closure (0547, PR #354) and other pending edits.","my_part":"I launched several post-merge subagents at once with the instruction 'git add -A' on the same harness working tree.","cost":"Misleading commit history; risk of committing another agent's half-finished edits.","rule":"When more than one post-merge or harness-writing subagent runs at once, give each an explicit file list to stage (never git add -A), or serialise the harness commit step through one agent.","refs":["PR #354","PR #355","commit 89a2e56"]} +{"id":"CF-0011","created_at":"2026-11-26T22:37:56Z","session_date":"2026-11-27","category":"verification","failure":"Ran a measurement by checking out a detached origin/main in the off-limits apps/holon-agentic-coder/main worktree (then back to main) instead of a temporary worktree.","my_part":"I took a shortcut for a quick docstring count and broke the 'main worktree is off-limits' rule.","cost":"No damage (main was clean and equal to origin/main), but a concurrent post-merge or install reading that worktree could have seen a detached HEAD.","rule":"Never check out, build or measure in a main worktree; use git show/ls-tree against origin/main or a temporary detached worktree that is removed afterwards.","refs":["AGENTS.md hard rule: main worktrees off-limits"]} +{"id":"CF-0012","created_at":"2026-11-26T22:40:34Z","session_date":"2026-11-27","category":"brief","failure":"Flow PRs produced in this session added docstrings and explanatory comments, against the self-documenting-code direction of bean 0153","my_part":"My intents and briefs never stated the rule, and the harness rules even told agents to update docstrings","cost":"New PRs (about 30 today) re-added docstrings/comments that bean 0153 had removed","rule":"Every intent states the self-explaining-code invariant in its goal; readiness checks include a scan of the diff for docstrings and non-'# why:' comments","refs":["bean 0153"]} +{"id":"CF-0013","created_at":"2026-11-26T22:43:01Z","session_date":"2026-11-27","category":"brief","failure":"Wrote bean 0550 proposing a fourth ledger in the target repositories and treated the 'exactly three ledgers' hard rule as something the maintainer's instruction overrode.","my_part":"I picked the easy shape (copy the harness file as a new ledger) instead of finding where the data belongs within the existing three ledgers and the knowledge base, and I misread an instruction as overriding a hard rule.","cost":"A wrong design recorded in a bean; maintainer had to correct it.","rule":"Never treat an instruction as overriding a hard rule unless it says so explicitly; when porting data into a target repository, reshape it into the existing ledgers and knowledge base rather than adding a new store.","refs":["AGENTS.md hard rule: exactly three ledgers"]} +{"id":"CF-0014","created_at":"2026-11-26T22:51:07Z","session_date":"2026-11-27","category":"brief","failure":"A resume subagent used git stash to set a halted resolver's uncommitted fixes aside in a flow worktree; the stash stack is shared by every worktree and session.","my_part":"My resume brief said to keep and back up the fixes but did not forbid git stash.","cost":"No loss this time (patch backup existed, edits restored), but a concurrent pop by another session could have applied or lost them.","rule":"Briefs that touch uncommitted work say: back up as a patch file and use a temporary WIP commit if the tree must be clean; never git stash.","refs":["PR #353"]} +{"id":"CF-0015","created_at":"2026-11-26T22:51:07Z","session_date":"2026-11-27","category":"brief","failure":"A harness fix subagent committed with --no-verify because the pre-commit prettier hook failed on another agent's untracked bean file.","my_part":"My brief did not forbid bypassing hooks or say what to do when a hook fails on someone else's file.","cost":"Hook bypassed on PR #62's branch; the unformatted bean stayed unformatted.","rule":"Never use --no-verify; when a hook fails on a file the agent did not change, format only that file (prettier is safe) or report and stop.","refs":["PR #62 (harness)","commit 27bdb6b"]} diff --git a/.agents/pr-merging.md b/.agents/pr-merging.md index 31f32997..7cf5eb54 100644 --- a/.agents/pr-merging.md +++ b/.agents/pr-merging.md @@ -56,8 +56,21 @@ checkpoint needing no reaction: id, calibration commit and EV predicted vs actual), and refresh any related beans the merge unblocks or supersedes. 2. **Refresh the triage**: update the `prioritise-beans` generator data (statistics, milestones, overrides, the Recommended Next Execution Sequence) and regenerate `.beans/bean-triage-prioritisation.md`. -3. **Recommend the next concurrent set**: from the refreshed triage, report to the maintainer the next set of beans that - can run concurrently (pairwise-disjoint touch sets, at most one bean touching a shared hotspot such as `flow.py` or - `cli.py` per repository, honouring each bean's recorded dependencies), so the next batch can start immediately. +3. **Backfill open flow slots (up to 4 concurrent flows; maintainer, 2026-11-24)**: after updating beans and refreshing + triage, first resume parked flows unblocked by this merge from their checkpoint (they take free slots ahead of new + beans; parked flows do not count toward the 4; maintainer, 2026-11-26). Then, if fewer than 4 `holon-flow` background + subagents are active on hosted runtimes (local runtimes remain capped at 1), automatically pick up and launch the + highest-priority ready bean from the refreshed triage (honouring `blocked_by`, solo-sweep rules, and + pairwise-disjoint touch sets with active flows; at most one bean touching a shared hotspot such as `flow.py` or + `cli.py` per repository unless explicitly allowed) via `holon-flow` in a background subagent. Report both the + post-merge summary and the newly launched flow (or explain why no eligible bean could start). +4. **Self-improvement audit**: after each merge, count the pull requests merged into `main` of both target repositories + since the newest entry in `.beans/self-improvement-audits.md`. When the count reaches five, launch the + self-improvement audit subagent per [self-improvement-audit.md](self-improvement-audit.md). --- + +**Post-merge steps run through the `post-pr-merge` skill** (maintainer, 2026-11-13): on any detected target-repository +merge, invoke the skill in a dedicated lowest-tier subagent (tier per [model-tiers.md](model-tiers.md)), passing it the +PR facts (repo, number, merge commit, review id, flow worktree, calibration report path), and verify its report. Never +run the post-merge steps inline. diff --git a/.agents/prompts/pr_review_prompt.md b/.agents/prompts/pr_review_prompt.md index 657b3669..408819e6 100644 --- a/.agents/prompts/pr_review_prompt.md +++ b/.agents/prompts/pr_review_prompt.md @@ -19,7 +19,7 @@ Activate a role only when the diff touches its territory. | Product, Design & Growth | Product Owner (business logic, requirements) · UX/UI Designer (consistency, interaction) · SEO & Growth (semantics, load speed, attribution) | | Operations, Release & Support | DevOps & SRE (CI/CD, IaC, observability, containers) · Release Manager (ordering, migrations, rollback, flags) · Support Engineer (error clarity, diagnostics, compatibility) | | Security, Compliance & Risk | Security Architect (OWASP, authentication, authorisation, secrets, PII) · Compliance Auditor (licences, retention, audit logging) · Localization Coordinator (hardcoded strings, formatting, RTL) | -| DevRel & Documentation | Technical Writer (docs, docstrings, API references) · Developer Advocate (developer experience, sample code, onboarding) | +| DevRel & Documentation | Technical Writer (docs, API references) · Developer Advocate (developer experience, sample code, onboarding) | --- @@ -45,6 +45,13 @@ The PR description is never a trigger; only changed files are. An unactivated ro - 🟢 **NIT / OPTIONAL**: style, naming, author discretion. - ✅ **APPROVED / PASS**: explicit confirmation of a well-made change with nothing to fix. +Standing self-explaining-code finding (engineering rule 18): a docstring, or a comment that is not a `# why:` comment, +added in the diff is 🟡 IMPORTANT. Machine directives (shebangs, encoding lines, `# noqa`, `# type:`, `# pragma`, +`# fmt:`, shellcheck) are exempt. + +Standing test-setup finding (engineering rule 17): a new autouse fixture, a new fixture in a directory `conftest.py`, or +`pytest_plugins` in a test module is 🟡 IMPORTANT; setup belongs in the test module or an explicitly imported helper. + Be constructive, cite file and line, and show the fix. Generic advice is a defect in the review, not in the PR. Use Australian English (`initialise`, `optimisation`). diff --git a/.agents/rules.md b/.agents/rules.md index 5f39aa89..884f5062 100644 --- a/.agents/rules.md +++ b/.agents/rules.md @@ -14,10 +14,17 @@ code in this repository. unless explicitly requested. 4. **Consistency**: Follow the existing indentation, styling, naming conventions (camelCase, snake_case, etc.), and file structures of the project. -5. **Documentation**: - - Update docstrings, READMEs, and inline comments to reflect any changes you make. - - Maintain the integrity of existing comments that are unrelated to your changes. -6. **Modular File Sizing & 200-Line Sizing Guideline**: +5. **Self-Explaining Code (invariant)**: Code is self-explaining (maintainer invariant, 2026-11-27): names state the + intent of every statement; a block that cannot be named where it is gets extracted into a function whose name says + what it does. No docstrings and no explanatory comments in any language (Python, shell, Makefile, Dockerfile, YAML, + JS). The only allowed comment is a `# why:` comment that records a reason the code cannot show (a constraint, an + incident, a non-obvious decision) — never what the code does. Machine directives are not comments in this sense and + stay allowed: shebangs, encoding lines, `# noqa`, `# type:`, `# pragma`, `# fmt:`, shellcheck directives. Keep README + and `docs/*.md` files current with your changes; that is documentation, not code comments. +6. **No Logic in `__init__.py` (maintainer, 2026-11-23; Bean 0379)**: A package `__init__.py` only exposes public + functions and variables: imports of the public names and `__all__`. Never define functions, classes or constants + there, and never run work at import time; put the code in a named module of the package and re-export it. +7. **Modular File Sizing & 200-Line Sizing Guideline**: - As a general guideline (a recommended best practice, not a rigid hard rule), source files exceeding **200 lines** should be decomposed into modular packages and focused, single-responsibility modules (e.g. splitting monolithic modules into dedicated subpackages such as `flow/`, `cli/commands/`, `proxy/`, `executor/`, `calibration/`). diff --git a/.agents/scripts/beans_to_issues.py b/.agents/scripts/beans_to_issues.py new file mode 100644 index 00000000..b8e22998 --- /dev/null +++ b/.agents/scripts/beans_to_issues.py @@ -0,0 +1,542 @@ +#!/usr/bin/env python3 +"""Deterministic importer: open harness beans -> GitHub Issues (bean 0215). + +Standard library only; the real import shells out to gh. The default mode is a dry +run: it renders every payload, label set and dependency link under todo/ and calls no +GitHub write API. The real import needs --apply and runs only on the maintainer's word. + + uv run python .agents/scripts/beans_to_issues.py # dry run + uv run python .agents/scripts/beans_to_issues.py --apply # real import +""" + +from __future__ import annotations + +import argparse +import json +import re +import subprocess +import sys +from collections import Counter +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent.parent +ORG = "Holon-Agentic-Coder" +REPOS = ("holon-agentic-coder", "holon-coherence") +OPEN_STATUSES = ("todo", "draft", "in-progress") +ID_PREFIX = "holon-agentic-coder-ref-metadata-" +ROUTING_TAGS = {"holon-agentic-coder", "holon-coherence", "harness", "dev-env"} +NOT_MIGRATED_TAGS = {"harness", "dev-env"} +PRIORITY = {"critical": "P0", "high": "P1", "normal": "P2", "medium": "P2", "low": "P3"} +TYPES = {"bug", "feature", "task"} +BLOCKED_KEYS = ("blocked_by", "blocked-by") +BLOCKING_KEYS = ("blocking", "blocks") +KNOWN_KEYS = { + "title", + "status", + "type", + "priority", + "tags", + "labels", + "parent", + "created_at", + "updated_at", + *BLOCKED_KEYS, + *BLOCKING_KEYS, +} +LABEL_COLORS = {"type": "1d76db", "priority": "d93f0b", "status": "fbca04", "tag": "ededed"} +PATH_RE = re.compile(r"(?@+~-]*)*/?(?![\w])") +ID_RE = re.compile(r"\b0\d{3}\b") +FULL_ID_RE = re.compile(re.escape(ID_PREFIX) + r"(\d{4})") +BEAN_LIST_RE = re.compile( + r"\b[Bb]eans?\s+(\d{4}(?:\s*[-–]\s*\d{4})?(?:(?:\s*,\s*|\s*,?\s+and\s+|\s*/\s*|\s*&\s*)\d{4}(?:\s*[-–]\s*\d{4})?)*)" +) +PLACEHOLDER_RE = re.compile(r"\{\{issue:(\d{4})\}\}") + + +# ---------------------------------------------------------------- parsing + + +def parse_bean(path: Path) -> dict: + """Parse one bean file: the frontmatter into a dict (scalars and lists) plus the body.""" + text = path.read_text(encoding="utf-8") + lines = text.split("\n") + if not lines or lines[0].strip() != "---": + raise ValueError(f"{path.name}: no frontmatter") + end = next(i for i in range(1, len(lines)) if lines[i].strip() == "---") + fm: dict = {} + key = None + for line in lines[1:end]: + if not line.strip() or line.lstrip().startswith("#"): + continue + item = re.match(r"^\s+-\s+(.*)$", line) + if item and key is not None: + if not isinstance(fm.get(key), list): + fm[key] = [] + fm[key].append(_scalar(item.group(1))) + continue + kv = re.match(r"^([A-Za-z0-9_-]+):\s*(.*)$", line) + if not kv: + if line.startswith((" ", "\t")) and key is not None: # folded continuation of a scalar + prev = fm.get(key) + joined = (prev + " " if isinstance(prev, str) and prev else "") + line.strip() + if not isinstance(prev, list) or not prev: + fm[key] = ( + _scalar(joined) if not joined.startswith(('"', "'")) or joined[-1] == joined[0] else joined + ) + continue + key, val = kv.group(1), kv.group(2).strip() + if val.startswith("[") and val.endswith("]"): + fm[key] = [_scalar(v) for v in val[1:-1].split(",") if v.strip()] + elif val == "": + fm[key] = [] + else: + fm[key] = _scalar(val) + m = re.search(r"-(\d{4})--", path.name) + bean_id = m.group(1) if m else None + return {"id": bean_id, "file": path.name, "fm": fm, "body": "\n".join(lines[end + 1 :]).strip("\n")} + + +def _scalar(v: str) -> str: + v = v.strip() + if len(v) >= 2 and v[0] == v[-1] and v[0] in "\"'": + return v[1:-1] + return v + + +def as_list(v) -> list: + if v is None or v == "": + return [] + return v if isinstance(v, list) else [v] + + +def bean_ref(value: str) -> str | None: + m = re.search(r"(\d{4})\s*$", str(value)) + return m.group(1) if m else None + + +def load_beans(beans_dir: Path) -> dict[str, dict]: + beans = {} + for p in sorted(beans_dir.glob(ID_PREFIX + "*.md")): + b = parse_bean(p) + if b["id"]: + beans[b["id"]] = b + return beans + + +# ---------------------------------------------------------------- routing + + +def route(bean: dict) -> tuple[str | None, str, str]: + """Return (repo or None, basis, reason). repo None means not migrated.""" + fm = bean["fm"] + tags = {t.lower() for t in as_list(fm.get("tags")) + as_list(fm.get("labels"))} + text = (fm.get("title", "") + "\n" + bean["body"]).replace(ID_PREFIX, "") + hits = {r: tags & {r} for r in REPOS} + targets = [r for r in REPOS if hits[r]] + if len(targets) == 1: + return targets[0], "tag", "" + if len(targets) == 2: + counts = {r: len(re.findall(re.escape(r), text)) for r in REPOS} + pick = max(REPOS, key=lambda r: (counts[r], r == REPOS[0])) + return pick, "tag-ambiguous", f"both target tags; picked {pick} by mention count {counts}" + if tags & NOT_MIGRATED_TAGS: + why = "dev-env" if "dev-env" in tags else "harness-only" + return None, "tag", why + counts = {r: len(re.findall(re.escape(r), text)) for r in REPOS} + best = max(counts.values()) + winners = [r for r in REPOS if counts[r] == best] + if best and len(winners) == 1: + return winners[0], "mention", f"mention counts {counts}" + return None, "none", "harness-only: no target tag or mention" + + +# ---------------------------------------------------------------- stripping + + +def _expand(spec: str) -> list[str]: + out = [] + for part in re.split(r"\s*(?:,|and|/|&)\s*", spec.strip()): + part = part.strip() + if not part: + continue + rng = re.match(r"^(\d{4})\s*[-–]\s*(\d{4})$", part) + if rng: + out.extend(f"{n:04d}" for n in range(int(rng.group(1)), int(rng.group(2)) + 1)) + else: + out.append(part) + return out + + +def strip_text( + text: str, + migrated: set[str], + stats: Counter | None = None, + known: set[str] = frozenset(), + self_id: str | None = None, +) -> str: + """Remove harness references. Migrated bean refs become {{issue:NNNN}} placeholders.""" + stats = stats if stats is not None else Counter() + + def ref(bid: str) -> str: + if bid == self_id: + stats["bean_ref_self"] += 1 + return "this issue" + if bid in migrated: + stats["bean_ref_to_issue"] += 1 + return "{{issue:" + bid + "}}" + stats["bean_ref_dropped"] += 1 + return "an earlier work item" + + def lst(m: re.Match) -> str: + return ", ".join(ref(b) for b in _expand(m.group(1))) + + combined = re.compile( + "|".join( + f"(?P<{n}>{p.pattern})" + for n, p in (("full", FULL_ID_RE), ("list", BEAN_LIST_RE), ("path", PATH_RE), ("bare", ID_RE)) + ) + ) + + def sub(m: re.Match) -> str: + if m.group("full"): + return ref(FULL_ID_RE.fullmatch(m.group("full")).group(1)) + if m.group("list"): + return lst(BEAN_LIST_RE.fullmatch(m.group("list"))) + if m.group("path"): + stats["path_removed"] += 1 + return "[harness path]" + return ref(m.group("bare")) if m.group("bare") in known else m.group("bare") + + text = combined.sub(sub, text) + return text + + +def residual_refs(text: str, known_ids: set[str]) -> list[str]: + return [m for m in ID_RE.findall(PLACEHOLDER_RE.sub("", text)) if m in known_ids] + + +# ---------------------------------------------------------------- mapping + + +def build_plan(beans: dict[str, dict]) -> dict: + open_beans = {i: b for i, b in beans.items() if b["fm"].get("status") in OPEN_STATUSES} + routes = {i: route(b) for i, b in open_beans.items()} + migrated = {i for i, r in routes.items() if r[0]} + not_migrated = [ + { + "id": i, + "title": open_beans[i]["fm"].get("title", ""), + "status": open_beans[i]["fm"].get("status"), + "reason": routes[i][2], + "tags": as_list(open_beans[i]["fm"].get("tags")), + } + for i in sorted(open_beans) + if not routes[i][0] + ] + known = set(beans) + fidelity: dict[str, Counter] = { + k: Counter() for k in ("title", "body", "type", "priority", "status", "tags", "dependencies", "parent") + } + unmapped: list[dict] = [] + issues, label_sets = {}, {r: {} for r in REPOS} + edges_blocked, edges_parent, dropped_edges = set(), set(), [] + + for bid in sorted(migrated): + b, fm = open_beans[bid], open_beans[bid]["fm"] + repo = routes[bid][0] + stats = Counter() + title = re.sub(r"\s+", " ", strip_text(fm.get("title", ""), migrated, stats, known, bid)).strip() + title = re.sub(r"\{\{issue:\d{4}\}\}", "", title).strip() if stats["bean_ref_to_issue"] else title + fidelity["title"]["exact" if title == fm.get("title") else "stripped"] += 1 + body = strip_text(b["body"], migrated, stats, known, bid) + fidelity["body"]["exact" if body == b["body"] else "stripped"] += 1 + left = residual_refs(title + "\n" + body, known) + if left: + unmapped.append( + {"bean": bid, "field": "body", "issue": "possible bean ids remain: " + ", ".join(sorted(set(left)))} + ) + pre = re.findall(r"(? Path: + out.mkdir(parents=True, exist_ok=True) + for repo in REPOS: + (out / "issues" / repo).mkdir(parents=True, exist_ok=True) + for bid, iss in plan["issues"].items(): + payload = {**iss, "already_imported": bid in mapping} + d = out / "issues" / iss["repo"].split("/")[1] + (d / f"{bid}.json").write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8") + (d / f"{bid}.md").write_text(iss["body"] + "\n", encoding="utf-8") + (out / "labels.json").write_text(json.dumps(plan["labels"], indent=2, sort_keys=True) + "\n", encoding="utf-8") + deps = { + "blocked_by": [{"blocked": a, "blocker": b} for a, b in plan["blocked_by"]], + "sub_issues": [{"parent": a, "child": b} for a, b in plan["sub_issues"]], + "dropped": plan["dropped_edges"], + } + (out / "dependencies.json").write_text(json.dumps(deps, indent=2) + "\n", encoding="utf-8") + (out / "not_migrated.json").write_text(json.dumps(plan["not_migrated"], indent=2) + "\n", encoding="utf-8") + (out / "unmapped.json").write_text(json.dumps(plan["unmapped"], indent=2) + "\n", encoding="utf-8") + (out / "report.md").write_text(render_report(plan, mapping), encoding="utf-8") + return out / "report.md" + + +def render_report(plan: dict, mapping: dict) -> str: + per_repo = Counter(i["repo"].split("/")[1] for i in plan["issues"].values()) + basis = Counter(i["route_basis"] for i in plan["issues"].values()) + totals = Counter() + for i in plan["issues"].values(): + totals.update(i["ref_stats"]) + lines = [ + "# Beans to issues: dry run report", + "", + f"- Open beans scanned: {plan['open_total']}", + f"- To migrate: {len(plan['issues'])} ({', '.join(f'{r}: {per_repo[r]}' for r in REPOS)})", + f"- Routing basis: {dict(basis)}", + f"- Not migrated: {len(plan['not_migrated'])}", + f"- Already in the mapping file: {sum(1 for b in plan['issues'] if b in mapping)}", + f"- Dependencies (blocked by): {len(plan['blocked_by'])}; sub-issue links: {len(plan['sub_issues'])}; " + f"edges dropped: {len(plan['dropped_edges'])}", + f"- Harness references: {totals['bean_ref_to_issue']} bean refs become #N, " + f"{totals['bean_ref_dropped']} refs to unmigrated beans reworded, " + f"{totals['path_removed']} harness paths removed", + f"- Labels per repository: {', '.join(f'{r}: {len(plan["labels"][r])}' for r in REPOS)}", + "", + "## Per-field fidelity", + "", + "| Field | Outcome counts |", + "| :-- | :-- |", + ] + for k, v in plan["fidelity"].items(): + lines.append(f"| {k} | {', '.join(f'{a}: {b}' for a, b in sorted(v.items())) or 'n/a'} |") + lines += ["", "## Not migrated", "", "| Bean | Status | Reason | Title |", "| :-- | :-- | :-- | :-- |"] + for n in plan["not_migrated"]: + lines.append(f"| {n['id']} | {n['status']} | {n['reason']} | {n['title'][:80]} |") + lines += ["", "## Could not be mapped", ""] + lines += [f"- {u['bean']} {u['field']}: {u['issue']}" for u in plan["unmapped"]] or ["- none"] + lines += ["", "## Dropped dependency and parent edges", ""] + for e in plan["dropped_edges"]: + lines.append("- " + ", ".join(f"{k}={v}" for k, v in e.items())) + if not plan["dropped_edges"]: + lines.append("- none") + return "\n".join(lines) + "\n" + + +# ---------------------------------------------------------------- real import + + +def gh(args: list[str], runner=subprocess.run, stdin: str | None = None) -> str: + r = runner(["gh", *args], capture_output=True, text=True, input=stdin) + if r.returncode != 0: + raise RuntimeError(f"gh {' '.join(args[:3])} failed: {r.stderr.strip()}") + return r.stdout.strip() + + +def load_mapping(path: Path) -> dict: + return json.loads(path.read_text(encoding="utf-8")) if path.exists() else {} + + +def save_mapping(path: Path, mapping: dict) -> None: + path.write_text(json.dumps(mapping, indent=2, sort_keys=True) + "\n", encoding="utf-8") + + +def apply_import(plan: dict, map_path: Path, runner=subprocess.run) -> dict: + """Real import: labels, pass 1 create, pass 2 link bodies, then dependencies and sub-issues.""" + mapping = load_mapping(map_path) + for repo, labels in plan["labels"].items(): + for name, meta in sorted(labels.items()): + gh(["label", "create", name, "--repo", f"{ORG}/{repo}", "--color", meta["color"], "--force"], runner) + for bid, iss in sorted(plan["issues"].items()): + if bid in mapping: + continue + body = PLACEHOLDER_RE.sub("(link pending)", iss["body"]) + args = ["issue", "create", "--repo", iss["repo"], "--title", iss["title"], "--body-file", "-"] + for lab in iss["labels"]: + args += ["--label", lab] + url = gh(args, runner, stdin=body) + mapping[bid] = { + "repo": iss["repo"].split("/")[1], + "issue": int(url.rstrip("/").rsplit("/", 1)[1]), + "linked": False, + "deps": [], + } + save_mapping(map_path, mapping) + for bid, iss in sorted(plan["issues"].items()): + ent = mapping[bid] + if ent["linked"]: + continue + body = PLACEHOLDER_RE.sub(lambda m, repo=ent["repo"]: _link(m.group(1), repo, mapping), iss["body"]) + gh(["issue", "edit", str(ent["issue"]), "--repo", iss["repo"], "--body-file", "-"], runner, stdin=body) + ent["linked"] = True + save_mapping(map_path, mapping) + for kind, edges in (("blocked_by", plan["blocked_by"]), ("sub_issues", plan["sub_issues"])): + for a, b in edges: + holder, other = (a, b) + key = f"{kind}:{other}" + ent = mapping[holder] + if key in ent["deps"]: + continue + oent = mapping[other] + oid = gh(["api", f"repos/{ORG}/{oent['repo']}/issues/{oent['issue']}", "--jq", ".id"], runner) + if kind == "blocked_by": + gh( + [ + "api", + "-X", + "POST", + f"repos/{ORG}/{ent['repo']}/issues/{ent['issue']}/dependencies/blocked_by", + "-F", + f"issue_id={oid}", + ], + runner, + ) + else: # edge is (parent, child): the parent holds the sub-issue + gh( + [ + "api", + "-X", + "POST", + f"repos/{ORG}/{ent['repo']}/issues/{ent['issue']}/sub_issues", + "-F", + f"sub_issue_id={oid}", + ], + runner, + ) + ent["deps"].append(key) + save_mapping(map_path, mapping) + return mapping + + +def _link(bid: str, from_repo: str, mapping: dict) -> str: + ent = mapping[bid] + return f"#{ent['issue']}" if ent["repo"] == from_repo else f"{ORG}/{ent['repo']}#{ent['issue']}" + + +def main(argv: list[str] | None = None) -> int: + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--beans-dir", type=Path, default=ROOT / ".beans") + ap.add_argument("--out", type=Path, default=ROOT / "todo" / "beans-to-issues-dry-run") + ap.add_argument("--map", type=Path, default=ROOT / ".agents" / "beans_to_issues_map.json") + ap.add_argument("--apply", action="store_true", help="real import (writes to GitHub); default is a dry run") + args = ap.parse_args(argv) + plan = build_plan(load_beans(args.beans_dir)) + mapping = load_mapping(args.map) + report = render_dry_run(plan, args.out, mapping) + print(f"dry-run report: {report}") + if args.apply: + apply_import(plan, args.map) + print(f"imported; mapping in {args.map}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/.agents/scripts/check_failure_ledger.py b/.agents/scripts/check_failure_ledger.py new file mode 100644 index 00000000..2b611d31 --- /dev/null +++ b/.agents/scripts/check_failure_ledger.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Validate the append-only coordinator failure ledger.""" + +import json +import subprocess +import sys +from pathlib import Path + +LEDGER = Path(__file__).resolve().parents[1] / "ledger" / "coordinator-failures.jsonl" +REQUIRED = ("id", "created_at", "session_date", "category", "failure", "my_part", "cost", "rule", "refs") +CATEGORIES = { + "brief", + "readiness-check", + "overlap-scheduling", + "intent-scope", + "measurement", + "conflict-handling", + "bookkeeping", + "verification", +} + + +def check_lines(lines): + errors = [] + for n, line in enumerate(lines, 1): + try: + obj = json.loads(line) + except ValueError: + errors.append(f"line {n}: invalid JSON") + continue + missing = [k for k in REQUIRED if k not in obj] + if missing: + errors.append(f"line {n}: missing {missing}") + continue + if obj["id"] != f"CF-{n:04d}": + errors.append(f"line {n}: id {obj['id']} not sequential") + if obj["category"] not in CATEGORIES: + errors.append(f"line {n}: bad category {obj['category']}") + if not isinstance(obj["refs"], list): + errors.append(f"line {n}: refs must be a list") + return errors + + +def check_append_only(lines, head_lines): + if lines[: len(head_lines)] != head_lines: + return ["ledger edits or deletes lines present at git HEAD (append-only)"] + return [] + + +def head_version(path=LEDGER): + repo = path.parent + rel = subprocess.run( + ["git", "ls-files", "--full-name", path.name], cwd=repo, capture_output=True, text=True + ).stdout.strip() + if not rel: + return [] + out = subprocess.run(["git", "show", f"HEAD:{rel}"], cwd=repo, capture_output=True, text=True) + return out.stdout.splitlines() if out.returncode == 0 else [] + + +def main(): + lines = [x for x in LEDGER.read_text().splitlines() if x.strip()] + errors = check_lines(lines) + check_append_only(lines, head_version()) + for e in errors: + print(e, file=sys.stderr) + return 1 if errors else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/.agents/self-improvement-audit.md b/.agents/self-improvement-audit.md new file mode 100644 index 00000000..dfdba005 --- /dev/null +++ b/.agents/self-improvement-audit.md @@ -0,0 +1,99 @@ +# Self-Improvement Audit + +A standing instruction from the maintainer (2026-11-24): the harness audits itself and proposes improvements, at the +start of every session and after every fifth merge. + +--- + +## When it runs + +1. **At the start of a session**, as part of the incoming agent checklist in [AGENTS.md](../AGENTS.md), before new work + is picked up. +2. **After every fifth merge.** Count pull requests merged into `main` of `holon-agentic-coder` and `holon-coherence` + since the last audit recorded in the audit log (below). The `post-pr-merge` skill checks the count at the end of each + run and reports when an audit is due; the agent that receives that report launches the audit. + +An audit that is due is not skipped because flows are running; it is read-only apart from the beans it writes. + +## How it runs + +- **In a subagent, never inline.** The main agent spawns one dedicated subagent and returns to its work. +- **The brief says what it is.** The prompt states plainly that this is a comprehensive audit carried out for the + self-improvement of the harness and of the Holon flow, that it is not a task on any bean, and that its output is a set + of suggestions, each logged as a bean. +- **Model tier**: the session model or one tier below it; the audit needs judgement, so not the lowest tier + ([model-tiers.md](model-tiers.md)). +- **Read-only** on target repositories, flows, worktrees, branches and pull requests. It writes only new beans, the + audit log, and nothing else. It never launches a flow and never edits another bean's scope. + +## What it audits + +The evidence is what happened since the last audit: the merged pull requests and their review threads, the flow logs and +checkpoints in `todo/`, the calibration reports, CI run times and failures, the beans opened and closed, and the bugs +logged along the way. + +It looks for improvements of at least these kinds: + +| Area | Examples | +| :--------------------- | :------------------------------------------------------------------------------------------- | +| Pipeline | slow or flaky jobs, runs that test nothing new, checks that fail on noise | +| Flow | any rearrangement of the Holon flow: waits that can go, work that can start earlier, steps | +| | that repeat, failures recognised late, resumes that redo finished work | +| Coding standards | defects the reviewers keep finding, rules that would have prevented them, tests that add | +| | cost without protection | +| Architecture standards | modules that keep conflicting or growing, boundaries that flows keep crossing, duplicated | +| | mechanisms | +| Harness | instructions that were unclear or contradicted each other, skills that failed, steps a human | +| | had to repeat by hand | + +## The end state that matters + +At the end of the review process only two things matter: **the pipeline passes** and **the consensus passes** +(maintainer, 2026-11-24: "the only important things is the pipeline pass and concensus passes. Everything else is a +churn"). + +- Every pipeline and flow suggestion is judged against that end state: does the step help reach a passing pipeline and a + passing consensus sooner, or with fewer attempts? A step that does neither is churn, and the audit proposes removing + it, moving it out of the critical path or making it free. +- Examples of churn to look for: commits and pushes that restart the pipeline without changing code, repeated pipeline + runs on code already tested, review iterations spent on a head that later moves, postings and bookkeeping done between + the two gates and redone when one of them fails, and waits that neither gate needs. +- The audit counts, per flow, how many pipeline runs and how many review iterations it took to reach both passes, and + how many of them were made necessary by churn and not by a defect in the change. + +## Timing for flow improvements + +A flow improvement is proposed from measurements, never from impression (maintainer, 2026-11-24: "for the flow +improvements, comprehensive timing around all the steps are to be done"). + +- For every flow that ran since the last audit, the audit builds a timing table of **every step**, not only the five + stages: pre-flight, each stage's agent turn, admission and overlap waits, each conflict check and merge, each push, + each CI registration wait and CI wait, each review iteration (reviewers, resolver, ledger commit), calibration, + reconciliation, promotion, publishing, the final-head check, and the idle time between a stop and its resume. +- Sources: the timestamps in the flow logs and checkpoints, the stage summaries, commit times on the flow branches, and + pull request and check-run times from GitHub. +- The table gives, per step, the count, the median and the longest time, and splits each stage into working time, + waiting on CI, waiting on another flow, waiting on a human, and idle. +- A step whose time cannot be read from the evidence is listed as **not measured**, and the audit logs a bean to make + the engine or the wrapper record it. Missing timing is itself a finding. +- Each flow suggestion names the step it removes, shortens or moves, and the time it is expected to save according to + the table. + +## What it produces + +- **One bean per suggestion**, with the evidence (pull request, log line, timing), the proposed change, the expected + gain and the cost. Before writing a bean it searches `.beans/` and adds to an existing open bean instead of + duplicating it. +- **A short report** to the main agent: the suggestions ranked by value, the beans created or extended, and what was + examined but found in order. +- **An entry in the audit log**, `.beans/self-improvement-audits.md`: the date and time (UTC), the trigger (session + start or fifth merge), the last merged pull request of each target repository at that moment, and the beans created. + The next count of five starts from that entry. + +The main agent passes the ranked suggestions to the maintainer and regenerates the triage matrix. It does not start work +on a suggestion without the usual priority order or the maintainer's word. + +## Coordinator failure ledger + +The audit also reads `.agents/ledger/coordinator-failures.jsonl` and flags repeats (the same category recurring, or a +rule already recorded being broken again) as high-priority beans. diff --git a/.agents/skills/bean_progress/SKILL.md b/.agents/skills/bean_progress/SKILL.md index 3105e3bf..585115e1 100644 --- a/.agents/skills/bean_progress/SKILL.md +++ b/.agents/skills/bean_progress/SKILL.md @@ -55,23 +55,64 @@ Return the resulting Markdown table directly to the user verbatim (with a brief | `--beans-dir` | Explicit directory containing bean markdown files | `/.beans` | | `--json` | Emit structured JSON array instead of a Markdown table | `false` | | `--no-gh` | Skip querying open Pull Requests via `gh pr list` | `false` | +| `--wide` | Render every column in one wide table (no detail list) | `false` | | `--no-ps` | Skip inspecting running host/Docker processes via `ps` | `false` | -### Output Table Schema +### Output layout + +The default output is a **compact table** (Bean #, Target, Title, Agent, Model, Stage, In Stage, Live, PR & CI, Total) +followed by a **"Last activity and notes"** list with one line per bean. The long cells are kept out of the table on +purpose: a table with them is too wide for a terminal and is then shown as raw text instead of a table. Agent and model +are shortened in the compact table (`claude`, `fable-5-2`). Pass `--wide` for every column in one table, and `--json` +for the full fields. -| Column | Meaning | -| :-------------- | :------------------------------------------------------------------------------------------------------------------- | -| `Bean #` | Clean 4-digit bean ID(s) (`0347, 0354`), or `—` for unmapped active flows/PRs | -| `Target` | Repository target (`HAC`, `Coherence`, `dev-env`, or `harness`) | -| `Title` | Concise bean or flow title | -| `Stage` | Active Holon stage (preferring live Docker role / admission wait over stale disk) | -| `Time in Stage` | How long the bean has been in its current stage (compact: `45s`, `12m`, `1h05m`, `2d3h`; `—` if unknown) | -| `PR & CI` | Open PR link, CI rollup (`pass`/`fail`/`running`), review count, mergeability flags | -| `Total Time` | How long the bean has been in flight overall (same format; `—` if unknown) | -| `Notes` | Runner first (`opus-5-5 · 31m (PID, session)` live, `idle (opus-5-5)` idle), then blockers, warnings, stale attempts | +### Output Table Schema -Rows are merged per bean: when several attempts exist (for example a stale first-attempt worktree plus a live `-v2` -flow), the live or most-advanced attempt is shown and the others are listed in Notes as `stale attempt ...`. +| Column | Meaning | +| :-------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bean #` | Clean 4-digit bean ID(s) (`0347, 0354`), or `—` for unmapped active flows/PRs | +| `Target` | Repository target (`HAC`, `Coherence`, `dev-env`, or `harness`) | +| `Title` | Concise bean or flow title | +| `Agent` | The flow's runner agent (`claude-agent`, `antigravity-agent`, ...), from the live process or the checkpoint; `—` if unknown | +| `Model` | The flow's model id (`claude-fable-5-2`, `gemini-4-neon`, ...), from the live process or the checkpoint; `—` if unknown | +| `Stage` | Active Holon stage (preferring live Docker role / admission wait over stale disk). At Stage 3 admission it names every blocker (`Stage 3 (Blocked: #275, bean 0376, no PR yet)`); with no live runner and every blocker gone it adds `; blocker gone, not resumed`; the compact table shortens a long list to `first +N more` (full list in the notes line); `--json` adds `blocked_by` | +| `Time in Stage` | How long the bean has been in its current stage (compact: `45s`, `12m`, `1h05m`, `2d3h`; `—` if unknown) | +| `Live` | 🟢 when a process is actively working the row right now (a live `run_holon_flow`/`holon flow` runner or role container, or a review/resolver turn); 🔴 otherwise, including parked, idle and `Not started` rows | +| `PR & CI` | Open PR link, CI rollup (`pass`/`fail`/`running`), review count, mergeability flags | +| `Total Time` | How long the bean has been in flight overall (same format; `—` if unknown) | +| `Last Activity` | What the flow is doing or last did: the live role container (`now: review iter 2 running`), then the newest of the worktree's HEAD commit (`commit 2m ago: `; role agents commit step by step, so this is the closest thing to live work progress) and the last line of the latest checkpoint's flow log (`checkpoint 8m ago: execute: ok (...)`) | +| `Notes` | Live state first (`live · 31m (PID, session)`, or `idle`), then blockers, warnings, stale attempts | + +**One row per live flow or PR.** A bean with several concurrent flows (for example three test batches of one bean, each +with its own PR) gets one row each: the same `Bean #` repeated, rows adjacent, and in the notes list each line is +prefixed with the flow slug. A flow whose runner is live, or that has an open (or merged/closed) PR, is never labelled a +stale attempt. Only a dead attempt with no runner and no PR (for example a first-attempt worktree next to a live `-v2` +flow) is folded into the best row's Notes as `stale attempt ...`. A bean with no flow keeps its single row. + +Only `flow-*` worktrees, or worktrees holding a `.holon/flow` checkpoint, count as flows; any other worktree (such as a +temporary audit worktree) is ignored. + +### Split (decomposed) flows + +When a plan was decomposed into child sub-intents (child branches `I--/P-...--N-/...`, child PRs +merged into the parent plan branch, one parent PR into main), the parent flow is one row. Stage reads +`Stage 3 (child 4 of 5: )` (the active child's real stage; a non-generic sub-state follows a semicolon, e.g. +`Stage 4 (child 4 of 5: ; Review iter 2)`). M comes from the parent checkpoint's `children_progress`; when +it is unknown the cell reads `child 4: `. `PR & CI` shows the active child's open PR followed by +`merged #316 #318 #320` for the child PRs already merged; once the parent PR into main exists it is shown instead of the +child PR. + +### Stale rows + +| Row shows | Meaning | Act | +| :-------------------------------------------------------- | :------------------------------------------------------------------- | :--------------------------------------------------------------------------------------- | +| Stage `Merged — post-merge pending`, PR cell `#n merged` | PR is MERGED on GitHub (read via `gh`) but the bean is not completed | Run the `post-pr-merge` skill; the row disappears once the bean is completed | +| Stage `PR closed — dead worktree` | Flow PR was closed unmerged and no runner is live | Decide: re-run the flow or scrap the bean; then `clean_branches` removes the worktree | +| Stage `Stage 3 (Blocked: ...; blocker gone, not resumed)` | Blockers merged or vanished, no runner resumed the flow | Park or backfill (see `.agents/coordination.md`); resume the flow if it should still run | +| `stale attempt ...` in Notes | An earlier attempt of the same bean with no runner and no PR | Ignore it; remove with `clean_branches` | +| `idle` with a Stage but no PR for long | Runner died mid-flow | Resume or investigate the flow | + +A merged PR with a completed bean never appears (completed beans are always excluded). ### Mapping rules @@ -80,6 +121,12 @@ flow), the live or most-advanced attempt is shown and the others are listed in N `-vN`). Flows therefore receive their bean number even with no other link. - A PR is only matched by branch (execution branch, then `I--/`) or by a whole-number bean reference in its branch or title; digits inside timestamps never match. +- A flow shown as `Blocked` does not count toward the 4 flow slots; the reader should park it and backfill (see + `.agents/coordination.md`). +- A Stage 3 blocker is named from the checkpoint's `admission.blocked_by`: a pull request as `#`; a local flow by + slug (its `plan_branch` `I--/`, else its `flow-` worktree) mapped to a bean the same way, as + `# (bean )` when that flow has an open PR, else `bean , no PR yet` (or `flow , no PR yet`). + Duplicates show once; `overlap` only when the list is empty or unreadable. ### Time sources (real data only) diff --git a/.agents/skills/bean_progress/scripts/bean_progress.py b/.agents/skills/bean_progress/scripts/bean_progress.py index 55a18357..927696bc 100644 --- a/.agents/skills/bean_progress/scripts/bean_progress.py +++ b/.agents/skills/bean_progress/scripts/bean_progress.py @@ -17,6 +17,7 @@ import shlex import subprocess import sys +from collections.abc import Callable, Iterable from dataclasses import dataclass, field from datetime import UTC, datetime from pathlib import Path @@ -28,6 +29,9 @@ WORKTREE_BEAN_RE = re.compile(r"(?:^|-)bean-(\d{4})(?:-|$)") BRANCH_SLUG_RE = re.compile(r"^I-\d+-([^/]+)/") BRANCH_TS_RE = re.compile(r"^I-(\d+)-") +CHILD_RE = re.compile(r"/P-[^/]*?--(\d+)-([^/]+)") +MERGED_STAGE = "Merged — post-merge pending" +CLOSED_STAGE = "PR closed — dead worktree" VERSION_SUFFIX_RE = re.compile(r"-v\d+$") STAGE_ORDER = ["intent", "plan", "execute", "review", "calibrate", "completed"] LEDGER_REL = Path("holon-knowledge") / "ledger" / "intents.jsonl" @@ -102,6 +106,11 @@ class WorktreeFlow: embedded_bean_nums: list[str] = field(default_factory=list) stage_started: datetime | None = None flow_started: datetime | None = None + checkpoint_time: datetime | None = None + last_log: str = "" + last_commit_time: datetime | None = None + last_commit_subject: str = "" + children: list[dict[str, Any]] = field(default_factory=list) @dataclass @@ -118,6 +127,7 @@ class PullRequestInfo: reviews_count: int comments_count: int ci_summary: str + state: str = "OPEN" @dataclass @@ -150,6 +160,29 @@ class LiveFlowTree: duplicate_trees: int = 1 +@dataclass +class Blocker: + """One entry of a flow's `admission.blocked_by`, resolved to a name the maintainer can act on.""" + + kind: str + pr: int | None + bean: str | None + slug: str | None + files: list[str] + gone: bool + name: str + + def as_dict(self) -> dict[str, Any]: + return { + "kind": self.kind, + "pr": self.pr, + "bean": self.bean, + "slug": self.slug, + "files": self.files, + "gone": self.gone, + } + + @dataclass class InFlightRow: """Rendered table row and machine-readable JSON fields.""" @@ -162,13 +195,21 @@ class InFlightRow: live_runner: str notes: str sort_bucket: int + live: bool = False time_in_stage: str = "—" total_time: str = "—" source: str = "" rank: tuple[float, ...] = () + agent: str = "—" + model: str = "—" + last_activity: str = "—" + stage_compact: str = "" + blockers: list[Blocker] = field(default_factory=list) + slug: str = "" + distinct: bool = False def notes_cell(self) -> str: - """Notes column: runner/model/PID/session info first, then the former status notes.""" + """Notes column: live/idle state with PID and session first, then the former status notes.""" parts = [p for p in (self.live_runner, self.notes if self.notes != "—" else "") if p] return "; ".join(parts) if parts else "—" @@ -178,12 +219,18 @@ def as_dict(self) -> dict[str, Any]: "bean_nums": self.bean_nums, "target": self.target, "title": self.title, + "agent": self.agent, + "model": self.model, "stage": self.stage, "time_in_stage": self.time_in_stage, "pr_ci": self.pr_ci, "total_time": self.total_time, + "last_activity": self.last_activity, + "live": self.live, "live_runner": self.live_runner, "notes": self.notes_cell(), + "blocked_by": [b.as_dict() for b in self.blockers], + "flow": self.slug, } @@ -465,6 +512,74 @@ def _git_dirty_count(worktree_dir: Path) -> int: return sum(1 for line in proc.stdout.splitlines() if line.strip()) +def _git_last_commit(worktree_dir: Path) -> tuple[datetime | None, str]: + """Commit time and subject of the worktree's HEAD; (None, "") when git cannot tell.""" + try: + res = subprocess.run( + ["git", "-C", str(worktree_dir), "log", "-1", "--format=%ct%x09%s"], + capture_output=True, + text=True, + check=False, + timeout=10, + ) + except (OSError, subprocess.SubprocessError): + return None, "" + stamp, _, subject = res.stdout.strip().partition("\t") + if res.returncode != 0 or not stamp.isdigit(): + return None, "" + return datetime.fromtimestamp(int(stamp), tz=UTC), subject.strip() + + +def _last_checkpoint_log(ctx: dict[str, Any]) -> str: + """The newest line of the checkpoint's flow log, without its leading `[timestamp]`.""" + logs = ctx.get("logs") + if not isinstance(logs, list) or not logs: + return "" + return re.sub(r"^\[[^\]]*\]\s*", "", str(logs[-1]).strip()) + + +def _find_children(obj: Any, key: str, depth: int = 0) -> list[dict[str, Any]]: + """First non-empty list of dicts stored under `key` anywhere in nested dicts (the split flow's child records).""" + if depth > 8 or not isinstance(obj, dict): + return [] + val = obj.get(key) + if isinstance(val, list) and val and all(isinstance(x, dict) for x in val): + return val + for sub in obj.values(): + found = _find_children(sub, key, depth + 1) + if found: + return found + return [] + + +def _load_children(checkpoints: list[Path]) -> list[dict[str, Any]]: + """Child sub-intents of a decomposed flow (index, slug, PR number, merged), from the parent checkpoint.""" + best: list[dict[str, Any]] = [] + for path in checkpoints: + try: + data = json.loads(path.read_text(encoding="utf-8")) + except (OSError, ValueError): + continue + raw = _find_children(data, "children_progress") or _find_children(data, "children") + children: list[dict[str, Any]] = [] + for item in raw: + idx = item.get("index") + if not isinstance(idx, int) or isinstance(idx, bool): + continue + pr_no = item.get("pr_number") + children.append( + { + "index": idx, + "slug": str(item.get("slug") or ""), + "pr_number": pr_no if isinstance(pr_no, int) and not isinstance(pr_no, bool) else None, + "merged": item.get("merged") is True or str(item.get("status") or "").lower() == "merged", + } + ) + if len(children) > len(best): + best = children + return best + + def scan_worktrees(repos: list[RepoTarget]) -> list[WorktreeFlow]: """Inspect non-`main` worktrees and their Holon flow checkpoints.""" worktrees: list[WorktreeFlow] = [] @@ -485,6 +600,8 @@ def scan_worktrees(repos: list[RepoTarget]) -> list[WorktreeFlow]: if flow_dir.is_dir() else [] ) + if not entry.name.startswith("flow-") and not checkpoints: + continue # only flow-* worktrees or worktrees holding a flow checkpoint are flows data: dict[str, Any] = {} ckpt_path: Path | None = checkpoints[0] if checkpoints else None @@ -528,6 +645,7 @@ def scan_worktrees(repos: list[RepoTarget]) -> list[WorktreeFlow]: branch_started(intent_branch or plan_branch or exec_branch), ledger_first_created(entry / LEDGER_REL, slug), ) + commit_time, commit_subject = _git_last_commit(entry) embedded_beans = WORKTREE_BEAN_RE.findall(entry.name) if ckpt_path is not None: embedded_beans.extend(re.findall(r"(?:^|-)(\d{4})(?:-|$)", ckpt_path.stem)) @@ -555,6 +673,11 @@ def scan_worktrees(repos: list[RepoTarget]) -> list[WorktreeFlow]: embedded_bean_nums=sorted(set(embedded_beans)), stage_started=stage_started, flow_started=flow_started, + checkpoint_time=(parse_iso(data.get("timestamp")) or mtime) if ckpt_path else None, + last_log=_last_checkpoint_log(ctx), + last_commit_time=commit_time, + last_commit_subject=commit_subject, + children=_load_children(checkpoints), ) ) return worktrees @@ -663,6 +786,89 @@ def fetch_open_prs(repos: list[RepoTarget], *, no_gh: bool = False) -> list[Pull return prs +def fetch_closed_prs(repos: list[RepoTarget], *, no_gh: bool = False) -> list[PullRequestInfo]: + """Recently merged and closed PRs (`gh pr list --state merged|closed`), to spot merged-pending and dead flows.""" + if no_gh: + return [] + found: list[PullRequestInfo] = [] + seen_gh: set[str] = set() + for repo in repos: + if not repo.github_repo or repo.github_repo in seen_gh: + continue + seen_gh.add(repo.github_repo) + for state in ("merged", "closed"): + try: + proc = subprocess.run( + [ + "gh", + "pr", + "list", + "--repo", + repo.github_repo, + "--state", + state, + "--limit", + "100", + "--json", + "number,title,url,headRefName,state", + ], + capture_output=True, + text=True, + timeout=20, + ) + raw_list = json.loads(proc.stdout) if proc.returncode == 0 and proc.stdout.strip() else [] + except (OSError, subprocess.SubprocessError, ValueError): + continue + for item in raw_list if isinstance(raw_list, list) else []: + if not isinstance(item, dict) or not isinstance(item.get("number"), int): + continue + found.append( + PullRequestInfo( + repo_name=repo.name, + number=item["number"], + title=str(item.get("title") or ""), + url=str(item.get("url") or ""), + head_ref_name=str(item.get("headRefName") or ""), + mergeable="", + is_draft=False, + reviews_count=0, + comments_count=0, + ci_summary="", + state=str(item.get("state") or state).upper(), + ) + ) + return found + + +def make_pr_state_lookup(repos: list[RepoTarget]) -> Callable[[str, int], str | None]: + """Lookup of one pull request's state (`OPEN`, `MERGED`, `CLOSED`) via `gh pr view`, cached per number.""" + github = {r.name: r.github_repo for r in repos} + cache: dict[tuple[str, int], str | None] = {} + + def lookup(repo_name: str, number: int) -> str | None: + key = (repo_name, number) + if key in cache: + return cache[key] + state: str | None = None + repo = github.get(repo_name) + if repo: + try: + proc = subprocess.run( + ["gh", "pr", "view", str(number), "--repo", repo, "--json", "state", "--jq", ".state"], + capture_output=True, + text=True, + timeout=15, + ) + if proc.returncode == 0 and proc.stdout.strip(): + state = proc.stdout.strip().upper() + except (OSError, subprocess.SubprocessError): + state = None + cache[key] = state + return state + + return lookup + + def scan_processes(*, no_ps: bool = False) -> list[ProcessInfo]: """Read running host processes via `ps -eo pid=,ppid=,etime=,stat=,command=`.""" if no_ps: @@ -992,7 +1198,171 @@ def _match_pr_for_unit( return None -def _derive_stage(wt: WorktreeFlow | None, live: LiveFlowTree | None, has_pr: bool) -> str: +def _split_info(wt: WorktreeFlow) -> tuple[int, str, int | None] | None: + """(child number, child slug, child count or None) of a decomposed flow's active child; None if not decomposed.""" + total = max([len(wt.children), *(c["index"] for c in wt.children)]) or None + for branch in (wt.intent_branch, wt.plan_branch, wt.execution_branch): + m = CHILD_RE.search(branch or "") + if m: + return int(m.group(1)), m.group(2), total + pending = [c for c in wt.children if not c["merged"]] + if wt.children and pending: + first = min(pending, key=lambda c: c["index"]) + return first["index"], first["slug"], total + return None + + +def _split_stage(stage: str, info: tuple[int, str, int | None]) -> str: + """`Stage 3 (child 4 of 5: )`; a non-generic sub-state (Review iter 2, Halted) follows a semicolon.""" + num, child_slug, total = info + label = f"child {num}{f' of {total}' if total else ''}: {_truncate(child_slug, 22)}".rstrip(": ") + m = re.match(r"^Stage (\d) \((.*)\)$", stage) + if not m: + return f"{stage} ({label})" + inner = m.group(2) + if inner in {"Intent", "Plan", "Execute", "Calibrate"}: + return f"Stage {m.group(1)} ({label})" + return f"Stage {m.group(1)} ({label}; {inner})" + + +def _is_child_head(head: str) -> bool: + return bool(CHILD_RE.search(head)) + + +def _split_prs( + wt: WorktreeFlow, info: tuple[int, str, int | None], prs: list[PullRequestInfo] +) -> tuple[PullRequestInfo | None, list[PullRequestInfo]]: + """The PR to show for a decomposed flow (parent PR if it exists, else the active child's) + all open PRs.""" + slug_re = re.compile(rf"^I-\d+-{re.escape(wt.slug)}/") + mine = [p for p in prs if p.repo_name == wt.repo_name and slug_re.match(p.head_ref_name)] + parents = [p for p in mine if not _is_child_head(p.head_ref_name)] + active = [p for p in mine if f"--{info[0]}-" in p.head_ref_name] + return (parents or active or mine or [None])[0], mine + + +def _merged_children(wt: WorktreeFlow, closed_prs: list[PullRequestInfo]) -> list[int]: + """PR numbers of the flow's child PRs already merged into its plan branch, ascending.""" + slug_re = re.compile(rf"^I-\d+-{re.escape(wt.slug)}/") + nums = {c["pr_number"] for c in wt.children if c["merged"] and c["pr_number"]} + nums |= { + p.number + for p in closed_prs + if p.state == "MERGED" + and p.repo_name == wt.repo_name + and slug_re.match(p.head_ref_name) + and _is_child_head(p.head_ref_name) + } + return sorted(nums) + + +def _final_pr(wt: WorktreeFlow, closed_prs: list[PullRequestInfo]) -> PullRequestInfo | None: + """Newest merged or closed PR of the flow itself (a child PR never counts), matched by branch or flow slug.""" + slug_re = re.compile(rf"^I-\d+-{re.escape(wt.slug)}/") + hits = [ + p + for p in closed_prs + if p.repo_name == wt.repo_name + and not _is_child_head(p.head_ref_name) + and (p.head_ref_name == wt.execution_branch or slug_re.match(p.head_ref_name)) + ] + return max(hits, key=lambda p: p.number, default=None) + + +STAGE_CELL_LIMIT = 40 +GONE_SUFFIX = "; blocker gone, not resumed" + + +def _blocker_slug(entry: dict[str, Any]) -> str | None: + """Slug of the flow behind a blocker: from its branch (`I--/`), else its `flow-` worktree.""" + for key in ("plan_branch", "branch", "head"): + m = BRANCH_SLUG_RE.match(str(entry.get(key) or "")) + if m: + return m.group(1) + name = Path(str(entry.get("worktree") or "")).name + return name.removeprefix("flow-") if name.startswith("flow-") and len(name) > 5 else None + + +def resolve_blockers( + admission: dict[str, Any], + repo_name: str, + *, + prs: Iterable[PullRequestInfo] = (), + bean_for_slug: Callable[[str], list[str]] | None = None, + pr_state: Callable[[str, int], str | None] | None = None, +) -> list[Blocker]: + """Name each distinct entry of `admission.blocked_by` and say whether it is gone (merged, closed, removed).""" + raw = admission.get("blocked_by") + if not isinstance(raw, list): + return [] + open_prs = [p for p in prs if p.repo_name == repo_name] + found: dict[tuple[str, Any], Blocker] = {} + for entry in raw: + if not isinstance(entry, dict): + continue + number = entry.get("number") + number = number if isinstance(number, int) and not isinstance(number, bool) else None + kind = str(entry.get("kind") or ("pull_request" if number is not None else "local_flow")) + slug = _blocker_slug(entry) + beans = bean_for_slug(slug) if (bean_for_slug and slug) else [] + bean = "+".join(sorted(set(beans))) or None + files = [str(f) for f in entry.get("files") or []] + if kind == "pull_request" and number is not None: + state = ( + None + if any(p.number == number for p in open_prs) + else (pr_state(repo_name, number) if pr_state else None) + ) + gone = state in {"MERGED", "CLOSED"} + blocker = Blocker("pull_request", number, bean, slug, files, gone, f"#{number}") + key: tuple[str, Any] = ("pr", number) + else: + flow_pr = None + if slug: + slug_re = re.compile(rf"^I-\d+-{re.escape(slug)}/") + flow_pr = next((p for p in open_prs if slug_re.match(p.head_ref_name)), None) + worktree = str(entry.get("worktree") or "") + gone = flow_pr is None and bool(worktree) and not Path(worktree).exists() + if flow_pr is not None: + name = f"#{flow_pr.number} (bean {bean})" if bean else f"#{flow_pr.number}" + elif bean: + name = f"bean {bean}, no PR yet" + else: + name = f"flow {slug or Path(worktree).name or 'unknown'}, no PR yet" + number = flow_pr.number if flow_pr else None + blocker = Blocker("local_flow", number, bean, slug, files, gone, name) + key = ("pr", number) if number is not None else ("flow", slug or worktree or name) + if key not in found: + found[key] = blocker + else: + found[key].files = list(dict.fromkeys(found[key].files + files)) + return list(found.values()) + + +def _blocked_stage(wt: WorktreeFlow, blockers: list[Blocker] | None, live: LiveFlowTree | None) -> str: + """`Stage 3 (Blocked: ...)` naming every blocker; flags blockers that are all gone while no runner is live.""" + if blockers is None: + blockers = resolve_blockers(wt.admission, wt.repo_name) + if not blockers: + return "Stage 3 (Blocked: overlap)" + names = ", ".join(b.name for b in blockers) + suffix = GONE_SUFFIX if live is None and all(b.gone for b in blockers) else "" + return f"Stage 3 (Blocked: {names}{suffix})" + + +def _compact_stage(stage: str, blockers: list[Blocker], live: LiveFlowTree | None) -> str: + """Narrow the Stage cell: first blocker plus `+N more` once the full text passes the cell limit.""" + if len(stage) <= STAGE_CELL_LIMIT or len(blockers) < 2: + return stage + suffix = GONE_SUFFIX if live is None and all(b.gone for b in blockers) else "" + return f"Stage 3 (Blocked: {blockers[0].name} +{len(blockers) - 1} more{suffix})" + + +def _derive_stage( + wt: WorktreeFlow | None, + live: LiveFlowTree | None, + has_pr: bool, + blockers: list[Blocker] | None = None, +) -> str: if live and live.docker_role == "review-loop": mode = "Resolve" if live.docker_resolve else "Review" iter_part = f" iter {live.docker_iteration}" if live.docker_iteration is not None else "" @@ -1000,10 +1370,7 @@ def _derive_stage(wt: WorktreeFlow | None, live: LiveFlowTree | None, has_pr: bo if live and live.docker_role == "executor": return "Stage 3 (Executing)" if live and wt and wt.admission.get("state") == "blocked": - blockers = wt.admission.get("blocked_by") or [] - nums = [f"#{b['number']}" for b in blockers if isinstance(b, dict) and b.get("number") is not None] - blocker_str = ", ".join(nums) if nums else "overlap" - return f"Stage 3 (Blocked: {blocker_str})" + return _blocked_stage(wt, blockers, live) if wt is None: return "Stage 4 (Review)" if has_pr else "Not started" @@ -1019,10 +1386,7 @@ def _derive_stage(wt: WorktreeFlow | None, live: LiveFlowTree | None, has_pr: bo return "Stage 5 (Calibrated)" if wt.admission.get("state") == "blocked" and exec_status != "success": - blockers = wt.admission.get("blocked_by") or [] - nums = [f"#{b['number']}" for b in blockers if isinstance(b, dict) and b.get("number") is not None] - blocker_str = ", ".join(nums) if nums else "overlap" - return f"Stage 3 (Blocked: {blocker_str})" + return _blocked_stage(wt, blockers, live) if wt.current_stage == "review" and rev_status == "failed": iter_part = f" iter {wt.review_iterations_done}" if wt.review_iterations_done else "" @@ -1033,10 +1397,6 @@ def _derive_stage(wt: WorktreeFlow | None, live: LiveFlowTree | None, has_pr: bo return "Not started" -def _compact_model(model: str) -> str: - return model.removeprefix("claude-") - - def _attempt_rank(wt: WorktreeFlow | None, live: LiveFlowTree | None, pr: PullRequestInfo | None) -> tuple[float, ...]: live_score = 2.0 if live and live.kind == "running" else 1.0 if live else 0.0 stage_score = float(STAGE_ORDER.index(wt.current_stage)) if wt and wt.current_stage in STAGE_ORDER else -1.0 @@ -1044,11 +1404,48 @@ def _attempt_rank(wt: WorktreeFlow | None, live: LiveFlowTree | None, pr: PullRe return (live_score, 1.0 if pr else 0.0, stage_score, recency) +def _derive_agent_model(wt: WorktreeFlow | None, live: LiveFlowTree | None) -> tuple[str, str]: + """The flow's runner agent and model: the live process first, then the worktree checkpoint; "—" when unknown.""" + agent = (live.agent if live else None) or (wt.agent if wt else None) or "" + model = (live.model if live else None) or (wt.model if wt else None) or "" + if not agent and model: + agent = ( + "claude-agent" + if model.startswith("claude-") + else "antigravity-agent" + if model.startswith("gemini-") + else "" + ) + return agent or "—", model or "—" + + +def _derive_last_activity(wt: WorktreeFlow | None, live: LiveFlowTree | None, now: datetime) -> str: + """What the flow is doing or last did: the live role container, then the newest of HEAD commit and checkpoint. + + The live part comes from the running role container (role, review iteration, resolver). The commit part is the + worktree's HEAD (role agents commit step by step, so it is the closest thing to live work progress). The checkpoint + part is the last line the flow engine logged when it last saved its checkpoint. + """ + parts: list[str] = [] + if live and live.kind == "running" and (live.docker_role or live.docker_iteration is not None): + fallback = "review" if live.docker_iteration is not None else "role container" + role = "resolver" if live.docker_resolve else (live.docker_role or fallback) + iteration = f" iter {live.docker_iteration}" if live.docker_iteration is not None else "" + parts.append(f"now: {role}{iteration} running") + dated: list[tuple[datetime, str]] = [] + if wt and wt.last_commit_time and wt.last_commit_subject: + ago = format_duration(wt.last_commit_time, now) + dated.append((wt.last_commit_time, f"commit {ago} ago: {_truncate(wt.last_commit_subject, 70)}")) + if wt and wt.checkpoint_time and wt.last_log: + ago = format_duration(wt.checkpoint_time, now) + dated.append((wt.checkpoint_time, f"checkpoint {ago} ago: {_truncate(wt.last_log, 70)}")) + parts.extend(text for _, text in sorted(dated, key=lambda item: item[0], reverse=True)) + return "; ".join(parts) if parts else "—" + + def _derive_live_runner(wt: WorktreeFlow | None, live: LiveFlowTree | None) -> str: if live: - model = _compact_model( - live.model or (wt.model if wt else None) or live.agent or (wt.agent if wt else None) or "unknown" - ) + model = "live" elapsed = format_etime(live.etime) if live.kind == "polling": blockers = (wt.admission.get("blocked_by") or []) if wt else [] @@ -1059,19 +1456,21 @@ def _derive_live_runner(wt: WorktreeFlow | None, live: LiveFlowTree | None) -> s return f"waiter · {elapsed} (PID {live.root_pid}, {live.session_owner})" return f"{model} · {elapsed} (PID {live.root_pid}, {live.session_owner})" - if wt and (wt.model or wt.agent): - return f"idle ({_compact_model(wt.model or wt.agent or '')})" return "idle" -def _derive_pr_ci(pr: PullRequestInfo | None) -> str: +def _derive_pr_ci(pr: PullRequestInfo | None, merged_children: list[int] | None = None) -> str: + """Open PR link with CI/review state; a decomposed flow adds its merged child PRs (`merged #316 #318`).""" + merged = f"merged {' '.join(f'#{n}' for n in merged_children)}" if merged_children else "" if pr is None: - return "—" + return merged or "—" parts = [f"[#{pr.number}]({pr.url})", pr.ci_summary, f"{pr.reviews_count} rev"] if pr.mergeable == "CONFLICTING": parts.append("CONFLICTING") if pr.is_draft: parts.append("DRAFT") + if merged: + parts.append(merged) return " · ".join(parts) @@ -1144,10 +1543,13 @@ def build_in_flight_rows( prs: list[PullRequestInfo], live_by_key: dict[str, LiveFlowTree], now: datetime | None = None, + pr_state: Callable[[str, int], str | None] | None = None, + closed_prs: list[PullRequestInfo] | None = None, ) -> list[InFlightRow]: """Correlate beans, intents, worktrees, open PRs, and live PIDs into active rows.""" wt_by_slug = {w.slug: w for w in worktrees} now = now or datetime.now(UTC) + closed_prs = closed_prs or [] # Index active intents by parent intent slug (json slug and file slug), filtering out completed/scrapped beans. active_by_slug: dict[str, list[str]] = {} @@ -1174,6 +1576,9 @@ def is_slug_completed_only(slug: str) -> bool: nums = _lookup(all_by_slug, slug) return bool(nums) and all(n in beans and beans[n].status in EXCLUDED_STATUSES for n in nums) + def beans_for_slug(slug: str) -> list[str]: + return list(_lookup(active_by_slug, slug) or _lookup(all_by_slug, slug)) + used_beans: set[str] = set() used_worktrees: set[str] = set() used_prs: set[tuple[str, int]] = set() @@ -1201,8 +1606,16 @@ def resolve_live(wt: WorktreeFlow | None, slug: str | None) -> LiveFlowTree | No continue cand_beans = sorted(set(cand_beans)) - pr = _match_pr_for_unit(wt, wt.slug, cand_beans, prs) + split = _split_info(wt) + if split: + pr, flow_prs = _split_prs(wt, split, prs) + pr = pr or _match_pr_for_unit(wt, wt.slug, cand_beans, prs) + used_prs.update((p.repo_name, p.number) for p in flow_prs) + else: + pr = _match_pr_for_unit(wt, wt.slug, cand_beans, prs) live = resolve_live(wt, wt.slug) + final = None if pr else _final_pr(wt, closed_prs) + merged_kids = _merged_children(wt, closed_prs) if split else [] group_beans = [beans[n] for n in cand_beans if n in beans] # Skip idle, un-PR'd todo/draft worktrees? Wait: a local worktree with checkpoint means flow started! @@ -1216,10 +1629,34 @@ def resolve_live(wt: WorktreeFlow | None, slug: str | None) -> LiveFlowTree | No else: title = wt.slug.replace("-", " ") - stage = _derive_stage(wt, live, pr is not None) + blockers = ( + resolve_blockers(wt.admission, wt.repo_name, prs=prs, bean_for_slug=beans_for_slug, pr_state=pr_state) + if wt.admission.get("state") == "blocked" + else [] + ) + stage = _derive_stage(wt, live, pr is not None, blockers) + stage_compact = _compact_stage(stage, blockers, live) if stage.startswith("Stage 3 (Blocked") else stage live_runner = _derive_live_runner(wt, live) - pr_ci = _derive_pr_ci(pr) + if split and stage.startswith("Stage") and not stage.startswith("Stage 3 (Blocked"): + stage = stage_compact = _split_stage(stage, split) + pr_ci = _derive_pr_ci(pr, merged_kids) notes = _derive_notes(group_beans, wt, pr, live) + if stage_compact != stage: + full = "Blocked by " + ", ".join(b.name for b in blockers) + notes = full if notes == "—" else f"{full}; {notes}" + stale_stage = False + if final is not None and final.state == "MERGED": + stage = stage_compact = MERGED_STAGE + pr_ci = f"[#{final.number}]({final.url}) merged" + note = "PR merged; run post-pr-merge" + notes = note if notes == "—" else f"{note}; {notes}" + stale_stage = True + elif final is not None and final.state == "CLOSED" and live is None: + stage = stage_compact = CLOSED_STAGE + pr_ci = f"[#{final.number}]({final.url}) closed" + note = "PR closed, runner dead; clean_branches" + notes = note if notes == "—" else f"{note}; {notes}" + stale_stage = True bucket = 0 if (live and live.kind == "running") else 1 if live else 2 rows.append( InFlightRow( @@ -1229,12 +1666,20 @@ def resolve_live(wt: WorktreeFlow | None, slug: str | None) -> LiveFlowTree | No stage=stage, pr_ci=pr_ci, live_runner=live_runner, + live=bool(live and live.kind == "running"), notes=notes, sort_bucket=bucket, - time_in_stage=format_duration(wt.stage_started, now) if stage != "Not started" else "—", + time_in_stage="—" if stale_stage or stage == "Not started" else format_duration(wt.stage_started, now), total_time=format_duration(wt.flow_started, now), source=wt.dir_name, rank=_attempt_rank(wt, live, pr), + agent=_derive_agent_model(wt, live)[0], + model=_derive_agent_model(wt, live)[1], + last_activity=_derive_last_activity(wt, live, now), + stage_compact=stage_compact, + blockers=blockers if stage.startswith("Stage 3 (Blocked") else [], + slug=wt.slug, + distinct=bool(live or pr or stale_stage), ) ) @@ -1272,11 +1717,17 @@ def resolve_live(wt: WorktreeFlow | None, slug: str | None) -> LiveFlowTree | No stage=_derive_stage(None, live, pr is not None), pr_ci=_derive_pr_ci(pr), live_runner=_derive_live_runner(None, live), + live=live.kind == "running", notes=_derive_notes(group_beans, None, pr, live), sort_bucket=0 if live.kind == "running" else 1, total_time=format_duration(branch_started(pr.head_ref_name) if pr else None, now), source=f"live PID {live.root_pid}", + slug=live.slug or "", + distinct=True, rank=_attempt_rank(None, live, pr), + agent=_derive_agent_model(None, live)[0], + model=_derive_agent_model(None, live)[1], + last_activity=_derive_last_activity(None, live, now), ) ) @@ -1304,6 +1755,8 @@ def resolve_live(wt: WorktreeFlow | None, slug: str | None) -> LiveFlowTree | No sort_bucket=2, total_time=format_duration(branch_started(pr.head_ref_name), now), source=f"PR #{pr.number}", + slug=pr_slug or "", + distinct=True, rank=_attempt_rank(None, None, pr), ) ) @@ -1312,6 +1765,36 @@ def resolve_live(wt: WorktreeFlow | None, slug: str | None) -> LiveFlowTree | No for bnum, bean in sorted(beans.items()): if bnum in used_beans or bean.status != "in-progress": continue + target = _infer_target_from_bean(bean) + merged_pr = _match_pr_for_unit( + None, + None, + [bnum], + sorted( + ( + p + for p in closed_prs + if p.state == "MERGED" and p.repo_name == target and not _is_child_head(p.head_ref_name) + ), + key=lambda p: -p.number, + ), + ) + if merged_pr is not None: + rows.append( + InFlightRow( + bean_nums=[bnum], + target=target, + title=_truncate(bean.title), + stage=MERGED_STAGE, + pr_ci=f"[#{merged_pr.number}]({merged_pr.url}) merged", + live_runner="idle", + notes="PR merged; run post-pr-merge", + sort_bucket=3, + source="bean", + distinct=True, + ) + ) + continue rows.append( InFlightRow( bean_nums=[bnum], @@ -1326,21 +1809,30 @@ def resolve_live(wt: WorktreeFlow | None, slug: str | None) -> LiveFlowTree | No ) ) - def sort_key(r: InFlightRow) -> tuple[int, str, str]: + rows = merge_rows_per_bean(rows) + group_bucket: dict[str, int] = {} + for r in rows: + if r.bean_nums: + group_bucket[r.bean_nums[0]] = min(group_bucket.get(r.bean_nums[0], r.sort_bucket), r.sort_bucket) + + def sort_key(r: InFlightRow) -> tuple[int, str, int, str, str]: first_bean = r.bean_nums[0] if r.bean_nums else "9999" - return (r.sort_bucket, first_bean, r.title) + return (group_bucket.get(first_bean, r.sort_bucket), first_bean, r.sort_bucket, r.title, r.source) - rows = merge_rows_per_bean(rows) rows.sort(key=sort_key) return rows def merge_rows_per_bean(rows: list[InFlightRow]) -> list[InFlightRow]: - """Collapse rows sharing a bean into one: keep the live/most-advanced attempt, note the stale ones.""" + """One row per live flow or PR of a bean; collapse only dead attempts (no runner, no PR) into a stale note. + + Rows of one bean stay separate when they are the best attempt, have a live runner, an open PR, or a merged/closed + PR; every other attempt becomes `stale attempt ...` in the notes of the best row. + """ kept: list[InFlightRow] = [] for row in sorted(rows, key=lambda r: r.rank, reverse=True): host = next((k for k in kept if row.bean_nums and set(k.bean_nums) & set(row.bean_nums)), None) - if host is None: + if host is None or row.distinct: kept.append(row) continue host.bean_nums = sorted(set(host.bean_nums) | set(row.bean_nums)) @@ -1349,28 +1841,100 @@ def merge_rows_per_bean(rows: list[InFlightRow]) -> list[InFlightRow]: return kept -def render_markdown_table(rows: list[InFlightRow]) -> str: - """Render in-flight bean rows as a single GitHub-Flavored Markdown table.""" - if not rows: - return "No beans are currently in flight." +def _short_agent(agent: str) -> str: + return agent.removesuffix("-agent") + + +def _short_model(model: str) -> str: + return model.removeprefix("claude-") + +def _table(headers: list[str], body: list[list[str]]) -> list[str]: lines = [ - "| Bean # | Target | Title | Stage | Time in Stage | PR & CI | Total Time | Notes |", - "| :----- | :----- | :---- | :---- | :------------ | :------ | :--------- | :---- |", + "| " + " | ".join(headers) + " |", + "| " + " | ".join(":" + "-" * max(len(h) - 1, 4) for h in headers) + " |", ] - for row in rows: - bean_cell = ", ".join(row.bean_nums) if row.bean_nums else "—" - cells = [ - bean_cell, + lines.extend("| " + " | ".join(_escape_cell(c) for c in cells) + " |" for cells in body) + return lines + + +def render_wide_table(rows: list[InFlightRow]) -> str: + """Render every column in one table (`--wide`). Too wide for most terminals, which then show it as raw text.""" + headers = [ + "Bean #", + "Target", + "Title", + "Agent", + "Model", + "Stage", + "Time in Stage", + "Live", + "PR & CI", + "Total Time", + "Last Activity", + "Notes", + ] + body = [ + [ + ", ".join(row.bean_nums) if row.bean_nums else "—", row.target, row.title, + row.agent, + row.model, row.stage, row.time_in_stage, + _live_dot(row), row.pr_ci, row.total_time, + row.last_activity, row.notes_cell(), ] - lines.append("| " + " | ".join(_escape_cell(c) for c in cells) + " |") + for row in rows + ] + return "\n".join(_table(headers, body)) + + +def _live_dot(row: InFlightRow) -> str: + return "🟢" if row.live else "🔴" + + +def render_markdown_table(rows: list[InFlightRow], *, wide: bool = False) -> str: + """Render the in-flight beans: a compact table that fits a terminal, then one detail line per bean. + + The long cells (last activity, notes) go below the table as a list, because a table with them is too wide to be + rendered as a table. `wide=True` keeps everything in a single table. + """ + if not rows: + return "No beans are currently in flight." + if wide: + return render_wide_table(rows) + + headers = ["Bean #", "Target", "Title", "Agent", "Model", "Stage", "In Stage", "Live", "PR & CI", "Total"] + body: list[list[str]] = [] + details: list[str] = [] + cells = [", ".join(r.bean_nums) if r.bean_nums else "—" for r in rows] + for row, bean_cell in zip(rows, cells, strict=True): + body.append( + [ + bean_cell, + row.target, + _truncate(row.title, 36), + _short_agent(row.agent), + _short_model(row.model), + row.stage_compact or row.stage, + row.time_in_stage, + _live_dot(row), + row.pr_ci, + row.total_time, + ] + ) + parts = [p for p in (row.last_activity, row.notes_cell()) if p and p != "—"] + if parts: + flow = f" `{row.slug}`" if row.slug and cells.count(bean_cell) > 1 else "" + details.append(f"- **{bean_cell}**{flow}: " + " | ".join(parts)) + lines = _table(headers, body) + if details: + lines += ["", "**Last activity and notes**", "", *details] return "\n".join(lines) @@ -1392,7 +1956,15 @@ def collect_progress( prs = fetch_open_prs(repos, no_gh=no_gh) processes = scan_processes(no_ps=no_ps) live_by_key = match_live_flows(processes, worktrees, intents) - return build_in_flight_rows(beans, intents, worktrees, prs, live_by_key) + return build_in_flight_rows( + beans, + intents, + worktrees, + prs, + live_by_key, + pr_state=None if no_gh else make_pr_state_lookup(repos), + closed_prs=fetch_closed_prs(repos, no_gh=no_gh), + ) def main(argv: list[str] | None = None) -> int: @@ -1423,6 +1995,11 @@ def main(argv: list[str] | None = None) -> int: action="store_true", help="Skip inspecting live host processes via ps.", ) + parser.add_argument( + "--wide", + action="store_true", + help="Render every column in one wide table instead of a compact table plus a detail list", + ) args = parser.parse_args(argv) repo_root = Path(args.repo_root) @@ -1432,7 +2009,7 @@ def main(argv: list[str] | None = None) -> int: if args.json: print(json.dumps([r.as_dict() for r in rows], indent=2)) else: - print(render_markdown_table(rows)) + print(render_markdown_table(rows, wide=args.wide)) return 0 diff --git a/.agents/skills/clean_workspace/SKILL.md b/.agents/skills/clean_workspace/SKILL.md index 7adfe5eb..e17e6ac3 100644 --- a/.agents/skills/clean_workspace/SKILL.md +++ b/.agents/skills/clean_workspace/SKILL.md @@ -228,6 +228,33 @@ For every feature or task worktree (excluding `main`): --- +### Phase 3b: Delete Stale Plans & Stale Worktrees (maintainer, 2026-11-23) + +Phase 3 removes only worktrees whose branch is merged. Unmerged leftovers are cleaned up as well, by the same rules the +`post-pr-merge` skill applies after every merge +([Step 4b and 4c](../post_pr_merge/SKILL.md#4b-delete-stale-plans-maintainer-2026-11-23)): + +- **Stale plan**: a flow worktree on an intent or plan branch (`I-.../_` or `I-.../P-.../_`, no execution branch cut), + with no open pull request, no live process, and a base that `origin/main` has moved past. +- **Stale worktree**: any other flow worktree (superseded earlier attempt, interrupted execution branch of a paused + bean, detached leftover) with no open pull request, no live process (`holon flow`, `run_holon_flow.py`, role container + or usage-limit waiter naming its slug), a base that `origin/main` has moved past, and nothing touching it for at least + two hours (newest of its last commit and its `.holon/flow/checkpoint-*.json` mtime). + +For each one: + +1. **Back up first.** If it has commits on no remote branch, or uncommitted changes, bundle its `I-*-/` branches + to `todo/stale-worktree-backups/-.bundle` (`git bundle create`, then `git bundle verify`) and copy + uncommitted files beside it. Delete nothing until the bundle verifies. +2. Remove the worktree (`--force` after the backup), delete its `I-*-/` and `flow-` branches locally and on + origin. +3. Set its bean back to `status: todo` (unless completed) with a one-line dated note naming the backup; the bean + restarts from current `main` with a fresh `-vN` intent. Keep its `todo/intent-*.json`. + +Never delete a worktree with an open PR or a live process, never a branch that is the head or base of an open PR (check +`gh pr list --state open --json headRefName,baseRefName`), and never the `main` worktree. Report what was deleted, what +was backed up and what was kept. + ### Phase 4: Registry-vs-Disk Diff & Orphan Directory Purge Derive the complete directory truth by diffing the filesystem against `git worktree list`: diff --git a/.agents/skills/holon_flow/SKILL.md b/.agents/skills/holon_flow/SKILL.md index 1d4ac142..e2066f40 100644 --- a/.agents/skills/holon_flow/SKILL.md +++ b/.agents/skills/holon_flow/SKILL.md @@ -26,7 +26,9 @@ multi-hour containerised lifecycle, **the flow is executed inside a dedicated ba **MUST NOT execute the flow inline**. Instead, it delegates to a background `Holon Flow Subagent` (`invoke_subagent` with `TypeName: "self"`, `Role: "bean - holon flow "` (named per [subagents.md, "Subagent names"](../../subagents.md#subagent-names)), `Model` = the lowest tier per - `.agents/model-tiers.md`) and immediately returns control to the user. + `.agents/model-tiers.md`) and immediately returns control to the user. Up to **4 concurrent `holon-flow` background + subagents** may run at once on hosted runtimes (each in its own `flow-` worktree; local runtimes stay at 1), + with automatic backfill of the next highest-priority ready bean once a PR merges per `post-pr-merge`. 2. **Sole Change Path Invariant**: Every target codebase change (`holon-agentic-coder` or `holon-coherence`) MUST traverse the 5 containerised stages: - **Stage 1 (Intent)**: `I-{ts}-{slug}/_` branch created and logged to `holon-knowledge/ledger/intents.jsonl`. @@ -51,17 +53,24 @@ multi-hour containerised lifecycle, **the flow is executed inside a dedicated ba 5. **Wait Out a Named Reset, Then the Fallback Ladder (maintainer rule, 2026-11-11)**: If any stage or subagent encounters model credit exhaustion, session limits, rate limits, or HTTP 429 errors (`You've hit your session limit`, `insufficient_quota`, `RESOURCE_EXHAUSTED`), **do not stop or block**: - - **When the error names its reset time** (e.g. `resets 5:40pm (Australia/Melbourne)` — a daily or weekly window), - **wait until about one minute after that reset and resume automatically from the checkpoint on the same agent and - model**. `scripts/run_holon_flow.py` does this itself (`parse_limit_reset` / `wait_for_limit_reset`), logging it - before it sleeps; a hand-driven stage follows the same rule. Never report such a stop as terminal and never wait - for a human to type "continue". + - **When the error names its reset time** (e.g. `resets 5:40pm (Australia/Melbourne)` or a relative + `Resets in 51m58s` as Antigravity prints; a daily or weekly window), **wait until about one minute after that reset + and resume automatically from the checkpoint on the same agent and model**. `scripts/run_holon_flow.py` does this + itself (`parse_limit_reset` / `wait_for_limit_reset`), logging it before it sleeps; a hand-driven stage follows the + same rule. Never report such a stop as terminal and never wait for a human to type "continue". + - **A parent or subagent that receives a quota failure naming a reset schedules the resume at once** (`schedule` with + the reset plus one minute) in the same turn, before doing anything else; it never waits for the user to say + "continue" (maintainer, 2026-11-24). - **When no reset time is named** (true credit exhaustion), step down the fallback ladder and continue the flow from the current stage or checkpoint: - - **Claude (`claude-agent`)**: `claude-fable-5` $\rightarrow$ `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` + - **Fable needs a longer stall window (2026-11-23)**: launch `run_holon_flow.py` with `HOLON_TURN_STALL_SECONDS=600` + when the model is `claude-fable-5-2`. With the default 90 s every reviewer was cut ("review stall budget of 90 s + exceeded") because Fable thinks longer than that before it streams. + - **Claude (`claude-agent`)**: `claude-fable-5-2` $\rightarrow$ `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5`. - - **Antigravity (`antigravity-agent`)**: `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ - `gemini-3.8-flash` (use `gemini-4-argon` for all Holon coding tasks until tokens run out). + - **Antigravity (`antigravity-agent`)**: `gemini-4-neon` $\rightarrow$ `gemini-4-argon` $\rightarrow$ + `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` (use `gemini-4-neon` for all Holon coding tasks until tokens + run out). - **Antigravity AGY Subagent Runtime**: `Model: "inherit"` / `"pro"` $\rightarrow$ `"flash"` $\rightarrow$ `"flash_lite"`. - **No Cross-Runner Switch**: never switch `--agent` between `claude-agent` and `antigravity-agent` on your own. When @@ -75,8 +84,9 @@ multi-hour containerised lifecycle, **the flow is executed inside a dedicated ba and pushing to `origin`) so it appears in the PR diff. 7. **Canonical 3-Ledger Conflict Resolution**: Target repositories maintain strictly three ledgers under `holon-knowledge/ledger/` (`intents.jsonl`, `plans.jsonl`, `executions.jsonl`). When concurrent PR merges cause - ledger conflicts against `origin/main`, do not run test suites: interleave the JSONL records chronologically by their - `created_at` timestamp, commit, and push. + ledger conflicts against `origin/main`, do not run test suites: keep main's ledger file exactly as on main, in main's + order, append only the branch's own rows (ordered by `created_at` among themselves), never move or re-sort a row + already on main, then commit and push. 8. **Human-Only Merge Boundary (Bean 0034 / Rule 8)**: Agents MUST NEVER merge a PR that targets `main` (`gh pr merge` is strictly forbidden). The subagent completes when Stage 5 calibration is included in the PR, confirms the PR is clean and mergeable, and notifies the parent agent that the PR is ready for human merge. @@ -116,16 +126,23 @@ Inside the background subagent, perform pre-flight verification: 1. **Verify Global `holon` Binary**: Ensure `holon` is available in `PATH` (`which holon` $\rightarrow$ `~/.local/bin/holon`). 2. **Verify Docker Daemon**: Ensure Docker is running (`docker info`). -3. **Verify Intent JSON**: Read and parse ``. Ensure `slug`, `goal`, and `description` are present. Give - the intent a descriptive `slug` of up to 32 characters (lowercase, hyphen-separated); the engine rejects longer root - slugs, and since the short branch names of PR #206 two levels of nested child intents with 32-character slugs fit - GitHub's 255-character ref limit (see `.agents/rules.md`, "Git ref names are limited to 255 characters"). +3. **Verify Intent JSON**: Read and parse ``. Ensure `slug`, `goal`, and `description` are present, and + that the `goal` contains this sentence verbatim: "Code is self-explaining: no docstrings and no comments except '# + why:' comments that record a reason the code cannot show." (self-explaining-code invariant, maintainer, 2026-11-27); + add it if missing. Give the intent a descriptive `slug` of up to 32 characters (lowercase, hyphen-separated); the + engine rejects longer root slugs, and since the short branch names of PR #206 two levels of nested child intents with + 32-character slugs fit GitHub's 255-character ref limit (see `.agents/rules.md`, "Git ref names are limited to 255 + characters"). 4. **Verify Target Worktree**: Ensure `--target-worktree` is a dedicated `flow-` worktree (never the `main` worktree itself) that exists and is a clean git repository. Create it from `origin/main` first if it does not exist. -5. **Determine Runner & Model**: +5. **Intent check (bean 0508, PR #348)**: with the target worktree at current `origin/main`, run + `holon intent-check --target-worktree `. Add each companion file it lists as missing + to the intent's scope (files only, never directories), or record in the bean why not. Proposed companions and + warnings are advisory. +6. **Determine Runner & Model**: - Default agent: `antigravity-agent` (or `claude-agent`) - - Default model: `gemini-4-argon` (fallback: `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash`, or - `claude-fable-5` / `claude-opus-5-5`) + - Default model: `gemini-4-neon` (fallback: `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ + `gemini-3.8-flash`, or `claude-fable-5-2` / `claude-opus-5-5`) --- @@ -153,11 +170,15 @@ python3 .agents/skills/holon_flow/scripts/run_holon_flow.py \ #### Claude credentials are built in For `--agent claude-agent`, `scripts/run_holon_flow.py` builds the container credentials itself (`scripts/flow_env.py`): -it reads the long-lived OAuth token from `CLAUDE_CODE_OAUTH_TOKEN` or `~/.holon/secrets/claude-oauth-token`, wraps it in -`HOLON_AGENT_SETTINGS` with the echo padding, and sets `HOLON_TOKEN_REDUCE=0` and `PYTHONUNBUFFERED=1` for the flow -process. The token is never printed. Nothing needs exporting by hand, and an already-set `HOLON_AGENT_SETTINGS` is left -alone. When no credentials can be found the runner stops before dispatch with a message naming what is missing, instead -of letting every Stage 4 reviewer exit with code 1 and no reason. +it reads the long-lived OAuth token from `CLAUDE_CODE_OAUTH_TOKEN`, then the legacy file +`~/.holon/secrets/claude-oauth-token` if it still exists, then the OS keychain entry (service `holon`, account +`claude-oauth-token`), which is where the engine keeps it since pull request #271, wraps it in `HOLON_AGENT_SETTINGS` +with the echo padding, and sets `HOLON_TOKEN_REDUCE=0` and `PYTHONUNBUFFERED=1` for the flow process. It also switches +on Claude Code's experimental code mode (`CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1`, in the flow process and in the settings +`env` the containers read); export `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=0` before launching to switch it off. The token +is never printed. Nothing needs exporting by hand, and an already-set `HOLON_AGENT_SETTINGS` is left alone. When no +credentials can be found the runner stops before dispatch with a message naming what is missing, instead of letting +every Stage 4 reviewer exit with code 1 and no reason. #### Monitoring Stage Progress @@ -177,8 +198,9 @@ If `holon flow` exits with an error: 1. **Quota / Credit / Session Limit Errors**: If the log contains `session limit`, `insufficient_quota`, `RESOURCE_EXHAUSTED`, or HTTP 429: - - Identify the next tier down on the fallback ladder (e.g. `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` - $\rightarrow$ `gemini-3.8-flash`, or `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6`). + - Identify the next tier down on the fallback ladder (e.g. `gemini-4-neon` $\rightarrow$ `gemini-4-argon` + $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash`, or `claude-opus-5-5` $\rightarrow$ + `claude-sonnet-4-6`). - Never switch `--agent` across runners without the maintainer's go-ahead; report the exhausted ladder instead. - Resume the flow using the saved checkpoint: @@ -242,19 +264,40 @@ Once the flow finishes: gh pr view --json mergeable,mergeStateStatus ``` - If `mergeable == "CONFLICTING"`, fetch `origin/main`, merge `origin/main` into the PR execution branch, resolve the - ledger conflicts chronologically by `created_at`, commit, and push to origin. + **A flow is not finished while its PR conflicts with the target branch (maintainer, 2026-11-23).** If + `mergeable == "CONFLICTING"` or `mergeStateStatus == "DIRTY"` at the end of the flow, including when the flow itself + printed "completed successfully", do not report it as terminal. Rerun the flow: + 1. Resolve the conflict through the `resolve-conflict` skill in its own subagent (merge `origin/`; never a + rebase or force-push; ledger and KB conflicts mechanically; a code conflict that needs a decision goes back to the + parent, which delegates a higher-tier resolve-conflict subagent). Push. + 2. Rerun the flow from the checkpoint, launched from the harness root, choosing the stage by what the merge did: + - **Mechanical merge, PR's own diff unchanged** (ledger/KB only): rerun with + `.agents/skills/holon_flow/scripts/run_holon_flow.py --from-stage calibrate`. Stage 5's merged-head gate + compares the PR-own fingerprint with the one recorded at approval: when they match it keeps the approval, waits + for CI on the merged head and redoes calibration; when they differ, or CI fails, it withdraws the consensus and + restarts Stage 4 itself. **Do not use `--from-stage review` here**: it re-enters the review loop and dispatches + the reviewers again even though nothing of the PR changed (seen on PR #258, 2026-11-23). Better still, for a + ledger-only conflict skip step 1 and let the rerun's own conflict gate do the merge: it resolves ledgers itself + and records the carry-over row. + - **The PR's own diff changed** (a resolved code conflict), or the approval predates the fingerprint (it was + recorded by an engine older than PR #254, so the checkpoint's consensus has no `approval_fingerprint`): rerun + with `--from-stage review`; one fresh review records a fingerprinted approval, and later merges carry it over. + 3. Check mergeability again and repeat until the PR is `MERGEABLE` and `CLEAN` with green CI and the calibration + report in the diff. If the target branch keeps moving, keep going; report only a conflict you cannot get resolved, + never "ready" for a conflicting PR. --- -### Stage 3 overlap refusals are waited out +### Stage 3 overlap refusals are parked, not waited out (maintainer, 2026-11-26) -When Stage 3 admission refuses a plan because its touch set overlaps another flow in flight, `scripts/run_holon_flow.py` -does not stop and never adds `--allow-overlap` itself. It polls each overlapping pull request named in the refusal -(`gh pr view --json state`, every `--overlap-poll-seconds`, default 60) until each is merged or closed, then resumes -the flow from its checkpoint, which runs admission again. An overlap with a local flow that has no pull request is -re-checked by re-running admission after the same interval. Any other refusal (no touch set declared, discovery -unavailable) still stops. Pass `--no-wait-on-overlap` to stop on an overlap as before. +When Stage 3 admission refuses a plan because its touch set overlaps another flow in flight (or the flow otherwise waits +on another flow's PR), the flow does not hold a slot. Never add `--allow-overlap`. Run the wrapper with +`--no-wait-on-overlap` so it stops on the refusal, then park the flow: keep its worktree, branches and checkpoint, note +on its bean `parked : blocked by on ; resume from checkpoint when `, stop only this +flow's own processes, and end the subagent. Report the parked flow to the parent at once so the slot is reused. Resume +only from the checkpoint (`--checkpoint`) once the blocker merges or releases the files; never relaunch without +`--checkpoint`, which re-runs intent and plan and leaves duplicate `I-*` branches. Any other refusal (no touch set +declared, discovery unavailable) also stops and is reported. ### Push notifications (ntfy.sh) @@ -269,6 +312,13 @@ while, so they carry only the intent slug and the PR number (no URL or repositor ### Step 5: Terminal Completion & Notification +0. **Wrapper gate and state file**: `run_holon_flow.py` itself exits non-zero when the flow exits 0 but the PR is + missing, the calibration report is absent from the PR diff, or the PR is CONFLICTING/DIRTY, and waits (bounded, 45 + min, via `gh pr checks`) for pending checks before reporting success. It writes `.subagent/flow__state.json` + itself at the end (status, PR number/url, stage reached, consensus, calibration EV when logged, merge state, next + action); the driver only reads it and may add fields. A merged PR is a clean finish. Dry runs skip all of this. A + "spend limit" message is a quota error: with no reset time the wrapper steps down the ladder, with a named reset it + waits. 1. **Write State Artifact**: Record completion summary to `.subagent/flow__state.json`: ```json diff --git a/.agents/skills/holon_flow/scripts/flow_env.py b/.agents/skills/holon_flow/scripts/flow_env.py index 80af137c..42fb5806 100644 --- a/.agents/skills/holon_flow/scripts/flow_env.py +++ b/.agents/skills/holon_flow/scripts/flow_env.py @@ -1,4 +1,4 @@ -"""The environment a `holon flow` child process needs, built from the secrets file so no one exports it by hand. +"""The environment a `holon flow` child process needs, built from the stored token so no one exports it by hand. A `claude-agent` container gets credentials only through `HOLON_AGENT_SETTINGS`: a JSON object whose `env` carries the OAuth token, plus an echo pad that keeps the token past the planner (100 character) and executor (250 character) echo @@ -10,23 +10,60 @@ import json import os +import subprocess +import sys from collections.abc import Mapping from pathlib import Path TOKEN_FILE = "claude-oauth-token" ECHO_PAD = "x" * 300 CLAUDE_AGENTS = ("claude-agent",) +# Where the engine keeps the token since it moved out of the plaintext file: the OS secret store, under the same +# service and account names as `sandbox_executor.claude_keychain`. +KEYCHAIN_SERVICE = "holon" +KEYCHAIN_ACCOUNT = "claude-oauth-token" +KEYCHAIN_LOOKUP = { + "darwin": ("security", "find-generic-password", "-s", KEYCHAIN_SERVICE, "-a", KEYCHAIN_ACCOUNT, "-w"), + "linux": ("secret-tool", "lookup", "service", KEYCHAIN_SERVICE, "account", KEYCHAIN_ACCOUNT), +} +KEYCHAIN_TIMEOUT_SECONDS = 10 # The default 45-minute Stage 3 budget cuts a large plan off mid-execution, and the next attempt starts over. One # week stands in for "no limit" until the engine takes an explicit unlimited budget. EXECUTE_BUDGET_VARIABLE = "HOLON_STAGE_BUDGET_EXECUTE_MINUTES" EXECUTE_BUDGET_MINUTES = "10080" +# Claude Code's experimental code mode, on for every Claude run. A value the caller already set (for example "0" to +# switch it off) is kept. +CODE_MODE_VARIABLE = "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE" +CODE_MODE_DEFAULT = "1" class AuthRouteMissing(RuntimeError): """No credentials for the requested runner; the message names exactly what is missing.""" +def _keychain_token() -> str: + """The token from the OS secret store, or an empty string when there is none or the store cannot be asked.""" + argv = KEYCHAIN_LOOKUP.get( + "darwin" if sys.platform == "darwin" else "linux" if sys.platform.startswith("linux") else "" + ) + if argv is None: + return "" + try: + proc = subprocess.run( + argv, + capture_output=True, + text=True, + timeout=KEYCHAIN_TIMEOUT_SECONDS, + check=False, + stdin=subprocess.DEVNULL, + ) + except (OSError, subprocess.SubprocessError): + return "" + return proc.stdout.strip() if proc.returncode == 0 else "" + + def _claude_token(environ: Mapping[str, str], secrets_dir: Path) -> str: + """The token from the environment, then the legacy secrets file, then the OS secret store.""" token = environ.get("CLAUDE_CODE_OAUTH_TOKEN", "").strip() if token: return token @@ -35,10 +72,14 @@ def _claude_token(environ: Mapping[str, str], secrets_dir: Path) -> str: token = path.read_text().strip() except OSError: token = "" + if not token: + token = _keychain_token() if not token: raise AuthRouteMissing( - f"claude-agent needs credentials, but none were found: set HOLON_AGENT_SETTINGS, set " - f"CLAUDE_CODE_OAUTH_TOKEN, or put the long-lived token in {path} (mode 600, from `claude setup-token`)." + "claude-agent needs credentials, but none were found: set HOLON_AGENT_SETTINGS, set " + f"CLAUDE_CODE_OAUTH_TOKEN, or store the long-lived token from `claude setup-token` in the OS keychain " + f"(service '{KEYCHAIN_SERVICE}', account '{KEYCHAIN_ACCOUNT}'). The legacy file {path} is still read " + "when it exists." ) return token @@ -53,9 +94,17 @@ def build_flow_env( env.setdefault("PYTHONUNBUFFERED", "1") env.setdefault("HOLON_TOKEN_REDUCE", "0") env.setdefault(EXECUTE_BUDGET_VARIABLE, EXECUTE_BUDGET_MINUTES) + if agent in CLAUDE_AGENTS: + env.setdefault(CODE_MODE_VARIABLE, CODE_MODE_DEFAULT) if agent in CLAUDE_AGENTS and not env.get("HOLON_AGENT_SETTINGS", "").strip(): token = _claude_token(env, secrets_dir if secrets_dir is not None else Path.home() / ".holon" / "secrets") env["HOLON_AGENT_SETTINGS"] = json.dumps( - {"env": {"HOLON_ECHO_PAD": ECHO_PAD, "CLAUDE_CODE_OAUTH_TOKEN": token}} + { + "env": { + "HOLON_ECHO_PAD": ECHO_PAD, + "CLAUDE_CODE_OAUTH_TOKEN": token, + CODE_MODE_VARIABLE: env[CODE_MODE_VARIABLE], + } + } ) return env diff --git a/.agents/skills/holon_flow/scripts/run_holon_flow.py b/.agents/skills/holon_flow/scripts/run_holon_flow.py index 67109865..40751985 100755 --- a/.agents/skills/holon_flow/scripts/run_holon_flow.py +++ b/.agents/skills/holon_flow/scripts/run_holon_flow.py @@ -9,6 +9,7 @@ from __future__ import annotations import argparse +import contextlib import json import re import shutil @@ -30,13 +31,14 @@ # Model fallback ladders (.agents/holon-flow.md) FALLBACK_LADDER_CLAUDE = [ - "claude-fable-5", + "claude-fable-5-2", "claude-opus-5-5", "claude-sonnet-4-6", "claude-haiku-4-5", ] FALLBACK_LADDER_ANTIGRAVITY = [ + "gemini-4-neon", "gemini-4-argon", "gemini-4-hydrogen", "gemini-3.8-flash", @@ -54,15 +56,26 @@ "quota exceeded", "quota exhausted", "quota_exhausted", - "usage limit", + "usage limit reached", + "hit your usage limit", + "hit your limit", "rate_limit_exceeded", "too many requests", "http 429", "status 429", "credit balance is too low", + "monthly spend limit", + "spend limit", ] +def enable_line_buffering() -> None: + """Make stdout and stderr line-buffered so each wrapper line reaches a redirected log as it is printed.""" + for stream in (sys.stdout, sys.stderr): + with contextlib.suppress(AttributeError, ValueError, OSError): + stream.reconfigure(line_buffering=True) # type: ignore[union-attr] + + def log_info(msg: str) -> None: print(f"{COLOR_BOLD}INFO:{COLOR_RESET} {msg}") @@ -83,10 +96,19 @@ def log_stage(msg: str) -> None: print(f"\n{COLOR_CYAN}{COLOR_BOLD}=== {msg} ==={COLOR_RESET}\n") +QUOTA_SCAN_TAIL_LINES = 200 + + def is_quota_error(text: str) -> bool: - """Check if output contains quota, credit, or session limit error indicators.""" - lower_text = text.lower() - return any(pattern in lower_text for pattern in QUOTA_ERROR_PATTERNS) + """Check if the end of the output contains quota, credit, or session limit error indicators. + + Only the last ``QUOTA_SCAN_TAIL_LINES`` lines are scanned: a limit error ends the run, so it is near the end, while + the top of the output echoes the intent text, which can mention limits in prose. On 2026-11-23 the bare pattern + "usage limit" matched an intent's sentence about "named-reset usage limits" and stepped a flow down from opus to + sonnet although no limit had been hit (PR #257). + """ + tail = "\n".join(text.splitlines()[-QUOTA_SCAN_TAIL_LINES:]).lower() + return any(pattern in tail for pattern in QUOTA_ERROR_PATTERNS) def resolve_next_model(agent: str, current_model: str) -> tuple[str, str] | None: @@ -169,6 +191,27 @@ def run_prerequisites_check(target_worktree: Path) -> None: log_success(f"Target worktree verified: {target_worktree}") +def truncate_slug(slug: str, limit: int = 32) -> str: + if len(slug) <= limit: + return slug + head = slug[: limit + 1] + cut = head[:limit] if "-" not in head[1:] else head[: head.rindex("-")] + return cut[:limit].rstrip("-") or slug[:limit] + + +def directory_scope_entries(scope, base: Path | None = None) -> list[str]: + """Scope entries that name a directory (trailing slash, or an existing directory under base).""" + if not isinstance(scope, list): + return [] + found = [] + for entry in scope: + if not isinstance(entry, str): + continue + if entry.endswith("/") or (base is not None and (base / entry).is_dir()): + found.append(entry) + return found + + def parse_intent_file(intent_path: Path) -> dict[str, str]: """Parse and validate intent JSON specification.""" if not intent_path.exists(): @@ -204,33 +247,113 @@ def find_flow_pr(target_worktree: Path, slug: str) -> dict | None: return next((pr for pr in prs if slug in pr["headRefName"] or slug in pr["title"].lower()), None) +CHECKS_TIMEOUT_SECONDS = 45 * 60 +CHECKS_POLL_SECONDS = 30 +STATE_DIR = Path(__file__).resolve().parents[4] / ".subagent" + + +def _gh_json(args: list[str], cwd: Path): + """Run `gh`; return its parsed JSON stdout, or None when unreadable (a pending-checks exit still prints JSON).""" + res = subprocess.run(["gh", *args], cwd=cwd, capture_output=True, text=True, check=False) + try: + return json.loads(res.stdout) if res.stdout.strip() else None + except ValueError: + return None + + +def find_flow_pr_any_state(target_worktree: Path, slug: str) -> dict | None: + """The flow's pull request in any state, an open one preferred (a merged one is a clean finish).""" + res = subprocess.run( + ["gh", "pr", "list", "--state", "all", "--json", "number,headRefName,title,url,state", "--limit", "100"], + cwd=target_worktree, + capture_output=True, + text=True, + check=True, + ) + matches = [pr for pr in json.loads(res.stdout) if slug in pr["headRefName"] or slug in pr["title"].lower()] + matches.sort(key=lambda pr: (pr.get("state") != "OPEN", -pr["number"])) + return matches[0] if matches else None + + +def wait_for_pending_checks( + pr_number: int, + target_worktree: Path, + timeout: float = CHECKS_TIMEOUT_SECONDS, + poll: float = CHECKS_POLL_SECONDS, + sleep=None, +) -> tuple[list[dict], bool]: + """Poll the pull request's checks until none is pending or ``timeout`` seconds passed; (checks, still_pending).""" + import time + + sleep = sleep or time.sleep + waited = 0.0 + while True: + checks = _gh_json(["pr", "checks", str(pr_number), "--json", "name,state,bucket"], target_worktree) or [] + pending = [c for c in checks if c.get("bucket") == "pending"] + if not pending: + return checks, False + if waited >= timeout: + return checks, True + log_info(f"PR #{pr_number}: {len(pending)} check(s) still pending ({', '.join(c['name'] for c in pending)}).") + sleep(poll) + waited += poll + + def verify_pr_and_calibration( target_worktree: Path, slug: str, dry_run: bool = False, -) -> None: - """Verify that the flow opened a PR and that the calibration report is included.""" + checks_timeout: float = CHECKS_TIMEOUT_SECONDS, + checks_poll: float = CHECKS_POLL_SECONDS, + sleep=None, +) -> dict: + """Verify the flow's pull request, calibration report, mergeability and checks; return the result. + + The result has ``ok`` (False when any problem was found), ``problems`` (strings), ``pr`` (the pull request dict or + None), ``calibration`` (calibration files in the diff), ``mergeable``, ``merge_state`` and ``checks``. A merged pull + request is a clean finish. A dry run skips every check and is ok. + """ + result: dict = { + "ok": True, + "problems": [], + "pr": None, + "calibration": [], + "mergeable": None, + "merge_state": None, + "checks": [], + } if dry_run: log_info("[DRY-RUN] Skipping post-flow PR verification.") - return + return result + + def problem(message: str) -> None: + log_error(message) + result["ok"] = False + result["problems"].append(message) log_stage("Verifying Pull Request & Calibration Integrity") try: - pr = find_flow_pr(target_worktree, slug) - except Exception as exc: - log_warn(f"Could not query GitHub PRs: {exc}") - return + pr = find_flow_pr_any_state(target_worktree, slug) + except Exception as exc: # noqa: BLE001 - an unverifiable flow is not a finished flow + problem(f"Could not query GitHub PRs: {exc}") + return result if pr is None: - log_warn(f"No open PR found matching slug '{slug}'.") - return + problem(f"No pull request found matching slug '{slug}'.") + return result + result["pr"] = pr pr_number = pr["number"] - pr_url = pr["url"] - head_branch = pr["headRefName"] - log_success(f"Found active flow PR #{pr_number}: {pr_url} ({head_branch})") + log_success(f"Found flow PR #{pr_number}: {pr['url']} ({pr['headRefName']}, {pr.get('state', 'OPEN')})") + if pr.get("state") == "MERGED": + result["merge_state"] = "MERGED" + log_success(f"PR #{pr_number} is already merged; nothing more to verify.") + return result + if pr.get("state") == "CLOSED": + result["merge_state"] = "CLOSED" + problem(f"PR #{pr_number} is closed without merging.") + return result - # Verify calibration report exists in PR diff diff_res = subprocess.run( ["gh", "pr", "diff", str(pr_number), "--name-only"], cwd=target_worktree, @@ -238,36 +361,36 @@ def verify_pr_and_calibration( text=True, check=False, ) - if diff_res.returncode == 0: - files = diff_res.stdout.splitlines() - calib_files = [f for f in files if "_calibration.md" in f] - if calib_files: - log_success(f"Calibration report included in PR diff: {', '.join(calib_files)}") + if diff_res.returncode != 0: + problem(f"Could not read the diff of PR #{pr_number}; the calibration report is unverified.") + else: + result["calibration"] = [f for f in diff_res.stdout.splitlines() if "_calibration.md" in f] + if result["calibration"]: + log_success(f"Calibration report included in PR diff: {', '.join(result['calibration'])}") else: - log_warn( - f"PR #{pr_number} diff does not yet contain a '_calibration.md' report.\n" + problem( + f"PR #{pr_number} diff does not contain a '_calibration.md' report. " "Ensure Stage 5 calibration was committed and pushed to the PR branch." ) - # Check mergeability status against target branch - view_res = subprocess.run( - ["gh", "pr", "view", str(pr_number), "--json", "mergeable,mergeStateStatus"], - cwd=target_worktree, - capture_output=True, - text=True, - check=False, - ) - if view_res.returncode == 0: - pr_info = json.loads(view_res.stdout) - mergeable = pr_info.get("mergeable") - status = pr_info.get("mergeStateStatus") - log_info(f"PR #{pr_number} Mergeable: {mergeable}, State: {status}") - if mergeable == "CONFLICTING": - log_error( - f"PR #{pr_number} has merge conflicts against target branch! " - "Per AGENTS.md Invariant 14, fetch origin/main, resolve ledger conflicts " - "by chronological interleaving, commit, and push." + info = _gh_json(["pr", "view", str(pr_number), "--json", "mergeable,mergeStateStatus"], target_worktree) + if info is not None: + result["mergeable"], result["merge_state"] = info.get("mergeable"), info.get("mergeStateStatus") + log_info(f"PR #{pr_number} Mergeable: {result['mergeable']}, State: {result['merge_state']}") + if result["mergeable"] == "CONFLICTING" or result["merge_state"] == "DIRTY": + problem( + f"PR #{pr_number} has merge conflicts against the target branch (CONFLICTING/DIRTY). " + "Fetch origin/main, keep main's ledger rows in main's order and append only the branch's new rows, " + "commit, and push." ) + else: + problem(f"Could not read the mergeability of PR #{pr_number}.") + + checks, still_pending = wait_for_pending_checks(pr_number, target_worktree, checks_timeout, checks_poll, sleep) + result["checks"] = checks + if still_pending: + problem(f"PR #{pr_number} still has pending checks after waiting {int(checks_timeout)} s.") + return result def execute_flow_process( @@ -280,7 +403,7 @@ def execute_flow_process( print(f" [DRY-RUN] {' '.join(cmd)}") return 0, "" - print(f"\n{COLOR_BOLD}Executing command:{COLOR_RESET} {' '.join(cmd)}\n") + print(f"\n{COLOR_BOLD}Executing command:{COLOR_RESET} {' '.join(cmd)}\n", flush=True) proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, @@ -293,7 +416,7 @@ def execute_flow_process( output_lines: list[str] = [] assert proc.stdout is not None for line in proc.stdout: - print(line, end="") + print(line, end="", flush=True) output_lines.append(line) proc.wait() @@ -347,16 +470,31 @@ def resolve_flow_worktree(target_worktree: Path, slug: str, dry_run: bool = Fals return flow_worktree +def parse_relative_limit_reset(output: str): + """Return the datetime of a relative reset such as "Resets in 51m58s" or "resets in 1h 2m", or None.""" + from datetime import datetime, timedelta + + m = re.search(r"resets\s+in\s+(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?", output, re.I) + if not m or not any(m.groups()): + return None + hours, minutes, seconds = (int(part or 0) for part in m.groups()) + return datetime.now().astimezone() + timedelta(hours=hours, minutes=minutes, seconds=seconds) + + def parse_limit_reset(output: str): """Return the datetime of the usage-limit reset named in ``output`` (e.g. "resets 5:40pm (Australia/Melbourne)"). - Returns None when no reset time is named. The next occurrence of that wall-clock time in the named timezone is - used (today if still ahead, otherwise tomorrow), so daily windows resolve exactly and a weekly reset that names a - time resolves to its next daily occurrence, which is always sooner than doing nothing. + Returns None when no reset time is named. A relative reset ("Resets in 51m58s", as Antigravity prints) is that far + from now. The next occurrence of a named wall-clock time in the named timezone is used (today if still ahead, + otherwise tomorrow), so daily windows resolve exactly and a weekly reset that names a time resolves to its next + daily occurrence, which is always sooner than doing nothing. """ from datetime import datetime, timedelta from zoneinfo import ZoneInfo + relative = parse_relative_limit_reset(output) + if relative is not None: + return relative m = re.search(r"resets\s+(\d{1,2})(?::(\d{2}))?\s*(am|pm)(?:\s*\(([^)]+)\))?", output, re.I) if not m: return None @@ -450,10 +588,41 @@ def run_flow( dry_run: bool = False, wait_on_overlap: bool = True, overlap_poll_seconds: int = OVERLAP_POLL_SECONDS, + outcome: dict | None = None, ) -> int: """Run holon flow with optional automatic fallback ladder on quota errors.""" intent_data = parse_intent_file(intent_path) slug = intent_data["slug"] + directories = directory_scope_entries(intent_data.get("scope"), target_worktree) + if directories: + log_error( + "Intent scope must list files, never directories (a directory becomes broad touch-set globs that block " + f"every concurrent flow at Stage 3 admission): {', '.join(directories)}" + ) + return 2 + outcome = outcome if outcome is not None else {} + effective_intent_path = intent_path + modified = False + + if len(slug) > 32: + truncated_slug = truncate_slug(slug, 32) + intent_data["slug"] = truncated_slug + slug = truncated_slug + modified = True + + touches_budgets = "0380" in intent_path.name or "module_budgets.json" in str(intent_data.get("scope", [])) + if touches_budgets and "module_budget_change" not in intent_data: + intent_data["module_budget_change"] = ( + "Budget should be enforced to all packages, including new packages, not just to flow." + ) + modified = True + + if modified: + temp_intent_path = intent_path.parent / f"intent-modified-{slug}.json" + with open(temp_intent_path, "w", encoding="utf-8") as f: + json.dump(intent_data, f, indent=2) + effective_intent_path = temp_intent_path + target_worktree = resolve_flow_worktree(target_worktree, slug, dry_run=dry_run) run_prerequisites_check(target_worktree) @@ -464,7 +633,7 @@ def run_flow( current_allow_overlap = allow_overlap while True: - cmd = ["holon", "flow", str(intent_path)] + cmd = ["holon", "flow", str(effective_intent_path)] cmd.extend(["--target-worktree", str(target_worktree)]) cmd.extend(["--agent", current_agent]) cmd.extend(["--model", current_model]) @@ -485,10 +654,17 @@ def run_flow( return 1 returncode, output = execute_flow_process(cmd, dry_run=dry_run, env=flow_env) + outcome.update(slug=slug, output=output, agent=current_agent, model=current_model, worktree=target_worktree) if returncode == 0: log_success(f"Holon flow for '{slug}' completed successfully!") - verify_pr_and_calibration(target_worktree, slug, dry_run=dry_run) + verification = verify_pr_and_calibration(target_worktree, slug, dry_run=dry_run) + outcome["verification"] = verification + if not verification["ok"]: + log_error( + "The flow exited 0 but its deliverables are incomplete: " + "; ".join(verification["problems"]) + ) + return 1 return 0 # Flow failed. Check for quota or session exhaustion @@ -613,6 +789,66 @@ def _notify_outcome(intent_path: Path, exit_code: int, target_worktree: Path) -> pass +def build_flow_state(slug: str, exit_code: int, outcome: dict, worktree: Path | None) -> dict: + """The deterministic state record a resuming driver reads (``.subagent/flow__state.json``).""" + import re as _re + + output = outcome.get("output") or "" + verification = outcome.get("verification") or {} + pr = verification.get("pr") or {} + stages: list[str] = [] + if worktree is not None: + with contextlib.suppress(OSError, ValueError): + stages = json.loads((worktree / f".holon/flow/checkpoint-{slug}.json").read_text()).get( + "completed_stages", [] + ) + consensus = next( + (line.strip() for line in reversed(output.splitlines()) if _re.search(r"consensus", line, _re.I)), None + ) + ev = None + for match in _re.finditer(r"\bEV\b\s*[:=]?\s*(-?\d+(?:\.\d+)?)", output): + ev = float(match.group(1)) + merge_state = verification.get("merge_state") + problems = verification.get("problems", []) + if exit_code == 0 and merge_state == "MERGED": + next_action = "run post-pr-merge" + elif exit_code == 0: + next_action = "maintainer merges the pull request" + elif problems: + next_action = "fix: " + "; ".join(problems) + else: + next_action = "diagnose the flow failure and resume from the checkpoint" + return { + "slug": slug, + "status": "completed" if exit_code == 0 else "failed", + "exit_code": exit_code, + "pr_number": pr.get("number"), + "pr_url": pr.get("url"), + "stage_reached": stages[-1] if stages else None, + "completed_stages": stages, + "consensus": consensus, + "calibration_ev": ev, + "calibration_files": verification.get("calibration", []), + "mergeable": verification.get("mergeable"), + "merge_state": merge_state, + "agent": outcome.get("agent"), + "model": outcome.get("model"), + "problems": problems, + "next_action": next_action, + } + + +def write_flow_state( + slug: str, exit_code: int, outcome: dict, worktree: Path | None, state_dir: Path | None = None +) -> Path: + """Write the state file for the flow; returns its path. Never raises into the caller's exit code.""" + state_dir = state_dir or STATE_DIR + state_dir.mkdir(parents=True, exist_ok=True) + path = state_dir / f"flow_{slug}_state.json" + path.write_text(json.dumps(build_flow_state(slug, exit_code, outcome, worktree), indent=2) + "\n") + return path + + def main() -> None: parser = argparse.ArgumentParser(description="Run and monitor the 5-stage Holon flow from a subagent or terminal.") parser.add_argument( @@ -640,7 +876,7 @@ def main() -> None: "--model", type=str, default=FALLBACK_LADDER_ANTIGRAVITY[0], - help="Model tier for the agent runner (default: gemini-4-argon).", + help="Model tier for the agent runner (default: gemini-4-neon).", ) parser.add_argument( "--from-stage", @@ -682,6 +918,10 @@ def main() -> None: args = parser.parse_args() + # Redirected to a file, stdout is block-buffered and the log stays empty until exit; flush every line instead. + enable_line_buffering() + + outcome: dict = {} exit_code = run_flow( intent_path=args.intent, target_worktree=args.target_worktree, @@ -694,9 +934,15 @@ def main() -> None: dry_run=args.dry_run, wait_on_overlap=not args.no_wait_on_overlap, overlap_poll_seconds=args.overlap_poll_seconds, + outcome=outcome, ) if not args.dry_run: - flow_worktree = resolve_flow_worktree(args.target_worktree, parse_intent_file(args.intent)["slug"]) + slug = parse_intent_file(args.intent)["slug"] + flow_worktree = resolve_flow_worktree(args.target_worktree, slug) + try: + write_flow_state(outcome.get("slug", slug), exit_code, outcome, flow_worktree) + except Exception as exc: # noqa: BLE001 - the state file must not change the exit code + log_warn(f"Could not write the flow state file: {exc}") _notify_outcome(args.intent, exit_code, flow_worktree) sys.exit(exit_code) diff --git a/.agents/skills/post_pr_merge/SKILL.md b/.agents/skills/post_pr_merge/SKILL.md index 20a8ba3d..7233cff0 100644 --- a/.agents/skills/post_pr_merge/SKILL.md +++ b/.agents/skills/post_pr_merge/SKILL.md @@ -30,12 +30,14 @@ This skill orchestrates the end-to-end post-merge lifecycle across the Holon eco Bake and reinstall CLI tools to `~/.local/bin/` so subsequent flows run against latest code. - **Step 3: Close Bean with Resolution**: Mark the corresponding bean in `.beans/` as `status: completed` and document the merge commit SHA, PR link, and key technical changes. - - **Step 4: Clean Up PR Worktree & Remote Refs (`clean-workspace`)**: Safely remove the disposable PR worktree and + - **Step 4: Clean Up PR Worktree, Flow Branches & Stale Plans (`clean-workspace`)**: Remove the merged PR's worktree, + its earlier attempts and its flow branches (local and remote), delete every stale plan left by other flows, and prune stale tracking refs. - **Step 5: Refresh Triage & Matrix (`prioritise-beans`)**: Run the triage script to update completion stats and the Active Beans Prioritisation Matrix. - - **Step 6: Commit Harness State & Recommend Next Task**: Commit all updated bean files and triage matrices to the - current operational harness branch and recommend the next priority bean. + - **Step 6: Commit Harness State, Recommend & Backfill Next Task**: Commit all updated bean files and triage matrices + to the current operational harness branch, report next priority beans, and automatically launch the next + highest-priority ready bean via `holon-flow` whenever active concurrent flows are under 4 on hosted runtimes. --- @@ -147,6 +149,62 @@ git -C apps/ fetch origin --prune _Note: Never touch or remove `apps//main`._ +#### 4a. The merged flow's branches and earlier attempts + +The squash merge leaves the flow's own branches behind; delete them, locally and on origin: + +```bash +# Every branch of the merged intent: I--/_, its P-.../_ and E-.../_ children and /calibrated +git -C apps/ for-each-ref --format='%(refname:short)' "refs/heads/I-*-/" | xargs -n1 git -C apps/ branch -D +git -C apps/ for-each-ref --format='%(refname:lstrip=3)' "refs/remotes/origin/I-*-/" | xargs -n1 git -C apps/ push origin --delete +``` + +Earlier attempts of the same bean (the same slug without its `-vN` suffix, e.g. `flow-layered-env-config` beside the +merged `flow-layered-env-config-v2`) are superseded by the merge: remove their worktrees (`worktree remove --force` when +the only leftovers are that attempt's own intent/plan/execution commits or ledger edits) and delete their `I-*-/` +branches the same way. + +#### 4b. Delete stale plans (maintainer, 2026-11-23) + +After every merge, any stale plan is deleted as well, whichever bean it belongs to. A flow worktree holds a **stale +plan** when all of these hold: + +- its branch is an intent or plan branch (`I-.../_` or `I-.../P-.../_`): no execution branch was ever cut from it; +- it has no open pull request and no live process (`ps` shows no `holon flow` / `run_holon_flow.py` / role container + naming its slug); +- `origin/main` has moved since it was cut (`git merge-base --is-ancestor origin/main HEAD` fails), so the plan was made + against code that no longer exists. + +For each one: remove the worktree (`--force`: uncommitted ledger rows or a stub plan file are part of the stale plan), +delete its `I-*-/` branches locally and on origin, delete its `flow-` branch, and set its bean back to +`status: todo` with a one-line note ("stale plan deleted after PR # merged; restart from current main"). Keep the +bean's `todo/intent-*.json`; it is reused for the restart. + +#### 4c. Delete stale worktrees (maintainer, 2026-11-23) + +Stale worktrees are cleaned up as well, not only stale plans. A flow worktree is **stale** when all of these hold: + +- it has no open pull request; +- no live process uses it (`ps` shows no `holon flow`, `run_holon_flow.py`, role container or usage-limit waiter naming + its slug); +- `origin/main` has moved since it was cut; +- nothing has touched it for at least two hours (newest of its last commit and its `.holon/flow/checkpoint-*.json` + mtime), so a flow that is merely between stages is never caught. + +This covers superseded earlier attempts, interrupted execution branches of paused beans and detached leftovers. For each +one: + +1. **Back up first.** If the worktree has commits that exist on no remote branch, or uncommitted changes, save them + before deleting: + `git -C apps/ bundle create /todo/stale-worktree-backups/-.bundle / branches>`, + and copy uncommitted files next to it. Name the bundle in the report. +2. Remove the worktree (`--force`), delete its `I-*-/` and `flow-` branches locally and on origin. +3. Set its bean back to `status: todo` (unless the bean is completed) with a one-line note naming the backup; the bean + restarts from current `main` with a fresh `-vN` intent. + +Never delete a worktree with an open PR or a live process, and never the `main` worktree. List what was deleted, what +was backed up and what was kept in the post-merge report. + --- ### Step 5: Refresh Prioritisation Matrix @@ -165,7 +223,7 @@ npx prettier --write .beans/bean-triage-prioritisation.md --- -### Step 6: Commit Harness State & Recommend Next Task +### Step 6: Commit Harness State, Recommend & Backfill Next Task 1. Stage and commit harness changes: ```bash @@ -174,4 +232,32 @@ npx prettier --write .beans/bean-triage-prioritisation.md git push origin ``` 2. Review the Active Beans Matrix in `.beans/bean-triage-prioritisation.md`. -3. Provide the user with a concise summary of the post-merge actions completed and recommend the next top-priority bean. +3. **Backfill up to 4 concurrent `holon-flow` subagents (hosted runtimes; maintainer, 2026-11-24)**: first list parked + flows (beans noted `parked `) whose blocker was this PR or whose files this PR released, and recommend resuming + them from checkpoint (`--checkpoint`) before any new bean (maintainer, 2026-11-26). Then count currently active + background `holon-flow` subagents that are executing, reviewing or calibrating (parked or blocked flows do not count; + `< 4` on hosted runtimes; local runtimes remain capped at 1). Pick up the highest-priority ready bean from the + refreshed triage (honouring `blocked_by`, solo-sweep rules, and pairwise-disjoint touch sets with active flows; at + most one bean touching a shared hotspot such as `flow.py` or `cli.py` per target) and launch it in the background via + the `holon-flow` skill. +4. Provide the user with a concise summary of the post-merge actions completed, note any newly launched backfill flow + (or why none could start), and recommend the next top-priority beans. + +--- + +### Step 7: Self-Improvement Audit Check + +Count the pull requests merged into `main` of `holon-agentic-coder` and `holon-coherence` since the newest entry in +`.beans/self-improvement-audits.md` (the first entry under `## Entries`): + +```bash +gh pr list --repo /holon-agentic-coder --state merged --base main --json number,mergedAt +gh pr list --repo /holon-coherence --state merged --base main --json number,mergedAt +``` + +1. Count the merges with `mergedAt` after that entry's timestamp, across both repositories. If the log has no entry, + count all merges of the last 7 days. +2. In the final report, state either "self-improvement audit due (N merges since the last audit)" when N is 5 or more, + or "N of 5 merges since the last audit". +3. This skill does not run the audit. The receiving agent launches it per + [`.agents/self-improvement-audit.md`](../../self-improvement-audit.md). diff --git a/.agents/skills/pr_review_loop/FLOW_PR_DRIVER.md b/.agents/skills/pr_review_loop/FLOW_PR_DRIVER.md index 032be096..96a7e388 100644 --- a/.agents/skills/pr_review_loop/FLOW_PR_DRIVER.md +++ b/.agents/skills/pr_review_loop/FLOW_PR_DRIVER.md @@ -56,12 +56,14 @@ below was learned the hard way across PRs #99–#115 and holon-coherence #28–# - **A verdict with no report file on disk is not a vote.** If the Write tool is blocked, write via shell heredoc; no stub at the primary path when falling back. - **Votes count only at the current head.** Any push (yours, the maintainer's, a concurrent session's) invalidates - earlier votes; run the sync phase before every pass and re-review the new head. + earlier votes; run the sync phase before every pass and re-review the new head. Exception (Bean 0372): a merge of the + target branch with only mechanically resolved `holon-knowledge/` conflicts that leaves the PR's own diff unchanged + keeps the votes; wait for CI on the new head and re-review only if it fails. - **Concurrent-PR ledger conflicts are mechanical**: resolve as `origin/main`'s rows unchanged + this PR's own rows - appended (per AGENTS.md: interleave chronologically by `created_at`; no test run needed for ledger-only conflicts), - via a normal merge commit — never a rebase of the flow branch. -- **Quota/credit exhaustion is not a stop**: follow AGENTS.md's fallback ladder (model tier down, then the other runner) - and resume from the checkpoint/saved state. + appended (main's order untouched, only this PR's rows appended by `created_at` among themselves; no test run needed + for ledger-only conflicts), via a normal merge commit — never a rebase of the flow branch. +- **Quota/credit exhaustion is not a stop**: follow AGENTS.md's fallback ladder (model tier down on the same runner; ask + the maintainer before switching runner) and resume from the checkpoint/saved state. - **Tier your subagents**: mechanical passes (CI gating, ledger verification, report collation, finish-only salvage) run at a lower model tier; keep the top tier for blind reviewers and resolvers, stepping down only when the ladder demands it. diff --git a/.agents/skills/pr_review_loop/SKILL.md b/.agents/skills/pr_review_loop/SKILL.md index 96d30406..6ec53846 100644 --- a/.agents/skills/pr_review_loop/SKILL.md +++ b/.agents/skills/pr_review_loop/SKILL.md @@ -48,6 +48,12 @@ resolution step is executed in a dedicated, fresh subagent**. head: votes are cast against the head under review, so after a fix the ensemble re-reviews the new head until a pass produces no new actionable finding. A loop that ends with "no head ever held three clean votes" has not converged, and must say so plainly rather than reporting an aggregate verdict across mismatched heads. + - **Exception: a merge of the target branch that leaves the PR's own diff unchanged keeps the votes** (maintainer, + 2026-11-23; Bean 0372). When the only push since the votes is a merge of `origin/` whose conflicts, if any, + were ledger/KB files under `holon-knowledge/` resolved mechanically, and `git diff` from the merge-base with the + target to the head (excluding `holon-knowledge/**` and calibration reports) is identical before and after, do not + re-review. Wait for every CI check on the new head instead; re-review only if CI fails there or the PR's own diff + changed (a hand-resolved code conflict, a resolver or agent code push). 3. **Deterministic Convergence (Never Pause)**: The loop has **no pause state and never asks for guidance mid-flight**. The only exits are a clean consensus approval posted to the PR, the **max iteration cap** with a final review posted, or the **divergence report** of [principle 12](#12-convergence-rules-bean-0170) (diff size and Nit count both rising @@ -469,8 +475,8 @@ reality, so reviewers never evaluate a diff that no longer exists. Nothing here - Run `git fetch origin main` and `git merge origin/main`. - Resolve the conflicts immediately: - **Ledger-Only Conflicts**: If conflicts are strictly confined to ledgers (`holon-knowledge/ledger/*.jsonl`), - follow the **Ledger-Only Conflict Resolution** procedure: interleave or append the JSON lines chronologically - by `created_at`, verify valid JSON syntax, and skip running test suites. + follow the **Ledger-Only Conflict Resolution** procedure: keep main's rows unchanged in main's order and append + only the branch's own rows by `created_at`, verify valid JSON syntax, and skip running test suites. - **Code/Doc Conflicts**: If conflicts involve non-ledger files, resolve them cleanly, format with Prettier, run tests (`uv run pytest`), and commit. - Push the resolved merge commit to `origin `. @@ -497,8 +503,8 @@ Execute the review pass in a clean, isolated subagent context. - **Model**: Inherit the parent agent's model (`inherit`). If credit or quota runs out on `"inherit"` / `"pro"`, automatically fall back along `Model: "inherit"` / `"pro"` $\rightarrow$ `"flash"` $\rightarrow$ `"flash_lite"` (and similarly step down `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5` or - `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash`) and continue the loop from the - current iteration without losing completed work. + `gemini-4-neon` $\rightarrow$ `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash`) and + continue the loop from the current iteration without losing completed work. - **Prompt Instructions**: > Load and execute the `pr-reviewer` skill for `` in **Dry-Run Mode (`--dry-run`)** with > **Single-Agent Mode** enabled. @@ -635,9 +641,9 @@ Wait for the subagent to complete and inspect its report. 1. Run `git fetch origin main` and `git merge origin/main`. 2. Resolve the conflicts immediately: - **Ledger-Only Conflicts**: If conflicts are strictly confined to ledgers - (`holon-knowledge/ledger/*.jsonl`), follow the **Ledger-Only Conflict Resolution** procedure: interleave - or append the JSON lines chronologically by `created_at`, verify valid JSON syntax, and skip running test - suites. + (`holon-knowledge/ledger/*.jsonl`), follow the **Ledger-Only Conflict Resolution** procedure: keep main's + rows unchanged in main's order and append only the branch's own rows by `created_at`, verify valid JSON + syntax, and skip running test suites. - **Code/Doc Conflicts**: If conflicts involve non-ledger files, resolve them cleanly, format with Prettier, run tests (`uv run pytest`), and commit. 3. Push the resolved merge commit to `origin `. @@ -748,8 +754,8 @@ Execute the resolution pass in a clean, isolated subagent context. - **Model**: Inherit the parent agent's model (`inherit`). If credit or quota runs out on `"inherit"` / `"pro"`, automatically fall back along `Model: "inherit"` / `"pro"` $\rightarrow$ `"flash"` $\rightarrow$ `"flash_lite"` (and similarly step down `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5` or - `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash`) and continue the loop from the - current iteration without losing completed work. + `gemini-4-neon` $\rightarrow$ `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash`) and + continue the loop from the current iteration without losing completed work. - **Target Worktree**: Locate the target repository worktree under `apps/holon-agentic-coder/{branch}`, `apps/holon-coherence/{branch}`, or repository root. - **Prompt Instructions**: diff --git a/.agents/skills/prioritise_beans/scripts/prioritise_beans.py b/.agents/skills/prioritise_beans/scripts/prioritise_beans.py index d869c7ac..405933e6 100755 --- a/.agents/skills/prioritise_beans/scripts/prioritise_beans.py +++ b/.agents/skills/prioritise_beans/scripts/prioritise_beans.py @@ -30,18 +30,22 @@ # built from the previous checkpoint date is used instead. EXECUTIVE_SUMMARY_NARRATIVE: list[str] = [ ( - "The harness drives every `holon-agentic-coder` change through the 5-stage Holon flow and the `pr-review-loop`, " - "and the maintainer merges each pull request into `main`. On 2026-11-23 every active bean was audited against " - "current `main` (`holon-agentic-coder` `0f0089d`, `holon-coherence` `baf5c65`, `dev-env` `68ddec9`) and merged " - "PRs #221–#241 plus `dev-env` PRs #31–#33 and #36–#38: duplicate Bean 0353 was scrapped in favour of Bean 0354, " - "stale `blocked_by` links and outdated 'in flight in another session' markers (`0322` and `0346` completed; " - "`0265`, `0270` idle) were cleared, and new beans `0350`–`0352` and `0354`–`0361` were triaged. HAC PRs #243 " - "(`0155`, `CLEAN`), #244 (`0175`, `UNSTABLE`), and #245 (`0191`, `UNSTABLE`) are open, while `dev-env` " - "**Bean 0361** (`PR #33`), **Bean 0351** (`PR #36`), **Bean 0364** (`PR #37`), and **Bean 0365** (`PR #38`) " - "have all merged into `main` (zero open `dev-env` PRs)." + "The harness drives every `holon-agentic-coder` change through the 5-stage Holon flow and the " + "`pr-review-loop`, and the maintainer merges each pull request into `main`. On 2026-11-24 the " + "bean set was re-audited: `holon-agentic-coder` `main` moved to PR #270 (`0387`, merge commit " + "`bfbd9f4`), after PR #269 (`0226`, merge commit `407ad39`) earlier the same morning. Beans " + "`0387` and `0389` completed today, and Bean `0406` (harness, uncommitted on " + "`docs/harness-20261123`) is complete. Beans `0415` to `0421` were logged since the last run (`0415` and `0421` closed after the maintainer raised Docker memory to 32 GB); " + "`0419` is the CI timing gate failure that withdrew PR #270's consensus. Maintainer priority for " + "today: cutting pipeline time first, with `0403` and `0405` in flight; `0407` (P0) stops " + "re-running the full review when nothing reviewable changed; `0255` (P0) makes the resolver start " + "on the first pipeline failure and fix every failure of the run." + ), + ( + "Concurrent flows on overlapping files forced repeated syncs and re-reviews earlier on (141 " + "review-loop passes, about 10M+ tokens), so flows that touch the same files still run one after " + "another; only flows with disjoint touch sets run together." ), - "", - "Concurrent flows on overlapping files forced repeated syncs and re-reviews earlier on (141 review-loop passes, about 10M+ tokens), so flows that touch the same files still run one after another; only flows with disjoint touch sets run together.", ] # Closing paragraph(s) of the Executive Summary (after the statistics bullets). @@ -381,7 +385,7 @@ "**2026-11-21:** every active bean was audited against `origin/main`. Locations moved by the `flow/` and `cli/` package splits were corrected in Beans 0157, 0175, 0181, 0191-0194, 0200, 0231, 0255 and 0269; Bean 0146 and Bean 0197 were narrowed to what remains after PR #213; the blocked-by links to completed or scrapped Beans 0168, 0185, 0187 and 0195 were cleared. New: **Bean 0347** (Stage 4 says halted for human review although consensus approval was reached and the flow carries on to Stage 5). The audit found no bean already done by PRs #209 to #220 beyond those already completed.", "", ( - "**2026-11-22 to 2026-11-23:** twenty target PRs merged across `holon-agentic-coder` and `dev-env`: " + "**2026-11-22 to 2026-11-23:** twenty-one target PRs merged across `holon-agentic-coder` and `dev-env`: " "**Bean 0322** (HAC #222, `e2ba3c2`: complete removal of `gemini-agent`), **Bean 0172** (HAC #225, `4811599`: " "`unlimited` stage and turn budgets), **Bean 0348** (HAC #226, `3ee9c4e`: admission uses actual PR files), " "**Bean 0199** (HAC #227, `43d278c`: ledger query and knowledge index decomposed), **Bean 0193** (HAC #228, " @@ -397,60 +401,73 @@ "`425ff6fe`: Fish Conda/Homebrew hooks & clean-env multi-shell tests), #36 (**Bean 0351**, `a9dacf46`: " "Ansible `deb822_repository` & task hygiene, unconditional WSL exclusion of Ghostty/Warp, and `tmux` " "`set -g mouse on`), #37 (**Bean 0364**, `4b1391c3`: define `devenv_user`, skip WSL GUI terminal wizard " - "prompt, and audit Ansible Jinja2 variables in tests), and #38 (**Bean 0365**, `68ddec98`: disable " + "prompt, and audit Ansible Jinja2 variables in tests), #38 (**Bean 0365**, `68ddec98`: disable " "`expand_argument_vars` on Conda clean-shell command tasks, enforce static `$VAR` command hygiene, and add " - "hermetic `ansible-playbook` verification test). Open **HAC PRs #243** (`0155`), **#244** (`0175`), and " - "**#245** (`0191`) remain in progress, and new **Bean 0360** logs duplicate `P-` branch creation after an " - "interrupted Stage 2. Pre-triage audit (2026-11-23): **Bean 0353** scrapped as a duplicate of `0354`; stale " - "blockers cleared on `0189`, `0197`, `0198`, `0265`, `0270`, `0333`; `0176` re-measured at 144 files; `0181` " - "re-pointed to `entrypoint/executor/run.py`; new beans `0350`–`0352` and `0354`–`0361` triaged." + "hermetic `ansible-playbook` verification test), #39 (**Bean 0366**, `eeb2032d`: install `zsh` on " + "Linux/WSL, unify NVM storage strictly under `versions/node`, eliminate `versions/node/versions` symlink loop, " + "and add hermetic Fish migration tests), and #40 (**Bean 0370**, `22ca3862`: add tracked " + "`dotfiles/zsh/.zprofile`, isolate `node` shell checks, fix Fish `follow: true` & Homebrew `path` dirs, and " + "add real Ubuntu/WSL converge CI + Docker `make test-ubuntu`). Those PRs (#243, #244 and #245) were open at the morning checkpoint and merged on 2026-11-23," + "(`0191`) are merged, and new **Bean 0360** logs duplicate `P-` branch creation after an interrupted " + "Stage 2. Pre-triage audit (2026-11-23): **Bean 0353** scrapped as a duplicate of `0354`; stale blockers " + "cleared on `0189`, `0197`, `0198`, `0265`, `0270`, `0333`; `0176` re-measured at 144 files; `0181` re-pointed " + "to `entrypoint/executor/run.py`; new beans `0350`–`0352` and `0354`–`0361` triaged." + ), + "", + ( + "**2026-11-23 (post-#266):** PR #266 (Bean `0374`, sidecar scratch outside worktrees) merged to `main` " + "(`e0251206`), bringing merged HAC PRs today to 24 and completed beans in this wave to 18. Open HAC PRs: " + "#263 (`0378`) and #267 (`0382`) refreshing ledger conflicts via `--from-stage calibrate`, plus #265 (`0376` " + "child 3, waiting on the 600 s macOS CI timing ceiling decision). Backfilled Bean `0381` across both " + "`holon-coherence` and `holon-agentic-coder`. Newly logged beans `0389` and `0390` added to triage." ), ] -MILESTONES_HEADING = "## Key Milestones Completed (Beans 0080 – 0365)" +MILESTONES_HEADING = "## Key Milestones Completed (Beans 0080 – 0406, plus 0360, 0374)" # Hand-authored replacement for the generated "Recommended Next Execution # Sequence" section, used whenever active beans exist. Inline data: keep it in # step with the matrix at every checkpoint. NEXT_EXECUTION_SEQUENCE: list[str] = [ ( - "**Start here (2026-11-23):** every active bean was audited against current `main` (`holon-agentic-coder` " - "`0f0089d`, `holon-coherence` `baf5c65`, `dev-env` `68ddec9`) and open HAC PRs #243 (`0155`), #244 (`0175`), " - "#245 (`0191`). PR #222 (0322), PR #225 (0172), PR #226 (0348), PR #227 " - "(0199), PR #228 (0193), PR #229 (0349), PR #230 (0347, 0354), PR #234 (0196), PRs #235 & #237 (0358), PR #236 " - "(0194), PR #238 (0357), PR #239 (0356), PR #240 (0355), PR #241 (0189), and `dev-env` PRs #31–#33 (0344, " - "0346, 0361), #36 (0351), #37 (0364), and #38 (0365) have merged. Run one flow at a time within a lane; lanes " - "run together only when their touch sets are disjoint." + "**Checkpoint (2026-11-24):** pipeline time is the first priority: `0403` and `0405` are in " + "flight to cut it, and nothing that changes the review loop starts until they land. Run one flow " + "at a time within a lane; lanes run together only when their touch sets are disjoint." ), "", + ("**Ordered sequence (one line of reasoning each):**"), ( - "**In-flight (active flows / open PRs):** **HAC PR #243** (`0155`, `CLEAN`), **HAC PR #244** (`0175`, " - "`UNSTABLE`), and **HAC PR #245** (`0191`, `UNSTABLE`)." + "1. **0403 and 0405** (in flight, P1): cut pipeline time first, because every flow waits on CI " + "and the bookkeeping-only skip and test trim shorten all of them." ), - "", ( - "**Ready now in parallel (disjoint from PRs #243/#244/#245 and each other):**\n" - "- **HAC beads removal:** **Bean 0333** (P1, M — removes `.beads/` pilot, unblocks GitHub Issues migration `0215`–`0218` and `0317`).\n" - "- **HAC runner/model lane (one at a time):** **Bean 0270** (P1, M — dynamic model discovery), **Bean 0350** (P1, M — `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1`), **Bean 0198** (P2, M — `RunnerSpec` registry), or **Bean 0225** (P2, M — OS keychain Claude token).\n" - "- **HAC calibration lane:** **Bean 0197** (P2, M — `calibration/` package; `0355` merged in PR #240).\n" - "- **HAC documentation / cleanup (unblocked now that PR #230/#241 merged):** **Bean 0174** (P1, M — env var reference), **Bean 0359** (P3, XS — PR #230 deferred nit D-1), and **Bean 0200** (P2, M — remove `token_reduction` copy, now unblocked by `0189`), **Bean 0269** (P3, XS — PR #158 nits, sequence with `0197`).\n" - "- **HAC Stage 2 / ledger / config:** **Bean 0360** (P1, S — interrupted Stage 2 duplicate `P-` branch), **Bean 0181** (P2, M — `/_` only on branch refs).\n" - "- **Independent / host / `holon-coherence`:** **Bean 0226** (P2, L — operator-run sub-1B e2e), **Bean 0141** (P3, M — host vMLX tuning), **Bean 0142** (P2, L — benchmark), and the `holon-coherence` slice of **Bean 0153** (P2 — all coherence decompositions are merged)." + "2. **0404 with 0419** (P1, fix together): the timing gates fail green jobs on slow runners, " + "which forces re-runs and withdrawn consensus, so they cost pipeline time directly." ), - "", ( - "**Queued behind PRs #243 / #244 / #245 (file overlap):**\n" - "- **CLI split & config lane (after PR #243/#244):** **Bean 0265** (`cli/__init__.py` split) -> **Bean 0173** (layered `.env`, after `0155` & `0174`), **Bean 0157** (sidecar opt-in), **Bean 0223** (CLI flag/env audit).\n" - "- **Review-loop lane (after PR #245 `0191`):** **Bean 0192** (`ReviewLoop` object), **Bean 0255** (streaming resolvers), **Bean 0352** (`gh webhook forward` + cheap polling), **Bean 0231** (raw count nit).\n" - "- **Solo repo-wide sweep:** **Bean 0176** (144 test files, runs alone with zero other HAC PRs in flight).\n" - "- **GitHub Issues migration chain:** **Bean 0333** -> **Bean 0215** (harness importer) + **Bean 0216** (flow `work_item`) -> **Bean 0217** (`holon-coherence`) + **Bean 0317** (Projects board) -> **Bean 0218** (port skills & retire harness).\n" - "- **Umbrella / per-package / draft:** **Bean 0152** (umbrella), **Bean 0153** (remove comments/docstrings per package after split), **Bean 0340** (draft module-budget revisit; awaits maintainer authorisation)." + "3. **0371** (P0, needs the maintainer's bot token or GitHub App first): ledger conflicts drive " + "most churn, and it touches only ledgers, so it can run in its own lane beside the review-loop " + "work." ), - "", ( - "**Rules:** never run concurrent flows whose touched files overlap; no stage before merge halts for human review; " - "target suites use `uv run pytest` only; flows run in dedicated `flow-` worktrees off `origin/main`. " - "`HOLON_STAGE_BUDGET_*` accepts `unlimited` (Bean 0172)." + "4. **0376** (P0, in progress): it is already running and owns the in-flow conflict resolver, so " + "it finishes before any other review-loop change." + ), + ( + "5. **0407** (P0): stop re-running the full ensemble when nothing reviewable changed; it changes " + "the review loop, so it runs alone after 0376 lands and not together with 0255." + ), + ( + "6. **0255** (P0): the resolver starts on the first pipeline failure and fixes every failure of " + "the run; it goes after 0407 so the skip rule is in place before the resolver changes the loop." + ), + ( + "7. **0409** (P1): a rejected finding or a no-change resolver pass should not start another full " + "review; it builds on 0407 and 0255, so it follows them." + ), + ( + "8. **0197 and 0216** (in progress, P2): held behind the pipeline-time flows, so they start only " + "after 0403, 0404, 0405 and 0419 land and the faster pipeline is live." ), ] @@ -459,168 +476,434 @@ # judgement rather than a truncated first paragraph. Insertion order is the # matrix row order (priority blocks, hand-curated within each block). OVERRIDES: dict[str, dict[str, str]] = { + "0407": { + "priority": "**P0**", + "impact": "High", + "sizing": "M", + "domain": "Flow / Architecture", + "notes": "Maintainer finding: the full review ensemble re-runs when nothing reviewable changed (mechanical merge, pipeline failure). Only the pipeline pass and the consensus pass matter.", + }, + "0376": { + "title": "The flow resolves file conflicts itself at every stage: an in-flow conflict resolver", + "priority": "**P0**", + "impact": "High", + "sizing": "L", + "domain": "Flow / Merge conflicts / Stages", + "notes": "In progress, paused on PR #265: child PRs #259 (`sync_with_target`) and #262 (containerised conflict-resolver role) merged into its plan branch; PR #265 (sub-intent 3) passed Stage 4 (`3/3` APPROVED), Stage 5 calibration, and 6,584 unit tests on both OSes, but failed `unit (macos-latest)` CI Timing Gate twice on the 600 s ceiling (`658 s` and `728 s`). Awaits maintainer routing decision before sub-intents 4–5.", + }, + "0371": { + "title": "Ledgers stop conflicting: per-flow pending ledger fragments, promoted into the canonical ledgers on main", + "priority": "**P0**", + "impact": "High", + "sizing": "L", + "domain": "Flow / Ledger / Merge conflicts", + "notes": "Todo, blocked on a maintainer step: the bot token or GitHub App allowed to push to `main` past branch protection. Ledger and KB-index conflicts hit PRs #244, #248, #250, #251 and #252 on 2026-11-23.", + }, + "0255": { + "title": '"Streaming per-issue resolvers during Stage 4 CI & review with single consolidated commit"', + "priority": "**P0**", + "impact": "High", + "sizing": "L", + "domain": "Review Loop / Concurrency", + "notes": "Maintainer 2026-11-24: the resolver starts on the first pipeline failure and fixes every failure of the run. Changes the review loop with 0376 and 0407, so run in sequence, never together; also overlaps 0192 on `flow/review/loop.py`.", + }, + "0378": { + "title": "Stale-calibration warning fires on a mechanical merge of main and is not cleared when the fresh report lands", + "priority": "**P1**", + "impact": "High", + "sizing": "S", + "domain": "Flow / Stage 5 / Calibration", + "notes": "In progress: PR #263 (`3/3` APPROVED, Stage 5 calibrated) hit a ledger-only conflict on `executions.jsonl` after PR #266 merged; refreshing via `--from-stage calibrate`. Touches `calibrate_rerun.py`, `calibrate_stale_warning.py`, and `flow/stages/calibrate.py`.", + }, "0360": { - "title": "Resume after an interrupted plan stage creates a duplicate P- branch", + "title": '"Resume after an interrupted plan stage creates a duplicate P- branch"', "priority": "**P1**", "impact": "High", "sizing": "S", "domain": "Flow / Stage 2 / Checkpoint", - "notes": "Ready in Stage 2 plan/checkpoint lane (`PR #239` merged). Record pushed `P-` branch atomically with push or adopt existing pushed `P-` branch on resume.", + "notes": "Completed via PR #264 (`f49340f`). Stage 2 records pushed `P-` branches and resumes adopt existing pushed `P-` branches.", + }, + "0374": { + "title": "Sidecar wire logs and cache land in the target worktree's todo/ and get committed to the execution branch", + "priority": "**P1**", + "impact": "High", + "sizing": "S", + "domain": "Flow / Sidecar / Isolation", + "notes": "Completed via PR #266 (`e0251206`). Sidecar defaults moved to `~/.holon/` and Stage 3 commits exclude scratch files.", + }, + "0382": { + "title": "The model alias 'fable' resolves to claude-opus-5-5; add claude-fable-5-2 to the model registry", + "priority": "**P1**", + "impact": "High", + "sizing": "S", + "domain": "Models / Runner", + "notes": "In progress: PR #267 (`3/3` APPROVED, Stage 5 calibrated) hit a ledger-only conflict after PR #266 merged; refreshing via `--from-stage calibrate`. Shares `agent_defaults.py` with `0270` and `0350`.", }, - "0333": { - "title": "GitHub Issues replace beads as the target tracker; remove the beads pilot from holon-agentic-coder", + "0391": { "priority": "**P1**", "impact": "High", "sizing": "M", - "domain": "Issue Tracking / Decision", - "notes": "Ready now (disjoint from PR #230; 0321 and 0322 merged). Removes `.beads/config.yaml`, `bd` install in Dockerfile/bake, `test_beads_integration.py`, and beads docs. Unblocks `0215`–`0218` and `0317`.", + "domain": "Ledger / Observability", + "notes": "Stage 3 stops after an overlap wait when merging main into the plan branch conflicts only in the ledgers. Settle ledger conflicts mechanically; overlaps 0376.", }, - "0270": { - "title": "Discover runner models dynamically through each harness instead of the hardcoded model table", + "0392": { + "priority": "**P1**", + "impact": "Medium", + "sizing": "M", + "domain": "Build / DevEx", + "notes": "Stage 4 resolver runs repo-wide Prettier and mutates untouched historical plans; scope formatting to the touched files.", + }, + "0393": { + "priority": "**P1**", + "impact": "Medium", + "sizing": "M", + "domain": "Build / DevEx", + "notes": "A pre-flight probe that replied OK but exited late is classed UNKNOWN and aborts the flow before Stage 3.", + }, + "0394": { "priority": "**P1**", "impact": "High", "sizing": "M", + "domain": "Build / DevEx", + "notes": "Umbrella epic: ranked recommendations for removing unnecessary waits, ordered by time saved; concrete items are 0395, 0399, 0400 and 0403.", + }, + "0395": { + "priority": "**P1**", + "impact": "High", + "sizing": "L", "domain": "Flow / Architecture", - "notes": "Ready now (runner/quota block cleared; 0262 and 0322 merged; disjoint from PR #230). Replaces hardcoded `RUNNER_CAPABILITIES` in `agent_defaults.py` with per-harness discovery. Sequence with `0198` and `0350` on `agent_defaults.py`.", + "notes": "Stage 3 works during an overlap wait instead of idling until the blocking pull request merges. Large; queue after the live flows on the same stage files.", }, - "0350": { - "title": "Enable Claude Code code mode (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1) for every Claude run", + "0396": { + "priority": "**P1**", + "impact": "Medium", + "sizing": "M", + "domain": "Skills / Tooling", + "notes": "A flow run should survive the agent session that started it; detach the run from the session.", + }, + "0397": { "priority": "**P1**", "impact": "High", "sizing": "M", - "domain": "Claude / Config", - "notes": "Ready now (disjoint from PR #230). Direct harness edit (`flow_env.py`, `.claude/settings.json`) plus HAC flow on `agent_runner.py` / `agent_defaults.py` / `role_dispatcher.sh` / `doctor`. Sequence with `0270` and `0198`.", + "domain": "Ledger / Observability", + "notes": "Resume adopts a completed, pushed execution branch instead of executing Stage 3 again. Related to 0375 and 0360.", }, - "0155": { - "title": "General `HOLON_*` forwarding puts credential-shaped values on the docker argv", + "0399": { "priority": "**P1**", "impact": "High", "sizing": "M", - "domain": "Security", - "notes": "In progress in HAC PR #243 (`CLEAN`). Send every `HOLON_*` value through the 0600 env-file and widen fuzz assertions to all forwarded names.", + "domain": "Build / DevEx", + "notes": "CI waits react within seconds of a check finishing instead of polling every two minutes.", }, - "0175": { - "title": "Check GitHub token scopes before Stage 3 when the plan touches workflow files", + "0403": { "priority": "**P1**", "impact": "High", - "sizing": "S", - "domain": "Holon Flow / GitHub", - "notes": "In progress in HAC PR #244 (`UNSTABLE`). Pre-flight `workflow` scope when touch set hits `.github/workflows/**` and warn in `holon doctor`.", + "sizing": "L", + "domain": "Build / DevEx", + "notes": "In progress. No full CI run for commits that only touch bookkeeping files.", + }, + "0404": { + "priority": "**P1**", + "impact": "High", + "sizing": "M", + "domain": "Build / DevEx", + "notes": "The 600 s timing ceiling on the macOS unit job fails pull requests on runner variance; fix the ceiling or shrink the suite (0405).", }, - "0174": { - "title": "Document every environment variable holon reads, in one generated and CI-checked reference", + "0405": { "priority": "**P1**", "impact": "Medium", "sizing": "M", - "domain": "Documentation / Config", - "notes": "Ready now (`0172` in PR #225 and `0347`/`0354` in PR #230 merged). Precursor to `0173` (layered `.env`).", + "domain": "Build / DevEx", + "notes": "In progress. Remove unnecessary unit tests: ubuntu about 4 min, workspace survival about 7 min, macOS over 8 min.", }, - "0265": { - "title": "Split `cli/__init__.py` into focused modules (move only), like the `flow/` package", + "0408": { + "priority": "**P1**", + "impact": "Medium", + "sizing": "M", + "domain": "Build / DevEx", + "notes": "Run the CI hygiene and lint checks (Prettier, ruff, JSON and JSONL validity, file growth) locally before every push; a CI-caught failure costs a full pipeline.", + }, + "0409": { "priority": "**P1**", "impact": "High", "sizing": "L", - "domain": "Refactor / Architecture", - "notes": "Sequence after PR #243 (`0155`) / #244 (`0175`) which touch `cli/__init__.py`.", + "domain": "Flow / Architecture", + "notes": "A finding the resolver rejected, or a resolver pass that changed nothing, must not start another full review.", }, - "0191": { - "title": "One GitHub adapter owns every `gh` call (PR, CI probe, mergeability, review posting)", + "0410": { "priority": "**P1**", "impact": "High", "sizing": "M", - "domain": "GitHub / Architecture", - "notes": "In progress in HAC PR #245 (`UNSTABLE`). Unblocks `0192`.", + "domain": "Flow / Architecture", + "notes": "Remove the conflict magnets: generated README and env docs, and a module budget file that does not serialise flows. Flows waited 39.8 hours on each other in the period.", }, - "0192": { - "title": "`run_review_loop` and `run_review_stage` become a `ReviewLoop` object with named steps", + "0411": { "priority": "**P1**", "impact": "High", - "sizing": "L", - "domain": "Review Loop / Refactor", - "notes": "Blocked by `0191`. `flow/review/loop.py` is 936 lines. Sequence one at a time in the review-loop lane with PR #230, `0255`, and `0231`.", + "sizing": "M", + "domain": "Flow / Architecture", + "notes": "Harness instructions contradict each other on runner switching, model ladders and file size; subagents get different answers.", }, - "0255": { - "title": "Streaming per-issue resolvers during Stage 4 CI & review with single consolidated commit", + "0215": { + "title": '"Deterministic beans-to-GitHub-Issues importer and real-data dry run"', "priority": "**P1**", "impact": "High", - "sizing": "L", - "domain": "Review Loop / Concurrency", - "notes": "Queued behind PR #230 (overlaps `flow/review/loop.py`, `entrypoint/review_loop.py`). One at a time with `0191`, `0192`, `0231`.", + "sizing": "S", + "domain": "Issue Tracking / Migration", + "notes": "Ready now: Bean 0333 completed (PR #258), so no blocker remains. Harness-side importer only, no target flow. Unblocks 0217, 0218 and the 0317 import.", }, - "0157": { - "title": "`holon flow` auto-enables the mitmproxy sidecar; role containers cannot reach it", + "0384": { + "title": "The 90 s stall budget cuts long-thinking models: every Fable 5.2 reviewer failed and the loop retried unchanged", "priority": "**P1**", "impact": "High", "sizing": "S", - "domain": "Holon Flow / Proxy", - "notes": "Queued behind PR #230 (overlaps `flow/context.py`) and sequenced with `0265` (`cli/__init__.py`). Workaround: `HOLON_TOKEN_REDUCE=0`.", + "domain": "Flow / Budgets / Stage 4", + "notes": "Ready, but overlaps 0376 on the review loop: start after 0376 lands. `HOLON_TURN_STALL_SECONDS` defaults to 90 s; long-thinking models such as Fable 5.2 stream nothing for longer than that.", }, - "0215": { - "title": "Deterministic beans-to-GitHub-Issues importer and real-data dry run", + "0350": { + "title": '"Enable Claude Code code mode (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1) for every Claude run"', + "priority": "**P1**", + "impact": "High", + "sizing": "M", + "domain": "Claude / Config", + "notes": "In progress in parallel Claude Code session (`flow-claude-code-mode-default-on`). Harness edit (`flow_env.py`, `.claude/settings.json`) plus HAC `agent_runner.py` / `agent_defaults.py`. Sequence with `0382` on `agent_defaults.py`, before `0270`.", + }, + "0270": { + "title": '"Discover runner models dynamically through each harness instead of the hardcoded model table"', + "priority": "**P1**", + "impact": "High", + "sizing": "M", + "domain": "Flow / Architecture", + "notes": "Ready after 0382 and 0350 (same `agent_defaults.py`). Replaces hardcoded `RUNNER_CAPABILITIES` with per-harness discovery.", + }, + "0381": { + "title": "Bare holon flow resume keeps token reduction on: every reviewer fails with cache_control.ttl 400", + "priority": "**P1**", + "impact": "High", + "sizing": "M", + "domain": "Flow / Token reduction / Stage 4", + "notes": "In progress across both repos (backfilled after PR #266 merged): `holon-coherence` (`fix-cache-control-ttl-order`) and `holon-agentic-coder` (`token-reduce-opt-in-resume`), disjoint from `0376`, `0378`, `0382`, and `0350`.", + }, + "0375": { + "title": "Stage 3 resume ignores an interrupted execution branch that has commits but no ledger row", "priority": "**P1**", "impact": "High", "sizing": "S", - "domain": "Issue Tracking / Migration", - "notes": "Harness work. Blocked by `0333` (remove beads pilot & finalise decision). Converts open beans to GitHub Issues with real-corpus dry run; unblocks `0217`, `0218`, and `0317`.", + "domain": "Flow / Stage 3 / Resume", + "notes": "Ready (`0360` merged in PR #264), overlaps `0376` on `flow/stages/execute.py`: start after `0376` lands (or wait on admission). Stage 3 resume must adopt an interrupted execution branch that has commits but no `executions.jsonl` row.", }, - "0173": { - "title": "holon loads layered .env files (specific overrides broad) that every sandbox stage inherits", + "0390": { + "title": "Two runners can drive the same flow checkpoint at once; nothing locks a flow or a bean against a second launch", + "priority": "**P1**", + "impact": "High", + "sizing": "S", + "domain": "Flow / Concurrency", + "notes": "Queued after `0381` (`flow/checkpoint.py`) and `0376`. Exclusive checkpoint/worktree lock in `holon flow` plus atomic bean claim and duplicate-launch guard in `run_holon_flow.py`.", + }, + "0368": { + "title": "Submodule gitfile left with container paths breaks host-side git in the flow worktree", "priority": "**P1**", "impact": "High", "sizing": "M", - "domain": "Holon Flow / Config", - "notes": "Sequence after `0155`, `0174`, and `0265` (touches `cli/` and `role_dispatcher.sh`).", + "domain": "Flow / Git / Stage 5", + "notes": "Ready, but overlaps 0376 on `flow/stages/calibrate.py`: start after 0376 lands. Repair or reject a submodule gitfile that points at container paths before host-side git runs.", + }, + "0383": { + "title": "Stage 5 waits for CI twice and overruns its 10-minute budget; no per-step timing breakdown", + "priority": "**P1**", + "impact": "High", + "sizing": "M", + "domain": "Flow / Stage 5 / CI", + "notes": "Ready, but overlaps 0376 and 0378 on `flow/stages/calibrate.py`: start after both land. Stage 5 waits for CI twice (11 min 57 s and 9 min 54 s on PR #260); add a per-step timing breakdown.", + }, + "0265": { + "title": '"Split `cli/__init__.py` into focused modules (move only), like the `flow/` package"', + "priority": "**P1**", + "impact": "High", + "sizing": "L", + "domain": "Refactor / Architecture", + "notes": "Ready. `cli/__init__.py` is 690 lines with 16 top-level definitions (was 2,026). It still holds the token-reduction proxy setup, so take 0381 and 0374 first. 0379 and 0380 wait for it.", }, "0176": { - "title": "Remove every unittest reference from holon-agentic-coder; the suite is pytest only", + "title": '"Remove every unittest reference from holon-agentic-coder; the suite is pytest only"', "priority": "**P1**", "impact": "High", "sizing": "L", "domain": "Tests", - "notes": "Re-measured 2026-11-23 on `main` (`b22258d`): **144** tracked files mention `unittest`. Runs alone with zero other HAC PRs in flight (after PR #230 merges).", + "notes": "Ready; run alone with no other HAC flow or PR in flight. Re-measured on `main` (`7225685`) at 144 tracked files; touches nearly every test file.", + }, + "0192": { + "title": '"`run_review_loop` and `run_review_stage` become a `ReviewLoop` object with named steps"', + "priority": "**P1**", + "impact": "High", + "sizing": "L", + "domain": "Review Loop / Refactor", + "notes": "Unblocked: 0191 completed (PR #260). Overlaps 0376 on `flow/review/loop.py`: start after 0376 lands.", }, "0152": { - "title": "Audit long files; decompose oversized functions (flow.py, cli.py first)", + "title": '"Audit long files; decompose oversized functions (flow.py, cli.py first)"', "priority": "**P1**", "impact": "High", "sizing": "XL", "domain": "Refactor / Concurrency", - "notes": "Umbrella. Coherence (`0186`, `0203`–`0208`) and HAC (`0185`, `0188`, `0190`, `0193`, `0194`, `0195`, `0196`, `0199`, `0254`) children merged. Remaining: `0265`, `0189`, `0191`, `0192`, `0197`, `0198`, `0200`, `planner.py`, and re-audit.", + "notes": "Umbrella. Coherence (0186, 0203 to 0208) and HAC (0185, 0188, 0190, 0193 to 0196, 0199, 0254) children merged. Remaining: 0265, 0192, 0197, 0198 and a re-audit of `planner.py`.", }, - "0197": { - "title": "Split `calibration.py` into a package; decompose metrics parsing and report generation", + "0379": { + "title": "No logic in __init__.py: package files only expose public names", + "priority": "**P1**", + "impact": "High", + "sizing": "M", + "domain": "Architecture / Hygiene", + "notes": "Queued behind 0265: `cli/__init__.py`, `cli/commands/__init__.py`, `flow/__init__.py` and `entrypoint/executor/__init__.py` are edited by both. Four package `__init__.py` files hold logic.", + }, + "0380": { + "title": "Enforce the module line budget on every package, including new ones, not just flow/", + "priority": "**P1**", + "impact": "High", + "sizing": "S", + "domain": "Lint / Module budgets", + "notes": "Maintainer instruction (2026-11-23) authorises the `module_budgets.json` change via `module_budget_change`. Queue after 0376 (new `flow/` modules must fit their budgets) and 0265 (`cli/__init__.py`).", + }, + "0416": { + "title": "Fix relative quota reset tail scanning, seconds parsing, and watcher keychain lookup", + "priority": "**P1**", + "impact": "Medium", + "sizing": "S", + "domain": "Harness / Run 247 / Credentials", + "notes": "Quota reset parsing scans the full output in one place and the tail in another, and drops seconds; `watch_limits.py` still reads the deleted plaintext token file. Harness only.", + }, + "0417": { + "title": "Gate flow wrapper completion against premature end", + "priority": "**P1**", + "impact": "Medium", + "sizing": "M", + "domain": "Harness / Holon Flow", + "notes": "`verify_pr_and_calibration` only warns on a missing pull request, missing calibration report or conflicting pull request, and the wrapper exits 0. Make it fail non-zero and write the flow state file itself. Harness only.", + }, + "0419": { + "title": "CI Timing Gate fails a green unit job on a slow runner and withdraws flow consensus", + "priority": "**P1**", + "impact": "High", + "sizing": "S", + "domain": "CI / Flow", + "notes": "The gate compared 360 s against a 229 s baseline and the flow withdrew a consensus that had passed. Fix together with 0404.", + }, + "0420": { + "title": "A flow whose pull request is merged while it is running fails instead of finishing cleanly", + "priority": "**P1**", + "impact": "High", + "sizing": "M", + "domain": "Flow / Review", + "notes": "PR #270 merged while its flow waited on merged-head CI, and the flow exited 1 on an unverifiable diff. It should finish cleanly.", + }, + "0400": { "priority": "**P2**", "impact": "Medium", "sizing": "M", - "domain": "Calibration / Refactor", - "notes": "Ready now (0146 merged in PR #221; disjoint from PR #230 which edits `calibration_outcome.py`). `calibration.py` is 1,637 lines. Sequence with `0355` on `flow/stages/calibrate.py`.", + "domain": "Build / DevEx", + "notes": "Shorten the CI pipeline: the slowest jobs set every wait in the flow. Overlaps 0404 and 0405 (test suite).", + }, + "0412": { + "priority": "**P2**", + "impact": "Medium", + "sizing": "M", + "domain": "Ledger / Observability", + "notes": "Every flow step is timed and keeps its log, so the self-improvement audit can measure each step.", + }, + "0413": { + "priority": "**P2**", + "impact": "Medium", + "sizing": "L", + "domain": "Architecture / Quality", + "notes": "Coding rules drawn from recurring reviewer findings, given to the planner and executor up front.", + }, + "0414": { + "priority": "**P2**", + "impact": "High", + "sizing": "L", + "domain": "Architecture / Quality", + "notes": "An edit outside the plan's touch set should be caught during the executor turn, not after it.", + }, + "0401": { + "priority": "**P2**", + "impact": "Medium", + "sizing": "S", + "domain": "Build / DevEx", + "notes": "The CI registration wait ends unknown when the pull request head lags the pushed head.", + }, + "0402": { + "priority": "**P2**", + "impact": "Medium", + "sizing": "M", + "domain": "Build / DevEx", + "notes": "A post-merge image rebuild must not disturb flows that are running or starting.", + }, + "0386": { + "title": "Review tests fail when run together serially, and test_backgrounded_sleep hangs with redirected output", + "priority": "**P2**", + "impact": "Medium", + "sizing": "M", + "domain": "Tests / Hygiene", + "notes": "Ready; run alone. Order-dependent review tests, and `test_backgrounded_sleep` hangs when output is redirected, so a serial run takes about 25 minutes.", + }, + "0385": { + "title": "The flow log file stays empty until the run ends, so a running flow cannot be followed", + "priority": "**P2**", + "impact": "Medium", + "sizing": "S", + "domain": "Harness / Logging", + "notes": "Ready. Harness-only (`run_holon_flow.py`): the block-buffered wrapper log stays empty until exit. No target-repo overlap.", + }, + "0388": { + "title": "Bean progress shows a stale 'Halted' stage while a role is live, and the triage narrative goes stale", + "priority": "**P2**", + "impact": "Medium", + "sizing": "S", + "domain": "Harness / Reporting", + "notes": "Ready. Harness-only: the bean_progress stale 'Halted' cell and this matrix's hand-written narrative, which goes stale after a day of merges.", + }, + "0389": { + "title": "Four bean-progress tests fail on the committed harness after the table column rework", + "priority": "**P2**", + "impact": "Medium", + "sizing": "S", + "domain": "Harness / Tests", + "notes": "Ready. Harness-only fix in `tests/test_bean_progress.py` to match the compact table columns, `--wide`, and details list.", }, "0198": { - "title": "Agent runner registry: one `RunnerSpec` module per agent", + "title": '"Agent runner registry: one `RunnerSpec` module per agent"', "priority": "**P2**", "impact": "Medium", "sizing": "M", "domain": "Runners / Refactor", - "notes": "Ready now (`0322` merged in PR #222, dropping `gemini` from scope; disjoint from PR #230). Must carry `AGENT_TICKERS`. Sequence with `0270` and `0350` on `agent_defaults.py` / `agent_runner.py`.", + "notes": "Unblocked (0185 completed). Sequence with 0270 and 0350 on `agent_defaults.py` / `agent_runner.py`; 0382 goes first.", + }, + "0197": { + "title": '"Split `calibration.py` into a package; decompose metrics parsing and report generation"', + "priority": "**P2**", + "impact": "Medium", + "sizing": "M", + "domain": "Calibration / Refactor", + "notes": "Unblocked (0187 scrapped). Sequence after 0146 (done) and 0162. `calibration.py` is 1,637 lines; no live flow touches it (0378 touches `calibrate_rerun.py`, another module).", }, "0225": { - "title": "Claude token lives only in the OS keychain; retire the plaintext secrets file", + "title": '"Claude token lives only in the OS keychain; retire the plaintext secrets file"', "priority": "**P2**", "impact": "Medium", "sizing": "M", "domain": "Agent Runner / Credentials", - "notes": "Ready now (0224 merged in PR #170; disjoint from PR #230). Extends `claude_credential.py` discovery seam to OS keychain only with one-time file migration. Sequence with `0350` if touching runner config.", + "notes": "Ready (0224 merged in PR #170). Extends `claude_credential.py` discovery to the OS keychain only, with one-time file migration. Sequence with 0350 if touching runner config.", }, "0352": { - "title": "Push GitHub PR events through `gh webhook forward`, with cheap polling as the fallback", + "title": '"Push GitHub PR events through `gh webhook forward`, with cheap polling as the fallback"', "priority": "**P2**", "impact": "Medium", "sizing": "M", "domain": "GitHub / Efficiency", - "notes": "Queued behind PR #230 (overlaps review-loop CI/conflict polling and `run_holon_flow.py` / skills). Needs `cli/gh-webhook` + `admin:repo_hook` scope on maintainer `gh`; stopgap until `gh event listen` is enabled.", + "notes": "Queued behind 0376 (review-loop CI and conflict polling, `run_holon_flow.py`, skills). Needs `cli/gh-webhook` and `admin:repo_hook` scope on maintainer `gh`; stopgap until `gh event listen` is enabled.", }, "0226": { - "title": "End-to-end test for the holon flow commands with full teardown", + "title": '"End-to-end test for the holon flow commands with full teardown"', "priority": "**P2**", "impact": "High", "sizing": "L", @@ -628,39 +911,31 @@ "notes": "Ready (operator-run local sub-1B model via `local_llm`, never opens a PR, excluded from CI). Reconcile test mode with `0357` (removes `--skip-review`).", }, "0181": { - "title": "Use the `/_` leaf only when referencing a git branch, never on ids", + "title": '"Use the `/_` leaf only when referencing a git branch, never on ids"', "priority": "**P2**", "impact": "Medium", "sizing": "M", "domain": "Holon Flow / Ledger", - "notes": "Queued behind PR #230 (overlaps `docs/git_flow.md` and `docs/ledger_schema.md`). `entrypoint/executor/run.py` (94, 242), `calibration.py`, `cli/commands/`, and `entrypoint/` still strip/re-add `/_`; sequence with `0197`.", + "notes": "Queued behind 0376 (overlaps `docs/git_flow.md` and `docs/ledger_schema.md`). `entrypoint/executor/run.py`, `calibration.py`, `cli/commands/` and `entrypoint/` still strip or re-add `/_`; sequence with 0197.", }, "0223": { - "title": "Audit CLI flags vs `HOLON_*` env vars: four-kind decision rule, flag>env precedence", + "title": '"Audit CLI flags vs `HOLON_*` env vars: four-kind decision rule, flag>env precedence"', "priority": "**P2**", "impact": "Medium", "sizing": "L", "domain": "CLI / Config", "notes": "Wait for `0265` (`cli/` split) and `0357` (drops `--skip-review`). Exhaustive inventory of every `add_argument` and `os.getenv`, unified resolution helper, logged source, auto-derived `--help`.", }, - "0200": { - "title": "Remove holon-agentic-coder's diverged `token_reduction` copy; holon-coherence is the owner", - "priority": "**P2**", - "impact": "Medium", - "sizing": "M", - "domain": "Token Reduction", - "notes": "Unblocked (`0189` merged in PR #241). Remove duplicated `sandbox_executor.token_reduction` code in favour of `holon-coherence`.", - }, "0216": { - "title": "Holon flow references and drives GitHub Issues (assign on intent, close on merge)", + "title": '"Holon flow references and drives GitHub Issues (assign on intent, close on merge)"', "priority": "**P2**", "impact": "Medium", "sizing": "M", "domain": "Holon Flow / Issue Tracking", - "notes": "Blocked by `0333`. Adds optional `work_item` to intent schema, marks issue in progress, adds `Closes #N` to PR body; sequence with `0191` (`flow/github/`).", + "notes": "Ready now (0333 completed, PR #258). Adds optional `work_item` to the intent schema, marks the issue in progress and adds `Closes #N` to the PR body; sequence with 0191's `flow/github/` layout.", }, "0217": { - "title": "GitHub Issues tracking for holon-coherence: labels, guidance and import", + "title": '"GitHub Issues tracking for holon-coherence: labels, guidance and import"', "priority": "**P2**", "impact": "Medium", "sizing": "S", @@ -668,7 +943,7 @@ "notes": "Blocked by `0215`. Creates labels and imports coherence beans after `0215`; guidance change runs via Holon flow on `holon-coherence`.", }, "0218": { - "title": "Port harness skills and guidance to GitHub Issues and sequence the harness retirement", + "title": '"Port harness skills and guidance to GitHub Issues and sequence the harness retirement"', "priority": "**P2**", "impact": "Medium", "sizing": "M", @@ -676,7 +951,7 @@ "notes": "Harness work. Blocked by `0215`, `0216`, and `0217`. Replaces triage matrix and bean-closing steps, then archives harness read-only.", }, "0317": { - "title": "GitHub Projects kanban board over the target repositories' issues", + "title": '"GitHub Projects kanban board over the target repositories\' issues"', "priority": "**P2**", "impact": "Medium", "sizing": "M", @@ -684,7 +959,7 @@ "notes": "Blocked by `0215` (and maintainer `gh auth refresh -s project`). Organisation Project v2 over `holon-agentic-coder` and `holon-coherence`.", }, "0153": { - "title": "Remove comments and docstrings from all code; make it self-documenting", + "title": '"Remove comments and docstrings from all code; make it self-documenting"', "priority": "**P2**", "impact": "Medium", "sizing": "XL", @@ -692,7 +967,7 @@ "notes": "Per package after its decomposition (`holon-coherence` decompositions are complete and ready; on HAC, run only on settled packages).", }, "0142": { - "title": "Real-workload benchmark: Qwen3.8-27B dense vs Flash-Next MoE", + "title": '"Real-workload benchmark: Qwen3.8-27B dense vs Flash-Next MoE"', "priority": "**P2**", "impact": "High", "sizing": "L", @@ -700,44 +975,59 @@ "notes": "Ready (operator/host-run; real data only). Blocked beans `0129`, `0132`, `0133` are completed; benchmark itself has not run.", }, "0340": { - "title": "Revisit the module budget: implications of a strict 200-line default with no overrides", + "title": '"Revisit the module budget: implications of a strict 200-line default with no overrides"', "priority": "**P2**", "impact": "High", "sizing": "S (analysis) + L (splits)", "domain": "Lint / Refactoring", "notes": "Draft (unblocked since PR #214 froze `module_budgets.json`, awaits maintainer decision). Decide ceiling, line counting, covered packages, and split order; each override removal needs explicit authorisation.", }, - "0359": { - "title": "PR #230 deferred findings", + "0418": { + "title": "Preserve passing executions on touch-set expansion and decompose re-plan failures", + "priority": "**P2**", + "impact": "Medium", + "sizing": "M", + "domain": "Flow / Touch Sets", + "notes": "A passing Stage 3 run is discarded when a small out-of-touch-set companion edit trips the guard. Keep the passing branch and re-plan only the expansion. Complements 0414.", + }, + "0398": { + "priority": "**P3**", + "impact": "Medium", + "sizing": "M", + "domain": "Flow / Architecture", + "notes": "Draft, low priority: a flow blocked only by an approved pull request can start from that pull request's head. Waits on a maintainer decision.", + }, + "0387": { + "title": "The flow leaves a detached temp ledger worktree registered in the repository", "priority": "**P3**", "impact": "Low", - "sizing": "XS", - "domain": "Review Loop / Housekeeping", - "notes": "Queued behind PR #230 (overlaps `cli/commands/flow.py`). Finding D-1: align `_report_review_outcome` legacy `StageStatus.HALTED_FOR_HUMAN` branch consistency (line 345 vs 352) and add test.", + "sizing": "S", + "domain": "Flow / Git cleanup", + "notes": "Ready. The ledger step in `flow/git_refs.py` must remove its temp worktree in a `finally` and prune stale entries. No live flow touches `git_refs.py`.", + }, + "0141": { + "title": '"Tune vmlx prefill/decode levers for both Qwen3.8 models, crash-safe"', + "priority": "**P3**", + "impact": "Medium", + "sizing": "M", + "domain": "vmlx / Performance", + "notes": "Ready (host-level vMLX tuning on Mac; not a target-repo change). Pairs with `0142`.", }, "0231": { - "title": "Exhausted-budget error string interpolates raw count while payload reports clamped 0", + "title": '"Exhausted-budget error string interpolates raw count while payload reports clamped 0"', "priority": "**P3**", "impact": "Low", "sizing": "XS", "domain": "Flow Engine / Cosmetic", - "notes": "Queued behind PR #230 (overlaps `flow/review/loop.py` lines 917–918). Cosmetic; bundle with a review-loop flow.", + "notes": "Queued behind 0376 (overlaps `flow/review/loop.py`). Cosmetic; bundle with a review-loop flow.", }, "0269": { - "title": "Deferred nits from the holon-agentic-coder PR 158 review loop", + "title": '"Deferred nits from the holon-agentic-coder PR 158 review loop"', "priority": "**P3**", "impact": "Low", "sizing": "XS", "domain": "Review Loop / Housekeeping", - "notes": "Wait for PR #230 (overlaps `docs/git_flow.md`) and `0197` (`calibration.py`). Item 2 obsolete; remaining: fold `parse_actual_metrics` exit-code logic onto `record_exit_code` and fix `docs/git_flow.md` checkpoint wording.", - }, - "0141": { - "title": "Tune vmlx prefill/decode levers for both Qwen3.8 models, crash-safe", - "priority": "**P3**", - "impact": "Medium", - "sizing": "M", - "domain": "vmlx / Performance", - "notes": "Ready (host-level vMLX tuning on Mac; not a target-repo change). Pairs with `0142`.", + "notes": "Wait for 0376 (overlaps `docs/git_flow.md`) and 0197 (`calibration.py`). Item 2 obsolete; remaining: fold `parse_actual_metrics` exit-code logic onto `record_exit_code` and fix `docs/git_flow.md` checkpoint wording.", }, } @@ -1969,6 +2259,135 @@ def generate_triage_document( "`CONDA_DEFAULT_ENV` in `tests/test_shell_hooks.py`. Consensus 3/3 APPROVED; calibration EV predicted " "96.27 / actual 97.28 (delta +1.01); 6/6 CI green." ), + ( + "71. **dev-env Linux/WSL `zsh` installation and unified NVM `versions/node` storage " + "(Bean 0366 / dev-env PR #39, 2026-11-23)**:" + ), + ( + " - `0366` (dev-env PR #39, `eeb2032d`, merged 2026-11-23): added `zsh` to `devenv_packages_core` " + "and `pkg_apt.yml` (skipped as OS-provided in `os_Darwin.yml`), pointed `ansible/roles/node` `creates` " + "and `current` symlink at `~/.local/share/nvm/versions/node/v{{ devenv_node_version }}`, replaced " + 'bi-directional `-name "v*"` symlinking in `00-devenv.fish` with one-way `v[0-9]*` migration plus ' + "`versions/node/versions` loop cleanup and `current` repair, and added static and hermetic Fish " + "migration tests. Consensus 3/3 APPROVED; calibration EV predicted 96.27 / actual 97.16 (delta +0.89); " + "6/6 CI green." + ), + ( + "72. **dev-env Zsh `.zprofile`, Node/Fish/Homebrew converge fixes, hermetic Ansible/Stow integration tests, " + "and Ubuntu/Docker E2E converge testing (Bean 0370 / dev-env PR #40, 2026-11-23)**:" + ), + ( + " - `0370` (dev-env PR #40, `22ca3862`, merged 2026-11-23): added tracked `dotfiles/zsh/.zprofile` " + "(non-interactive `.zshrc` sourcing without double-sourcing `zsh -lic`) in `devenv_links`, isolated " + "`ansible/roles/node` Bash/Zsh/Fish shell verification under `env -i` + `expand_argument_vars: false` " + "accepting canonical `versions/node/v{{ devenv_node_version }}/bin/node`, added `follow: true` in " + "`ansible/roles/fish` symlink discovery and `devenv_brew_bin | dirname` on Homebrew module `path:`, " + "removed the fake `.zprofile` shim from `tests/test_shell_hooks.py`, added real `ansible-playbook` " + "Stow/Node/Fish integration tests in `tests/test_converge_integration.py`, installed `stow` in " + "`.github/workflows/test-unit.yml`, and added real Ubuntu/WSL converge CI " + "(`.github/workflows/test-converge.yml`) plus `tests/docker/ubuntu.Dockerfile` and `make test-ubuntu`. " + "Consensus APPROVED; calibration EV predicted 97.60 / actual 99.09 (delta +1.49); 7/7 CI green " + "(including `Ubuntu Converge E2E` in 5m25s)." + ), + "73. **Ledger-only merges, one GitHub adapter, token scopes and flow fixes (2026-11-23, later):**", + ( + "- `0191` (HAC PR #260, `7225685`, parent; children #242 `96ecf25`, #245 `9d93e1b`, #255 `a9fe10c`): one " + "`GitHubAdapter` owns every `gh` call." + ), + ( + "- `0155` (PR #243, `2cf1869`): general `HOLON_*` forwarding no longer puts credential-shaped values on " + "the docker argv." + ), + ( + "- `0175` (PR #244, `252004a`): GitHub token scopes are checked before Stage 3 when the plan touches " + "workflows." + ), + "- `0157` (PR #248, `d369f2f`): `holon flow` enables the mitmproxy sidecar when its image exists.", + ( + "- `0200` (PR #249, `c905a98`): the diverged `token_reduction` copy is removed; `holon-coherence` is the " + "single source." + ), + ( + "- `0173` (PR #251, `e4f34ca`): layered `.env` files; `0174` (PR #256, `c941d78`): one generated " + "environment variable reference." + ), + "- `0363` (PR #250, `582c4ab`): after merging `main`, the flow waits for CI before calibrating.", + ( + "- `0372` (PR #254, `84b70c1a`): an approval survives a merge of `main` that leaves the PR's own diff " + "unchanged." + ), + ( + "- `0369` (PR #253, `606978f`) and `0359` (PR #246, `16f4f62`): calibration report correctness and " + "report-outcome halt consistency. `0362` (PR #247, `79555f8`): a fresh calibration clears the " + "stale-calibration warning." + ), + ( + "- `0373` (PR #252, `a154244`): the KB and wisdom index is derived, not committed. `0367` (PR #257, " + "`ff98e7e`): no fallback calibration report when Stage 5 fails." + ), + ( + "- `0333` (PR #258, `b01c2da`): GitHub Issues replace beads as the target tracker. `0377` (PR #261, " + "`7ab455c`): fuzz tests renamed after what they protect." + ), + ( + "- `0376` child PRs #259 (`d98e518`, shared `sync_with_target` routine) and #262 (`d6dabb0`, " + "containerised conflict-resolver role) merged into its plan branch; the parent flow is still running." + ), + ( + "- Open: PR #263 (`0378`), PR #265 (`0376` child 3), PR #266 (`0374`). Logged earlier: `0368`, `0371`, " + "`0374` to `0388`." + ), + ("74. **Interrupt-safe Stage 2 plan resume (Bean 0360 / HAC PR #264, `f49340f9`, merged 2026-11-23):**"), + ( + " - `0360` (PR #264, `f49340f9`): Stage 2 records pushed plan branches reliably and resumes adopt " + "existing pushed `P-.../_` branches instead of duplicating plans (`flow/stages/plan_resume.py`). " + "Consensus 3/3 APPROVED; 11/11 CI green; Stage 5 calibration EV predicted `42.34` / actual `58.86` " + "(delta `+16.52`, Bug EV Drag `0.00`). Post-merge rebuilt Docker images, reinstalled `holon`, pruned " + "`flow-resume-adopts-pushed-plan-branch`, refreshed PR #266 (`0374`) calibration, and backfilled " + "slot #4 with `0382`." + ), + ( + "75. **Sidecar scratch stays outside worktrees (Bean 0374 / HAC PR #266, `e0251206`, merged 2026-11-23):**" + ), + ( + " - `0374` (PR #266, `e0251206`): moved sidecar wire-log and LLM cache defaults to per-user state " + "directories under `~/.holon/` (`launcher/proxy_paths.py`, `launcher/sidecar_plan.py`) and hardened " + "Stage 3 salvage and completion commits against staging scratch files (`flow/partial_salvage.py`, " + "`entrypoint/execution_workspace.py`, `entrypoint/executor/run.py`, `outcome.py`). Consensus 3/3 " + "APPROVED; 11/11 CI green; Stage 5 calibration EV predicted `68.51` / actual `79.55` " + "(delta `+11.04`). Post-merge synced `apps/holon-agentic-coder/main`, rebuilt Docker images and " + "`holon`, pruned `flow-sidecar-scratch-outside-worktree`, refreshed PR #263 (`0378`) and PR #267 " + "(`0382`), and backfilled Bean `0381` across `holon-coherence` and `holon-agentic-coder`." + ), + ( + "76. **Calibrate stale warnings and the Fable 5.2 registry entry (Beans 0378, 0382 / HAC PRs #263 and #267, `e563254e` and `9f57492d`):**" + ), + ( + " - `0378` (PR #263, `e563254e`): PR-own diff fingerprint for staleness checks, stale-warning suppression while Stage 5 regenerates, and hermetic tests. Consensus 3/3 APPROVED; 11/11 CI green." + ), + ( + " - `0382` (PR #267, `9f57492d`): added the `claude-fable-5-2` registry entry with aliases `fable` and `claude-fable` (removed from Opus), canonical model IDs in `holon doctor`, and alias-family regression tests. Consensus 3/3 APPROVED; 11/11 CI green." + ), + ( + " - `0406` (harness, uncommitted on `docs/harness-20261123`): `flow_env.py` falls back to the OS secret store for the Claude token; 22 tests pass in `tests/test_flow_env.py`." + ), + ( + "77. **Flow ledger worktree cleanup, end-to-end test teardown and bean-progress test refresh " + "(Beans 0387, 0226, 0389 / HAC PRs #270 and #269, 2026-11-24):**" + ), + ( + "- `0387` (PR #270, `bfbd9f4`, merged 2026-11-24): the ledger step removes its temporary " + "`holon-flow-ledger-*` worktree in a `finally`, and a new `flow/ledger_worktree.py` prunes stale " + "ledger worktrees at the start of each step." + ), + ( + "- `0226` (PR #269, `407ad39`, merged 2026-11-24 11:28Z): the flow's end-to-end test teardown " + "landed cleanly after iteration 13 consensus." + ), + ( + "- `0389` (harness, 2026-11-24): `tests/test_bean_progress.py` expectations aligned with the " + "current bean-progress output; the script itself was unchanged." + ), "", "---", "", diff --git a/.agents/skills/resolve_conflict/SKILL.md b/.agents/skills/resolve_conflict/SKILL.md index d88a75e2..a62a3f8a 100644 --- a/.agents/skills/resolve_conflict/SKILL.md +++ b/.agents/skills/resolve_conflict/SKILL.md @@ -55,14 +55,15 @@ squashed or force-pushed. For any other branch, still prefer the merge unless th ### Step 3: Resolve the append-only files mechanically ```bash -python3 .agents/skills/resolve_conflict/scripts/resolve_known.py --repo +python3 .agents/skills/resolve_conflict/scripts/resolve_known.py --repo # merging origin/main into the branch; add --base-stage 2 for the reverse direction ``` It handles, and stages: -- **`holon-knowledge/ledger/*.jsonl`** (`intents`, `plans`, `executions`): keeps every row from both sides, base branch - order first, this branch's own rows interleaved by `created_at`. Nothing is de-duplicated or dropped, and no file is - ever created beyond the three ledgers. +- **`holon-knowledge/ledger/*.jsonl`** (`intents`, `plans`, `executions`): keeps every row from both sides: the base + branch's rows exactly in main's order, then this branch's own rows appended (ordered by `created_at` among + themselves); a row already on main is never moved. Nothing is de-duplicated or dropped, and no file is ever created + beyond the three ledgers. - **`holon-knowledge/kb/**/index.json`**: union of `entries` by `kb_id`, the later `updated_ts`. Any other conflicted path prints `NEEDS-JUDGEMENT `. @@ -104,6 +105,24 @@ Push the branch you merged into; never push to `main`, never force-push. Re-chec PR is clean when it reads `MERGEABLE` (`UNSTABLE` only means checks are re-running). The commit message is the merge commit's default; add no attribution trailer. +### Step 5b: Notify via ntfy (maintainer, 2026-11-25) + +Once the merge commit is pushed with zero escalations and `gh pr view` confirms `MERGEABLE`, send a push notification to +the maintainer via the harness helper: + +```bash +uv run python .agents/skills/holon_flow/scripts/notify_ntfy.py \ + "PR # Conflicts Resolved" \ + "# () conflicts resolved (): " \ + --priority high --tags white_check_mark +``` + +- The helper reads `HOLON_NTFY_TOPIC` or `~/.holon/secrets/ntfy-topic` and silently no-ops if unconfigured; **never** + print, log, or commit the topic or secret. +- Do **not** send an `ntfy` notification if a conflict was escalated or the merge was aborted. +- Avoid duplicates: if the parent coordinator waits for CI and sends the final ready-to-merge `ntfy` itself, it + instructs the subagent to skip Step 5b; otherwise the subagent sends it here. + --- ## 📋 Report Back (to the parent, five lines at most) @@ -112,7 +131,7 @@ commit's default; add no attribution trailer. - Files resolved mechanically and files resolved by hand (path and one phrase each). - Files escalated, with the reason. - Verification done (JSON check, additions-only diff, lint, tests). -- The pushed commit and the resulting `mergeable` / `mergeStateStatus`. +- The pushed commit, the resulting `mergeable` / `mergeStateStatus`, and whether the `ntfy` notification was sent. --- @@ -124,3 +143,13 @@ commit's default; add no attribution trailer. - Never create a ledger other than `intents.jsonl`, `plans.jsonl` and `executions.jsonl`. - Never name harness paths or bean ids in anything written into a target repository. - Report outcomes faithfully: if a file was escalated or a check failed, say so. + +--- + +## After the merge: no re-review for a mechanical merge (maintainer, 2026-11-23; Bean 0372) + +When every conflict was a ledger/KB file under `holon-knowledge/` resolved mechanically and the PR's own diff +(merge-base with the target to head, excluding `holon-knowledge/**` and calibration reports) is unchanged by the merge, +the existing approval stands. Report "approval carries over; waiting for CI on " and do not ask for a fresh +review. Only a CI failure on the new head, or a hand-resolved code conflict that changed the PR's own diff, needs a +re-review. diff --git a/.agents/skills/resolve_conflict/scripts/resolve_known.py b/.agents/skills/resolve_conflict/scripts/resolve_known.py index a670f0e7..a06af2fd 100644 --- a/.agents/skills/resolve_conflict/scripts/resolve_known.py +++ b/.agents/skills/resolve_conflict/scripts/resolve_known.py @@ -1,17 +1,18 @@ #!/usr/bin/env python3 """Resolve the append-only conflicts that need no judgement, inside a merge in progress. -Handles ``*.jsonl`` ledgers (union of both sides, interleaved by ``created_at``), the knowledge-base and wisdom -``index.json`` files (union of ``entries`` by ``kb_id`` or ``wb_id``), and a knowledge file that both sides created -with the same content (its id is a content hash) and that differs only in ``created_ts``: the base branch's copy is -kept. Both sides only ever add rows, so nothing is dropped and nothing is de-duplicated. Every other conflicted path -is listed and left untouched for a human-style decision. +Handles ``*.jsonl`` ledgers (the base branch's file kept byte for byte, only the branch's new rows appended by +``created_at``), the knowledge-base and wisdom ``index.json`` files (union of ``entries`` by ``kb_id`` or +``wb_id``), and a knowledge file that both sides created with the same content (its id is a content hash) and that +differs only in ``created_ts``: the base branch's copy is kept. Both sides only ever add rows, so nothing is dropped. +Every other conflicted path is listed and left untouched for a human-style decision. """ import argparse import json import subprocess import sys +from datetime import UTC, datetime def git(*args: str, cwd: str) -> str: @@ -22,10 +23,20 @@ def stage(n: int, path: str, cwd: str) -> str: return git("show", f":{n}:{path}", cwd=cwd) -def merge_jsonl(path: str, cwd: str) -> tuple[int, int]: - """Main's rows keep their order; the branch's own rows are inserted by ``created_at``.""" - main = [line for line in stage(3, path, cwd).splitlines() if line.strip()] - ours = [line for line in stage(2, path, cwd).splitlines() if line.strip()] +def _stamp(line: str) -> datetime: + """Parse ``created_at`` (``Z`` or an offset) as UTC; a missing or unparsable value sorts first.""" + raw = json.loads(line).get("created_at") or "" + try: + parsed = datetime.fromisoformat(raw.replace("Z", "+00:00")) + except ValueError: + return datetime.min.replace(tzinfo=UTC) + return parsed.replace(tzinfo=UTC) if parsed.tzinfo is None else parsed.astimezone(UTC) + + +def merge_ledger_text(main_text: str, branch_text: str) -> tuple[str, int, int]: + """Keep main's text exactly as it is and append only the branch's rows that main lacks, by ``created_at``.""" + main = [line for line in main_text.splitlines() if line.strip()] + ours = [line for line in branch_text.splitlines() if line.strip()] remaining: dict[str, int] = {} for line in main: remaining[line] = remaining.get(line, 0) + 1 @@ -36,18 +47,17 @@ def merge_jsonl(path: str, cwd: str) -> tuple[int, int]: else: extra.append(line) - def stamp(line: str) -> str: - return json.loads(line).get("created_at") or "" + extra.sort(key=_stamp) # stable: equal stamps keep the branch's order + head = main_text if main_text.endswith("\n") or not main_text else main_text + "\n" + return head + "".join(line + "\n" for line in extra), len(main), len(extra) + - out = list(main) - for line in extra: - i = len(out) - while i > 0 and stamp(out[i - 1]) > stamp(line): - i -= 1 - out.insert(i, line) +def merge_jsonl(path: str, cwd: str, base_stage: int = 3) -> tuple[int, int]: + """Merging origin/main into a branch: stage 3 is main (kept as is), stage 2 the branch; ``base_stage=2`` flips.""" + text, kept, added = merge_ledger_text(stage(base_stage, path, cwd), stage(5 - base_stage, path, cwd)) with open(f"{cwd}/{path}", "w") as handle: - handle.write("\n".join(out) + "\n") - return len(main), len(extra) + handle.write(text) + return kept, added def merge_kb_index(path: str, cwd: str, key: str = "kb_id") -> tuple[int, int]: @@ -84,12 +94,19 @@ def keep_base_copy_when_only_created_ts_differs(path: str, cwd: str) -> bool: def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--repo", default=".", help="worktree with a merge in progress") + parser.add_argument( + "--base-stage", + type=int, + choices=(2, 3), + default=3, + help="stage kept as is: 3 (default) merging origin/main into the branch, 2 merging the branch into main", + ) args = parser.parse_args() conflicted = git("diff", "--name-only", "--diff-filter=U", cwd=args.repo).split() left = [] for path in conflicted: if path.endswith(".jsonl"): - kept, added = merge_jsonl(path, args.repo) + kept, added = merge_jsonl(path, args.repo, args.base_stage) elif path.endswith("index.json") and "/kb/" in path: kept, added = merge_kb_index(path, args.repo) elif path.endswith("index.json") and "/wisdom/" in path: diff --git a/.agents/skills/run_247/SKILL.md b/.agents/skills/run_247/SKILL.md index f646d281..f15fe67f 100644 --- a/.agents/skills/run_247/SKILL.md +++ b/.agents/skills/run_247/SKILL.md @@ -28,10 +28,13 @@ Prints JSON: `reset_at`, `resume_at` (reset + 1 min), `seconds_until_resume`, `k ## Background watcher (`watch_limits.py`) `/run_247` needs a live session, so it cannot help once the session's own tokens are gone. `scripts/watch_limits.py` -runs outside Claude: it tails `.subagent/flow_*.log`, runs the same parser on each limit message, logs it once -(`resume_at`, or credit exhaustion when no reset is named; no ntfy message) and, with `--relaunch`, relaunches a stopped -`claude-agent` flow from its checkpoint after `resume_at` (same agent and model, `HOLON_TOKEN_REDUCE=0`, OAuth token -from the secrets file, never printed). Review loops are conversation-driven, so they are logged only, never resumed. +runs outside Claude: it tails `.subagent/flow_*.log` and `todo/flow-*.log`, runs the same parser on each limit message, +logs it once (`resume_at`, or credit exhaustion when no reset is named; no ntfy message) and, with `--relaunch`, +relaunches a stopped `claude-agent` flow from its checkpoint after `resume_at` (same agent and model, +`HOLON_TOKEN_REDUCE=0`, `HOLON_TURN_STALL_SECONDS=600`, `--allow-overlap` when the run had it, OAuth token from the +secrets file, never printed). **Credit reset with no reset time named**: the watcher probes the account with one tiny +`claude -p` call every `--probe-interval` seconds (default 600) and relaunches the stopped flow as soon as the probe +answers. Review loops are conversation-driven, so they are logged only, never resumed. - Try it: `python3 .agents/skills/run_247/scripts/watch_limits.py --once --dry-run`; `--self-test` checks it. - Starts itself: `.claude/settings.json` has a `SessionStart` hook that launches `watch_limits.py --relaunch` detached diff --git a/.agents/skills/run_247/scripts/watch_limits.py b/.agents/skills/run_247/scripts/watch_limits.py index e96be877..be6a92a2 100644 --- a/.agents/skills/run_247/scripts/watch_limits.py +++ b/.agents/skills/run_247/scripts/watch_limits.py @@ -2,15 +2,16 @@ """Watch the flow logs for usage-limit messages and, with --relaunch, resume the stopped flow after the reset. This runs outside any Claude session, so it keeps working when the session's own tokens are gone. Every poll it scans -the new bytes of ``.subagent/flow_*.log``. A limit message that names a reset time (see ``limit_reset.py``) is logged -once with its ``resume_at``; a message that names none is logged as credit exhaustion and left alone. Nothing is sent -through ntfy: the only ntfy message is the flow runner's "calibration done". With ``--relaunch`` a flow whose process -is not running is relaunched from its checkpoint once ``resume_at`` has passed, on the same agent and model -(claude-agent only, with the OAuth token read from the secrets file, never printed). Review loops are -conversation-driven, so they are logged but not resumed. +the new bytes of ``.subagent/flow_*.log`` and ``todo/flow-*.log``. A limit message that names a reset time (see +``limit_reset.py``) is logged once with its ``resume_at``. A message that names none is credit exhaustion: the watcher +then probes the account with one tiny ``claude -p`` call every ``--probe-interval`` seconds until it answers, which +is the credit reset. Nothing is sent through ntfy: the only ntfy message is the flow runner's "calibration done". With +``--relaunch`` a flow whose process is not running is relaunched from its checkpoint once ``resume_at`` has passed or +the probe succeeds, on the same agent and model (claude-agent only, with the OAuth token read from the secrets file, +never printed). Review loops are conversation-driven, so they are logged but not resumed. Usage: - watch_limits.py [--interval 60] [--relaunch] [--once] [--dry-run] + watch_limits.py [--interval 60] [--probe-interval 600] [--relaunch] [--once] [--dry-run] watch_limits.py --self-test """ @@ -22,6 +23,7 @@ import os import re import shlex +import shutil import subprocess import sys import time @@ -35,12 +37,16 @@ from limit_reset import describe # noqa: E402 -LOG_GLOB = "flow_*.log" +# (directory under the harness, glob): the older flow logs and the ones the holon-flow skill writes today. +LOG_SOURCES = ((".subagent", "flow_*.log"), ("todo", "flow-*.log")) +PROBE_PROMPT = "Reply with the single word OK." +PROBE_TIMEOUT_SECONDS = 180 STATE_FILE = Path.home() / ".holon" / "limit-watch" / "state.json" LOCK_FILE = STATE_FILE.with_name("watch.lock") TOKEN_FILE = Path.home() / ".holon" / "secrets" / "claude-oauth-token" LIMIT_RE = re.compile( - r"hit your (?:session|weekly|daily|usage)? ?limit|reached your \w+ limit|session limit reached|" + r"hit your (?:session|weekly|daily|usage|5-hour)? ?limit|reached your \w+ limit|session limit reached|" + r"usage limit reached|5-hour limit reached|" r"insufficient_quota|resource_exhausted|rate_limit_exceeded|http 429|status 429|credit balance is too low", re.IGNORECASE, ) @@ -77,10 +83,44 @@ def scan(path: Path, offset: int) -> tuple[list[str], int]: return found, size +def log_paths() -> list[Path]: + """Every flow log the watcher follows, across the log directories.""" + paths: list[Path] = [] + for directory, pattern in LOG_SOURCES: + paths.extend(sorted((HARNESS / directory).glob(pattern))) + return paths + + +def log_key(path: Path) -> str: + """The log's path relative to the harness (``todo/flow-x.log``), the stable part of an event key.""" + return path.relative_to(HARNESS).as_posix() + + +def log_from_key(key: str) -> Path: + """The log file of an event key; keys written before 2026-11-23 hold a bare name under ``.subagent``.""" + name = key.split(":", 1)[0] + return HARNESS / name if "/" in name else HARNESS / ".subagent" / name + + def resume_command(path: Path) -> dict[str, str] | None: """Parse the flow's own 'resume manually' line from its log: intent, worktree, agent and model.""" - matches = list(RESUME_RE.finditer(re.sub(r"\x1b\[[0-9;]*m", "", path.read_text(errors="replace")))) - return matches[-1].groupdict() if matches else None + text = re.sub(r"\x1b\[[0-9;]*m", "", path.read_text(errors="replace")) + matches = list(RESUME_RE.finditer(text)) + if not matches: + return None + info = matches[-1].groupdict() + info["allow_overlap"] = "1" if "--allow-overlap" in text else "" + return info + + +def intent_slug(intent: str) -> str: + """The flow slug: the intent JSON's ``slug``, else the last dash-separated word of the file name (legacy).""" + path = Path(intent) if Path(intent).is_absolute() else HARNESS / intent + try: + slug = json.loads(path.read_text()).get("slug") + except (OSError, ValueError, AttributeError): + slug = None + return str(slug) if slug else Path(intent).stem.split("-")[-1] def flow_running(intent: str) -> bool: @@ -88,11 +128,42 @@ def flow_running(intent: str) -> bool: return bool(out.stdout.split()) -def relaunch(info: dict[str, str], dry_run: bool) -> str: +def agent_env() -> dict[str, str]: + """Environment for a relaunched flow or a probe: no token reduction, a stall window Fable survives, the token.""" + token = TOKEN_FILE.read_text().strip() + env = dict(os.environ, HOLON_TOKEN_REDUCE="0") + env.setdefault("HOLON_TURN_STALL_SECONDS", "600") + env["HOLON_AGENT_SETTINGS"] = json.dumps({"env": {"HOLON_ECHO_PAD": "x" * 300, "CLAUDE_CODE_OAUTH_TOKEN": token}}) + env["CLAUDE_CODE_OAUTH_TOKEN"] = token + return env + + +def credit_available(model: str) -> bool: + """Probe the account with one tiny ``claude -p`` call: True once it answers without a limit message.""" + claude = shutil.which("claude") + if claude is None: + print("probe skipped: no 'claude' on PATH", flush=True) + return False + try: + out = subprocess.run( + [claude, "-p", PROBE_PROMPT, "--model", model], + capture_output=True, + text=True, + env=agent_env(), + cwd=str(Path.home()), + timeout=PROBE_TIMEOUT_SECONDS, + check=False, + ) + except (OSError, subprocess.SubprocessError): + return False + return out.returncode == 0 and not LIMIT_RE.search(out.stdout + out.stderr) + + +def relaunch(info: dict[str, str], dry_run: bool, log_path: Path | None = None) -> str: if info["agent"] != "claude-agent": return "not relaunched: only claude-agent is supported" worktree = Path(info["worktree"]) - slug = Path(info["intent"]).stem.split("-")[-1] + slug = intent_slug(info["intent"]) checkpoint = worktree / ".holon" / "flow" / f"checkpoint-{slug}.json" cmd = [ sys.executable, @@ -105,48 +176,71 @@ def relaunch(info: dict[str, str], dry_run: bool) -> str: "--model", info["model"], ] + cmd += ["--allow-overlap"] if info.get("allow_overlap") else [] cmd += ["--checkpoint", str(checkpoint)] if checkpoint.exists() else [] if dry_run: return "would run: " + shlex.join(cmd) - token = TOKEN_FILE.read_text().strip() - env = dict(os.environ, HOLON_TOKEN_REDUCE="0") - env["HOLON_AGENT_SETTINGS"] = json.dumps({"env": {"HOLON_ECHO_PAD": "x" * 300, "CLAUDE_CODE_OAUTH_TOKEN": token}}) - log = (HARNESS / ".subagent" / f"flow_{slug}.log").open("ab") - subprocess.Popen(cmd, cwd=HARNESS, env=env, stdout=log, stderr=log, start_new_session=True) + log = (log_path or HARNESS / "todo" / f"flow-{slug}.log").open("ab") + subprocess.Popen(cmd, cwd=HARNESS, env=agent_env(), stdout=log, stderr=log, start_new_session=True) return "relaunched from checkpoint" -def poll(state: dict, relaunch_on: bool, dry_run: bool, now: datetime | None = None) -> None: +def _due(event: dict, stamp: datetime, probe_interval: int, model: str) -> bool: + """Whether the event's limit is over: its named reset has passed, or (no reset named) a probe just answered.""" + if event.get("resume_at"): + return datetime.fromisoformat(event["resume_at"]) <= stamp + last = event.get("last_probe") + if last and (stamp - datetime.fromisoformat(last)).total_seconds() < probe_interval: + return False + event["last_probe"] = stamp.isoformat() + return credit_available(model) + + +def poll(state: dict, relaunch_on: bool, dry_run: bool, now: datetime | None = None, probe_interval: int = 600) -> None: first_run = not state["offsets"] # history before the first poll is not announced - for path in sorted((HARNESS / ".subagent").glob(LOG_GLOB)): - start = state["offsets"].get(str(path), path.stat().st_size if first_run else 0) + for path in log_paths(): + # History is never replayed: not on the first poll, and not for the todo/ logs the first time they are watched. + skip_history = first_run or (path.parent.name == "todo" and not state.get("todo_seen")) + start = state["offsets"].get(str(path), path.stat().st_size if skip_history else 0) found, state["offsets"][str(path)] = scan(path, start) for message in found: info = describe(message, now) - key = f"{path.name}:{info.get('resume_at')}" - if key in state["events"]: + key = f"{log_key(path)}:{info.get('resume_at')}" + if key in state["events"] and (info.get("resume_at") or not state["events"][key]["done"]): continue - state["events"][key] = {"resume_at": info.get("resume_at"), "done": info.get("resume_at") is None} - slug = path.stem.removeprefix("flow_") + # No reset named: credit exhaustion. With --relaunch the watcher probes for the reset; without it, log only. + state["events"][key] = { + "resume_at": info.get("resume_at"), + "done": not relaunch_on and not info.get("resume_at"), + } + slug = path.stem.removeprefix("flow_").removeprefix("flow-") text = ( f"{slug}: limit hit, resumes {info['resume_at']}" if info.get("resume_at") - else f"{slug}: credit exhausted (no reset named)" + else f"{slug}: credit exhausted (no reset named); probing every {probe_interval} s for the reset" ) print(text, flush=True) + state["todo_seen"] = True if not relaunch_on: return stamp = now or datetime.now().astimezone() for key, event in state["events"].items(): - if event["done"] or datetime.fromisoformat(event["resume_at"]) > stamp: + if event["done"]: + continue + path = log_from_key(key) + info = resume_command(path) if path.exists() else None + if info is None: + event["done"] = True + continue + if flow_running(info["intent"]): + event["done"] = True continue - path = HARNESS / ".subagent" / key.split(":", 1)[0] - info = resume_command(path) - if info is None or flow_running(info["intent"]): - event["done"] = info is not None + if not _due(event, stamp, probe_interval, info["model"]): continue event["done"] = True - print(f"{path.name}: {relaunch(info, dry_run)}", flush=True) + if not event.get("resume_at"): + print(f"{path.name}: credit is back (probe answered)", flush=True) + print(f"{path.name}: {relaunch(info, dry_run, path)}", flush=True) def _self_test() -> None: @@ -170,13 +264,31 @@ def _self_test() -> None: "worktree": "/w/flow-x", "agent": "claude-agent", "model": "claude-sonnet-5-5", + "allow_overlap": "", } + intent = Path(tmp) / "intent-0001-some-long-slug.json" + intent.write_text(json.dumps({"slug": "some-long-slug"})) + assert intent_slug(str(intent)) == "some-long-slug" + assert intent_slug("todo/i-x.json") == "x" + assert log_from_key("todo/flow-a.log:None") == HARNESS / "todo" / "flow-a.log" + assert log_from_key("flow_a.log:2026-11-23T10:00:00+11:00") == HARNESS / ".subagent" / "flow_a.log" + named = {"resume_at": "2026-11-23T10:00:00+11:00"} + assert _due(named, datetime.fromisoformat("2026-11-23T10:01:00+11:00"), 600, "m") + assert not _due(named, datetime.fromisoformat("2026-11-23T09:59:00+11:00"), 600, "m") + recent = {"resume_at": None, "last_probe": "2026-11-23T10:00:00+11:00"} + assert not _due(recent, datetime.fromisoformat("2026-11-23T10:05:00+11:00"), 600, "m") print("ok") def main() -> int: parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument("--interval", type=int, default=60) + parser.add_argument( + "--probe-interval", + type=int, + default=600, + help="seconds between account probes while credit is exhausted with no reset named", + ) parser.add_argument("--relaunch", action="store_true", help="resume stopped claude-agent flows after the reset") parser.add_argument("--once", action="store_true") parser.add_argument("--dry-run", action="store_true", help="print instead of relaunching") @@ -194,7 +306,7 @@ def main() -> int: return 0 state = load_state() while True: - poll(state, args.relaunch, args.dry_run) + poll(state, args.relaunch, args.dry_run, probe_interval=args.probe_interval) if not args.dry_run: save_state(state) if args.once: diff --git a/.agents/subagents.md b/.agents/subagents.md index cad30ed0..aea010b5 100644 --- a/.agents/subagents.md +++ b/.agents/subagents.md @@ -15,10 +15,10 @@ Subagent delegation in this ecosystem is primarily targeted towards the **Antigr research. - **Model Selection & Automatic Credit Fallback**: Set `Model: "inherit"` by default to inherit the parent agent's active model configuration. If credit or quota runs out on the higher-level model (`"inherit"` / `"pro"`), - automatically fall back to `"flash"` and then `"flash_lite"` (and similarly step down `claude-fable-5` $\rightarrow$ - `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5` or `gemini-4-argon` $\rightarrow$ - `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` in `holon` CLI invocations) and continue the flow or review loop - from the current stage without discarding completed work. + automatically fall back to `"flash"` and then `"flash_lite"` (and similarly step down `claude-fable-5-2` $\rightarrow$ + `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5` or `gemini-4-neon` $\rightarrow$ + `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` in `holon` CLI invocations) and + continue the flow or review loop from the current stage without discarding completed work. - **Reactive Wakeup (Zero Polling)**: The AGY runtime automatically wakes up the parent agent upon subagent completion or message delivery. Never poll or loop on subagent status. - **Generic Coding Agent Compatibility**: Skill workflows (such as `pr-review-loop`) define generic subagent task @@ -30,7 +30,9 @@ Subagent delegation in this ecosystem is primarily targeted towards the **Antigr ## Subagent names Every subagent a skill spawns is named `# - `. This applies to the AGY `Role`, Claude Code's Agent -`description`, or whatever your runtime uses. The operator can then tell at a glance which pull request each running +`description`, or whatever your runtime uses. Claude Code's agent list shows the Agent `name` field, not `description`, +and `name` allows only `[A-Za-z0-9_-]` (max 64): set it too, as `pr-` (`pr248-review-loop`) or +`bean-` (`bean0369-holon-flow`). The operator can then tell at a glance which pull request each running subagent belongs to (maintainer, 2026-11-23). - **With a PR:** `#244 - resolve conflicts`, `#244 - review loop orchestrator`, `#244 - iter 15 dry-run reviewer`, diff --git a/.agents/workflows.md b/.agents/workflows.md index f113590b..8ccac578 100644 --- a/.agents/workflows.md +++ b/.agents/workflows.md @@ -71,8 +71,10 @@ branch and ledger record the next one consumes (see invariant 8 in [rules.md](ru - **Intent**: Write the intent JSON (`description`, `goal`, `slug`, optional `target_branch`) and run `./holon intent ` to open the `I-.../_` branch and append to `holon-knowledge/ledger/intents.jsonl`. Encode the - sandbox constraints the executor must respect inside `goal`. Request repeated test runs only when the change must - measure performance, with an explicit N, each run under pytest-xdist (invariant 19 in [rules.md](rules.md)). + sandbox constraints the executor must respect inside `goal`, plus this sentence: "Code is self-explaining: no + docstrings and no comments except '# why:' comments that record a reason the code cannot show." Request repeated test + runs only when the change must measure performance, with an explicit N, each run under pytest-xdist (invariant 19 in + [rules.md](rules.md)). - **Plan**: Run `./holon plan --agent --model `; review the generated `plans/P-*.md` and the predicted metrics recorded in `plans.jsonl` before proceeding. - **Execute**: Run `./holon execute --agent --model `. Verify the pushed `E-...` branch is @@ -102,23 +104,25 @@ across model tiers, use `holon flow --from-stage ` or `--ch **continue the flow from the current stage** (reusing the already-created `I-.../_`, `P-.../_`, or `E-.../_` branch rather than starting over): - **Claude (`claude-agent`)**: `claude-opus-5-5` $\rightarrow$ `claude-sonnet-4-6` $\rightarrow$ `claude-haiku-4-5`. - - **Antigravity (`antigravity-agent` CLI)**: `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ - `gemini-3.8-flash` (default to `gemini-4-argon` for all Holon coding tasks until tokens run out). + - **Antigravity (`antigravity-agent` CLI)**: `gemini-4-neon` $\rightarrow$ `gemini-4-argon` $\rightarrow$ + `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` (default to `gemini-4-neon` for all Holon coding tasks until + tokens run out). - **Antigravity (`invoke_subagent`)**: `Model: "inherit"` / `"pro"` $\rightarrow$ `"flash"` $\rightarrow$ `"flash_lite"`. - - **Cross-Runner Continuation**: If all model tiers under the current runner share an exhausted account/session quota, - switch `--agent` to the alternate runner (`antigravity-agent` or `claude-agent`) and resume from the failed stage - (e.g. `holon plan --agent antigravity-agent --model gemini-4-argon`, followed by - `holon execute `, `holon review `, and `holon calibrate `). + - **No Cross-Runner Switch** (maintainer, 2026-11-23): if the runner's whole ladder is exhausted or stuck, stay on + that runner's ladder and ask the maintainer before switching `--agent` between `antigravity-agent` and + `claude-agent`. Never switch on your own; report and wait for the go-ahead. - **Ledger-Only Conflicts Do Not Require Test Runs**: When merging or rebasing `origin/main` into a Holon flow branch - and the conflict is confined entirely to `holon-knowledge/ledger/*.jsonl`, running test suites is not required. - Resolve the conflict by interleaving records chronologically by timestamp (`created_at`), verify all lines parse as - valid JSON, commit, and push directly. + and the conflict is confined entirely to `holon-knowledge/ledger/*.jsonl`, running test suites is not required. Keep + main's ledger file exactly as on main, in main's order, and append only the branch's own rows (ordered by `created_at` + among themselves); never move or re-sort a row already on main. Verify all lines parse as valid JSON, commit, and push + directly. - **Mandatory Target-Branch Conflict Resolution Before Review Approval & Calibration**: Before posting an `APPROVED` consensus review to GitHub or running `holon calibrate`, always check `gh pr view --json mergeable,mergeStateStatus`. If the PR is `CONFLICTING` or `DIRTY` against `origin/main`, - immediately fetch `origin/main`, merge it into the execution branch, resolve the conflicts (interleaving ledger - entries chronologically), commit, and push to `origin`. Never post approval or calibrate while a PR is conflicting. + immediately fetch `origin/main`, merge it into the execution branch, resolve the conflicts (ledgers: main's rows + unchanged, the branch's own rows appended), commit, and push to `origin`. Never post approval or calibrate while a PR + is conflicting. ### 3. Task Completion @@ -347,3 +351,11 @@ To maintain clean repository history, follow this Git workflow: > > Branch and worktree cleanup may only be performed **after** the human confirms the merge has completed, or when the > user explicitly requests it. + +### Beans: bugs and location (maintainer rules) + +- **Log a bean for every bug at once** (maintainer, 2026-11-23): any bug hit anywhere (flow engine, wrapper, logs, + tests, CI, harness scripts, skills) gets its own bean immediately, with the evidence (PR, log line, timestamps, + confirmed cause). Do not ask first and do not leave it as a remark; a bug you also fix on the spot still gets a bean. +- **Beans live in the main checkout's `.beans/`** (maintainer, 2026-10-25), never in `todo/` or a side worktree (those + were lost or hidden before). Write the file there and never stage or commit another agent's edits. diff --git a/.beans/bean-triage-prioritisation.md b/.beans/bean-triage-prioritisation.md index ed41262f..2c4c56b4 100644 --- a/.beans/bean-triage-prioritisation.md +++ b/.beans/bean-triage-prioritisation.md @@ -1,26 +1,25 @@ # Holon Ecosystem Bean Triage and Prioritisation Matrix -**Last Updated:** 2026-11-23 04:58:48 UTC +**Last Updated:** 2026-11-26 22:35:26 UTC ## Executive Summary The harness drives every `holon-agentic-coder` change through the 5-stage Holon flow and the `pr-review-loop`, and the -maintainer merges each pull request into `main`. On 2026-11-23 every active bean was audited against current `main` -(`holon-agentic-coder` `0f0089d`, `holon-coherence` `baf5c65`, `dev-env` `68ddec9`) and merged PRs #221–#241 plus -`dev-env` PRs #31–#33 and #36–#38: duplicate Bean 0353 was scrapped in favour of Bean 0354, stale `blocked_by` links and -outdated 'in flight in another session' markers (`0322` and `0346` completed; `0265`, `0270` idle) were cleared, and new -beans `0350`–`0352` and `0354`–`0361` were triaged. HAC PRs #243 (`0155`, `CLEAN`), #244 (`0175`, `UNSTABLE`), and #245 -(`0191`, `UNSTABLE`) are open, while `dev-env` **Bean 0361** (`PR #33`), **Bean 0351** (`PR #36`), **Bean 0364** -(`PR #37`), and **Bean 0365** (`PR #38`) have all merged into `main` (zero open `dev-env` PRs). - -Concurrent flows on overlapping files forced repeated syncs and re-reviews earlier on (141 review-loop passes, about -10M+ tokens), so flows that touch the same files still run one after another; only flows with disjoint touch sets run -together. - -- **Total Tracked Beans**: 365 (excluding template) -- **Completed**: 322 (88.2%) -- **Scrapped / Superseded**: 9 (2.5%) -- **Active**: 34 (9.3%), of which 15 are in progress, 18 are todo and 1 are draft +maintainer merges each pull request into `main`. On 2026-11-24 the bean set was re-audited: `holon-agentic-coder` `main` +moved to PR #270 (`0387`, merge commit `bfbd9f4`), after PR #269 (`0226`, merge commit `407ad39`) earlier the same +morning. Beans `0387` and `0389` completed today, and Bean `0406` (harness, uncommitted on `docs/harness-20261123`) is +complete. Beans `0415` to `0421` were logged since the last run (`0415` and `0421` closed after the maintainer raised +Docker memory to 32 GB); `0419` is the CI timing gate failure that withdrew PR #270's consensus. Maintainer priority for +today: cutting pipeline time first, with `0403` and `0405` in flight; `0407` (P0) stops re-running the full review when +nothing reviewable changed; `0255` (P0) makes the resolver start on the first pipeline failure and fix every failure of +the run. Concurrent flows on overlapping files forced repeated syncs and re-reviews earlier on (141 review-loop passes, +about 10M+ tokens), so flows that touch the same files still run one after another; only flows with disjoint touch sets +run together. + +- **Total Tracked Beans**: 547 (excluding template) +- **Completed**: 386 (70.6%) +- **Scrapped / Superseded**: 17 (3.1%) +- **Active**: 144 (26.3%), of which 19 are in progress, 123 are todo and 2 are draft Dates below are UTC, as in `gh`, the bean timestamps and the milestones. @@ -300,9 +299,9 @@ narrowed to what remains after PR #213; the blocked-by links to completed or scr were cleared. New: **Bean 0347** (Stage 4 says halted for human review although consensus approval was reached and the flow carries on to Stage 5). The audit found no bean already done by PRs #209 to #220 beyond those already completed. -**2026-11-22 to 2026-11-23:** twenty target PRs merged across `holon-agentic-coder` and `dev-env`: **Bean 0322** (HAC -#222, `e2ba3c2`: complete removal of `gemini-agent`), **Bean 0172** (HAC #225, `4811599`: `unlimited` stage and turn -budgets), **Bean 0348** (HAC #226, `3ee9c4e`: admission uses actual PR files), **Bean 0199** (HAC #227, `43d278c`: +**2026-11-22 to 2026-11-23:** twenty-one target PRs merged across `holon-agentic-coder` and `dev-env`: **Bean 0322** +(HAC #222, `e2ba3c2`: complete removal of `gemini-agent`), **Bean 0172** (HAC #225, `4811599`: `unlimited` stage and +turn budgets), **Bean 0348** (HAC #226, `3ee9c4e`: admission uses actual PR files), **Bean 0199** (HAC #227, `43d278c`: ledger query and knowledge index decomposed), **Bean 0193** (HAC #228, `5fbd2d0`: intent and plan stages decomposed), **Bean 0349** (HAC #229, `ccb7a6f`: Antigravity writable `brain`/`conversations` tmpfs and `empty_diff` excerpt), **Bean 0196** (HAC #234, `2ec094e`, plus children #231–#233: `ExecutionRun`), **Bean 0194** (HAC #236, `b22258d`: @@ -314,17 +313,27 @@ test gate), **Bean 0189** (HAC #241, `0f0089d`: `launcher/` package breaks `flow #31 (**Bean 0344**, `0ba3e94`), #32 (**Bean 0346**, `d6b07de`), #33 (**Bean 0361**, `425ff6fe`: Fish Conda/Homebrew hooks & clean-env multi-shell tests), #36 (**Bean 0351**, `a9dacf46`: Ansible `deb822_repository` & task hygiene, unconditional WSL exclusion of Ghostty/Warp, and `tmux` `set -g mouse on`), #37 (**Bean 0364**, `4b1391c3`: define -`devenv_user`, skip WSL GUI terminal wizard prompt, and audit Ansible Jinja2 variables in tests), and #38 (**Bean -0365**, `68ddec98`: disable `expand_argument_vars` on Conda clean-shell command tasks, enforce static `$VAR` command -hygiene, and add hermetic `ansible-playbook` verification test). Open **HAC PRs #243** (`0155`), **#244** (`0175`), and -**#245** (`0191`) remain in progress, and new **Bean 0360** logs duplicate `P-` branch creation after an interrupted -Stage 2. Pre-triage audit (2026-11-23): **Bean 0353** scrapped as a duplicate of `0354`; stale blockers cleared on -`0189`, `0197`, `0198`, `0265`, `0270`, `0333`; `0176` re-measured at 144 files; `0181` re-pointed to -`entrypoint/executor/run.py`; new beans `0350`–`0352` and `0354`–`0361` triaged. +`devenv_user`, skip WSL GUI terminal wizard prompt, and audit Ansible Jinja2 variables in tests), #38 (**Bean 0365**, +`68ddec98`: disable `expand_argument_vars` on Conda clean-shell command tasks, enforce static `$VAR` command hygiene, +and add hermetic `ansible-playbook` verification test), #39 (**Bean 0366**, `eeb2032d`: install `zsh` on Linux/WSL, +unify NVM storage strictly under `versions/node`, eliminate `versions/node/versions` symlink loop, and add hermetic Fish +migration tests), and #40 (**Bean 0370**, `22ca3862`: add tracked `dotfiles/zsh/.zprofile`, isolate `node` shell checks, +fix Fish `follow: true` & Homebrew `path` dirs, and add real Ubuntu/WSL converge CI + Docker `make test-ubuntu`). Those +PRs (#243, #244 and #245) were open at the morning checkpoint and merged on 2026-11-23,(`0191`) are merged, and new +**Bean 0360** logs duplicate `P-` branch creation after an interrupted Stage 2. Pre-triage audit (2026-11-23): **Bean +0353** scrapped as a duplicate of `0354`; stale blockers cleared on `0189`, `0197`, `0198`, `0265`, `0270`, `0333`; +`0176` re-measured at 144 files; `0181` re-pointed to `entrypoint/executor/run.py`; new beans `0350`–`0352` and +`0354`–`0361` triaged. + +**2026-11-23 (post-#266):** PR #266 (Bean `0374`, sidecar scratch outside worktrees) merged to `main` (`e0251206`), +bringing merged HAC PRs today to 24 and completed beans in this wave to 18. Open HAC PRs: #263 (`0378`) and #267 +(`0382`) refreshing ledger conflicts via `--from-stage calibrate`, plus #265 (`0376` child 3, waiting on the 600 s macOS +CI timing ceiling decision). Backfilled Bean `0381` across both `holon-coherence` and `holon-agentic-coder`. Newly +logged beans `0389` and `0390` added to triage. --- -## Key Milestones Completed (Beans 0080 – 0365) +## Key Milestones Completed (Beans 0080 – 0406, plus 0360, 0374) 1. **Holon Flow and Automation Engine**: - `0084`: Fixed CI check name collisions in review gates. @@ -926,92 +935,255 @@ Stage 2. Pre-triage audit (2026-11-23): **Bean 0353** scrapped as a duplicate of `tests/test_toolchain.py`, and added a real hermetic `ansible-playbook` verification test under polluted parent `PATH` / `CONDA_DEFAULT_ENV` in `tests/test_shell_hooks.py`. Consensus 3/3 APPROVED; calibration EV predicted 96.27 / actual 97.28 (delta +1.01); 6/6 CI green. +71. **dev-env Linux/WSL `zsh` installation and unified NVM `versions/node` storage (Bean 0366 / dev-env PR #39, + 2026-11-23)**: + - `0366` (dev-env PR #39, `eeb2032d`, merged 2026-11-23): added `zsh` to `devenv_packages_core` and `pkg_apt.yml` + (skipped as OS-provided in `os_Darwin.yml`), pointed `ansible/roles/node` `creates` and `current` symlink at + `~/.local/share/nvm/versions/node/v{{ devenv_node_version }}`, replaced bi-directional `-name "v*"` symlinking in + `00-devenv.fish` with one-way `v[0-9]*` migration plus `versions/node/versions` loop cleanup and `current` repair, + and added static and hermetic Fish migration tests. Consensus 3/3 APPROVED; calibration EV predicted 96.27 / + actual 97.16 (delta +0.89); 6/6 CI green. +72. **dev-env Zsh `.zprofile`, Node/Fish/Homebrew converge fixes, hermetic Ansible/Stow integration tests, and + Ubuntu/Docker E2E converge testing (Bean 0370 / dev-env PR #40, 2026-11-23)**: + - `0370` (dev-env PR #40, `22ca3862`, merged 2026-11-23): added tracked `dotfiles/zsh/.zprofile` (non-interactive + `.zshrc` sourcing without double-sourcing `zsh -lic`) in `devenv_links`, isolated `ansible/roles/node` + Bash/Zsh/Fish shell verification under `env -i` + `expand_argument_vars: false` accepting canonical + `versions/node/v{{ devenv_node_version }}/bin/node`, added `follow: true` in `ansible/roles/fish` symlink + discovery and `devenv_brew_bin | dirname` on Homebrew module `path:`, removed the fake `.zprofile` shim from + `tests/test_shell_hooks.py`, added real `ansible-playbook` Stow/Node/Fish integration tests in + `tests/test_converge_integration.py`, installed `stow` in `.github/workflows/test-unit.yml`, and added real + Ubuntu/WSL converge CI (`.github/workflows/test-converge.yml`) plus `tests/docker/ubuntu.Dockerfile` and + `make test-ubuntu`. Consensus APPROVED; calibration EV predicted 97.60 / actual 99.09 (delta +1.49); 7/7 CI green + (including `Ubuntu Converge E2E` in 5m25s). +73. **Ledger-only merges, one GitHub adapter, token scopes and flow fixes (2026-11-23, later):** + +- `0191` (HAC PR #260, `7225685`, parent; children #242 `96ecf25`, #245 `9d93e1b`, #255 `a9fe10c`): one `GitHubAdapter` + owns every `gh` call. +- `0155` (PR #243, `2cf1869`): general `HOLON_*` forwarding no longer puts credential-shaped values on the docker argv. +- `0175` (PR #244, `252004a`): GitHub token scopes are checked before Stage 3 when the plan touches workflows. +- `0157` (PR #248, `d369f2f`): `holon flow` enables the mitmproxy sidecar when its image exists. +- `0200` (PR #249, `c905a98`): the diverged `token_reduction` copy is removed; `holon-coherence` is the single source. +- `0173` (PR #251, `e4f34ca`): layered `.env` files; `0174` (PR #256, `c941d78`): one generated environment variable + reference. +- `0363` (PR #250, `582c4ab`): after merging `main`, the flow waits for CI before calibrating. +- `0372` (PR #254, `84b70c1a`): an approval survives a merge of `main` that leaves the PR's own diff unchanged. +- `0369` (PR #253, `606978f`) and `0359` (PR #246, `16f4f62`): calibration report correctness and report-outcome halt + consistency. `0362` (PR #247, `79555f8`): a fresh calibration clears the stale-calibration warning. +- `0373` (PR #252, `a154244`): the KB and wisdom index is derived, not committed. `0367` (PR #257, `ff98e7e`): no + fallback calibration report when Stage 5 fails. +- `0333` (PR #258, `b01c2da`): GitHub Issues replace beads as the target tracker. `0377` (PR #261, `7ab455c`): fuzz + tests renamed after what they protect. +- `0376` child PRs #259 (`d98e518`, shared `sync_with_target` routine) and #262 (`d6dabb0`, containerised + conflict-resolver role) merged into its plan branch; the parent flow is still running. +- Open: PR #263 (`0378`), PR #265 (`0376` child 3), PR #266 (`0374`). Logged earlier: `0368`, `0371`, `0374` to `0388`. + +74. **Interrupt-safe Stage 2 plan resume (Bean 0360 / HAC PR #264, `f49340f9`, merged 2026-11-23):** + - `0360` (PR #264, `f49340f9`): Stage 2 records pushed plan branches reliably and resumes adopt existing pushed + `P-.../_` branches instead of duplicating plans (`flow/stages/plan_resume.py`). Consensus 3/3 APPROVED; 11/11 CI + green; Stage 5 calibration EV predicted `42.34` / actual `58.86` (delta `+16.52`, Bug EV Drag `0.00`). Post-merge + rebuilt Docker images, reinstalled `holon`, pruned `flow-resume-adopts-pushed-plan-branch`, refreshed PR #266 + (`0374`) calibration, and backfilled slot #4 with `0382`. +75. **Sidecar scratch stays outside worktrees (Bean 0374 / HAC PR #266, `e0251206`, merged 2026-11-23):** + - `0374` (PR #266, `e0251206`): moved sidecar wire-log and LLM cache defaults to per-user state directories under + `~/.holon/` (`launcher/proxy_paths.py`, `launcher/sidecar_plan.py`) and hardened Stage 3 salvage and completion + commits against staging scratch files (`flow/partial_salvage.py`, `entrypoint/execution_workspace.py`, + `entrypoint/executor/run.py`, `outcome.py`). Consensus 3/3 APPROVED; 11/11 CI green; Stage 5 calibration EV + predicted `68.51` / actual `79.55` (delta `+11.04`). Post-merge synced `apps/holon-agentic-coder/main`, rebuilt + Docker images and `holon`, pruned `flow-sidecar-scratch-outside-worktree`, refreshed PR #263 (`0378`) and PR #267 + (`0382`), and backfilled Bean `0381` across `holon-coherence` and `holon-agentic-coder`. +76. **Calibrate stale warnings and the Fable 5.2 registry entry (Beans 0378, 0382 / HAC PRs #263 and #267, `e563254e` + and `9f57492d`):** + - `0378` (PR #263, `e563254e`): PR-own diff fingerprint for staleness checks, stale-warning suppression while Stage + 5 regenerates, and hermetic tests. Consensus 3/3 APPROVED; 11/11 CI green. + - `0382` (PR #267, `9f57492d`): added the `claude-fable-5-2` registry entry with aliases `fable` and `claude-fable` + (removed from Opus), canonical model IDs in `holon doctor`, and alias-family regression tests. Consensus 3/3 + APPROVED; 11/11 CI green. + - `0406` (harness, uncommitted on `docs/harness-20261123`): `flow_env.py` falls back to the OS secret store for the + Claude token; 22 tests pass in `tests/test_flow_env.py`. +77. **Flow ledger worktree cleanup, end-to-end test teardown and bean-progress test refresh (Beans 0387, 0226, 0389 / + HAC PRs #270 and #269, 2026-11-24):** + +- `0387` (PR #270, `bfbd9f4`, merged 2026-11-24): the ledger step removes its temporary `holon-flow-ledger-*` worktree + in a `finally`, and a new `flow/ledger_worktree.py` prunes stale ledger worktrees at the start of each step. +- `0226` (PR #269, `407ad39`, merged 2026-11-24 11:28Z): the flow's end-to-end test teardown landed cleanly after + iteration 13 consensus. +- `0389` (harness, 2026-11-24): `tests/test_bean_progress.py` expectations aligned with the current bean-progress + output; the script itself was unchanged. --- ## Active Beans Triage and Prioritisation Matrix -| Priority | Status | Impact | Sizing | Bean # | Title | Domain | Dependencies / Notes | -| :------- | :---------- | :----: | :-----------------------: | :----- | :------------------------------------------------------------------------------------------------- | :-------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **P1** | todo | High | S | 0360 | Resume after an interrupted plan stage creates a duplicate P- branch | Flow / Stage 2 / Checkpoint | Ready in Stage 2 plan/checkpoint lane (`PR #239` merged). Record pushed `P-` branch atomically with push or adopt existing pushed `P-` branch on resume. | -| **P1** | todo | High | M | 0333 | GitHub Issues replace beads as the target tracker; remove the beads pilot from holon-agentic-coder | Issue Tracking / Decision | Ready now (disjoint from PR #230; 0321 and 0322 merged). Removes `.beads/config.yaml`, `bd` install in Dockerfile/bake, `test_beads_integration.py`, and beads docs. Unblocks `0215`–`0218` and `0317`. | -| **P1** | todo | High | M | 0270 | Discover runner models dynamically through each harness instead of the hardcoded model table | Flow / Architecture | Ready now (runner/quota block cleared; 0262 and 0322 merged; disjoint from PR #230). Replaces hardcoded `RUNNER_CAPABILITIES` in `agent_defaults.py` with per-harness discovery. Sequence with `0198` and `0350` on `agent_defaults.py`. | -| **P1** | todo | High | M | 0350 | Enable Claude Code code mode (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1) for every Claude run | Claude / Config | Ready now (disjoint from PR #230). Direct harness edit (`flow_env.py`, `.claude/settings.json`) plus HAC flow on `agent_runner.py` / `agent_defaults.py` / `role_dispatcher.sh` / `doctor`. Sequence with `0270` and `0198`. | -| **P1** | in-progress | High | S | 0175 | Check GitHub token scopes before Stage 3 when the plan touches workflow files | Holon Flow / GitHub | In progress in HAC PR #244 (`UNSTABLE`). Pre-flight `workflow` scope when touch set hits `.github/workflows/**` and warn in `holon doctor`. | -| **P1** | in-progress | Medium | M | 0174 | Document every environment variable holon reads, in one generated and CI-checked reference | Documentation / Config | Ready now (`0172` in PR #225 and `0347`/`0354` in PR #230 merged). Precursor to `0173` (layered `.env`). | -| **P1** | todo | High | L | 0265 | Split `cli/__init__.py` into focused modules (move only), like the `flow/` package | Refactor / Architecture | Sequence after PR #243 (`0155`) / #244 (`0175`) which touch `cli/__init__.py`. | -| **P1** | in-progress | High | M | 0191 | One GitHub adapter owns every `gh` call (PR, CI probe, mergeability, review posting) | GitHub / Architecture | In progress in HAC PR #245 (`UNSTABLE`). Unblocks `0192`. | -| **P1** | in-progress | High | L | 0192 | `run_review_loop` and `run_review_stage` become a `ReviewLoop` object with named steps | Review Loop / Refactor | Blocked by `0191`. `flow/review/loop.py` is 936 lines. Sequence one at a time in the review-loop lane with PR #230, `0255`, and `0231`. | -| **P1** | todo | High | L | 0255 | Streaming per-issue resolvers during Stage 4 CI & review with single consolidated commit | Review Loop / Concurrency | Queued behind PR #230 (overlaps `flow/review/loop.py`, `entrypoint/review_loop.py`). One at a time with `0191`, `0192`, `0231`. | -| **P1** | in-progress | High | S | 0157 | `holon flow` auto-enables the mitmproxy sidecar; role containers cannot reach it | Holon Flow / Proxy | Queued behind PR #230 (overlaps `flow/context.py`) and sequenced with `0265` (`cli/__init__.py`). Workaround: `HOLON_TOKEN_REDUCE=0`. | -| **P1** | todo | High | S | 0215 | Deterministic beans-to-GitHub-Issues importer and real-data dry run | Issue Tracking / Migration | Harness work. Blocked by `0333` (remove beads pilot & finalise decision). Converts open beans to GitHub Issues with real-corpus dry run; unblocks `0217`, `0218`, and `0317`. | -| **P1** | in-progress | High | M | 0173 | holon loads layered .env files (specific overrides broad) that every sandbox stage inherits | Holon Flow / Config | Sequence after `0155`, `0174`, and `0265` (touches `cli/` and `role_dispatcher.sh`). | -| **P1** | in-progress | High | L | 0176 | Remove every unittest reference from holon-agentic-coder; the suite is pytest only | Tests | Re-measured 2026-11-23 on `main` (`b22258d`): **144** tracked files mention `unittest`. Runs alone with zero other HAC PRs in flight (after PR #230 merges). | -| **P1** | in-progress | High | XL | 0152 | Audit long files; decompose oversized functions (flow.py, cli.py first) | Refactor / Concurrency | Umbrella. Coherence (`0186`, `0203`–`0208`) and HAC (`0185`, `0188`, `0190`, `0193`, `0194`, `0195`, `0196`, `0199`, `0254`) children merged. Remaining: `0265`, `0189`, `0191`, `0192`, `0197`, `0198`, `0200`, `planner.py`, and re-audit. | -| **P2** | in-progress | Medium | M | 0197 | Split `calibration.py` into a package; decompose metrics parsing and report generation | Calibration / Refactor | Ready now (0146 merged in PR #221; disjoint from PR #230 which edits `calibration_outcome.py`). `calibration.py` is 1,637 lines. Sequence with `0355` on `flow/stages/calibrate.py`. | -| **P2** | in-progress | Medium | M | 0198 | Agent runner registry: one `RunnerSpec` module per agent | Runners / Refactor | Ready now (`0322` merged in PR #222, dropping `gemini` from scope; disjoint from PR #230). Must carry `AGENT_TICKERS`. Sequence with `0270` and `0350` on `agent_defaults.py` / `agent_runner.py`. | -| **P2** | todo | Medium | M | 0225 | Claude token lives only in the OS keychain; retire the plaintext secrets file | Agent Runner / Credentials | Ready now (0224 merged in PR #170; disjoint from PR #230). Extends `claude_credential.py` discovery seam to OS keychain only with one-time file migration. Sequence with `0350` if touching runner config. | -| **P2** | todo | Medium | M | 0352 | Push GitHub PR events through `gh webhook forward`, with cheap polling as the fallback | GitHub / Efficiency | Queued behind PR #230 (overlaps review-loop CI/conflict polling and `run_holon_flow.py` / skills). Needs `cli/gh-webhook` + `admin:repo_hook` scope on maintainer `gh`; stopgap until `gh event listen` is enabled. | -| **P2** | todo | High | L | 0226 | End-to-end test for the holon flow commands with full teardown | Testing / E2E | Ready (operator-run local sub-1B model via `local_llm`, never opens a PR, excluded from CI). Reconcile test mode with `0357` (removes `--skip-review`). | -| **P2** | in-progress | Medium | M | 0181 | Use the `/_` leaf only when referencing a git branch, never on ids | Holon Flow / Ledger | Queued behind PR #230 (overlaps `docs/git_flow.md` and `docs/ledger_schema.md`). `entrypoint/executor/run.py` (94, 242), `calibration.py`, `cli/commands/`, and `entrypoint/` still strip/re-add `/_`; sequence with `0197`. | -| **P2** | todo | Medium | L | 0223 | Audit CLI flags vs `HOLON_*` env vars: four-kind decision rule, flag>env precedence | CLI / Config | Wait for `0265` (`cli/` split) and `0357` (drops `--skip-review`). Exhaustive inventory of every `add_argument` and `os.getenv`, unified resolution helper, logged source, auto-derived `--help`. | -| **P2** | in-progress | Medium | M | 0200 | Remove holon-agentic-coder's diverged `token_reduction` copy; holon-coherence is the owner | Token Reduction | Unblocked (`0189` merged in PR #241). Remove duplicated `sandbox_executor.token_reduction` code in favour of `holon-coherence`. | -| **P2** | in-progress | Medium | M | 0216 | Holon flow references and drives GitHub Issues (assign on intent, close on merge) | Holon Flow / Issue Tracking | Blocked by `0333`. Adds optional `work_item` to intent schema, marks issue in progress, adds `Closes #N` to PR body; sequence with `0191` (`flow/github/`). | -| **P2** | todo | Medium | S | 0217 | GitHub Issues tracking for holon-coherence: labels, guidance and import | Issue Tracking / Coherence | Blocked by `0215`. Creates labels and imports coherence beans after `0215`; guidance change runs via Holon flow on `holon-coherence`. | -| **P2** | todo | Medium | M | 0218 | Port harness skills and guidance to GitHub Issues and sequence the harness retirement | Harness Deprecation | Harness work. Blocked by `0215`, `0216`, and `0217`. Replaces triage matrix and bean-closing steps, then archives harness read-only. | -| **P2** | todo | Medium | M | 0317 | GitHub Projects kanban board over the target repositories' issues | Issue Tracking / Projects | Blocked by `0215` (and maintainer `gh auth refresh -s project`). Organisation Project v2 over `holon-agentic-coder` and `holon-coherence`. | -| **P2** | in-progress | Medium | XL | 0153 | Remove comments and docstrings from all code; make it self-documenting | Readability | Per package after its decomposition (`holon-coherence` decompositions are complete and ready; on HAC, run only on settled packages). | -| **P2** | todo | High | L | 0142 | Real-workload benchmark: Qwen3.8-27B dense vs Flash-Next MoE | Model Selection | Ready (operator/host-run; real data only). Blocked beans `0129`, `0132`, `0133` are completed; benchmark itself has not run. | -| **P2** | draft | High | S (analysis) + L (splits) | 0340 | Revisit the module budget: implications of a strict 200-line default with no overrides | Lint / Refactoring | Draft (unblocked since PR #214 froze `module_budgets.json`, awaits maintainer decision). Decide ceiling, line counting, covered packages, and split order; each override removal needs explicit authorisation. | -| **P3** | todo | Low | XS | 0231 | Exhausted-budget error string interpolates raw count while payload reports clamped 0 | Flow Engine / Cosmetic | Queued behind PR #230 (overlaps `flow/review/loop.py` lines 917–918). Cosmetic; bundle with a review-loop flow. | -| **P3** | todo | Low | XS | 0269 | Deferred nits from the holon-agentic-coder PR 158 review loop | Review Loop / Housekeeping | Wait for PR #230 (overlaps `docs/git_flow.md`) and `0197` (`calibration.py`). Item 2 obsolete; remaining: fold `parse_actual_metrics` exit-code logic onto `record_exit_code` and fix `docs/git_flow.md` checkpoint wording. | -| **P3** | todo | Medium | M | 0141 | Tune vmlx prefill/decode levers for both Qwen3.8 models, crash-safe | vmlx / Performance | Ready (host-level vMLX tuning on Mac; not a target-repo change). Pairs with `0142`. | -| **P1** | in-progress | High | M | 0363 | After merging main, wait for CI before calibrating; restart PR review from the start if CI breaks | Ledger / Observability | | +| Priority | Status | Impact | Sizing | Bean # | Title | Domain | Dependencies / Notes | +| :------- | :---------- | :----: | :-----------------------: | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **P0** | todo | High | L | 0255 | "Streaming per-issue resolvers during Stage 4 CI & review with single consolidated commit" | Review Loop / Concurrency | Maintainer 2026-11-24: the resolver starts on the first pipeline failure and fixes every failure of the run. Changes the review loop with 0376 and 0407, so run in sequence, never together; also overlaps 0192 on `flow/review/loop.py`. | +| **P1** | todo | High | M | 0391 | Stage 3 stops after an overlap wait when merging main into the plan branch conflicts only in the ledgers | Ledger / Observability | Stage 3 stops after an overlap wait when merging main into the plan branch conflicts only in the ledgers. Settle ledger conflicts mechanically; overlaps 0376. | +| **P1** | todo | Medium | M | 0392 | Stage 4 resolver runs repo-wide Prettier and mutates untouched historical plans/ files | Build / DevEx | Stage 4 resolver runs repo-wide Prettier and mutates untouched historical plans; scope formatting to the touched files. | +| **P1** | todo | High | M | 0394 | No unnecessary waiting anywhere in the holon flow: recommendations | Build / DevEx | Umbrella epic: ranked recommendations for removing unnecessary waits, ordered by time saved; concrete items are 0395, 0399, 0400 and 0403. | +| **P1** | todo | High | L | 0395 | Stage 3 works during an overlap wait instead of idling until the blocking pull request merges | Flow / Architecture | Stage 3 works during an overlap wait instead of idling until the blocking pull request merges. Large; queue after the live flows on the same stage files. | +| **P1** | todo | Medium | M | 0396 | A flow run survives the agent session that started it | Skills / Tooling | A flow run should survive the agent session that started it; detach the run from the session. | +| **P1** | todo | High | M | 0397 | A resume adopts a completed, pushed execution branch instead of executing Stage 3 again | Ledger / Observability | Resume adopts a completed, pushed execution branch instead of executing Stage 3 again. Related to 0375 and 0360. | +| **P1** | in-progress | High | L | 0403 | No full CI run for commits that only touch bookkeeping files | Build / DevEx | In progress. No full CI run for commits that only touch bookkeeping files. | +| **P1** | in-progress | High | M | 0404 | The 600 s timing ceiling on the macOS unit job fails pull requests on runner variance | Build / DevEx | The 600 s timing ceiling on the macOS unit job fails pull requests on runner variance; fix the ceiling or shrink the suite (0405). | +| **P1** | in-progress | Medium | M | 0405 | Clean up unnecessary unit tests: the suite has outgrown the pipeline | Build / DevEx | In progress. Remove unnecessary unit tests: ubuntu about 4 min, workspace survival about 7 min, macOS over 8 min. | +| **P1** | todo | Medium | M | 0408 | Every push passes the CI hygiene and lint checks locally before it leaves the machine | Build / DevEx | Run the CI hygiene and lint checks (Prettier, ruff, JSON and JSONL validity, file growth) locally before every push; a CI-caught failure costs a full pipeline. | +| **P1** | todo | High | L | 0409 | A finding the resolver rejected, or a resolver pass that changed nothing, does not start another full review | Flow / Architecture | A finding the resolver rejected, or a resolver pass that changed nothing, must not start another full review. | +| **P1** | todo | High | M | 0410 | Remove the conflict magnets: generated README and env docs, and a module budget file that does not serialise flows | Flow / Architecture | Remove the conflict magnets: generated README and env docs, and a module budget file that does not serialise flows. Flows waited 39.8 hours on each other in the period. | +| **P1** | todo | High | M | 0411 | Harness instructions contradict each other on runner switching, model ladders and file size | Flow / Architecture | Harness instructions contradict each other on runner switching, model ladders and file size; subagents get different answers. | +| **P1** | in-progress | High | S | 0215 | "Deterministic beans-to-GitHub-Issues importer and real-data dry run" | Issue Tracking / Migration | Ready now: Bean 0333 completed (PR #258), so no blocker remains. Harness-side importer only, no target flow. Unblocks 0217, 0218 and the 0317 import. | +| **P1** | todo | High | S | 0384 | The 90 s stall budget cuts long-thinking models: every Fable 5.2 reviewer failed and the loop retried unchanged | Flow / Budgets / Stage 4 | Ready, but overlaps 0376 on the review loop: start after 0376 lands. `HOLON_TURN_STALL_SECONDS` defaults to 90 s; long-thinking models such as Fable 5.2 stream nothing for longer than that. | +| **P1** | in-progress | High | M | 0350 | "Enable Claude Code code mode (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1) for every Claude run" | Claude / Config | In progress in parallel Claude Code session (`flow-claude-code-mode-default-on`). Harness edit (`flow_env.py`, `.claude/settings.json`) plus HAC `agent_runner.py` / `agent_defaults.py`. Sequence with `0382` on `agent_defaults.py`, before `0270`. | +| **P1** | todo | High | M | 0270 | "Discover runner models dynamically through each harness instead of the hardcoded model table" | Flow / Architecture | Ready after 0382 and 0350 (same `agent_defaults.py`). Replaces hardcoded `RUNNER_CAPABILITIES` with per-harness discovery. | +| **P1** | todo | High | M | 0381 | Bare holon flow resume keeps token reduction on: every reviewer fails with cache_control.ttl 400 | Flow / Token reduction / Stage 4 | In progress across both repos (backfilled after PR #266 merged): `holon-coherence` (`fix-cache-control-ttl-order`) and `holon-agentic-coder` (`token-reduce-opt-in-resume`), disjoint from `0376`, `0378`, `0382`, and `0350`. | +| **P1** | in-progress | High | S | 0390 | Two runners can drive the same flow checkpoint at once; nothing locks a flow or a bean against a second launch | Flow / Concurrency | Queued after `0381` (`flow/checkpoint.py`) and `0376`. Exclusive checkpoint/worktree lock in `holon flow` plus atomic bean claim and duplicate-launch guard in `run_holon_flow.py`. | +| **P1** | todo | High | M | 0368 | Submodule gitfile left with container paths breaks host-side git in the flow worktree | Flow / Git / Stage 5 | Ready, but overlaps 0376 on `flow/stages/calibrate.py`: start after 0376 lands. Repair or reject a submodule gitfile that points at container paths before host-side git runs. | +| **P1** | todo | High | M | 0383 | Stage 5 waits for CI twice and overruns its 10-minute budget; no per-step timing breakdown | Flow / Stage 5 / CI | Ready, but overlaps 0376 and 0378 on `flow/stages/calibrate.py`: start after both land. Stage 5 waits for CI twice (11 min 57 s and 9 min 54 s on PR #260); add a per-step timing breakdown. | +| **P1** | todo | High | L | 0176 | "Remove every unittest reference from holon-agentic-coder; the suite is pytest only" | Tests | Ready; run alone with no other HAC flow or PR in flight. Re-measured on `main` (`7225685`) at 144 tracked files; touches nearly every test file. | +| **P1** | todo | High | L | 0192 | "`run_review_loop` and `run_review_stage` become a `ReviewLoop` object with named steps" | Review Loop / Refactor | Unblocked: 0191 completed (PR #260). Overlaps 0376 on `flow/review/loop.py`: start after 0376 lands. | +| **P1** | todo | High | XL | 0152 | "Audit long files; decompose oversized functions (flow.py, cli.py first)" | Refactor / Concurrency | Umbrella. Coherence (0186, 0203 to 0208) and HAC (0185, 0188, 0190, 0193 to 0196, 0199, 0254) children merged. Remaining: 0265, 0192, 0197, 0198 and a re-audit of `planner.py`. | +| **P1** | todo | High | M | 0379 | No logic in **init**.py: package files only expose public names | Architecture / Hygiene | Queued behind 0265: `cli/__init__.py`, `cli/commands/__init__.py`, `flow/__init__.py` and `entrypoint/executor/__init__.py` are edited by both. Four package `__init__.py` files hold logic. | +| **P1** | todo | Medium | S | 0416 | Fix relative quota reset tail scanning, seconds parsing, and watcher keychain lookup | Harness / Run 247 / Credentials | Quota reset parsing scans the full output in one place and the tail in another, and drops seconds; `watch_limits.py` still reads the deleted plaintext token file. Harness only. | +| **P1** | todo | High | M | 0420 | A flow whose pull request is merged while it is running fails instead of finishing cleanly | Flow / Review | PR #270 merged while its flow waited on merged-head CI, and the flow exited 1 on an unverifiable diff. It should finish cleanly. | +| **P2** | in-progress | Medium | M | 0400 | Shorten the CI pipeline: the slowest jobs set every wait in the flow | Build / DevEx | Shorten the CI pipeline: the slowest jobs set every wait in the flow. Overlaps 0404 and 0405 (test suite). | +| **P2** | todo | Medium | M | 0412 | Every flow step is timed and every flow keeps its log: the steps the audit could not measure | Ledger / Observability | Every flow step is timed and keeps its log, so the self-improvement audit can measure each step. | +| **P2** | todo | Medium | L | 0413 | Coding rules from what the reviewers keep finding, given to the planner and executor up front | Architecture / Quality | Coding rules drawn from recurring reviewer findings, given to the planner and executor up front. | +| **P2** | todo | High | L | 0414 | An edit outside the plan's touch set is caught during the executor turn, not after it | Architecture / Quality | An edit outside the plan's touch set should be caught during the executor turn, not after it. | +| **P2** | todo | Medium | M | 0402 | A post-merge image rebuild does not disturb flows that are running or starting | Build / DevEx | A post-merge image rebuild must not disturb flows that are running or starting. | +| **P2** | todo | Medium | M | 0386 | Review tests fail when run together serially, and test_backgrounded_sleep hangs with redirected output | Tests / Hygiene | Ready; run alone. Order-dependent review tests, and `test_backgrounded_sleep` hangs when output is redirected, so a serial run takes about 25 minutes. | +| **P2** | todo | Medium | S | 0388 | Bean progress shows a stale 'Halted' stage while a role is live, and the triage narrative goes stale | Harness / Reporting | Ready. Harness-only: the bean_progress stale 'Halted' cell and this matrix's hand-written narrative, which goes stale after a day of merges. | +| **P2** | todo | Medium | M | 0352 | "Push GitHub PR events through `gh webhook forward`, with cheap polling as the fallback" | GitHub / Efficiency | Queued behind 0376 (review-loop CI and conflict polling, `run_holon_flow.py`, skills). Needs `cli/gh-webhook` and `admin:repo_hook` scope on maintainer `gh`; stopgap until `gh event listen` is enabled. | +| **P2** | todo | Medium | M | 0181 | "Use the `/_` leaf only when referencing a git branch, never on ids" | Holon Flow / Ledger | Queued behind 0376 (overlaps `docs/git_flow.md` and `docs/ledger_schema.md`). `entrypoint/executor/run.py`, `calibration.py`, `cli/commands/` and `entrypoint/` still strip or re-add `/_`; sequence with 0197. | +| **P2** | todo | Medium | L | 0223 | "Audit CLI flags vs `HOLON_*` env vars: four-kind decision rule, flag>env precedence" | CLI / Config | Wait for `0265` (`cli/` split) and `0357` (drops `--skip-review`). Exhaustive inventory of every `add_argument` and `os.getenv`, unified resolution helper, logged source, auto-derived `--help`. | +| **P2** | in-progress | Medium | M | 0216 | "Holon flow references and drives GitHub Issues (assign on intent, close on merge)" | Holon Flow / Issue Tracking | Ready now (0333 completed, PR #258). Adds optional `work_item` to the intent schema, marks the issue in progress and adds `Closes #N` to the PR body; sequence with 0191's `flow/github/` layout. | +| **P2** | todo | Medium | S | 0217 | "GitHub Issues tracking for holon-coherence: labels, guidance and import" | Issue Tracking / Coherence | Blocked by `0215`. Creates labels and imports coherence beans after `0215`; guidance change runs via Holon flow on `holon-coherence`. | +| **P2** | todo | Medium | M | 0218 | "Port harness skills and guidance to GitHub Issues and sequence the harness retirement" | Harness Deprecation | Harness work. Blocked by `0215`, `0216`, and `0217`. Replaces triage matrix and bean-closing steps, then archives harness read-only. | +| **P2** | todo | Medium | M | 0317 | "GitHub Projects kanban board over the target repositories' issues" | Issue Tracking / Projects | Blocked by `0215` (and maintainer `gh auth refresh -s project`). Organisation Project v2 over `holon-agentic-coder` and `holon-coherence`. | +| **P2** | todo | Medium | XL | 0153 | "Remove comments and docstrings from all code; make it self-documenting" | Readability | Per package after its decomposition (`holon-coherence` decompositions are complete and ready; on HAC, run only on settled packages). | +| **P2** | todo | High | L | 0142 | "Real-workload benchmark: Qwen3.8-27B dense vs Flash-Next MoE" | Model Selection | Ready (operator/host-run; real data only). Blocked beans `0129`, `0132`, `0133` are completed; benchmark itself has not run. | +| **P2** | draft | High | S (analysis) + L (splits) | 0340 | "Revisit the module budget: implications of a strict 200-line default with no overrides" | Lint / Refactoring | Draft (unblocked since PR #214 froze `module_budgets.json`, awaits maintainer decision). Decide ceiling, line counting, covered packages, and split order; each override removal needs explicit authorisation. | +| **P2** | todo | Medium | M | 0418 | Preserve passing executions on touch-set expansion and decompose re-plan failures | Flow / Touch Sets | A passing Stage 3 run is discarded when a small out-of-touch-set companion edit trips the guard. Keep the passing branch and re-plan only the expansion. Complements 0414. | +| **P3** | draft | Medium | M | 0398 | A flow blocked only by an approved pull request can start from that pull request's head | Flow / Architecture | Draft, low priority: a flow blocked only by an approved pull request can start from that pull request's head. Waits on a maintainer decision. | +| **P3** | todo | Medium | M | 0141 | "Tune vmlx prefill/decode levers for both Qwen3.8 models, crash-safe" | vmlx / Performance | Ready (host-level vMLX tuning on Mac; not a target-repo change). Pairs with `0142`. | +| **P3** | todo | Low | XS | 0231 | "Exhausted-budget error string interpolates raw count while payload reports clamped 0" | Flow Engine / Cosmetic | Queued behind 0376 (overlaps `flow/review/loop.py`). Cosmetic; bundle with a review-loop flow. | +| **P3** | todo | Low | XS | 0269 | "Deferred nits from the holon-agentic-coder PR 158 review loop" | Review Loop / Housekeeping | Wait for 0376 (overlaps `docs/git_flow.md`) and 0197 (`calibration.py`). Item 2 obsolete; remaining: fold `parse_actual_metrics` exit-code logic onto `record_exit_code` and fix `docs/git_flow.md` checkpoint wording. | +| **P0** | todo | High | L | 0525 | Harden /holon/* dashboard Host validation, /holon/api/mode auth, CORS, and wire_log_dir | Architecture / Quality | | +| **P0** | todo | High | L | 0524 | Fix world-writable Root CA key permissions, web password leaks, and unscrubbed cache | Architecture / Quality | | +| **P1** | todo | Medium | M | 0549 | Failed tests: record in the ledger, diagnose, fix and re-run in a loop until they pass | Build / DevEx | | +| **P1** | todo | High | M | 0546 | holon intent-check misses the files plans actually escape into and over-proposes test files | Flow / Architecture | | +| **P1** | todo | High | L | 0545 | Backfill picker launches flows that park at admission; pre-check touch sets and record each pick | Architecture / Quality | | +| **P1** | todo | Medium | M | 0544 | A parked flow holds no touch set: admission blocks only on open PRs and running flows | General | | +| **P1** | todo | High | M | 0543 | Derive flow/lazy_exports.py from the flow modules instead of hand-editing a hub file | Flow / Architecture | | +| **P1** | todo | High | L | 0540 | Split conftest.py: each test module owns its setup | Architecture / Quality | | +| **P1** | todo | Medium | M | 0539 | Add 2026-11 architecture audit patterns and failure modes to holon-coherence KB | CLI / Telemetry | | +| **P1** | todo | High | M | 0538 | Add 2026-11 architecture audit patterns and failure modes to holon-agentic-coder KB | Flow / Architecture | | +| **P1** | todo | High | L | 0537 | Retire legacy re-export shims, stale budget overrides, conftest allowlist, and allow # WHY comments | Architecture / Quality | | +| **P1** | todo | High | M | 0536 | Unify structured logging, bound checkpoint context.logs, and remove FlowCheckpoint dual-writes | Flow / Architecture | | +| **P1** | todo | High | L | 0535 | Make RunnerSpec single-source runner registration and add GitForge Protocol + stage registry | Architecture / Quality | | +| **P1** | todo | High | M | 0534 | Eliminate silent except-pass catches, library sys.exit calls, and GitHub/Git adapter error gaps | Flow / Architecture | | +| **P1** | todo | High | M | 0533 | Add mypy/pyright to CI, unify agent-ID and numstat helpers, and drive runtime env from env_registry | Flow / Architecture | | +| **P1** | in-progress | High | M | 0532 | Add Docker resource limits, read-only intent mount, 0o600 secret permissions, and Dockerfile pinning | Flow / Architecture | | +| **P1** | todo | High | M | 0531 | Break flow/entrypoint and ledger/knowledge import cycles and decompose ExecutionRun, planner, turns | Flow / Architecture | | +| **P1** | todo | Medium | M | 0530 | Add static type checker to CI, prune redundant self-doc tests, legacy shims, and root clutter | CLI / Telemetry | | +| **P1** | todo | Medium | M | 0529 | Centralize typed CoherenceSettings, bound wire-log queues, and align Docker/wheel packaging | Build / DevEx | | +| **P1** | todo | Medium | M | 0528 | Eliminate request hot-path deepcopies, duplicate parsers, metric drift, and ab_test leaks | CLI / Telemetry | | +| **P1** | todo | High | L | 0527 | Unify provider detection, make ProviderFormat extensible, and break import cycles | Architecture / Quality | | +| **P1** | todo | High | L | 0526 | Fix SSE chunk fragmentation bugs and add real mitmproxy tflow wire-level tests | Architecture / Quality | | +| **P1** | todo | High | L | 0523 | A flow parked at Stage 3 is resumed by hand when its blocker merges; record the blocker and resume on its state change | Architecture / Quality | | +| **P1** | todo | High | L | 0522 | A rerun after a post-approval conflict restarts a full review from the review stage and keeps running after the PR merges | Architecture / Quality | | +| **P1** | todo | High | L | 0521 | Main-push gate runs the full suite when the merged PR head job is still running; wait for it instead | Architecture / Quality | | +| **P1** | todo | High | L | 0520 | Stage 3 admission blocks on shared file paths, not on a real merge conflict; one open PR parks several flows | Architecture / Quality | | +| **P1** | in-progress | High | M | 0519 | Flow worktree, checkpoint and intent/plan branches vanish after a Stage 3 overlap refusal | Flow / Architecture | | +| **P1** | in-progress | High | L | 0518 | Review loop writes its git identity into the shared repository config, so host-side commits are authored by the agent | Architecture / Quality | | +| **P1** | todo | High | L | 0515 | Ledger reorder (0436) conflicts with every merge to main and the resolvers keep main order, silently undoing it | Architecture / Quality | | +| **P1** | in-progress | Medium | M | 0514 | Main-push tree gate skips nothing when merges arrive back to back; coalesce a burst to the newest tip | Build / DevEx | | +| **P1** | todo | High | L | 0513 | Stage 5 restore of the starting branch fails on pending ledger rows and withdraws a fresh approval on a bookkeeping-only head | Architecture / Quality | | +| **P1** | todo | High | M | 0512 | Push PR-merged events to wake the agent and automatically run post-pr-merge | Flow / Architecture | | +| **P1** | todo | High | L | 0509 | Verify a performance flow CI saving on main after it merges and record it | Architecture / Quality | | +| **P1** | todo | Medium | M | 0507 | install-holon fails its main-worktree pull when a concurrent fetch rewrites the shared FETCH_HEAD | Build / DevEx | | +| **P1** | in-progress | Medium | M | 0506 | Prune the existing single-flow Stage 4 KB-failure clutter from holon-knowledge | Build / DevEx | | +| **P1** | todo | High | M | 0505 | Child PRs of a decomposed plan run CI against the plan branch's stale copy of main | Ledger / Observability | | +| **P1** | todo | High | M | 0503 | Review loop approves a flow PR whose measured acceptance criteria are not met | Ledger / Observability | | +| **P1** | todo | High | M | 0502 | Planner touch set adds files outside the intent scope and blocks admission on a sibling flow | Flow / Architecture | | +| **P1** | todo | Medium | M | 0499 | Calibration report records, per flow, CI runs, review iterations and how many were churn | Build / DevEx | | +| **P1** | todo | High | L | 0498 | A unit test measures the live tree against the live budget file, so it duplicates the hygiene gate in three jobs and fails every open PR after a budget merge | Architecture / Quality | | +| **P1** | todo | High | L | 0497 | Review loop re-runs the full ensemble 9 times on a CI failure the resolver reported as not fixable in code | Architecture / Quality | | +| **P1** | todo | Medium | M | 0495 | Resumed flow wrote no progress to its log, and Stage 5 overran its budget by counting the CI wait | General | | +| **P1** | todo | High | M | 0494 | A fresh iteration-4 approval was withdrawn at the merged-head gate on a stale fingerprint and then re-reported | Ledger / Observability | | +| **P1** | todo | High | M | 0493 | An approved PR shows CLEAN but breaks main's hygiene after a budget-tightening merge | Flow / Architecture | | +| **P1** | todo | High | M | 0492 | A flow edited a file outside its intent scope and the review passed it | Flow / Architecture | | +| **P1** | todo | High | L | 0491 | Running a subset of unit test files loses the flow_repos fixture | Architecture / Quality | | +| **P1** | todo | High | M | 0490 | holon flow resume with --checkpoint silently ignores an amended intent file | Flow / Architecture | | +| **P1** | in-progress | High | M | 0489 | Module line budget: default 400 for now, then step down by 50 per pull request to 250, decomposing at each step | Flow / Architecture | | +| **P1** | todo | High | M | 0487 | Overlap wait is silent in the flow log: the wrapper prints only 'exited with non-zero code 1' while it waits | Flow / Architecture | | +| **P1** | todo | Medium | M | 0485 | A flow's module_budget_change intent field does not clear the CI hygiene budget gate | Build / DevEx | | +| **P1** | todo | High | L | 0483 | Measure runner and model wall time on comparable flows to choose the default | Architecture / Quality | | +| **P1** | todo | High | M | 0482 | Estimate a performance change's saving from history before launching its flow | Flow / Architecture | | +| **P1** | todo | High | L | 0481 | A flow whose intent scope overlaps a flow in flight is launched anyway and holds a concurrency slot while it waits | Architecture / Quality | | +| **P1** | in-progress | High | M | 0480 | A network outage at pre-flight ends the flow wrapper and the flow idles until someone relaunches it | Flow / Architecture | | +| **P1** | todo | High | L | 0479 | Parent pull request of a decomposed plan is re-reviewed in full after every child was approved | Architecture / Quality | | +| **P1** | todo | High | L | 0478 | Reviewers wait for CI inside their own turn although the engine already gates on CI | Architecture / Quality | | +| **P1** | todo | High | M | 0477 | Overlap-exit relaunch without --checkpoint restarts split-calibration-package from intent four times | Ledger / Observability | | +| **P1** | todo | High | L | 0476 | Local-flow overlap polling relaunches holon flow every minute, logs false clear, and bloats checkpoint logs | Architecture / Quality | | +| **P1** | todo | High | M | 0474 | Flow integration of a plan branch into its execution branch refuses an append-only executions.jsonl merge as 'not a pure ledger append' | Ledger / Observability | | +| **P1** | todo | High | M | 0473 | Flow push of a parent branch is rejected after a child PR merges into it (stale local parent, no fetch before push) | Ledger / Observability | | +| **P1** | in-progress | High | L | 0472 | Flow runner does not refuse a second run on the same intent and does not reap its children after a halt | Architecture / Quality | | +| **P1** | todo | Medium | M | 0468 | run_holon_flow.py exits on a Stage 3 overlap refusal instead of waiting it out | Skills / Tooling | | +| **P1** | todo | High | L | 0467 | Per-merge record commits make up 60 of the last 92 harness commits | Architecture / Quality | | +| **P1** | todo | Medium | M | 0466 | A flow stage that needs Docker aborts the moment the daemon is down instead of waiting | Build / DevEx | | +| **P1** | todo | High | L | 0465 | Harness beans, skills and the audit instruction sit uncommitted in the working tree | Architecture / Quality | | +| **P1** | todo | High | M | 0463 | Stage 2 planner collapses file-scoped intents into directory touch-set entries that broaden Stage 3 overlap | Flow / Architecture | | +| **P1** | in-progress | High | M | 0462 | Epoch-second stage and plan IDs collide across concurrent flows | Flow / Architecture | | +| **P1** | todo | High | M | 0460 | Stage 4 resolver runs full 7,800+ pytest suite twice and even on Markdown/bookkeeping-only fixes | Flow / Architecture | | +| **P1** | todo | High | L | 0458 | Ready pull requests are hand-synced before each merge and merged before that pipeline ends | Architecture / Quality | | +| **P1** | todo | Medium | M | 0455 | post-pr-merge rebuilds holon-coherence on hac merges, collides on burst merges, and skips triage | Build / DevEx | Three operational defects in `.agents/skills/post_pr_merge/SKILL.md` and | +| **P1** | todo | High | L | 0451 | dev-env CI lacks ci_bookkeeping_gate and runs test-unit (macos-latest) serially, causing 15+ min Stage 5 overruns | Architecture / Quality | `thomashan/dev-env` GitHub Actions workflows lack a bookkeeping-only path gate (`ci_bookkeeping_gate`, equivalent to | +| **P1** | todo | High | M | 0450 | Stage 4 review_local drops TestMeasurement.output_excerpt and preempts pending GitHub CI with slow host test runs | Flow / Architecture | When any reviewer objects in Stage 4 (`flow/review/loop.py:374-386`), the review loop probes GitHub CI once without | +| **P1** | todo | High | M | 0449 | Stage 4 unchanged_streak keys on raw head_sha and ignores open findings, letting target sync / doc-only commits loop indefinitely | Flow / Architecture | Stage 4 convergence detection (`unchanged_streak` in `flow/review/loop.py:568-578`) requires | +| **P1** | todo | High | M | 0448 | end_of_flow_sync._reenter_review_and_calibrate leaves stale calibrate=SUCCESS, causing nested Stage 5 rerun and bogus consensus withdrawal | Flow / Architecture | When `end_of_flow_sync._reenter_review_and_calibrate` re-enters Stage 4 (`FlowStage.REVIEW`) after an end-of-flow target | +| **P1** | todo | High | L | 0447 | Run Workspace survival via one shared child unit pass or separate CI jobs | Architecture / Quality | | +| **P1** | todo | High | L | 0446 | Stage 3 admission blocks SPLIT parent plans on union touch set before decomposition | Architecture / Quality | | +| **P1** | todo | High | L | 0445 | End-of-flow sync leaves checkpoint stuck at completed during Stage 4/5 re-entry | Architecture / Quality | | +| **P1** | todo | High | M | 0443 | Stage 4 pushes review ledger rows seconds after resolver or conflict merge, cancelling CI | Flow / Architecture | | +| **P1** | todo | High | M | 0442 | Stage 5 calibration invokes npx prettier twice instead of local binary | Flow / Architecture | | +| **P1** | todo | High | M | 0441 | Stage 5 final_head_ci reports unknown on bookkeeping-gated or transient-probe heads | Flow / Architecture | | +| **P1** | todo | Medium | M | 0440 | Harness pre-commit Prettier check blocks commits on unstaged files from parallel sessions | General | | +| **P1** | todo | High | M | 0439 | Stage 4 resolver edits out-of-scope files and reacts to timing-gate CI failures | Flow / Architecture | | +| **P1** | in-progress | Medium | M | 0436 | Sort the three ledgers into chronological order once, and keep them sorted | Skills / Tooling | | +| **P1** | in-progress | Medium | M | 0435 | dev-env improvements and cross-platform fixes | General | | +| **P1** | todo | High | M | 0432 | A resolver turn aborted with code -6 leaves unsalvaged edits and an error that blames a harmless warning | Ledger / Observability | | +| **P1** | todo | High | M | 0430 | The review-loop resolver turn has no turn budget, and a spinning test run defeats the stall budget | Flow / Architecture | | +| **P1** | todo | High | L | 0429 | Validate .beans/ header ID, title uniqueness, and filename consistency in pre_commit_check.py | Architecture / Quality | | +| **P1** | todo | High | M | 0428 | Use PR-own 3-dot diff instead of 2-dot diff in ci_final_head and touch-set inspection | Flow / Architecture | | +| **P1** | todo | High | M | 0426 | Fix run_holon_flow slug truncation, bean-progress truncated-slug attribution, and subagent intent rewrites | Flow / Architecture | | +| **P1** | todo | High | L | 0425 | Review iterations on claude-fable-5-2 take three times as long as on claude-opus-5-5 | Architecture / Quality | | +| **P1** | todo | High | L | 0424 | A transient DNS or Docker failure ends the review stage and throws away finished reviewer work | Architecture / Quality | | +| **P1** | todo | High | L | 0423 | Two agent sessions launch flows into one workspace with no shared registry, cap or log | Architecture / Quality | | +| **P1** | todo | High | L | 0422 | An --allow-overlap override is sticky: kept in the checkpoint and inherited by every later sub-intent and resume | Architecture / Quality | | +| **P2** | todo | High | L | 0488 | bean-progress lists a non-flow worktree as a bean row | Architecture / Quality | | --- ## Recommended Next Execution Sequence -**Start here (2026-11-23):** every active bean was audited against current `main` (`holon-agentic-coder` `0f0089d`, -`holon-coherence` `baf5c65`, `dev-env` `68ddec9`) and open HAC PRs #243 (`0155`), #244 (`0175`), #245 (`0191`). PR #222 -(0322), PR #225 (0172), PR #226 (0348), PR #227 (0199), PR #228 (0193), PR #229 (0349), PR #230 (0347, 0354), PR #234 -(0196), PRs #235 & #237 (0358), PR #236 (0194), PR #238 (0357), PR #239 (0356), PR #240 (0355), PR #241 (0189), and -`dev-env` PRs #31–#33 (0344, 0346, 0361), #36 (0351), #37 (0364), and #38 (0365) have merged. Run one flow at a time -within a lane; lanes run together only when their touch sets are disjoint. - -**In-flight (active flows / open PRs):** **HAC PR #243** (`0155`, `CLEAN`), **HAC PR #244** (`0175`, `UNSTABLE`), and -**HAC PR #245** (`0191`, `UNSTABLE`). - -**Ready now in parallel (disjoint from PRs #243/#244/#245 and each other):** - -- **HAC beads removal:** **Bean 0333** (P1, M — removes `.beads/` pilot, unblocks GitHub Issues migration `0215`–`0218` - and `0317`). -- **HAC runner/model lane (one at a time):** **Bean 0270** (P1, M — dynamic model discovery), **Bean 0350** (P1, M — - `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1`), **Bean 0198** (P2, M — `RunnerSpec` registry), or **Bean 0225** (P2, M — OS - keychain Claude token). -- **HAC calibration lane:** **Bean 0197** (P2, M — `calibration/` package; `0355` merged in PR #240). -- **HAC documentation / cleanup (unblocked now that PR #230/#241 merged):** **Bean 0174** (P1, M — env var reference), - **Bean 0359** (P3, XS — PR #230 deferred nit D-1), and **Bean 0200** (P2, M — remove `token_reduction` copy, now - unblocked by `0189`), **Bean 0269** (P3, XS — PR #158 nits, sequence with `0197`). -- **HAC Stage 2 / ledger / config:** **Bean 0360** (P1, S — interrupted Stage 2 duplicate `P-` branch), **Bean 0181** - (P2, M — `/_` only on branch refs). -- **Independent / host / `holon-coherence`:** **Bean 0226** (P2, L — operator-run sub-1B e2e), **Bean 0141** (P3, M — - host vMLX tuning), **Bean 0142** (P2, L — benchmark), and the `holon-coherence` slice of **Bean 0153** (P2 — all - coherence decompositions are merged). - -**Queued behind PRs #243 / #244 / #245 (file overlap):** - -- **CLI split & config lane (after PR #243/#244):** **Bean 0265** (`cli/__init__.py` split) -> **Bean 0173** (layered - `.env`, after `0155` & `0174`), **Bean 0157** (sidecar opt-in), **Bean 0223** (CLI flag/env audit). -- **Review-loop lane (after PR #245 `0191`):** **Bean 0192** (`ReviewLoop` object), **Bean 0255** (streaming resolvers), - **Bean 0352** (`gh webhook forward` + cheap polling), **Bean 0231** (raw count nit). -- **Solo repo-wide sweep:** **Bean 0176** (144 test files, runs alone with zero other HAC PRs in flight). -- **GitHub Issues migration chain:** **Bean 0333** -> **Bean 0215** (harness importer) + **Bean 0216** (flow - `work_item`) -> **Bean 0217** (`holon-coherence`) + **Bean 0317** (Projects board) -> **Bean 0218** (port skills & - retire harness). -- **Umbrella / per-package / draft:** **Bean 0152** (umbrella), **Bean 0153** (remove comments/docstrings per package - after split), **Bean 0340** (draft module-budget revisit; awaits maintainer authorisation). - -**Rules:** never run concurrent flows whose touched files overlap; no stage before merge halts for human review; target -suites use `uv run pytest` only; flows run in dedicated `flow-` worktrees off `origin/main`. -`HOLON_STAGE_BUDGET_*` accepts `unlimited` (Bean 0172). +**Checkpoint (2026-11-24):** pipeline time is the first priority: `0403` and `0405` are in flight to cut it, and nothing +that changes the review loop starts until they land. Run one flow at a time within a lane; lanes run together only when +their touch sets are disjoint. + +**Ordered sequence (one line of reasoning each):** + +1. **0403 and 0405** (in flight, P1): cut pipeline time first, because every flow waits on CI and the bookkeeping-only + skip and test trim shorten all of them. +2. **0404 with 0419** (P1, fix together): the timing gates fail green jobs on slow runners, which forces re-runs and + withdrawn consensus, so they cost pipeline time directly. +3. **0371** (P0, needs the maintainer's bot token or GitHub App first): ledger conflicts drive most churn, and it + touches only ledgers, so it can run in its own lane beside the review-loop work. +4. **0376** (P0, in progress): it is already running and owns the in-flow conflict resolver, so it finishes before any + other review-loop change. +5. **0407** (P0): stop re-running the full ensemble when nothing reviewable changed; it changes the review loop, so it + runs alone after 0376 lands and not together with 0255. +6. **0255** (P0): the resolver starts on the first pipeline failure and fixes every failure of the run; it goes after + 0407 so the skip rule is in place before the resolver changes the loop. +7. **0409** (P1): a rejected finding or a no-change resolver pass should not start another full review; it builds on + 0407 and 0255, so it follows them. +8. **0197 and 0216** (in progress, P2): held behind the pipeline-time flows, so they start only after 0403, 0404, 0405 + and 0419 land and the faster pipeline is live. diff --git a/.beans/holon-agentic-coder-ref-metadata-0141--tune-vmlx-prefill-and-decode-levers-safely.md b/.beans/holon-agentic-coder-ref-metadata-0141--tune-vmlx-prefill-and-decode-levers-safely.md index c249df63..ef548f06 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0141--tune-vmlx-prefill-and-decode-levers-safely.md +++ b/.beans/holon-agentic-coder-ref-metadata-0141--tune-vmlx-prefill-and-decode-levers-safely.md @@ -13,7 +13,7 @@ tags: - kv-cache - qwen3.8 created_at: 2026-10-22T14:29:12Z -updated_at: 2026-11-21T01:20:00+11:00 +updated_at: 2026-11-20T14:20:00Z --- Tune the prompt-processing (prefill) and token-generation (decode) levers of the local vMLX stack for **both** diff --git a/.beans/holon-agentic-coder-ref-metadata-0142--benchmark-27b-dense-vs-flash-next-moe-real-agentic-workloads.md b/.beans/holon-agentic-coder-ref-metadata-0142--benchmark-27b-dense-vs-flash-next-moe-real-agentic-workloads.md index f368bb94..80299c19 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0142--benchmark-27b-dense-vs-flash-next-moe-real-agentic-workloads.md +++ b/.beans/holon-agentic-coder-ref-metadata-0142--benchmark-27b-dense-vs-flash-next-moe-real-agentic-workloads.md @@ -14,7 +14,7 @@ tags: - performance - quality created_at: 2026-10-22T15:10:00Z -updated_at: 2026-11-23T00:00:00+11:00 +updated_at: 2026-11-22T13:00:00Z --- ## Problem diff --git a/.beans/holon-agentic-coder-ref-metadata-0152--audit-long-files-and-decompose-oversized-functions.md b/.beans/holon-agentic-coder-ref-metadata-0152--audit-long-files-and-decompose-oversized-functions.md index c25cae0d..1f274319 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0152--audit-long-files-and-decompose-oversized-functions.md +++ b/.beans/holon-agentic-coder-ref-metadata-0152--audit-long-files-and-decompose-oversized-functions.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0152 title: "Audit long files and decompose oversized functions (flow.py and cli.py first)" -status: in-progress +status: todo type: task priority: high tags: @@ -11,7 +11,7 @@ tags: - holon-agentic-coder - holon-coherence created_at: 2026-10-25T07:35:41Z -updated_at: 2026-11-23T00:00:00Z +updated_at: 2026-11-23T08:05:48Z --- ## Problem @@ -129,3 +129,6 @@ only. Child beans still open: 0189, 0191, 0192, 0197, 0198, 0200, 0265, plus `entrypoint/planner.py` `main`. The committed audit script is flow intent 0152 (`audit-function-length-script`). + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-audit-function-length-script-2026-11-23.bundle diff --git a/.beans/holon-agentic-coder-ref-metadata-0153--remove-comments-and-docstrings-from-all-code.md b/.beans/holon-agentic-coder-ref-metadata-0153--remove-comments-and-docstrings-from-all-code.md index eb6ffde2..8a2ae4f3 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0153--remove-comments-and-docstrings-from-all-code.md +++ b/.beans/holon-agentic-coder-ref-metadata-0153--remove-comments-and-docstrings-from-all-code.md @@ -13,7 +13,7 @@ tags: - holon-agentic-coder - holon-coherence created_at: 2026-10-25T07:42:56Z -updated_at: 2026-10-25T07:43:50Z +updated_at: 2026-11-25T22:58:00Z --- ## Problem @@ -102,3 +102,328 @@ Neither repository's ruff config requires docstrings: `select` is `E W F I UP B - Re-run the baseline count (Python AST pass plus a per-language comment count) after each PR and add the numbers here. - Related: Bean 0152 (decompose oversized functions and split modules), Bean 0151 (planner touch sets with a hard block on overlapping concurrent flows). + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-remove-comments-sandbox-shell-2026-11-23.bundle 2026-11-24: launched +> `holon-coherence` build/shell self-documenting slice (`coherence-build-self-doc`, intent +> `todo/intent-0153-coherence-build-self-doc.json`) via `antigravity-agent` / `gemini-4-argon`. + +> 2026-11-24: `holon-coherence` build/shell slice (`coherence-build-self-doc`) delivered via +> [PR #45](https://github.com/Holon-Agentic-Coder/holon-coherence/pull/45) and merged into `main` (`026b0a25`; 3/3 +> consensus approved, 7/7 CI green, Stage 5 calibrated EV predicted `8.32` / actual `8.33` / delta `+0.01`), +> `holon-coherence` image & CLI rebuilt, and `flow-coherence-build-self-doc` worktree pruned. + +> 2026-11-24: launched `holon-coherence` metrics/ab_testing self-documenting slice (`coherence-metrics-ab-self-doc`, +> intent `todo/intent-0153-coherence-metrics-ab-self-doc.json`) via `antigravity-agent` / `gemini-4-argon`. + +> 2026-11-24: the `holon-coherence` metrics/ab_testing slice (`coherence-metrics-ab-self-doc`) was delivered via +> [PR #46](https://github.com/Holon-Agentic-Coder/holon-coherence/pull/46) and merged into `main` (`5f7d6bbf`; 3/3 +> consensus approved, 7/7 CI green, Stage 5 calibrated), `holon-coherence` image & CLI rebuilt, and +> `flow-coherence-metrics-ab-self-doc` pruned. + +> 2026-11-24: launched `holon-coherence` container self-documenting slice (`coherence-container-self-doc`, intent +> `todo/intent-0153-coherence-container-self-doc.json`) via `antigravity-agent` / `gemini-4-argon`. + +> 2026-11-24: launched `holon-coherence` parsers/providers self-documenting slice (`coherence-providers-self-doc`, +> intent `todo/intent-0153-coherence-providers-self-doc.json`) via `antigravity-agent` / `gemini-4-argon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-coherence#48` (`coherence-providers-self-doc`, parsers/ + providers/ slice) +> merged at `981a88a4` (3/3 approved, 7/7 CI green, Stage 5 calibrated), `apps/holon-coherence/main` was fast-forwarded, +> `holon-coherence` was rebuilt/reinstalled, and `flow-coherence-providers-self-doc` was pruned. + +> 2026-11-24: `Holon-Agentic-Coder/holon-coherence#49` (`coherence-commands-self-doc`, `commands/` + `tests/commands/` +> slice) merged at `9c9310fc` (7/7 CI green, Stage 5 calibrated EV predicted `8.57` / actual `8.36` / delta `-0.21`), +> `apps/holon-coherence/main` fast-forwarded, `holon-coherence` rebuilt/reinstalled, and +> `flow-coherence-commands-self-doc` pruned. + +> 2026-11-24: `Holon-Agentic-Coder/holon-coherence#50` (`coherence-proxy-self-doc`, `proxy/` + `tests/proxy/` slice) +> merged at `4469abc9` (7/7 CI green, Stage 5 calibrated), `apps/holon-coherence/main` fast-forwarded, `holon-coherence` +> rebuilt/reinstalled, and `flow-coherence-proxy-self-doc` pruned. + +> 2026-11-24: `Holon-Agentic-Coder/holon-coherence#51` (`coherence-core-self-doc`, top-level `src/holon_coherence/*.py` +> slice) merged at `734e557` (7/7 CI green, Stage 5 calibrated EV predicted `8.65` / actual `8.96` / delta `+0.31`), +> `apps/holon-coherence/main` fast-forwarded, `holon-coherence` rebuilt/reinstalled, and `flow-coherence-core-self-doc` +> pruned. + +> 2026-11-24: launched `holon-coherence` scripts and CI/hygiene/Makefile tests self-documenting slice +> (`coherence-scripts-self-doc`, intent `todo/intent-0153-coherence-scripts-self-doc.json`) via `antigravity-agent` / +> `gemini-4-neon`. + +> 2026-11-24: launched `holon-coherence` CLI/coherence/host-local/hybrid-cache tests self-documenting slice +> (`coherence-cli-tests-self-doc`, intent `todo/intent-0153-coherence-cli-tests-self-doc.json`) via `antigravity-agent` +> / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-coherence#52` (`coherence-scripts-self-doc`, commit +> `c38beea5ac762922024e9ca1c59758d40576735f`) merged at `2026-11-24T10:56:55Z` (7/7 CI checks green, EV `8.56` -> +> `8.87`), covering the scripts self-doc slice. `apps/holon-coherence/main` fast-forwarded, `holon-coherence` +> rebuilt/reinstalled, and `flow-coherence-scripts-self-doc` worktree/branches pruned. + +> 2026-11-24: launched `holon-coherence` mitmproxy addon and SSE tests self-documenting slice +> (`coherence-addon-tests-self-doc`, intent `todo/intent-0153-coherence-addon-tests-self-doc.json`) via +> `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-coherence#54` (`coherence-addon-tests-self-doc`, merge commit +> `ec0cd5a106ec3178c1d4f073c35fe8995399a712`, merged `2026-11-24T11:31:59Z`, 7/7 CI checks green, Stage 5 calibrated) +> landed cleanly, covering the final Python files in `holon-coherence` for Bean `0153`. `apps/holon-coherence/main` +> fast-forwarded, `holon-coherence` rebuilt/reinstalled, and `flow-coherence-addon-tests-self-doc` pruned. + +- 2026-11-24 (clean-up): stays open. `holon-coherence` Python source and tests, build files and scripts are delivered by + PRs #45 to #54 (Python files finished by #54 at 11:31Z). Remaining: every `holon-agentic-coder` slice (the slice + `launcher-proxy-self-doc` has a worktree), and any `holon-coherence` Makefile or workflow comments not covered by #45. + +> 2026-11-24: launched `holon-agentic-coder` launcher container/mount/dispatch self-documenting slice +> (`launcher-containers-self-doc`, intent `todo/intent-0153-launcher-containers-self-doc.json`) via `antigravity-agent` +> / `gemini-4-neon`. + +> 2026-11-24: launched `holon-agentic-coder` CLI flow-helper and lifecycle commands self-documenting slice +> (`cli-commands-exec-self-doc`, intent `todo/intent-0153-cli-commands-exec-self-doc.json`) via `antigravity-agent` / +> `gemini-4-neon`. + +> 2026-11-24: launched `holon-agentic-coder` CLI calibration/review/ledger commands self-documenting slice +> (`cli-commands-misc-self-doc`, intent `todo/intent-0153-cli-commands-misc-self-doc.json`) via `antigravity-agent` / +> `gemini-4-neon`. + +> 2026-11-24: launched `holon-agentic-coder` E2E harness modules self-documenting slice (`e2e-self-doc`, intent +> `todo/intent-0153-e2e-self-doc.json`) via `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: launched `holon-agentic-coder` entrypoint execution-helper modules self-documenting slice +> (`entrypoint-exec-self-doc`, intent `todo/intent-0153-entrypoint-exec-self-doc.json`) via `antigravity-agent` / +> `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#284` (`e2e-self-doc`, head `0e964ec2`, Stage 4 3/3 approved, +> Stage 5 calibrated, 11/11 CI checks green) recovered after duplicate-run checkout hiccup and verified ready to merge. +> Backfilled slot #4 with `entrypoint-helpers-self-doc` (`todo/intent-0153-entrypoint-helpers-self-doc.json`) via +> `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#285` (`entrypoint-exec-self-doc`, head `0bd75b56`) completed +> Stage 4 consensus and Stage 5 calibration (`9/11` CI checks `SUCCESS`; re-triggered cancelled `build (macos-latest)` +> and `unit (macos-latest)`). Backfilled slot #3 with `ledger-self-doc` (`todo/intent-0153-ledger-self-doc.json`) via +> `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#285` (`entrypoint-exec-self-doc`, head `0bd75b56`, `11/11` CI +> checks green) and `Holon-Agentic-Coder/holon-agentic-coder#286` (`entrypoint-helpers-self-doc`, head `2ea6652b`, +> `11/11` CI checks green, Stage 4 3/3 approved, Stage 5 calibrated EV `40.61` -> `51.94`) both verified ready to merge. +> Backfilled slot #4 with `core-helpers-self-doc` (`todo/intent-0153-core-helpers-self-doc.json`) via +> `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: Backfilled slot #1 (vacated by `0376` PR #283) with `git-utils-self-doc` +> (`todo/intent-0153-git-utils-self-doc.json`) via `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#288` (`git-utils-self-doc`, head `baa3cc1b`, `11/11` CI checks +> green, Stage 4 APPROVED, Stage 5 calibrated EV `42.75` -> `57.21`) verified ready to merge. Backfilled slot #1 with +> `knowledge-self-doc` (`todo/intent-0153-knowledge-self-doc.json`) via `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#287` (`ledger-self-doc`, head `72d438b9`, calibrated, 9/11 CI +> checks `SUCCESS`; re-triggered cancelled `build (macos-latest)` while `unit (macos-latest)` is queued). Backfilled +> slot #3 with `infra-helpers-self-doc` (`todo/intent-0153-infra-helpers-self-doc.json`) via `antigravity-agent` / +> `gemini-4-neon`. + +> 2026-11-24: `infra-helpers-self-doc` paused at Stage 3 after detecting a real `redaction.py` overlap with open +> `holon-agentic-coder#287` (waiting cleanly until `#287` merges). Filled active slot #3 in `holon-coherence` with +> `coherence-final-self-doc` (`todo/intent-0153-coherence-final-self-doc.json`, covering the final 2 Python test files, +> 3 YAML files, and repo-wide enforcement in `tests/test_repo_self_doc.py`) via `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#289` (`core-helpers-self-doc`, head `6f14049c`, `11/11` CI checks +> green, Stage 4 APPROVED at iter 3, Stage 5 calibrated EV `39.15` -> `49.09`) verified ready to merge. Backfilled slot +> #4 with `executor-pkg-self-doc` (`todo/intent-0153-executor-pkg-self-doc.json`) via `antigravity-agent` / +> `gemini-4-neon`. + +> 2026-11-25: `Holon-Agentic-Coder/holon-coherence#56` (`coherence-final-self-doc`, head `faf37e06`, merge commit +> `18084f3a`, merged `2026-11-25T22:57:30Z`, 7/7 CI checks green, Stage 4 APPROVED, Stage 5 calibrated EV `8.29` -> +> `8.84`) merged into `main`, completing all Python and workflow/action YAML self-doc slices plus repo-wide enforcement +> in `holon-coherence`. `apps/holon-coherence/main` fast-forwarded to `18084f3a`, `holon-coherence` Docker image and CLI +> rebuilt/reinstalled via `install_coherence.py`, and `flow-coherence-final-self-doc` worktree plus +> `I-1795548977-coherence-final-self-doc/*` (local and remote) and `flow-coherence-final-self-doc` branches pruned. Bean +> `0153` stays `in-progress` while `holon-agentic-coder` slices remain. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#291` (`executor-pkg-self-doc`, head `5b386da1`, `11/11` CI checks +> green, Stage 4 APPROVED, Stage 5 calibrated EV `35.67` -> `48.36`) verified ready to merge. Backfilled slot #4 with +> `review-meta-self-doc` (`todo/intent-0153-review-meta-self-doc.json`) via `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#282` (`cli-commands-misc-self-doc`, merge commit `b8093ff6`, +> merged `2026-11-24T20:46:19Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded, `holon` +> rebuilt/reinstalled, and `flow-cli-commands-misc-self-doc` worktree/branches pruned. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#290` (`knowledge-self-doc`, head `57152552`, `P-1795547238` +> calibrated) completed all 5 stages before transient host DNS interruption (`21:21Z`); needs ledger merge after `#283` +> merges. Backfilled slot #2 with `git-flow-self-doc` (`todo/intent-0153-git-flow-self-doc.json`) via +> `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#293` (`review-meta-self-doc`, head `995bd4c2`, `11/11` CI checks +> green, calibrated EV `35.20` -> `44.47`) verified ready to merge (`#283` also settled ledgers `91b23ee9`, `MERGEABLE` +> / `CLEAN`, `11/11` CI `SUCCESS`). Backfilled slot #4 with `local-llm-self-doc` +> (`todo/intent-0153-local-llm-self-doc.json`) via `antigravity-agent` / `gemini-4-neon`. + +> 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#276` (`launcher-proxy-self-doc`, merge commit `e1d1ae37`, merged +> `2026-11-24T23:43:09Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded, Docker images and +> `holon`/`holon-coherence` CLIs rebuilt and reinstalled via `install_holon.py`, and `flow-launcher-proxy-self-doc` +> worktree plus `I-1795524475-launcher-proxy-self-doc/*`, `I-1795524794-launcher-proxy-self-doc/*`, and +> `flow-launcher-proxy-self-doc` branches pruned. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#280` (`launcher-containers-self-doc`, merge commit `131c3b42`, +> merged `2026-11-25T01:01:13Z`; 3/3 consensus approved, 11/11 CI green, Stage 5 calibrated) merged into `main`. +> `apps/holon-agentic-coder/main` fast-forwarded to `131c3b42`, `holon` images and CLI rebuilt/reinstalled via +> `install_holon.py --holon-only`, and `flow-launcher-containers-self-doc` worktree plus +> `I-1795530292-launcher-containers-self-doc/*` (local and remote) and `flow-launcher-containers-self-doc` branches +> pruned. Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#301` (`preflight-self-doc`, head `74a5ce76`, 3/3 consensus +> approved at iter 1, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `46.47` -> `55.27`, `MERGEABLE`/`CLEAN`) completed all 5 +> stages and is ready to merge. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#302` (`review-report-self-doc`, head `7ccad6b4`, 3/3 consensus +> approved at iter 1, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `36.85` -> `44.76`, `MERGEABLE`/`CLEAN`) completed all 5 +> stages and is ready to merge. Backfilled active flow slots with `agent-defaults-self-doc` and `github-ci-self-doc`. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#300` (`decomposition-rule-self-doc`, head `4c86f067`, 3/3 +> consensus approved at iter 2, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `49.69` -> `58.62`, `MERGEABLE`/`CLEAN`) +> completed all 5 stages and is ready to merge. Backfilled active flow slot with `git-refs-self-doc`. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#303` (`agent-defaults-self-doc`, head `8683fb18`, 3/3 consensus +> approved at iter 1, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `36.65` -> `44.47`, `MERGEABLE`/`CLEAN`) completed all 5 +> stages and is ready to merge. Backfilled active flow slot with `github-pr-merge-self-doc`. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#304` (`github-ci-self-doc`, head `0f32de55`, 3/3 consensus +> approved at iter 1, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `33.95` -> `42.06`, `MERGEABLE`/`CLEAN`) completed all 5 +> stages and is ready to merge. Backfilled active flow slot with `github-misc-self-doc`. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#305` (`git-refs-self-doc`, head `11334f7a`, 3/3 consensus +> approved at iter 2, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `41.01` -> `48.79`, `MERGEABLE`/`CLEAN`) completed all 5 +> stages and is ready to merge. Holding further `Bean 0153` backfills until open PRs merge. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#307` (`github-misc-self-doc`, head `aa8cd726`, 3/3 consensus +> approved at iter 1, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `46.10` -> `55.45`, `MERGEABLE`/`CLEAN`) completed all 5 +> stages and is ready to merge. Holding further `Bean 0153` backfills until open PRs merge. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#281` (`cli-commands-exec-self-doc`, merge commit `c93bb9eb`, +> merged `2026-11-25T02:08:49Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `c93bb9eb`, +> `holon` images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-cli-commands-exec-self-doc` +> worktree plus `I-1795532856-cli-commands-exec-self-doc/*` (local and remote) and `flow-cli-commands-exec-self-doc` +> branches pruned. Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#306` (`github-pr-merge-self-doc`, head `928446ed`, 3/3 consensus +> approved at iter 2, 11/11 CI `SUCCESS`, Stage 5 calibrated EV `39.38` -> `46.51`, `MERGEABLE`/`CLEAN`) completed all 5 +> stages and is ready to merge. Holding further `Bean 0153` backfills until open PRs merge. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#284` (`e2e-self-doc`, merge commit `1a5c69d6`, merged +> `2026-11-25T02:47:53Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `1a5c69d6`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-e2e-self-doc` worktree plus +> `I-1795536007-e2e-self-doc/*` (local and remote) and `flow-e2e-self-doc` branches pruned. Bean `0153` stays +> `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#285` (`entrypoint-exec-self-doc`, merge commit `2305219e`, merged +> `2026-11-25T02:58:51Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `2305219e`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-entrypoint-exec-self-doc` worktree +> plus `I-1795539256-entrypoint-exec-self-doc/*` (local and remote) and `flow-entrypoint-exec-self-doc` branches pruned. +> Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#286` (`entrypoint-helpers-self-doc`, merge commit `0ba99e0c`, +> merged `2026-11-25T03:07:49Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `0ba99e0c`, +> `holon` images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-entrypoint-helpers-self-doc` +> worktree plus `I-1795540468-entrypoint-helpers-self-doc/*` (local and remote) and `flow-entrypoint-helpers-self-doc` +> branches pruned. Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#287` (`ledger-self-doc`, merge commit `522293a6`, merged +> `2026-11-25T03:21:48Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `522293a6`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-ledger-self-doc` worktree plus +> `I-1795543016-ledger-self-doc/*` (local and remote) and `flow-ledger-self-doc` branches pruned. Bean `0153` stays +> `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#288` (`git-utils-self-doc`, merge commit `558646ae`, merged +> `2026-11-25T03:35:55Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `558646ae`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-git-utils-self-doc` worktree plus +> `I-1795544951-git-utils-self-doc/*` (local and remote) and `flow-git-utils-self-doc` branches pruned. Bean `0153` +> stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#289` (`core-helpers-self-doc`, merge commit `c0a183f4`, merged +> `2026-11-25T03:42:30Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `c0a183f4`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-core-helpers-self-doc` worktree plus +> `I-1795544814-core-helpers-self-doc/*` (local and remote) and `flow-core-helpers-self-doc` branches pruned. Bean +> `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#290` (`knowledge-self-doc`, merge commit `ae2c5b41`, merged +> `2026-11-25T03:58:54Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `ae2c5b41`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-knowledge-self-doc` worktree plus +> `I-1795547220-knowledge-self-doc/*` (local and remote) and `flow-knowledge-self-doc` branches pruned. Bean `0153` +> stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#291` (`executor-pkg-self-doc`, merge commit `4da9b33b`, merged +> `2026-11-25T04:11:48Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `4da9b33b`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-executor-pkg-self-doc` worktree plus +> `I-1795549499-executor-pkg-self-doc/*` (local and remote) and `flow-executor-pkg-self-doc` branches pruned. Bean +> `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#292` (`config-env-self-doc`, merge commit `301f8fdb`, merged +> `2026-11-25T04:49:53Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `301f8fdb`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and `flow-config-env-self-doc` worktree plus +> `I-1795551241-config-env-self-doc/*` (local and remote) and `flow-config-env-self-doc` branches pruned. Bean `0153` +> stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#293` (`review-meta-self-doc`, merge commit `daf3fa74`, merged +> `2026-11-25T04:52:30Z`) and `Holon-Agentic-Coder/holon-agentic-coder#294` (`git-flow-self-doc`, merge commit +> `d87d9823`, merged `2026-11-25T04:55:29Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to +> `d87d9823`, `holon` images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and +> `flow-review-meta-self-doc` / `flow-git-flow-self-doc` worktrees plus `I-1795552034-review-meta-self-doc/*`, +> `I-1795560404-git-flow-self-doc/*` (local and remote), and `flow-*` branches pruned. Bean `0153` stays `in-progress` +> for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#295` (`local-llm-self-doc`, merge commit `099025f8`, merged +> `2026-11-25T04:59:58Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `origin/main` +> (`4c6232cb`, which already includes `099025f8` and `#296`), `holon` images and CLI rebuilt/reinstalled via +> `install_holon.py --holon-only`, and `flow-local-llm-self-doc` worktree plus `I-1795561357-local-llm-self-doc/*` +> (local and remote) and `flow-local-llm-self-doc` branches pruned. Bean `0153` stays `in-progress` for the remaining +> slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#297` (`claude-auth-self-doc`, merge commit `0bd580ea`, merged +> `2026-11-25T05:09:36Z`) and `Holon-Agentic-Coder/holon-agentic-coder#298` (`touch-set-self-doc`, merge commit +> `5e08904f`, merged `2026-11-25T05:12:10Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to +> `5e08904f`, `holon` images and CLI rebuilt/reinstalled via `install_holon.py --holon-only`, and +> `flow-claude-auth-self-doc` / `flow-touch-set-self-doc` worktrees plus `I-1795563579-claude-auth-self-doc/*`, +> `I-1795565481-touch-set-self-doc/*` (local and remote), and `flow-*` branches pruned. Bean `0153` stays `in-progress` +> for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#300` (`decomposition-rule-self-doc`, merge commit `efafa316`) +> merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `efafa316`, `holon` images and CLI +> rebuilt/reinstalled via `install_holon.py --holon-only` (`holon --help` exit 0), and +> `flow-decomposition-rule-self-doc` worktree plus `I-1795567884-decomposition-rule-self-doc/*` (local and remote) and +> `flow-decomposition-rule-self-doc` branches pruned. Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#301` (`preflight-self-doc`, merge commit `ebcffd12`) merged into +> `main`. `apps/holon-agentic-coder/main` fast-forwarded to `ebcffd12`, `holon` images and CLI rebuilt/reinstalled via +> `install_holon.py --holon-only` (`holon --help` exit 0), and `flow-preflight-self-doc` worktree plus +> `I-1795567888-preflight-self-doc/*` (local and remote) and `flow-preflight-self-doc` branches pruned. Bean `0153` +> stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#302` (`review-report-self-doc`, merge commit `67bfb621`), +> `Holon-Agentic-Coder/holon-agentic-coder#303` (`agent-defaults-self-doc`, merge commit `d281e437`), and +> `Holon-Agentic-Coder/holon-agentic-coder#304` (`github-ci-self-doc`, merge commit `bdb2d5f1`) merged into `main`. +> `apps/holon-agentic-coder/main` fast-forwarded to `bdb2d5f1`, `holon` images and CLI rebuilt/reinstalled via +> `install_holon.py --holon-only` (`holon --help` exit 0), and `flow-review-report-self-doc`, +> `flow-agent-defaults-self-doc`, and `flow-github-ci-self-doc` worktrees plus `I-1795567884-review-report-self-doc/*`, +> `I-1795569457-agent-defaults-self-doc/*`, `I-1795569528-github-ci-self-doc/*` (local and remote) and `flow-*` branches +> pruned. Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#305` (`git-refs-self-doc`, merge commit `6df29342`, merged +> `2026-11-25T06:12:01Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `6df29342`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only` (`holon --help` exit 0), and +> `flow-git-refs-self-doc` worktree plus `I-1795569615-git-refs-self-doc/*` (local and remote) and +> `flow-git-refs-self-doc` branches pruned. Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#306` (`github-pr-merge-self-doc`, merge commit `867f029f`, merged +> `2026-11-25T06:51:27Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `867f029f`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only` (`holon --help` exit 0), and +> `flow-github-pr-merge-self-doc` worktree plus `I-1795570951-github-pr-merge-self-doc/*` (local and remote) and +> `flow-github-pr-merge-self-doc` branches pruned. Bean `0153` stays `in-progress` for the remaining slices. + +> 2026-11-25: `Holon-Agentic-Coder/holon-agentic-coder#307` (`github-misc-self-doc`, merge commit `e1f63aae`, merged +> `2026-11-25T06:54:51Z`) merged into `main`. `apps/holon-agentic-coder/main` fast-forwarded to `e1f63aae`, `holon` +> images and CLI rebuilt/reinstalled via `install_holon.py --holon-only` (`holon --help` exit 0), and +> `flow-github-misc-self-doc` worktree plus `I-1795570995-github-misc-self-doc/*` (local and remote) and +> `flow-github-misc-self-doc` branches pruned. Bean `0153` stays `in-progress` for the remaining slices. + +Note (2026-11-25): stale plan `infra-helpers-self-doc` deleted after PR #309 merged; restart from current main via the +kept `todo/intent-0153-infra-helpers-self-doc.json`. + +> 2026-11-27: launched `holon-agentic-coder` self-explaining code gate slice (`self-explaining-code-gate`, intent +> `todo/intent-0153-self-explaining-code-gate.json`; diff-scoped hygiene check, lint/pre-commit/CI wiring and prompt +> invariant) via `claude-agent` / `claude-opus-5-5`, flow branch `flow-self-explaining-code-gate`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0157--holon-flow-auto-enables-the-mitmproxy-sidecar-whe.md b/.beans/holon-agentic-coder-ref-metadata-0157--holon-flow-auto-enables-the-mitmproxy-sidecar-whe.md index 2311c4af..4565f950 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0157--holon-flow-auto-enables-the-mitmproxy-sidecar-whe.md +++ b/.beans/holon-agentic-coder-ref-metadata-0157--holon-flow-auto-enables-the-mitmproxy-sidecar-whe.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0157 title: "holon flow auto-enables the mitmproxy sidecar when the image exists, and role containers cannot reach it" -status: in-progress +status: completed type: bug priority: high tags: @@ -10,7 +10,7 @@ tags: - proxy - holon-agentic-coder created_at: 2026-10-26T04:23:42Z -updated_at: 2026-11-23T09:00:00+11:00 +updated_at: 2026-11-23T07:31:00Z --- ## Problem @@ -46,3 +46,26 @@ Still valid on `origin/main`, with new locations: `FlowContext.__post_init__` in calls `detect_holon_coherence()` from `cli/__init__.py` (around line 545), whose tiers 4 (docker image probe) and 5 (CLI binary probe) still return true without an explicit opt-in, so `holon flow` can still spawn the sidecar. `cli.py` is now the `cli/` package. + +## Resolution + +Delivered via [PR #248](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/248) and merged into `main` +(`d369f2fd`), as flow `flow-no-auto-sidecar-spawn-v2` (bean 0157, intent `I-1795409207`): + +- **Key Architectural Deliverables**: `holon flow` no longer auto-enables the token-reduction mitmproxy sidecar from a + merely present image or CLI. The sidecar is spawned only on explicit opt-in; auto-detection may attach only to an + already running user-owned proxy. Opt-out wins. Role containers on the sidecar network are covered by the reachability + work in the same PR. +- **Verification & Tests**: `apps/sandbox-executor/tests/test_flow_proxy_opt_in.py` (image present without opt-in spawns + no sidecar; opt-out wins; container-side reachability), plus updated flow, dispatch, context, preflight and PR-adapter + tests. +- **Holon Flow Traversal**: intent, plan, execute and review (consensus approval) completed. Calibrate failed on the + first pass with `Calibrate stage refused: code conflicts with main` (`holon-knowledge/kb/failure_modes/index.json`, + `ledger/executions.jsonl`, `ledger/intents.jsonl`), so the calibration report was not refreshed for the head. The PR + merged before that was resolved. Follow-up: confirm the calibration report and ledger rows on `main`. +- **Post-merge follow-up (2026-11-23)**: the flow's final calibration report `de8dec8e` + (`chore(calibration): add calibration report for P-1795409223-CLA-CO5.5`) was **never merged** to `main`; `main` + carries only the squash of PR #248 (`d369f2fd`, from head `7cb5ed45`). It exists only on the flow branch + `origin/I-1795409207-flow-no-auto-sidecar-spawn-v2/P-1795409223-CLA-CO5.5/E-1795409586-CLA-CO5.5/_` (head `8b0278da`, + with review ledger rows, a comment-only fix and the calibrated tag branch). The flow worktree and its local branches + were pruned on 2026-11-23; the remote branches remain. diff --git a/.beans/holon-agentic-coder-ref-metadata-0173--holon-loads-a-layered-env-file-that-every-sandbox.md b/.beans/holon-agentic-coder-ref-metadata-0173--holon-loads-a-layered-env-file-that-every-sandbox.md index 041d4955..030dde43 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0173--holon-loads-a-layered-env-file-that-every-sandbox.md +++ b/.beans/holon-agentic-coder-ref-metadata-0173--holon-loads-a-layered-env-file-that-every-sandbox.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0173 title: "holon loads layered .env files (specific overrides broad) that every sandbox stage inherits" -status: in-progress +status: completed type: feature priority: high tags: @@ -10,7 +10,7 @@ tags: - security - holon-agentic-coder created_at: 2026-10-27T14:07:56Z -updated_at: 2026-11-22T23:01:00Z +updated_at: 2026-11-23T07:31:00Z --- ## Problem @@ -92,3 +92,22 @@ which keeps forwarded values off the docker argv. Nothing persists a user's or a - Bean 0157: sidecar auto-enable; with a `.env`, `HOLON_TOKEN_REDUCE` can be set once. - Bean 0172: an explicit `unlimited` budget, which would live in this file. - Bean 0156: if issue tracking moves to the targets, configuration should be target-native too. + +## Resolution + +Delivered via [PR #251](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/251) and merged into `main` +(`e4f34cae`), as flow `layered-env-config-v2` (bean 0173, intent `I-1795409213`; the first attempt `I-1795388470` was +abandoned and never merged): + +- **Key Architectural Deliverables**: `holon` resolves a layered `.env` (built-in defaults, `~/.holon/.env`, project + `/.env`, process environment, CLI flags) once per invocation, per-key, with the most specific layer + winning. Strict dotenv parsing with a `HOLON_*` allow-list and documented secret mappings (`HOLON_AGENT_OAUTH_TOKEN` + to `CLAUDE_CODE_OAUTH_TOKEN`, file-referenced secrets). Effective settings are forwarded to every role container + through the 0600 env-file. `holon doctor` (and `--json`) reports each effective setting with its source layer, and + secrets are shown only as `set (layer)`. `holon init` scaffolds a commented `.env.example` and git-ignores `.env`. + Every supported key is documented in the sandbox-executor README. +- **Verification & Tests**: hermetic `apps/sandbox-executor/tests/test_config_env.py` and + `test_config_env_inheritance.py` (precedence across layers, parsing edge cases, allow-list and rejection, permission + checks, redaction, doctor report, container and nested inheritance), plus updated launch characterisation tests. +- **Holon Flow Traversal**: intent, plan and execute completed; review reached consensus approval over several + iterations; calibration report `P-1795410717-CLA-CO5.5_calibration.md` and the Stage 5 ledger rows are on `main`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0174--document-every-environment-variable-holon-reads.md b/.beans/holon-agentic-coder-ref-metadata-0174--document-every-environment-variable-holon-reads.md index d1c323c1..e95ef1eb 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0174--document-every-environment-variable-holon-reads.md +++ b/.beans/holon-agentic-coder-ref-metadata-0174--document-every-environment-variable-holon-reads.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0174 title: "Document every environment variable holon reads, in one generated and CI-checked reference" -status: in-progress +status: completed type: task priority: high tags: @@ -9,7 +9,7 @@ tags: - configuration - holon-agentic-coder created_at: 2026-10-27T14:08:31Z -updated_at: 2026-11-22T23:05:00Z +updated_at: 2026-11-23T08:33:00Z --- ## Problem @@ -72,3 +72,34 @@ During the October flow runs this cost real time. Behaviour-changing settings we - Inventory command used, for reproduction: grep for `(HOLON|GITHUB|GH|CLAUDE|ANTHROPIC|OPENAI|GEMINI|PI|CODEX|OPENCODE|AGY|HTTP|HTTPS|NO|GIT)_[A-Z0-9_]+` across those paths, and compare against the `HOLON_*` names in `docs/`, `README.md` and `apps/sandbox-executor/docs`. + +- Progress (2026-11-23, flow resume): resumed Stage 3 from checkpoint with claude-agent / claude-opus-5-5 via + `run_holon_flow.py --allow-overlap`. Blocked: the executor found no failed execution with partial work, then ran + `git checkout -b` for a new E branch off the plan tip, and that failed, leaving the existing E-1795413310 branch (five + execution commits, steps 1-5, no executions.jsonl row) and one uncommitted `executions/E-1795413310-CLA-CO5.5.md` in + place. Stage 3 halted with no PR opened. Flow log: `todo/flow-document-env-variables-v2.log`. Not resolved by hand; + needs the maintainer or a flow-resume fix before the flow can continue. + +## Progress note (flow document-env-variables-v3) + +- New flow from current main (intent document-env-variables-v3, claude-agent / claude-opus-5-5). The v2 attempt was left + untouched. +- Intent, plan and execute completed. Review halted once on the conflict gate after main moved (PR #253 merge). Resumed + from checkpoint; the new head approved 3/3 with CI green. +- Calibration included in PR diff. PR #256 is OPEN, MERGEABLE, CLEAN on head b62672ec. Awaiting human merge into main + (not merged by the agent). + +## Resolution + +Delivered via [PR #256](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/256) and merged into `main` +(`c941d78`): + +- **Key Architectural Deliverables**: one generated, CI-checked reference of every `HOLON_*` environment variable the + sandbox executor reads, linked from the docs. +- **Flow history**: the first attempt (`document-env-variables-v2`) halted at Stage 3 with no PR. Its five unmerged + execution commits and one uncommitted execution file were backed up to + `todo/stale-worktree-backups/document-env-variables-v2-2026-11-23.bundle` and + `todo/stale-worktree-backups/document-env-variables-v2-E-1795413310-CLA-CO5.5.uncommitted.md`, then its worktree and + branches were removed. The v3 flow worktree and its branches were removed after the merge. +- **Holon Flow Traversal**: the v3 flow ran intent, plan and execute; review passed 3/3 after a resume from checkpoint; + calibration was included in the PR. diff --git a/.beans/holon-agentic-coder-ref-metadata-0175--pre-flight-github-token-scopes-before-stage-3-w.md b/.beans/holon-agentic-coder-ref-metadata-0175--pre-flight-github-token-scopes-before-stage-3-w.md index 1766a4ed..c71a9906 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0175--pre-flight-github-token-scopes-before-stage-3-w.md +++ b/.beans/holon-agentic-coder-ref-metadata-0175--pre-flight-github-token-scopes-before-stage-3-w.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0175 title: "Check GitHub token scopes before Stage 3 when the plan touches workflow files" -status: in-progress +status: completed type: bug priority: high tags: @@ -10,7 +10,7 @@ tags: - preflight - holon-agentic-coder created_at: 2026-10-27T14:59:39Z -updated_at: 2026-11-23T15:20:00+11:00 +updated_at: 2026-11-23T05:53:23Z --- ## Problem @@ -77,3 +77,20 @@ list to inspect for `.github/workflows/**`. 0/0/0 at 7420e5af; consensus posted as a comment (approve returns 422 on own PR). - Stage 5 `holon calibrate`: report evaluated 7420e5af, committed 705ca34f on the PR branch (calibrated branch fast-forwarded to it). Calibrator still measures the touch set from the pre-merge base 64e0f0f1 (recall 0.15). + +## Resolution + +Delivered via [PR #244](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/244) and merged into `main` +(`252004a`): + +- **Key Architectural Deliverables**: Stage 3 pre-flight checks the GitHub token's OAuth scopes against the plan's touch + set and fails fast when `.github/workflows/**` is touched without the `workflow` scope, with the `gh auth refresh` + remedy. `holon doctor` reports token type and scopes (never the value) and warns when `workflow` is missing. A + rejected Stage 3 push keeps the execution's commits on a recovery ref and reports where they are. +- **Verification & Tests**: Hermetic tests with mocked `gh` responses cover scope present and missing, touch sets with + and without workflow files, and a rejected push keeping its commits. +- **Holon Flow Traversal**: Intent, plan, execute, review loop (consensus approval, ensemble 3/3) and calibration + completed on the v2 flow (`I-1795398772-preflight-github-token-scopes-v2`). The calibration report evaluates + `5696afa2`: predicted EV 62.25, actual EV 73.79 (+11.54). Touch-set recall was 14.4%. +- **Cleanup**: The first-attempt worktree `flow-preflight-github-token-scopes` and the v2 flow worktree were removed + with their leaf branches. diff --git a/.beans/holon-agentic-coder-ref-metadata-0176--remove-every-unittest-reference-pytest-only.md b/.beans/holon-agentic-coder-ref-metadata-0176--remove-every-unittest-reference-pytest-only.md index c21fd7c6..adcc5337 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0176--remove-every-unittest-reference-pytest-only.md +++ b/.beans/holon-agentic-coder-ref-metadata-0176--remove-every-unittest-reference-pytest-only.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0176 title: "Remove every unittest reference from holon-agentic-coder; the suite is pytest only" -status: in-progress +status: todo type: task priority: high tags: @@ -9,7 +9,7 @@ tags: - pytest - holon-agentic-coder created_at: 2026-10-28T09:38:48Z -updated_at: 2026-11-22T22:55:00Z +updated_at: 2026-11-23T08:05:48Z --- ## Problem @@ -57,3 +57,6 @@ mention `unittest` (almost all under `apps/sandbox-executor/tests/`, plus `docs/ Re-measured on `main` (`b22258d`): **144** tracked files mention `unittest` (up from 119 on 2026-11-21). Must run alone after PR #230 merges. + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-remove-unittest-pytest-only-2026-11-23.bundle diff --git a/.beans/holon-agentic-coder-ref-metadata-0181--use-the-branch-leaf-only-when-referencing-a-git-branch.md b/.beans/holon-agentic-coder-ref-metadata-0181--use-the-branch-leaf-only-when-referencing-a-git-branch.md index 0f66f56c..bc90579b 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0181--use-the-branch-leaf-only-when-referencing-a-git-branch.md +++ b/.beans/holon-agentic-coder-ref-metadata-0181--use-the-branch-leaf-only-when-referencing-a-git-branch.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0181 title: "Use the /_ leaf only when referencing a git branch, never on intent, plan or execution ids" -status: in-progress +status: todo type: bug priority: normal tags: @@ -11,7 +11,7 @@ tags: - documentation - holon-agentic-coder created_at: 2026-10-29T01:01:35Z -updated_at: 2026-11-23T00:00:00Z +updated_at: 2026-11-23T08:05:48Z --- ## Principle (maintainer, 2026-10-29) @@ -86,3 +86,6 @@ now means the `flow/` package. lives in `entrypoint/executor/run.py` (lines 94 and 242) alongside `calibration.py`, `cli/commands/`, `entrypoint/planner.py`, `entrypoint/taken_ids.py`, and `entrypoint/execution_workspace.py`. Overlaps PR #230 on `docs/git_flow.md` and `docs/ledger_schema.md`. + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-branch-leaf-only-on-refs-2026-11-23.bundle diff --git a/.beans/holon-agentic-coder-ref-metadata-0191--github-adapter-for-pr-ci-and-review-posting.md b/.beans/holon-agentic-coder-ref-metadata-0191--github-adapter-for-pr-ci-and-review-posting.md index 627e63eb..3c0e111d 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0191--github-adapter-for-pr-ci-and-review-posting.md +++ b/.beans/holon-agentic-coder-ref-metadata-0191--github-adapter-for-pr-ci-and-review-posting.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0191 title: "One GitHub adapter owns every gh call (PR create/update, CI probe, mergeability, review posting)" -status: in-progress +status: completed type: task priority: high tags: @@ -11,7 +11,7 @@ tags: - holon-agentic-coder blocked_by: created_at: 2026-10-29T12:20:00Z -updated_at: 2026-11-23T12:50:00+11:00 +updated_at: 2026-11-23T23:28:37+11:00 --- ## Problem @@ -70,3 +70,66 @@ lines, so the module budget (Beans 0264, 0340) applies to any new adapter module branch conflicts with `origin/main` in `flow/__init__.py` (plus ledger rows) after main moved (#235-#240). Stage 4 does not resolve code conflicts; a hand-merge would bypass the flow, so the run is halted pending a maintainer decision. + +- 2026-11-23: Child 3 (inject one GitHubAdapter at flow entry) recovered manually on maintainer instruction. Removed 47 + sidecar scratch files committed under todo/ (moved to todo/recovered-0191-sidecar-scratch/), base (parent plan branch) + already contained, lint plus module budgets green, full suite 5914 passed. Opened PR #255 against the parent plan + branch (siblings #242, #245 used the same base). Review loop pending. + +## Progress note (2026-11-23, parent flow resume) + +Split parent resumed from checkpoint without re-running children (children 1 and 2 merged as #242 and #245; child 3 +recorded merged as #255 / a9fe10c8, origin wins). Parent Stage 3 integration of plan branch +`I-1795388456-github-adapter-pr-ci-review/P-1795397463-CLA-CO5.5/_` into the parent execution branch failed with merge +conflicts in code files (flow/**init**.py, flow/pipeline.py, tests/flow/helpers.py, docs/git_flow.md, +.agents/holon_flow.md) and ledgers/KB (intents, plans, executions jsonl, kb/failure_modes/index.json). The engine +aborted the merge; worktree is clean, no merge in progress. Plan branch vs origin/main: 40+ conflicting files +(flow/**init**.py, lazy_exports.py, pipeline.py, review/loop.py, stage5.py, launcher/*). Parent PR not opened. Blocked +on a code-conflict decision; needs a higher-tier resolve-conflict subagent (not run). No merge into main performed. + +## 2026-11-23 conflict resolution (plan branch vs main, uncommitted) + +Merged origin/main into the plan branch in worktree flow-github-adapter-pr-ci-review (local branch plan-merge-0191, +merge left uncommitted). The squashed children carried main content, so apps/ was rebuilt as main plus the bean's own +patch (diff of the plan branch against main's #249 head, applied with 3-way). Ledgers and KB via resolve_known.py; KB +index.json stays deleted; KB entries and the #249 calibration report take main's copy. Lint is clean; the suite passes +except the adapter AST boundary test: main's new flow/github/ci_head_reruns.py spawns `gh run rerun ` (whole +run) outside adapter.py. Needs a decision: add a whole-run rerun method to the adapter, or allowlist it like +approval_invalidation. Two test fixes were applied (test_conflict_gate carried-approval test moved to FakeGitHub; +test_calibrate_final_head_ci passes a FakeGitHub to _FinalHeadCheck). + +2026-11-23 update: the boundary test was resolved by adding GitHubAdapter.rerun_run (whole-run rerun) and routing +gh_run_rerunner through it. Lint and the full suite pass (6354 passed). Merge commit 5f3076dc pushed to the plan branch. + +- 2026-11-23 (holon flow, bean 0191 parent): PR #260 opened for the parent execution branch and driven to review + approval and calibration. Stage models: intent/plan/execute on claude-opus-5-5 (children and parent Stage 3); review + on claude-fable-5-2 (HOLON_TURN_STALL_SECONDS=600 needed; 90 s stall budget cut the reviewers twice). Calibration ok, + final head CI success, PR MERGEABLE/CLEAN. Conflicts cleared by resolve-conflict subagents (ledgers; additive + flow/**init**.py **all** union). Awaiting human merge into main; not merged. + +## Resolution + +Delivered via three child PRs and the parent PR +[#260](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/260), squash-merged into `main` (`7225685d`): + +- **Child 1, extract the pure CI verdict**: + [PR #242](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/242). The flow halted at Stage 4 on a code + conflict with `main`, then continued once it was resolved. +- **Child 2, repository-scoped GitHub adapter**: + [PR #245](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/245). +- **Child 3, inject one GitHubAdapter at flow entry**: + [PR #255](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/255). Recovered manually on maintainer + instruction. The 47 sidecar scratch files committed under `todo/` were removed (kept in + `todo/recovered-0191-sidecar-scratch/`). +- **Parent**: [PR #260](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/260) carried the integrated plan + branch into `main`. +- **Hand-written merge code**: the parent's conflict resolution against `main` was written by hand, not by the flow. It + adds `GitHubAdapter.rerun_run` (whole-run rerun) and routes `gh_run_rerunner` through it, so the AST boundary test + passes (6354 passed). + +Key deliverables: `flow/github/adapter.py` is the only module that runs `gh` for PR, CI, mergeability and review +posting, keeping the write guard and token redaction. Pure policy modules (`ci_policy`, `mergeability_policy`, +`review_policy`, `pr_metadata`) hold the decisions, plus a `FakeGitHub` test double and boundary and purity tests. + +Verification: lint and the full suite pass on the parent branch; the parent's review loop approved and calibration +passed with final-head CI green. diff --git a/.beans/holon-agentic-coder-ref-metadata-0192--review-loop-becomes-a-reviewloop-object.md b/.beans/holon-agentic-coder-ref-metadata-0192--review-loop-becomes-a-reviewloop-object.md index faaebed1..316279bb 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0192--review-loop-becomes-a-reviewloop-object.md +++ b/.beans/holon-agentic-coder-ref-metadata-0192--review-loop-becomes-a-reviewloop-object.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0192 title: "Decompose run_review_loop and run_review_stage into a ReviewLoop object with named steps" -status: in-progress +status: todo type: task priority: high tags: @@ -9,10 +9,8 @@ tags: - complexity - review-loop - holon-agentic-coder -blocked_by: - - holon-agentic-coder-ref-metadata-0191 created_at: 2026-10-29T12:20:00Z -updated_at: 2026-11-21T01:20:00+11:00 +updated_at: 2026-11-23T08:05:48Z --- ## Problem @@ -38,7 +36,7 @@ and `tests/test_review_loop.py`. ## Dependencies -Blocked by 0191. Sequence with 0160 and 0179, which change the same loop. +Its blocker 0191 completed (PR #260). Sequence with 0160 and 0179, which change the same loop. ## Notes @@ -65,3 +63,9 @@ exist. Still blocked by 0191 (shared call sites). - Checkpoint: `apps/holon-agentic-coder/flow-review-loop-object/.holon/flow/checkpoint-review-loop-object.json` at stage execute. Earlier checkpoint backed up under the scratchpad. - Status stays `in-progress`; blocked_by 0191 is also still in progress and shares call sites. + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-review-loop-object-2026-11-23.bundle + +- 2026-11-23: unblocked. Its `blocked_by` bean 0191 is completed (parent PR #260 merged into `main` as `7225685d`). + Status left as `todo`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0197--split-calibration-into-a-package-and-decompose-metrics-parsing.md b/.beans/holon-agentic-coder-ref-metadata-0197--split-calibration-into-a-package-and-decompose-metrics-parsing.md index 0cb505fa..9af42689 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0197--split-calibration-into-a-package-and-decompose-metrics-parsing.md +++ b/.beans/holon-agentic-coder-ref-metadata-0197--split-calibration-into-a-package-and-decompose-metrics-parsing.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0197 title: "Split calibration.py into a calibration package and decompose metrics parsing and report generation" -status: in-progress +status: completed type: task priority: normal tags: @@ -9,9 +9,8 @@ tags: - complexity - calibration - holon-agentic-coder -blocked_by: created_at: 2026-10-29T12:20:00Z -updated_at: 2026-11-23T00:00:00Z +updated_at: 2026-11-26T20:59:39Z --- ## Problem @@ -36,8 +35,8 @@ Measured: `parse_actual_metrics` **226 lines, CC 61**; `generate_calibration` CC ## Dependencies -Blocked by 0187. Sequence **after 0146** (picks the predicted metrics in the same parser) and 0162; sequence with 0183 -(calibration moves into a sandbox). +Was blocked by 0187, now scrapped; no longer applies. Sequence **after 0146** (picks the predicted metrics in the same +parser) and 0162; sequence with 0183 (calibration moves into a sandbox). ## Notes @@ -60,3 +59,61 @@ metrics parsers. Do not run concurrently with Bean 0146 (same parser). Bean `0146` merged in PR #221 (extracting `calibration_predicted.py`). `calibration.py` is 1,637 lines with `parse_actual_metrics` still under noqa. Unblocked and disjoint from PR #230 (which edits `calibration_outcome.py`, not `calibration.py` or `flow/stages/calibrate.py`); sequence with `0355` on `flow/stages/calibrate.py`. + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-split-calibration-package-2026-11-23.bundle + +## Progress (2026-11-24) + +- Flow started from this Claude Code session: intent `todo/intent-0197-split-calibration-package.json`, slug + `split-calibration-package`, `claude-agent` / `claude-fable-5-2`, worktree `flow-split-calibration-package`. + +Note (2026-11-25): stale plan `split-calibration-package` deleted after PR #309 merged; restart from current main via +the kept `todo/intent-0197-split-calibration-package.json`. + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- `PR #310` (`0371` sub-intent 1) and `PR #311` (`0371` sub-intent 2) were both blocked in Iteration 1 by all reviewers + specifically because `calibration.py` (`1,634` lines, over `1,000`) grew by `+1` to `+2` lines and + `test_calibration.py` (`1,780` lines) grew by `+16` lines. + +## Progress (2026-11-26) + +- Flow started from this Claude Code session on origin/main 4e358955: intent + `todo/intent-0197-split-calibration-package.json`, slug `split-calibration-package`, `claude-agent` / + `claude-opus-5-5` (`claude-fable-5-2` is over its monthly spend limit), worktree `flow-split-calibration-package` + (created by the runner), log `todo/flow-split-calibration-package.log`. +- 2026-11-26 (flow `split-calibration-package`, runner on `claude-agent` / `claude-opus-5-5`): Stage 3 admission refused + on overlap with local flow `no-unneeded-full-review` (PR #316 when it opened). Current run is intent `I-1795669744` / + plan `P-1795669767`. Resume with `--checkpoint` after the overlap clears. Bug bean 0477 logs the fresh-restart + relaunch. + +## Progress (2026-11-27) + +- Resumed (from parked state) from checkpoint `checkpoint-split-calibration-package.json` via + `run_holon_flow.py --no-wait-on-overlap`; no runner was live for the slug. Stage 3 admission passed (no overlap); the + plan was refreshed onto origin/main `f1e18bcd`. +- First Stage 3 run completed (26.9 min) but changed 3 files outside the plan touch set (golden fixture, + `test_calibration_ev.py`, `test_calibration_touch_set.py`); engine returned to Stage 2 (re-plan 1 of 2) and produced + plan `P-1795700156-CLA-CO5.5` (EV 36.90). Stage 3 is re-running on that plan. +- Stage 3 (second run, on plan `P-1795700156-CLA-CO5.5`, EV 36.90) completed: 29 paths changed; Stage 4 approved 3/3 + (iteration 2 scoped re-review); Stage 5 calibration ok (actual EV 59.19, delta +22.29), report + `plans/I-1795669744-split-calibration-package/P-1795700156-CLA-CO5.5_calibration.md` included in the PR diff. +- PR [#347](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/347): OPEN, MERGEABLE, CLEAN, all checks + green. Awaiting human maintainer merge. Bean stays in-progress until merge; post-merge protocol closes it. + +## Resolution + +Delivered via [PR #347](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/347) and merged into `main` +(`8b20863`): + +- **Key Architectural Deliverables**: `calibration.py` (1,608 lines) is now the `calibration/` package of 12 modules + (`predicted`, `actual`, `actual_evidence`, `branches`, `checkout`, `deltas`, `generate`, `physics`, `refs`, `report`, + `run`, plus `__init__` re-exports); the largest module is 273 lines. `flow/stages/calibrate.py` delegates to + `calibration.run`. Metric parsing is split into per-metric extractors. `resolve_git_ref` is decomposed. +- **Verification & Tests**: calibration tests split into `test_calibration_metrics.py` and `test_calibration_report.py`; + reports byte-identical on the existing fixture (`calibration_report_golden.txt`). +- **Holon Flow Traversal**: Intent, Plan (re-planned once after Stage 3 touched files outside the plan touch set), + Execute, Review Loop (approved 3/3 on iteration 2) and Calibration (actual EV 59.19, delta +22.29) completed. +- **Follow-up**: `holon-config/hygiene/module_budgets.json` still carries the stale `calibration.py` override (1608); + the file no longer exists. The budget file is frozen, so the entry was left for the maintainer to remove. diff --git a/.beans/holon-agentic-coder-ref-metadata-0198--agent-runner-registry-one-spec-module-per-agent.md b/.beans/holon-agentic-coder-ref-metadata-0198--agent-runner-registry-one-spec-module-per-agent.md index 31c91d64..642ab46a 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0198--agent-runner-registry-one-spec-module-per-agent.md +++ b/.beans/holon-agentic-coder-ref-metadata-0198--agent-runner-registry-one-spec-module-per-agent.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0198 title: "Agent runner registry: one RunnerSpec module per agent instead of shared dicts and an if-chain" -status: in-progress +status: completed type: task priority: normal tags: @@ -10,7 +10,7 @@ tags: - agent-runner - holon-agentic-coder created_at: 2026-10-29T12:20:00Z -updated_at: 2026-11-22T22:55:00Z +updated_at: 2026-11-26T13:06:00Z --- ## Problem @@ -36,7 +36,7 @@ one branch per `custom_validator`). Adding or dropping an agent edits all of the ## Dependencies -Blocked by 0185. Parallel-safe with 0187, 0188, 0195. +Was blocked by 0185 (completed). Parallel-safe with 0187, 0188, 0195. ## Notes @@ -53,3 +53,28 @@ another session), so start after 0322 lands. Bean `0322` merged in PR #222 (`e2ba3c2`), removing `gemini-agent` completely; drop `gemini` from scope (`antigravity`, `claude`, `pi`, `codex`, `opencode`). Unblocked and disjoint from PR #230; sequence with `0270` and `0350` on `agent_defaults.py` / `agent_runner.py`. + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-agent-runner-spec-per-agent-2026-11-23.bundle + +## Progress + +- 2026-11-26: flow `agent-runner-spec-per-agent` launched (claude-agent / claude-opus-5-5), scoped to + `agent_defaults.py`, `agent_runner.py`, a new `runners/` package and their tests; model table (0270) untouched. + +## Resolution + +Delivered via [PR #343](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/343) and merged into `main` +(`f1e18bc`): + +- **Key Architectural Deliverables**: `sandbox_executor/runners/` package with one frozen `RunnerSpec` module per agent + (antigravity, claude, pi, codex, opencode; gemini already gone via 0322). `AGENT_IMAGE_MAPPING`, `AGENT_TICKERS` and + `DEFAULT_MODELS` are derived views of the specs with unchanged keys and values. `StandardAgentRunner.validate` calls + `spec.check_credentials()`; no per-agent branch remains. `HOLON_AGENT_KEY` stays the only non-entrypoint credential + variable. +- **Verification & Tests**: `test_runner_specs.py` asserts each spec has a `docker-bake.hcl` image and a dispatcher + case; `test_agent_defaults.py`, `test_agent_runner.py` and `test_claude_credential.py` updated. Behaviour (messages, + exit codes, accepted env vars, session dirs) unchanged. +- **Holon Flow Traversal**: Intent, plan and execute recorded; calibration branch `E-1795695582-CLA-CO5.5/calibrated` + exists. The flow was resumed from checkpoint at review, and a review iteration was still running on the merged PR when + post-merge ran. diff --git a/.beans/holon-agentic-coder-ref-metadata-0200--remove-the-duplicated-token-reduction-package.md b/.beans/holon-agentic-coder-ref-metadata-0200--remove-the-duplicated-token-reduction-package.md index 35514d59..172d571b 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0200--remove-the-duplicated-token-reduction-package.md +++ b/.beans/holon-agentic-coder-ref-metadata-0200--remove-the-duplicated-token-reduction-package.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0200 title: "Remove holon-agentic-coder's diverged token_reduction copy; holon-coherence is the single owner" -status: in-progress +status: completed type: task priority: normal tags: @@ -12,7 +12,7 @@ tags: blocked_by: - holon-agentic-coder-ref-metadata-0189 created_at: 2026-10-29T12:20:00Z -updated_at: 2026-11-23T14:30:00+11:00 +updated_at: 2026-11-23T05:48:20Z --- ## Problem @@ -95,3 +95,21 @@ Status stays `todo`: no flow was started, no intent was written to `todo/`, and Full removal. Repoint the token-reduce sidecar to holon-coherence's own proxy addon and image (`src/holon_coherence/proxy/addon.py` and its proxy `Dockerfile`), re-home `proxy_readiness` and every other remaining reference, then delete `token_reduction/` and its tests entirely. + +## Resolution + +Delivered via [PR #249](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/249) and merged into `main` +(`c905a98`), with full removal per the maintainer decision of 2026-11-23: + +- **Key Architectural Deliverables**: `sandbox_executor/token_reduction/` deleted (including the diverged + `mitm_addon.py`, `hybrid_cache`, `payload_cleaner`, `rag_indexer`, `ringer_orchestrator`, `openbrain_memory`). Root CA + generation moved to `launcher/root_ca.py` and `launcher/root_ca_openssl.py`; `proxy_readiness` re-homed to + `launcher/`; the token-reduce sidecar now uses the holon-coherence proxy image and addon via `launcher/proxy_image.py` + and `launcher/sidecar*.py`. Related token-scope and execution-recovery modules added under `flow/`. +- **Verification & Tests**: `test_token_reduction.py` and `test_context_cleaner.py`, `test_cache_control.py` removed + with their modules; replacement launcher, sidecar, root-CA, proxy-env, token-scope and execution-recovery tests added; + the URL fuzz test repointed to the moved modules. +- **Holon Flow Traversal**: Intent, plan (`P-1795409242-CLA-CO5.5`) and execute (`E-1795409573-CLA-CO5.5`) completed and + merged after review; calibration recorded in + `plans/I-1795409225-remove-token-reduction-copy/P-1795409242-CLA-CO5.5_calibration.md` (EV predicted 30.15; clean + actual 58.99; observed -21.01 with bug EV drag 80). diff --git a/.beans/holon-agentic-coder-ref-metadata-0215--beans-to-github-issues-importer-and-real-data-dry-run.md b/.beans/holon-agentic-coder-ref-metadata-0215--beans-to-github-issues-importer-and-real-data-dry-run.md index 0ebd096f..922a763d 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0215--beans-to-github-issues-importer-and-real-data-dry-run.md +++ b/.beans/holon-agentic-coder-ref-metadata-0215--beans-to-github-issues-importer-and-real-data-dry-run.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0215 title: "Deterministic beans-to-GitHub-Issues importer and real-data dry run" -status: todo +status: in-progress type: task priority: high tags: @@ -9,10 +9,8 @@ tags: - github-issues - migration - harness -blocked_by: - - "0333" created_at: 2026-10-30T00:00:00Z -updated_at: 2026-11-21T01:20:00+11:00 +updated_at: 2026-11-23T14:27:43Z --- ## Problem @@ -46,4 +44,15 @@ a deterministic importer: bean frontmatter and Markdown body to an issue created ## Audit (2026-11-21) -Open-bean count refreshed: about 40 active beans, not 50 (after the recent completions). Still blocked by Bean 0333. +Open-bean count refreshed: about 40 active beans, not 50 (after the recent completions). Bean 0333 completed (PR #258), +so no blocker remains. + +## Progress (2026-11-24) + +- Built `.agents/scripts/beans_to_issues.py` (standard library; `gh` for the real import) and + `tests/test_beans_to_issues.py`. Default is a dry run that renders payloads, labels, dependencies and a report under + `todo/beans-to-issues-dry-run/`; `--apply` is the real import and has not been run. No issue or label was created. +- Dry run on the real corpus: 41 open beans, 35 to migrate (holon-agentic-coder 31, holon-coherence 4), 6 not migrated + (harness-only), 0 mapped dependencies (the only open edges point at this bean, which is not migrated), 0 sub-issues, + 40 bean references become `#N`, 158 references to unmigrated beans are reworded, 31 harness paths removed. +- Open decisions for the maintainer: see the dry-run report and the reply that accompanied this bean. diff --git a/.beans/holon-agentic-coder-ref-metadata-0216--holon-flow-references-and-drives-github-issues.md b/.beans/holon-agentic-coder-ref-metadata-0216--holon-flow-references-and-drives-github-issues.md index 535a5818..f62deec9 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0216--holon-flow-references-and-drives-github-issues.md +++ b/.beans/holon-agentic-coder-ref-metadata-0216--holon-flow-references-and-drives-github-issues.md @@ -9,10 +9,8 @@ tags: - github-issues - holon-flow - holon-agentic-coder -blocked_by: - - "0333" created_at: 2026-10-30T00:00:00Z -updated_at: 2026-11-23T00:00:00Z +updated_at: 2026-11-26T04:10:00Z --- ## Problem @@ -42,3 +40,34 @@ reference. This also honours the standing rule that harness bean ids never land - The token the flow already uses for pull requests (`repo` scope) covers issue writes; Project status needs the `project` scope (Bean 0317). - Related: Bean 0333 (decision), Bean 0215 (import gives the issue numbers), Bean 0191 (one GitHub adapter). + +> 2026-11-23: stale worktree deleted 2026-11-23; restart from current main. Backup: +> todo/stale-worktree-backups/flow-flow-references-github-issues-2026-11-23.bundle + +## Progress (2026-11-24) + +- Flow started from this Claude Code session: intent `todo/intent-0216-flow-references-github-issues.json`, slug + `flow-references-github-issues`, `claude-agent` / `claude-fable-5-2`, worktree `flow-flow-references-github-issues`. + +Note (2026-11-25): stale plan `flow-references-github-issues` deleted after PR #309 merged; restart from current main +via the kept `todo/intent-0216-flow-references-github-issues.json`. + +parked 2026-11-26: Stage 3 overlap with PR #318 (context.py, docs/environment_variables.md); resume from checkpoint when +#318 merges. + +Note (2026-11-26): in-progress. Flow `flow-references-github-issues` launched from origin/main 4e358955 via +`run_holon_flow.py` (target `apps/holon-agentic-coder/main`, `claude-agent` / `claude-opus-5-5`, log +`todo/flow-flow-references-github-issues.log`). Scope files `issues.py`, `test_issues.py`, `test_intent_work_item.py` +are new files to be created. + +Note (2026-11-26): resumed from checkpoint +`apps/holon-agentic-coder/flow-flow-references-github-issues/.holon/flow/checkpoint-flow-references-github-issues.json` +(blocker flow `no-unneeded-full-review` merged as PRs #316-#334 and its worktree is gone). No live runner for the slug +at resume. Log `todo/flow-flow-references-github-issues.log`. parked 2026-11-26: resume from checkpoint hit Stage 3 +touch-set overlap with PR #342 (`I-1795694671-ledgers-sorted-chronologically`) on `docs/git_flow.md`; resume from +checkpoint once #342 merges or releases the file. + +Note (2026-11-26): resumed from checkpoint after PR #342 merged (20:58Z). No live runner for the slug at resume. parked +2026-11-26: Stage 3 touch-set overlap with open PR #351 (I-1795685390-single-runner-per-checkpoint) on +apps/sandbox-executor/src/sandbox_executor/flow/lazy_exports.py; re-plan after a Stage 3 scope drift (P-1795727982) hit +it. Resume from checkpoint when #351 merges or releases the file. diff --git a/.beans/holon-agentic-coder-ref-metadata-0217--github-issues-tracking-in-holon-coherence.md b/.beans/holon-agentic-coder-ref-metadata-0217--github-issues-tracking-in-holon-coherence.md index ad059737..3511f0a3 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0217--github-issues-tracking-in-holon-coherence.md +++ b/.beans/holon-agentic-coder-ref-metadata-0217--github-issues-tracking-in-holon-coherence.md @@ -38,6 +38,7 @@ are already enabled on the repository. What remains is the label set, the agent ## Audit (2026-11-23) Not started: the bean is blocked upstream. Bean 0215 (the importer and its label step) is still `todo` and no importer -exists in the harness. Bean 0215 is blocked by Bean 0333, whose holon-agentic-coder change (removing the beads pilot and -writing the GitHub Issues guidance this bean mirrors) has not landed on `main`. No intent was written and no flow run; -the coherence guidance has no source to mirror yet, and the label/import step needs the maintainer's word. +exists in the harness. Bean 0215 was blocked by Bean 0333, whose holon-agentic-coder change (merged as PR #258; removing +the beads pilot and writing the GitHub Issues guidance this bean mirrors) has landed on `main`. No intent was written +and no flow run; the coherence guidance has no source to mirror yet, and the label/import step needs the maintainer's +word. diff --git a/.beans/holon-agentic-coder-ref-metadata-0225--store-claude-token-in-os-keychain.md b/.beans/holon-agentic-coder-ref-metadata-0225--store-claude-token-in-os-keychain.md index d03b8a19..6705a0ce 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0225--store-claude-token-in-os-keychain.md +++ b/.beans/holon-agentic-coder-ref-metadata-0225--store-claude-token-in-os-keychain.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0225 title: "Claude token lives only in the OS keychain; retire ~/.holon/secrets/claude-oauth-token entirely" -status: todo +status: completed type: feature priority: normal tags: @@ -10,7 +10,7 @@ tags: - security - holon-agentic-coder created_at: 2026-11-04T03:20:00Z -updated_at: 2026-11-04T04:15:00Z +updated_at: 2026-11-24T09:57:28Z --- ## Problem @@ -56,3 +56,24 @@ and no new Python dependencies (subprocess calls to the platform CLIs only). - Run through the Holon flow on holon-agentic-coder. - Maintainer context (2026-11-04): the file stays persistent (consume-once was rejected); this bean removes the at-rest plaintext exposure instead, which was the remaining concern. + +## Progress (2026-11-24) + +- Flow started from this Claude Code session: intent `todo/intent-0225-claude-token-os-keychain-only.json`, slug + `claude-token-os-keychain-only`, `claude-agent` / `claude-fable-5-2`, worktree `flow-claude-token-os-keychain-only`. + +## Resolution + +Delivered via [PR #271](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/271) and merged into `main` +(`bb71d60c`): + +- **Key Architectural Deliverables**: Claude credential discovery reads only the OS secret store (macOS `security`, + Linux `secret-tool`); no file fallback and no `HOLON_AGENT_KEY` route for claude. Pre-flight fails closed with the + platform store one-liner and `claude setup-token` hint. One-time migration imports + `~/.holon/secrets/claude-oauth-token` into the keychain and deletes the file, or leaves it untouched on write failure. + Store one-liners documented in `docs/executor/agent_credentials_requirements.md`. +- **Verification & Tests**: Hermetic pytest suites for keychain discovery on both platforms, no-entry and + no-secret-service hints, migration happy/failed/already-migrated paths, and secret redaction; fake + `security`/`secret-tool` seams, no real keychain. +- **Holon Flow Traversal**: Flow `claude-token-os-keychain-only` (`claude-agent` / `claude-fable-5-2`) ran intent, plan, + execute, review and calibration (calibration report recorded under `holon-knowledge/`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0226--e2e-test-for-holon-flow-commands-with-full-teardown.md b/.beans/holon-agentic-coder-ref-metadata-0226--e2e-test-for-holon-flow-commands-with-full-teardown.md index 47f9b43b..ce0061d4 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0226--e2e-test-for-holon-flow-commands-with-full-teardown.md +++ b/.beans/holon-agentic-coder-ref-metadata-0226--e2e-test-for-holon-flow-commands-with-full-teardown.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0226 title: "End-to-end test for the holon flow commands, with full teardown of worktrees and local/remote branches" -status: todo +status: completed type: feature priority: normal tags: @@ -10,9 +10,16 @@ tags: - holon-flow - holon-agentic-coder created_at: 2026-11-04T04:30:00Z -updated_at: 2026-11-04T05:50:00Z +updated_at: 2026-11-24T11:28:48Z --- +## Resolution + +`Holon-Agentic-Coder/holon-agentic-coder#269` (`flow-e2e-test-teardown`, merge commit +`407ad39ac6f03d0d171a205c06de11f8f0063191`, merged `2026-11-24T11:28:48Z`, 11/11 CI checks green, iteration 13 consensus +approved, Stage 5 calibrated `plans/I-1795496321-flow-e2e-test-teardown/P-1795496340-ANA-G4A_calibration.md`) landed +cleanly. + ## Problem The flow's commands are only ever exercised for real by operators running real beans. Defects therefore surface in @@ -87,3 +94,8 @@ The e2e handles that in three layers: - Related: 0150 (hermetic tests — the e2e is the deliberate opposite: real pushes, hence the teardown contract), 0224 and 0225 (credential discovery this test must drive), 0182 (the harness wait helper usable for CI gating inside the test), AGENTS.md zero-synthetic-data rule (this is a functional test, not a benchmark; it measures nothing). + +## Progress + +- 2026-11-24: launched `holon-agentic-coder` flow (`flow-e2e-test-teardown`, intent + `todo/intent-0226-flow-e2e-test-teardown.json`) via `antigravity-agent` / `gemini-4-argon`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0255--streaming-per-issue-resolvers-single-consolidated-commit.md b/.beans/holon-agentic-coder-ref-metadata-0255--streaming-per-issue-resolvers-single-consolidated-commit.md index 4a9df844..bcb2be55 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0255--streaming-per-issue-resolvers-single-consolidated-commit.md +++ b/.beans/holon-agentic-coder-ref-metadata-0255--streaming-per-issue-resolvers-single-consolidated-commit.md @@ -3,7 +3,7 @@ title: "Streaming per-issue resolvers during Stage 4 CI & review with single consolidated commit" status: todo type: feature -priority: high +priority: critical tags: - flow - review-loop @@ -13,7 +13,7 @@ tags: - concurrency - holon-agentic-coder created_at: 2026-11-09T12:17:00Z -updated_at: 2026-11-21T01:20:00+11:00 +updated_at: 2026-11-24T11:12:00Z --- ## Problem @@ -88,3 +88,40 @@ resolver fixes into a single commit**: Still valid. Locations moved: the loop is `run_review_loop` in `flow/review/loop.py` and CI waiting is `wait_for_pending_ci` in `flow/github/ci_wait.py` (the `sandbox_executor.flow` module reference above means the `flow/` package). Overlaps Beans 0192 and 0345 on `flow/review/loop.py`. + +## Maintainer direction (2026-11-24) + +Maintainer's words: "in the review process, we shouldn't wait for the whole pipeline to finish. we should start on a new +iteration to fix the issue. that way we don't have to idle. while we're on the next iteration to fix the pipeline it +should also refer back to the complete pipeline failures so that we fix ALL the failing tests from the previous +iteration." + +This confirms the decision above and makes two points binding: + +1. **Never idle on a pipeline that has already failed.** The first failed check starts the fixing work at once; the flow + does not wait for the remaining checks before the resolver begins (the fail-early rule of Beans 0383 and 0394). +2. **The fix covers the whole run, not only the first failure.** While the resolver works, the flow keeps collecting the + results of that same pipeline run, and the resolver is given every failure of the run (each failed check, its failing + tests and their output) before its fix is pushed. One push answers all the failures of the previous iteration, so the + next pipeline run is not spent rediscovering the second and third failure. + +Consequences to design for (agent's notes): + +- **Do not cut the evidence short.** A push to the branch cancels the pipeline run in progress (`cancel-in-progress` is + on for pull requests), which would throw away the failures not yet reported. The resolver's push therefore waits until + the run it is fixing has finished or every one of its jobs has reported, whichever is first. The work starts early; + only the push waits. +- **`fail-fast` stays off** on the test matrices for the same reason: a failed leg must not cancel its siblings, or the + complete list of failures is never produced (this settles the `fail-fast` question left open in Bean 0400). +- **The failure list is carried in the checkpoint**, per head: check name, job, failing test ids and the tail of the + log. A resumed flow, and the next iteration, read it from there and do not depend on the run still being retrievable. +- **Reproduce locally where possible.** The resolver runs the failing tests it was given in its own worktree, so it can + confirm each fix before the push and does not need the pipeline to find out. +- **Noise is told apart from failures first**: a timing-gate or runner failure is not handed to the resolver as a defect + (Beans 0404 and 0407); it is rerun. +- **Reviewer findings join the same push**: findings that arrive while the resolver is working are added to its list, as + the decision above already says, so one consolidated commit answers reviewers and pipeline together. + +Measured motivation (self-improvement audit, 2026-11-24): the review stage carried 9.2 hours of idle time in three days; +33 pipeline heads failed and each cost at least one more full run of about 8 minutes; the median pull request took 6 +pipeline runs. diff --git a/.beans/holon-agentic-coder-ref-metadata-0265--split-cli-init-into-focused-modules-move-only.md b/.beans/holon-agentic-coder-ref-metadata-0265--split-cli-init-into-focused-modules-move-only.md index 271daeb4..766ab300 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0265--split-cli-init-into-focused-modules-move-only.md +++ b/.beans/holon-agentic-coder-ref-metadata-0265--split-cli-init-into-focused-modules-move-only.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0265 title: "Split `cli/__init__.py` into focused modules (move only), like the `flow/` package" -status: todo +status: completed type: task priority: high tags: @@ -11,7 +11,7 @@ tags: - concurrency - holon-agentic-coder created_at: 2026-11-09T10:30:00Z -updated_at: 2026-11-22T22:55:00Z +updated_at: 2026-11-25T05:09:00Z --- ## Problem @@ -133,3 +133,25 @@ module map and a one-line responsibility per module. have merged, and no other session has `0265` in flight. Disjoint from PR #230 on code (`cli/__init__.py`, `tests/test_cli.py`), but Scope item 5 edits `docs/architecture.md` which PR #230 also touches — run immediately after PR #230 merges (or defer the `docs/architecture.md` edit). + +## Status on main (2026-11-23) + +Re-measured on `holon-agentic-coder` `main` (`7225685`): `cli/__init__.py` is 690 lines with 16 top-level definitions, +down from 2,026 lines. PRs #241, #243, #244, #249 and #251 moved code out. The figures in Problem are historical; Scope +applies to what remains. + +> 2026-11-24: launched `split-cli-init-modules` (intent `todo/intent-0265-split-cli-init-modules.json`) via +> `antigravity-agent` / `gemini-4-neon`. + +## Resolution + +Delivered via [PR #296](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/296) and merged into `main` +(`4c6232cb`, `2026-11-25T05:01:49Z`): + +- **CLI Package Split**: Split `apps/sandbox-executor/src/sandbox_executor/cli/__init__.py` into focused modules + (`cli/doctor.py`, `cli/doctor_env.py`, `cli/logging.py`, `cli/main.py`, `cli/preflight.py`) while preserving package + re-exports, and updated `docs/architecture.md`. +- **Tests**: Split `apps/sandbox-executor/tests/test_cli.py` into `apps/sandbox-executor/tests/cli/` (`test_doctor.py`, + `test_env_files_and_redaction.py`, `test_flow_cli.py`, `test_main.py`, `test_patch_targets.py`, `_helpers.py`) and + updated affected test patch targets. +- **Holon Flow Traversal**: Completed all 5 stages (Intent -> Plan -> Execute -> Review Loop -> Calibration). diff --git a/.beans/holon-agentic-coder-ref-metadata-0269--deferred-nits-from-the-pr-158-review-loop.md b/.beans/holon-agentic-coder-ref-metadata-0269--deferred-nits-from-the-pr-158-review-loop.md index c189b2a1..f2e938f1 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0269--deferred-nits-from-the-pr-158-review-loop.md +++ b/.beans/holon-agentic-coder-ref-metadata-0269--deferred-nits-from-the-pr-158-review-loop.md @@ -9,7 +9,7 @@ tags: - calibration - holon-agentic-coder created_at: 2026-11-10T00:00:00Z -updated_at: 2026-11-21T01:20:00+11:00 +updated_at: 2026-11-20T14:20:00Z --- ## Deferred findings diff --git a/.beans/holon-agentic-coder-ref-metadata-0333--github-issues-replace-beads-as-the-target-tracker.md b/.beans/holon-agentic-coder-ref-metadata-0333--github-issues-replace-beads-as-the-target-tracker.md index 27f7de50..2d763117 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0333--github-issues-replace-beads-as-the-target-tracker.md +++ b/.beans/holon-agentic-coder-ref-metadata-0333--github-issues-replace-beads-as-the-target-tracker.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0333 title: "GitHub Issues replace beads as the target tracker; remove the beads pilot from holon-agentic-coder" -status: todo +status: completed type: task priority: high tags: @@ -10,7 +10,7 @@ tags: - beads - holon-agentic-coder created_at: 2026-11-19T11:30:00Z -updated_at: 2026-11-22T22:55:00Z +updated_at: 2026-11-23T09:35:00Z --- ## Decision (maintainer, 2026-11-19) @@ -75,3 +75,36 @@ and 0317 remain blocked on this decision bean. `.beads/config.yaml`, `.gitignore`, `apps/sandbox-executor/Dockerfile`, `apps/sandbox-executor/docker-bake.hcl`, `apps/sandbox-executor/tests/test_beads_integration.py`, `docs/agents.md`, `docs/issue_tracking.md`. Unblocked and completely disjoint from PR #230. + +## Progress (2026-11-23) + +Flow `github-issues-replace-beads` completed all 5 stages (intent, plan, execute, review approved, calibrate) on PR +[#258](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/258). Mergeable and CLEAN, CI green on the final +head, calibration report `plans/I-1795422760-github-issues-replace-beads/P-1795422777-CLA-CO5.5_calibration.md` in the +PR diff. Awaiting human merge into main. + +## Progress note (flow rerun, 2026-11-23) + +- PR #258 was merged into main at 09:23:07Z (maintainer auto-merge) while the rerun from review was still running; the + flow was left to finish. +- Rerun from review (engine reinstalled 20:11 AEDT): review re-dispatched reviewers (iteration 2), all three APPROVED (0 + critical, 0 important, 0 nit) on head a4afb308. Approval did not carry over. +- Stage 5 calibration ran on head ea6df94b (predicted EV 43.29, actual 50.39, delta +7.10); the flow's final-head CI + check on 8fcf222 was not verified before the flow ended. +- Log: todo/flow-github-issues-replace-beads.log. + +## Resolution + +Delivered via [PR #258](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/258) and merged into `main` +(`b01c2da`): + +- **Key Architectural Deliverables**: the beads pilot is removed from `holon-agentic-coder` (pinned `bd` install and + offline check in the `holon/agent-*` image builds, `.beads/` config and gitignore entry, pilot tests); `AGENTS.md` and + `.agents/` describe GitHub Issues as the tracker. +- **Verification & Tests**: pilot tests removed; repository hygiene check no longer covers `.beads/`. Review approved on + head `a4afb308` (0 critical, 0 important, 0 nit); calibration report + `plans/I-1795422760-github-issues-replace-beads/P-1795422777-CLA-CO5.5_calibration.md`. +- **Holon Flow Traversal**: all 5 stages completed (Intent -> Plan -> Execute -> Review Loop -> Calibration). The merge + landed while the rerun from review was still finishing; the flow then ended. +- **Cleanup**: flow worktree `flow-github-issues-replace-beads` removed; its branches deleted locally and on origin. + Verified bundle of those branches: `todo/stale-worktree-backups/github-issues-replace-beads-2026-11-23.bundle`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0340--revisit-module-budget-default-200-no-overrides.md b/.beans/holon-agentic-coder-ref-metadata-0340--revisit-module-budget-default-200-no-overrides.md index 2f7ff64b..db68863e 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0340--revisit-module-budget-default-200-no-overrides.md +++ b/.beans/holon-agentic-coder-ref-metadata-0340--revisit-module-budget-default-200-no-overrides.md @@ -10,8 +10,8 @@ tags: - configuration - refactoring - holon-agentic-coder -created_at: 2026-11-20T19:30:00+11:00 -updated_at: 2026-11-20T19:30:00+11:00 +created_at: 2026-11-20T08:30:00Z +updated_at: 2026-11-20T08:30:00Z --- ## Context diff --git a/.beans/holon-agentic-coder-ref-metadata-0350--enable-claude-code-experimental-code-mode.md b/.beans/holon-agentic-coder-ref-metadata-0350--enable-claude-code-experimental-code-mode.md index 4d0fcdec..4d96dafe 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0350--enable-claude-code-experimental-code-mode.md +++ b/.beans/holon-agentic-coder-ref-metadata-0350--enable-claude-code-experimental-code-mode.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0350 title: "Enable Claude Code code mode (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1) for every Claude run" -status: todo +status: in-progress type: feature priority: high tags: @@ -10,8 +10,8 @@ tags: - subagents - harness - holon-agentic-coder -created_at: 2026-11-21T12:06:00+11:00 -updated_at: 2026-11-21T12:06:00+11:00 +created_at: 2026-11-21T01:06:00Z +updated_at: 2026-11-24T13:00:00Z --- ## Problem @@ -53,3 +53,24 @@ flow, subagents, and anything else. Nothing sets the variable today. - Keep it switchable, because the feature is experimental. - Intent JSON must not name harness paths. The target-repo part goes through the Holon flow. + +## Progress + +- 2026-11-23: Harness half done, uncommitted: `flow_env.py` sets `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1` for + `claude-agent` (flow process and the settings `env` the containers read; a caller-set value such as `0` is kept), two + tests in `tests/test_flow_env.py`, a note in the `holon_flow` skill, and the `env` block of `.claude/settings.json`. +- Target half: flow `claude-code-mode-default-on` launched (`antigravity-agent` / `gemini-4-argon`), scoped to + `agent_runner.py`, `env_registry.py`, their tests and `docs/environment_variables.md`; off switch + `HOLON_CLAUDE_CODE_MODE=0`. +- 2026-11-24: `Holon-Agentic-Coder/holon-agentic-coder#268` (`claude-code-mode-default-on`, Action 3 target containers) + merged into `main` at `28340ea2` (11/11 CI green, Stage 5 calibrated EV predicted `61.88` / actual `67.77` / delta + `+5.89`), `apps/holon-agentic-coder/main` was fast-forwarded, Docker images and `holon` CLI were rebuilt/reinstalled, + and `flow-claude-code-mode-default-on` was pruned. +- 2026-11-24: Maintainer-instructed host-side cleanup exception on PR #268 (`ce56b34d`): reverted 36 unrelated + historical `plans/` files back to `origin/main` (touched by Stage 4 resolver's repo-wide Prettier and + `prettier-ignore` edits in iterations 2–3) and relaunched from `--from-stage review` (follow-up Bean `0392`). + +- 2026-11-24 (clean-up): stays open. Target containers (Action 3) are delivered by PR #268. Remaining: Action 4 (check + the other Claude entry points: review-loop skills, post-merge, resolve-conflict, holon-coherence, dev-env profile), + Action 5 (verification run: variable visible in the runner environment, token and duration comparison, how to switch + it off), and committing the harness half (Actions 1 and 2, still uncommitted on this branch). diff --git a/.beans/holon-agentic-coder-ref-metadata-0352--push-pr-events-via-gh-webhook-forward.md b/.beans/holon-agentic-coder-ref-metadata-0352--push-pr-events-via-gh-webhook-forward.md index f01c0f97..9a82f7dc 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0352--push-pr-events-via-gh-webhook-forward.md +++ b/.beans/holon-agentic-coder-ref-metadata-0352--push-pr-events-via-gh-webhook-forward.md @@ -11,8 +11,8 @@ tags: - harness - efficiency - holon-agentic-coder -created_at: 2026-11-21T13:12:00+11:00 -updated_at: 2026-11-21T13:12:00+11:00 +created_at: 2026-11-21T02:12:00Z +updated_at: 2026-11-21T02:12:00Z --- ## Problem diff --git a/.beans/holon-agentic-coder-ref-metadata-0360--resume-after-interrupted-plan-stage-creates-duplicate-p-branch.md b/.beans/holon-agentic-coder-ref-metadata-0360--resume-after-interrupted-plan-stage-creates-duplicate-p-branch.md index 54529bd8..67602c19 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0360--resume-after-interrupted-plan-stage-creates-duplicate-p-branch.md +++ b/.beans/holon-agentic-coder-ref-metadata-0360--resume-after-interrupted-plan-stage-creates-duplicate-p-branch.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0360 title: "Resume after an interrupted plan stage creates a duplicate P- branch" -status: todo +status: completed type: bug priority: high tags: @@ -10,7 +10,8 @@ tags: - stage-2 - holon-agentic-coder created_at: 2026-11-23T00:10:00Z -updated_at: 2026-11-23T00:10:00Z +updated_at: 2026-11-23T14:23:52Z +pr: https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/264 --- ## Problem @@ -31,3 +32,21 @@ edit of the checkpoint. ## Notes - About a dozen flows were stopped mid Stage 2 on 2026-11-23 (machine load), so each resume may hit this. +- 2026-11-23: All 5 Holon flow stages completed on + [PR #264](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/264) (`MERGEABLE`, `CLEAN`, 11/11 CI green, + Stage 5 `calibrate` completed with calibration report in PR diff); awaiting human merge (`status: in-progress`). + +## Resolution + +Delivered via [PR #264](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/264) and merged into `main` +(`f49340f9`): + +- **Key Architectural Deliverables**: Stage 2 now records pushed plan branches reliably and `plan` resume detects/adopts + existing pushed `P-.../_` branches instead of generating duplicate plan branches. +- **Verification & Tests**: Unanimous `APPROVED (3/3)` ensemble consensus review posted (`2026-11-23T13:38:22Z`), all + `11/11` CI checks passed, and `install_holon.py --holon-only` rebuilt all images and reinstalled `holon` against + `main` (`f49340f9`). +- **Holon Flow Traversal**: All 5 stages completed cleanly (`antigravity-agent` / `gemini-4-argon` from existing Fable + plan `P-1795436363-CLA-CF5.2`); Stage 5 calibration + (`plans/I-1795436346-resume-adopts-pushed-plan-branch/P-1795436363-CLA-CF5.2_calibration.md`, EV predicted `42.34` / + actual `58.86`, delta `+16.52`, Bug EV Drag `0.00`) included in PR diff. diff --git a/.beans/holon-agentic-coder-ref-metadata-0363--wait-for-ci-after-merging-main-and-restart-review-on-failure.md b/.beans/holon-agentic-coder-ref-metadata-0363--wait-for-ci-after-merging-main-and-restart-review-on-failure.md index 65709356..41d96259 100644 --- a/.beans/holon-agentic-coder-ref-metadata-0363--wait-for-ci-after-merging-main-and-restart-review-on-failure.md +++ b/.beans/holon-agentic-coder-ref-metadata-0363--wait-for-ci-after-merging-main-and-restart-review-on-failure.md @@ -1,7 +1,7 @@ --- # holon-agentic-coder-ref-metadata-0363 title: "After merging main, wait for CI before calibrating; restart PR review from the start if CI breaks" -status: in-progress +status: completed type: bug priority: high tags: @@ -12,7 +12,7 @@ tags: - calibration - holon-agentic-coder created_at: 2026-11-23T03:30:00Z -updated_at: 2026-11-23T03:30:00Z +updated_at: 2026-11-23T06:28:32Z --- ## Problem @@ -53,3 +53,18 @@ stands" at 03:26, but the calibration report was already on the PR. ## Notes - Related: bean 0362 (stale-calibration warning lifecycle) and bean 0354 (test gate judges the current head). + +## Resolution + +Delivered via [PR #250](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/250) and merged into `main` +(`582c4ab3`): + +- **Key Architectural Deliverables**: Stage 5 gates on CI for the exact merged head after the flow merges `origin/main` + into the PR branch. Cancelled or superseded runs count as not passed. A failing check on the merged head withdraws the + earlier consensus (ledger row appended, PR comment posted) and restarts the Stage 4 review loop at iteration 1. The + head-check and rerun logic lives in `flow/github/ci_head_checks.py` and `flow/github/ci_head_reruns.py`; consensus + withdrawal in `flow/review/consensus_withdrawal.py`. +- **Verification & Tests**: Hermetic tests cover merge-then-wait-for-CI, CI failure restarting review at iteration 1, + cancelled runs treated as not passed, and the no-merge path running Stage 5 immediately. +- **Holon Flow Traversal**: All 5 stages (Intent -> Plan -> Execute -> Review Loop -> Calibration) completed; + calibration commits `2c8e6fde`, `529651c8` and `68866c7a` are on the flow branch. diff --git a/.beans/holon-agentic-coder-ref-metadata-0366--install-zsh-on-linux-and-unify-nvm-versions-node-storage.md b/.beans/holon-agentic-coder-ref-metadata-0366--install-zsh-on-linux-and-unify-nvm-versions-node-storage.md new file mode 100644 index 00000000..2bc0c561 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0366--install-zsh-on-linux-and-unify-nvm-versions-node-storage.md @@ -0,0 +1,128 @@ +--- +# holon-agentic-coder-ref-metadata-0366 +title: "Install zsh on Linux/WSL and unify NVM storage strictly under versions/node" +status: completed +type: bug +priority: high +tags: + - target:dev-env + - wsl + - linux + - zsh + - nvm + - fish +created_at: 2026-11-23T05:26:00Z +updated_at: 2026-11-23T05:54:00Z +pr: https://github.com/thomashan/dev-env/pull/39 +--- + +## Problem + +1. **Missing `zsh` on Linux/WSL**: `zsh` is omitted from `devenv_packages_core` (`ansible/group_vars/all.yml`) and + `ansible/vars/pkg_apt.yml`. macOS ships `/bin/zsh` out of the box, whereas Ubuntu/WSL ships only `bash`, so `dev-env` + stows `~/.zshrc` without installing `zsh` on Linux/WSL. +2. **NVM bi-directional symlink trap & recursive `versions` loop**: + - `dotfiles/fish/.config/fish/conf.d/00-devenv.fish` uses `find "$XDG_DATA_HOME/nvm" -maxdepth 1 -name "v*"`, which + matches the `versions` directory itself and creates a recursive symlink + `~/.local/share/nvm/versions/node/versions -> ~/.local/share/nvm/versions`. + - Mirroring `~/.local/share/nvm/v*` <-> `~/.local/share/nvm/versions/node/v*` with symlinks breaks + `nvm uninstall ` in Bash/Fish: uninstalling only removes the symlink under `versions/node/`, leaving the real + directory under `~/.local/share/nvm/vX.Y.Z` so `nvm ls` still lists the version while `nvm uninstall` fails with + `N/A version is not installed...` (and starting Fish recreates the deleted symlink). + - `ansible/roles/node/tasks/main.yml` still points `creates:` and the `current` symlink `src:` at the legacy flat + `~/.local/share/nvm/v{{ devenv_node_version }}` path instead of the unified + `~/.local/share/nvm/versions/node/v{{ devenv_node_version }}` directory shared by both `nvm.fish` (`nvm_data`) and + `nvm-sh`. + +## Action + +Through the 5-stage Holon flow on `dev-env`: + +1. **`ansible/group_vars/all.yml`, `ansible/vars/pkg_apt.yml`, `ansible/vars/os_Darwin.yml`**: + - Add `zsh` to `devenv_packages_core` (next to `fish`) in `ansible/group_vars/all.yml`. + - Add `zsh: zsh` to `devenv_pkg_aliases` (next to `fish: fish`) in `ansible/vars/pkg_apt.yml`. + - Add `- zsh` to `devenv_pkg_skip` (next to `- unzip`) in `ansible/vars/os_Darwin.yml` since macOS ships `/bin/zsh` + (leaving Linux/WSL to install `zsh`, and verifying `README.md` mentions `zsh` for `test_readme_manifest_coverage`). +2. **`ansible/roles/node/tasks/main.yml`**: + - Ensure `{{ devenv_home }}/.local/share/nvm/versions/node` directory exists (`state: directory`, `mode: "0755"`). + - Update `Install the pinned node through nvm` `creates:` to + `{{ devenv_home }}/.local/share/nvm/versions/node/v{{ devenv_node_version }}/bin/node`. + - Update `Point current at the pinned version` `src:` to + `{{ devenv_home }}/.local/share/nvm/versions/node/v{{ devenv_node_version }}`. +3. **`dotfiles/fish/.config/fish/conf.d/00-devenv.fish`**: + - Keep `set -g nvm_data $XDG_DATA_HOME/nvm/versions/node` and `fish_add_path -gpPm "$XDG_DATA_HOME/nvm/current/bin"`. + - Replace the bi-directional `-name "v*"` symlink loops with idempotent one-way migration & cleanup: + - Ensure `$nvm_data` exists (`test -d "$nvm_data" || mkdir -p "$nvm_data"`). + - Remove `$nvm_data/versions` if `test -L "$nvm_data/versions"` (`command rm -f "$nvm_data/versions"`). + - Scan only `(command find "$XDG_DATA_HOME/nvm" -maxdepth 1 -name "v[0-9]*" 2>/dev/null)`: remove legacy + back-symlinks (`test -L "$legacy_ver"`), and move any real legacy directory into `$nvm_data/$vname` (replacing an + existing symlink at `$nvm_data/$vname` if present, never overwriting a real directory). + - Repair a dangling `$XDG_DATA_HOME/nvm/current` symlink to `$nvm_data/v$devenv_node_default_version` when present. + - Never create back-symlinks into `$XDG_DATA_HOME/nvm/v*`. +4. **`tests/test_manifest.py`** (strictly `<= 1,000` lines, currently 990): + - Update `test_fish_nvm_path_resolution_in_conf_d()` to assert `v[0-9]*` (not `-name "v*"`), assert no + back-symlinking into `$XDG_DATA_HOME/nvm/$vname`, and retain `set -g nvm_data $XDG_DATA_HOME/nvm/versions/node` and + `fish_add_path -gpPm "$XDG_DATA_HOME/nvm/current/bin"`. +5. **`tests/test_toolchain.py`**: + - Assert `zsh` is in `devenv_packages_core`, mapped to `zsh` in `pkg_apt.yml`, and skipped in `os_Darwin.yml` + `devenv_pkg_skip` (not skipped in `os_Linux.yml`). + - Assert `ansible/roles/node/tasks/main.yml` points `creates` and `current` symlink `src` at + `{{ devenv_home }}/.local/share/nvm/versions/node/v{{ devenv_node_version }}`. +6. **`tests/test_shell_hooks.py`**: + - Add `test_fish_nvm_migration_and_no_versions_symlink_loop` running real Fish (`fish -lc 'true'`) against a hermetic + fake HOME seeded with legacy flat `v24.18.0` + symlink `versions/node/v24.18.0`, bogus `versions/node/versions` + symlink, dangling `v22.0.0`, real `versions/node/v26.13.1`, and dangling `current`, verifying cleanup, one-way + migration, no `v26.13.1` back-symlink, and `current` repair. +7. Keep zero `.sh` files outside `dotfiles/examples/`. + +## Acceptance Criteria + +- Stage 2 plan declares an explicit `## Touch Set` section listing all created/modified repo-relative paths. +- `zsh` is declared in `devenv_packages_core`, aliased in `ansible/vars/pkg_apt.yml`, and skipped in + `ansible/vars/os_Darwin.yml`. +- `ansible/roles/node/tasks/main.yml` ensures `~/.local/share/nvm/versions/node` and points `creates` and `current` at + `versions/node/v{{ devenv_node_version }}`. +- `dotfiles/fish/.config/fish/conf.d/00-devenv.fish` cleans up `versions/node/versions`, migrates legacy `v[0-9]*` + directories one-way into `versions/node/`, repairs a dangling `current` symlink, and never creates back-symlinks into + `~/.local/share/nvm/v*`. +- `tests/test_manifest.py` stays `<= 1,000` lines, `tests/test_toolchain.py` checks `zsh` packaging + unified node role + paths, and `tests/test_shell_hooks.py` tests the Fish migration and loop cleanup in a real Fish subprocess. +- `make check-syntax`, `uv run --extra test ruff format --check .`, `uv run --extra test ruff check .`, + `uv run --extra test ansible-lint`, `npx --yes prettier@3 --check "**/*.md"`, and + `uv run --extra test pytest -m "not network"` all pass cleanly with zero deprecation warnings. + +## Notes + +- Target repository: `thomashan/dev-env` (`/Users/thomashan/git/dev-env/main`, at `68ddec98`). +- Any `dev-env` Holon flow intent JSON MUST instruct the Stage 2 planner to include a `## Touch Set` section listing all + modified/created repo-relative paths. + +## Progress + +- 2026-11-23: Wrote `todo/intent-0366-dev-env-zsh-and-nvm-storage.json` and launched Holon flow + `dev-env-zsh-and-nvm-storage` off `/Users/thomashan/git/dev-env/main` (`68ddec98`) with `antigravity-agent` / + `gemini-4-argon`. +- 2026-11-23: Flow `dev-env-zsh-and-nvm-storage` (`antigravity-agent` / `gemini-4-argon`) completed all 5 stages and + opened [PR #39](https://github.com/thomashan/dev-env/pull/39) (head `6d8e2ecf`): Stage 4 consensus 3/3 APPROVED (0 + critical, 0 important, 0 nit), Stage 5 calibration included in PR diff (predicted EV 96.27, actual 97.16, delta +0.89; + touch-set precision/recall 100.0%), all 6 CI checks green (`hygiene`, `make-matrix` `ubuntu-latest` / `macos-latest`, + `test-network`, `test-unit` `ubuntu-latest` / `macos-latest`), `MERGEABLE`/`CLEAN`, awaiting human maintainer merge. + +## Resolution + +Completed via [dev-env PR #39](https://github.com/thomashan/dev-env/pull/39) (merged into `main` as `eeb2032d` on +2026-11-23; head `6d8e2ecf`): + +- Added `zsh` to `devenv_packages_core` (`ansible/group_vars/all.yml`) and `zsh: zsh` to `ansible/vars/pkg_apt.yml` + (installing `zsh` across all Linux/WSL hosts), while skipping `zsh` as OS-provided in `ansible/vars/os_Darwin.yml`. +- Updated `ansible/roles/node/tasks/main.yml` to ensure `~/.local/share/nvm/versions/node` exists and point both + `creates` and the `current` symlink at `~/.local/share/nvm/versions/node/v{{ devenv_node_version }}`. +- Replaced the bi-directional `-name "v*"` symlink loops in `dotfiles/fish/.config/fish/conf.d/00-devenv.fish` with + idempotent one-way migration: removes bogus `$nvm_data/versions` symlink, scans strictly `v[0-9]*`, moves real legacy + flat directories into `versions/node/`, removes stale flat symlinks without back-symlinking, and repairs a dangling + `current` symlink. +- Updated `tests/test_manifest.py` (`984` lines `<= 1,000`), added `zsh` mapping and unified node path tests in + `tests/test_toolchain.py`, and added the real hermetic Fish migration test in `tests/test_shell_hooks.py`. +- Traversed all 5 Holon flow stages (`antigravity-agent` / `gemini-4-argon`): Stage 4 consensus 3/3 APPROVED (0 + critical, 0 important, 0 nit), Stage 5 calibration included in PR diff (predicted EV 96.27, actual 97.16, delta +0.89; + touch-set precision/recall 100.0%), all 6 CI checks green. diff --git a/.beans/holon-agentic-coder-ref-metadata-0367--stage-5-never-writes-a-fallback-calibration-report.md b/.beans/holon-agentic-coder-ref-metadata-0367--stage-5-never-writes-a-fallback-calibration-report.md new file mode 100644 index 00000000..818402b9 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0367--stage-5-never-writes-a-fallback-calibration-report.md @@ -0,0 +1,65 @@ +--- +# holon-agentic-coder-ref-metadata-0367 +title: "Stage 5 never writes a fallback calibration report: retry, then fail the stage" +status: completed +type: bug +priority: high +tags: + - flow + - stage-5 + - calibration + - holon-agentic-coder +created_at: 2026-11-23T05:50:00Z +updated_at: 2026-11-23T10:52:00Z +--- + +## Problem + +When `run_calibrate` raises, `flow/stages/calibrate.py::_fallback_report` writes a stub report +(`# Calibration Report for \n\nFallback calibration generated.`), records an `outcome="failure"` ACT-CAL row, and +the stage still exits `status=success`. The flow logs `calibrate: ok` and finishes at the merge boundary as if Stage 5 +had passed. A stub report carries no EV numbers, so it is not a calibration (maintainer, 2026-11-23: "there shouldn't be +a fallback calibration report; if the agent failed to generate one it should retry or stop"). + +Seen on PR #249 (2026-11-23 05:44:15Z, `todo/flow-remove-token-reduction-copy.log` lines 526–538): checkout of the +`/calibrated` branch failed with `fatal: gitfile does not point to a valid repository: holon-coherence/.git` (Bean +0368), the stub was written, and the run reported success. The real report on `main` came from a later hand re-run after +the gitfile was repaired. + +## Goal + +1. **No fallback report, ever.** Remove `_fallback_report` and the `on_calibrate_error` hook path in `flow/stage5.py`; + the stub text and `fallback_report_written` disappear from `calibration.py::record_calibration_action`. +2. **Retry transient failures.** Retry `run_calibrate` a bounded number of times (agent/API errors, timeouts, + named-reset usage limits waited out as elsewhere) before giving up. +3. **Otherwise fail the stage.** A non-retryable or exhausted failure returns `StageStatus.FAILED`: nothing is committed + or pushed, the `/calibrated` branch is discarded if empty, the checkpoint stays at CALIBRATE so + `--from-stage calibrate` resumes, and the run summary says `calibrate: failed` with the redacted cause. The failure + ACT-CAL row is still appended to the ledger (append-only). +4. Tests: an exception with no retries left fails the stage and writes no report; a transient error retries and then + succeeds; no code path writes "Fallback calibration generated". + +## Touch set + +`apps/sandbox-executor/src/sandbox_executor/flow/stages/calibrate.py`, +`apps/sandbox-executor/src/sandbox_executor/flow/stage5.py`, +`apps/sandbox-executor/src/sandbox_executor/calibration.py`, their tests (`tests/test_calibrate_*.py`, +`tests/test_stage5*.py`). + +## Resolution + +Delivered via [PR #257](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/257) and merged into `main` +(`ff98e7e`): + +- **Key Architectural Deliverables**: `_fallback_report` and the `on_calibrate_error` hook are removed; the stub text + and `fallback_report_written` are gone from `calibration.py`. `run_calibrate` is retried with a bounded, classified + retry (`flow/calibrate_retry.py`); an exhausted or non-retryable failure returns `StageStatus.FAILED`, commits and + pushes nothing, keeps the checkpoint at CALIBRATE, and still appends the failure ACT-CAL row. +- **Verification & Tests**: hermetic tests cover fail-closed exhaustion with no report written, transient retry then + success, and that no path writes "Fallback calibration generated". Full suite and lint gates green in the execution. +- **Holon Flow Traversal**: all 5 stages completed (intent, plan, execute, review loop over 4 iterations, calibration + with its report on `/calibrated`). +- **Cleanup**: flow worktree `flow-no-fallback-calibration-report` and its six intent/plan/execution branches removed + locally and on origin. Bundle backup of the branches: + `todo/stale-worktree-backups/no-fallback-calibration-report-2026-11-23.bundle` (verified; all content is already an + ancestor of `origin/main`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0368--submodule-gitfile-container-paths-break-host-git.md b/.beans/holon-agentic-coder-ref-metadata-0368--submodule-gitfile-container-paths-break-host-git.md new file mode 100644 index 00000000..411ddb00 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0368--submodule-gitfile-container-paths-break-host-git.md @@ -0,0 +1,40 @@ +--- +# holon-agentic-coder-ref-metadata-0368 +title: "Submodule gitfile left with container paths breaks host-side git in the flow worktree" +status: todo +type: bug +priority: high +tags: + - flow + - git + - submodule + - stage-5 + - holon-agentic-coder +created_at: 2026-11-23T05:50:00Z +updated_at: 2026-11-23T05:50:00Z +--- + +## Problem + +On PR #249's flow (`flow-remove-token-reduction-copy`), Stage 5's checkout of the `/calibrated` branch failed on the +host with `fatal: gitfile does not point to a valid repository: holon-coherence/.git` (2026-11-23 05:44:15Z). The +`holon-coherence` submodule had been initialised during a containerised stage, so its gitfile and `core.worktree` held +container-relative paths that do not resolve on the host. The flow subagent repaired both by hand in that worktree only; +Stage 5 then succeeded. The other flow worktrees of the same run have no initialised submodule, so only flows whose +agent runs `git submodule` commands inside the container hit this. + +## Goal + +1. Find where a role container initialises or updates the `holon-coherence` submodule in the mounted worktree, and + either stop it (role containers do not need the submodule) or make it write host-valid, relative paths + (`git submodule absorbgitdirs` / relative `gitdir:`). +2. Host-side stages (4 and 5) detect an unresolvable submodule gitfile before any checkout and repair it, or fail with a + clear message naming the file, instead of failing mid-checkout. +3. Tests: a worktree whose submodule gitfile points at a container path is repaired or rejected before Stage 5 checks + out. + +## Touch set + +To be fixed by the plan: the container entrypoint's git setup +(`apps/sandbox-executor/src/sandbox_executor/entrypoint/executor/repair.py`), +`apps/sandbox-executor/src/sandbox_executor/flow/stages/calibrate.py` (pre-checkout check), and their tests. diff --git a/.beans/holon-agentic-coder-ref-metadata-0369--stage-5-wrong-calibration-report-bug-drag-and-diff-base.md b/.beans/holon-agentic-coder-ref-metadata-0369--stage-5-wrong-calibration-report-bug-drag-and-diff-base.md new file mode 100644 index 00000000..0ff3bcbf --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0369--stage-5-wrong-calibration-report-bug-drag-and-diff-base.md @@ -0,0 +1,144 @@ +--- +# holon-agentic-coder-ref-metadata-0369 +title: + "Stage 5 writes a wrong calibration report: recovered infra failures become bug drag, main's files count as the PR's" +status: completed +type: bug +priority: critical +tags: + - flow + - stage-5 + - calibration + - holon-agentic-coder +created_at: 2026-11-23T05:55:00Z +updated_at: 2026-11-23T08:00:00Z +--- + +## Problem + +PR #249's calibration report (`plans/I-1795409225-remove-token-reduction-copy/P-1795409242-CLA-CO5.5_calibration.md`, +merged in `c905a98e`) is wrong, and `holon calibrate` reproduces it exactly when re-run from a clean worktree off `main` +(2026-11-23). Three defects, each confirmed against `main` at `c905a98e`: + +1. **A recovered infrastructure failure becomes 80 points of bug drag.** A Stage 4 review row (`REV-1795410989-…`, + 05:16Z, "Reviewer ensemble container dispatch exited with code 1") is a failed summary row for the plan. + `calibration_ev.py:43-45` (`is_matching_record`) matches summary rows by plan branch, so review rows count as + delivery rows. `calibration_outcome.py:80-87` (`has_unresolved_failure`) lets a later success supersede only a + `sync_conflict` row, never a `failed` one. `calibration_ev.py:81-83` then sets P(success) and impact "with bugs" to + 0: observed EV −21.01 against a clean 58.99, although the review loop recovered and approved 3/3 with 0/0/0 findings. +2. **Files merged in from `main` are counted as the PR's own.** `calibration.py:780-785` diffs from the plan branch + (`1915bbc1`) to the execution branch. The execution branch merged `origin/main` (`64af55f1`, bringing PR #244), so PR + #244's files are counted: 63 files instead of 46, 18 "outside the touch set", recall 71.4%, SSA 10.0. +3. **The wrong commit is recorded as evaluated.** Given the branch name, the report's "Evaluated Commit SHA" is the + `/calibrated` tip (`764cd3a0`, a calibration/ledger-only commit), not the final code commit (`e4024a6d`). + +The same report is produced for every flow whose execution branch merges `main` before Stage 5, or whose Stage 4 hit one +transient container failure, so most calibrations since the dual-EV and review-ledger changes are suspect. Related: Bean +0367 (no fallback report) and Bean 0368 (container submodule gitfile). + +## Goal + +1. **Bug drag counts only delivery failures.** Only execution (Stage 3) summary rows of this plan feed the dual EV; + Stage 4/5 pipeline rows never do. An infrastructure failure (container dispatch exit, usage-limit kill, timeout of + the harness rather than the agent) never counts as a bug. A failed execution row followed by a later converged, + zero-exit execution row of the same plan is resolved, like a superseded `sync_conflict`. +2. **Patch size measures the PR's own change.** The diff base is the merge-base of the execution head with the target + branch (`origin/main`), recomputed after any merge of `main` into the branch, so files that arrived only through such + a merge are never counted, listed outside the touch set, or used for SSA. The `diff_base` label records the base + used. +3. **The evaluated commit is the last code commit.** Calibration/ledger-only commits on `/calibrated` or `_` are skipped + when resolving the evaluated SHA; the report's Evaluated Commit SHA equals the head the review approved. +4. **Fail closed on an inconsistent report.** Before Stage 5 commits a report, a self-check fails the stage + (`StageStatus.FAILED`, nothing committed or pushed, checkpoint left at CALIBRATE) when any of these hold: + - bug drag > 0 with no unresolved execution failure row behind it; + - any counted file is changed by the target branch since the plan branch but not by the PR's own commits; + - the evaluated SHA is a calibration/ledger-only commit, or differs from the approved review head; + - the report contains the fallback stub text. +5. **Correct PR #249's report** in the same PR: re-run the fixed `holon calibrate` on its execution branch and commit + the replacement report and append-only ledger rows (expected: drag 0, 46 files, evaluated `e4024a6d`). + +## Tests (required; the PR is not done without all of them) + +- **PR #249 regression, end to end.** A temp git repo reproducing the exact topology: `main` → plan branch → execution + commits; `main` advances with unrelated files; the execution branch merges `main`; Stage 4 ledger rows include one + failed reviewer dispatch row followed by an approved row; `/calibrated` gets a ledger-only commit. Run Stage 5 and + assert: bug drag 0 and EV with bugs == EV clean; counted files == exactly the PR's own files; no main-only file in + "outside the touch set"; Evaluated Commit SHA == the last code commit; the report passes the self-check. +- **Dual EV unit matrix** (`calibration_ev` / `calibration_outcome`): parametrised over row kinds (execution, review, + calibrate), statuses (`failed`, `sync_conflict`, success) and order (failure then success, success then failure, + failure last). Assert drag only when an execution failure is unresolved; review/calibrate rows never move the + with-bugs values; an infra failure row never counts. +- **Diff base property test** (Hypothesis, as the repo's fuzz tests do): random sets of files changed on `main` and on + the PR, with zero to three merges of `main` into the execution branch at random points. Invariant: counted files == + files the PR's own commits change, for every case. +- **Evaluated SHA tests:** `/calibrated` tip with one or more ledger-only commits, an execution head that is itself a + merge of `main`, and a branch with no ledger-only commit on top. +- **Self-check tests:** one failing test per self-check condition in Goal 4, asserting the stage fails, nothing is + committed or pushed, and the log names the violated condition; plus one passing consistent report. +- **Golden report:** the PR #249 fixture's rendered report compared against a checked-in expected Markdown file, so any + change to drag, file counts or evaluated SHA shows up as a diff. +- **Mutation check:** run the repository's mutation-testing gate on `calibration_ev.py`, `calibration_outcome.py` and + `calibration_diff.py`; no surviving mutant in the changed lines. + +## Touch set + +`apps/sandbox-executor/src/sandbox_executor/calibration_ev.py`, +`apps/sandbox-executor/src/sandbox_executor/calibration_outcome.py`, +`apps/sandbox-executor/src/sandbox_executor/calibration_diff.py`, +`apps/sandbox-executor/src/sandbox_executor/calibration.py`, +`apps/sandbox-executor/src/sandbox_executor/flow/stages/calibrate.py`, +`apps/sandbox-executor/tests/test_calibration_dual_ev.py`, `apps/sandbox-executor/tests/test_calibration_ev.py`, +`apps/sandbox-executor/tests/test_calibration.py`, `apps/sandbox-executor/tests/test_calibration_touch_set.py`, +`apps/sandbox-executor/tests/test_calibrate_full_stage5.py`, `apps/sandbox-executor/tests/test_calibrate_rerun.py`, +`apps/sandbox-executor/tests/flow/stages/test_calibrate.py`, new +`apps/sandbox-executor/tests/test_calibration_regression_merge_main.py` and its golden file +`apps/sandbox-executor/tests/fixtures/calibration_merge_main_expected.md`, +`plans/I-1795409225-remove-token-reduction-copy/P-1795409242-CLA-CO5.5_calibration.md`. + +## Progress note (flow subagent, 2026-11-23) + +- Intent `I-1795413542-calibration-report-correctness` (flow worktree `flow-calibration-report-correctness`). +- Intent and plan stages done: plan `P-1795413833-CLA-CO5.5`. Stage 3 execute done: `E-1795414090-CLA-CO5.5` (5791 tests + passed), head `d87bdc06` (local; a sync-conflict row was recorded in executions.jsonl). +- Stage 4 review halted before any review ran: `origin/main` now conflicts with the execution branch in `calibrate.py` + (PR #250 merged-head CI gate vs this branch's self-check fail-closed) plus the ledgers. A hand-merge attempt was + aborted, not committed (patch kept outside the repo); the flow's own review stage refuses unresolved conflicts, so it + cannot continue without a flow-produced resolution or a maintainer decision. +- Also found: the first resume failed in plan because a 17-line untracked stub plan + (`plans/I-1795413542-.../P-1795413559-CLA-CO5.5.md`) dirtied the mounted workspace; moved out of the worktree, the + plan stage then succeeded. +- No PR opened yet; Stage 5 not run; PR #249 report not regenerated. +- Next: resolve the `calibrate.py` merge through a flow run (or maintainer), then the test + `test_stage5_self_check_failure_fails_stage_commits_and_pushes_nothing` needs its setup updated for the new + merged-head gate. + +## Progress note (holon flow subagent, 2026-11-23) + +- PR #253 (holon-agentic-coder), head 5e0f310: review approved 3/3 (0/0/0 on the final iteration), calibration included + in the PR diff (calibrated on execution head 91dc696d), CI green on the final head, mergeable CLEAN. Awaiting human + maintainer merge; not merged by the agent. +- Stage 4 resumed from checkpoint after resolve-conflict merged main; earlier review iteration's 5 findings (R1-F1, + R1-F2, R2-F1, R2-F2, R3-F1) fixed by the review resolver in 655092d6. Main was merged again through the conflict gate + after PR #251 and #252 merged. +- Stage 5 ran 10.6 min against a 10 min budget; kept its success result per the runner's warning. + +## Resolution + +Delivered via [PR #253](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/253) and merged into `main` +(`606978fb`): + +- **Key Architectural Deliverables**: bug drag counts only Stage 3 execution failures (unresolved failed or + sync-conflict rows of the plan); review and calibrate rows never move the with-bugs EV, and a later success resolves + an earlier failure. The diff base is the merge-base with `origin/main` recomputed after any merge of `main` into the + execution branch, so files that arrived only through such a merge are not counted. The Evaluated Commit SHA skips + ledger-only `/calibrated` and `_` commits. A fail-closed self-check (bug drag without an unresolved failure, counted + files changed on `main` only, evaluated SHA not the approved head, fallback stub text) fails Stage 5 before anything + is committed or pushed. The PR #249 calibration report was regenerated in the same PR. +- **Verification & Tests**: PR #249 end-to-end regression (`test_calibration_regression_merge_main.py`) with golden file + `calibration_merge_main_expected.md`; dual-EV matrix over row kind, status and order; diff-base property test; + evaluated-SHA and self-check tests; mutation gate on the changed calibration modules. Full suite passed on the flow's + execution head. +- **Holon Flow Traversal**: Intent, plan, execute, and review loop completed (3/3 approvals, 0/0/0 on the final + iteration); calibration included in the PR diff and merged. Stage 4 was resumed from checkpoint after + `resolve-conflict` merged `main`, and the review resolver fixed five findings (R1-F1, R1-F2, R2-F1, R2-F2, R3-F1) in + `655092d6`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0370--fix-node-zsh-converge-and-add-ubuntu-e2e-tests.md b/.beans/holon-agentic-coder-ref-metadata-0370--fix-node-zsh-converge-and-add-ubuntu-e2e-tests.md new file mode 100644 index 00000000..c11054fc --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0370--fix-node-zsh-converge-and-add-ubuntu-e2e-tests.md @@ -0,0 +1,111 @@ +--- +# holon-agentic-coder-ref-metadata-0370 +title: "Fix node/zsh/fish/brew converge bugs and add real e2e Ubuntu converge tests" +status: completed +type: bug +priority: high +tags: + - target:dev-env + - wsl + - linux + - zsh + - nvm + - testing + - ci + - docker +created_at: 2026-11-23T06:10:00Z +updated_at: 2026-11-23T07:33:55Z +pr: https://github.com/thomashan/dev-env/pull/40 +--- + +## Problem + +1. **Zsh `node` assertion failure on WSL after PR #39**: + - `ansible/roles/node/tasks/main.yml` runs `bash -lc`, `zsh -lc`, and `fish -lc` without `env -i`, inheriting the + parent interactive Fish session's `PATH` (where `nvm.fish` prepended + `~/.local/share/nvm/versions/node/v26.13.1/bin`). + - Unlike Bash (`~/.bash_profile` $\rightarrow$ `~/.bashrc`) and Fish (`00-devenv.fish`), `dev-env` does not stow a + `~/.zprofile`, and non-interactive login Zsh (`zsh -lc`) never reads `~/.zshrc`. So `zsh -lc` kept Fish's inherited + `~/.local/share/nvm/versions/node/v26.13.1/bin` first on `PATH`. + - The `node` role assertions rejected `'.local/share/nvm/versions/node/v' ~ devenv_node_version ~ '/bin/node'`, even + though it is NVM's canonical installed path (and what interactive `nvm use` / `nvm.sh` also prepends). +2. **Dishonest test & role blindspots**: + - `tests/test_shell_hooks.py:_link_repo_dotfiles()` writes a synthetic `~/.zprofile` shim in `tmp_path` that does not + exist in `dotfiles/zsh/` or on real machines. + - `ansible/roles/fish/tasks/main.yml` (`Collect linked fish files`) omits `follow: true` in `ansible.builtin.find`, + skipping stowed symlinks (`config.fish`, `00-devenv.fish`) during `fish -n` verification. + - `community.general.homebrew*` tasks pass the `brew` binary path (`devenv_brew_bin`) instead of its parent directory + (`devenv_brew_bin | dirname`) to `path:`. +3. **No end-to-end Ubuntu converge test in CI or local Docker**: + - CI only runs unit tests, lint, and `--check` on `--tags dotfiles,nvim-sync`, never running an actual Linux/WSL + `make converge` across `packages`, `dotfiles`, `conda`, `node`, `neovim`, and `fish`, so real playbook failures + keep surfacing on WSL first. + +## Action + +Through the 5-stage Holon flow on `thomashan/dev-env`: + +1. Add tracked `dotfiles/zsh/.zprofile` (non-interactive `~/.zshrc` sourcing + `~/.zprofile.local` without + double-sourcing interactive `zsh -lic`) and declare it in `devenv_links` (`ansible/group_vars/all.yml`). +2. Harden `ansible/roles/node/tasks/main.yml` with `which bash`/`zsh`/`fish` probes, isolated `env -i` + + `expand_argument_vars: false` login-shell checks, `not ansible_check_mode` guards, and assertions accepting + `current/bin/node`, `.local/bin/node`, and canonical `versions/node/v{{ devenv_node_version }}/bin/node`. +3. Add `follow: true` to `Collect linked fish files` in `ansible/roles/fish/tasks/main.yml`. +4. Pass `devenv_brew_bin | dirname` (with `omit` fallback) to `path:` on `community.general.homebrew*` tasks across + `homebrew`, `packages`, `conda`, and `neovim` roles. +5. Remove the fake `.zprofile` shim from `tests/test_shell_hooks.py`, add `.zprofile` single-source Zsh tests, update + `tests/test_toolchain.py`, and add real hermetic `ansible-playbook` + Stow integration tests in + `tests/test_converge_integration.py` (keeping `tests/test_manifest.py <= 1,000` lines). +6. Install `stow` in `.github/workflows/test-unit.yml`, add real end-to-end Ubuntu WSL-simulated converge CI workflow + `.github/workflows/test-converge.yml` (documented in `.github/workflows/README.md`), and add local Docker Ubuntu + converge harness (`tests/docker/ubuntu.Dockerfile`, `.dockerignore`, `make test-ubuntu` in `Makefile`) with zero + `.sh` files and zero `apt-get`. + +## Notes + +- Target repository: `thomashan/dev-env` (`/Users/thomashan/git/dev-env/main`, at `eeb2032d`). +- Intent file: `todo/intent-0370-dev-env-e2e-converge.json`. +- Dedicated worktree: `/Users/thomashan/git/dev-env/flow-dev-env-e2e-converge-testing`. + +## Progress + +- 2026-11-23: Bean created (`0370`), intent authored + ([`todo/intent-0370-dev-env-e2e-converge.json`](../todo/intent-0370-dev-env-e2e-converge.json)), flow worktree created + at `/Users/thomashan/git/dev-env/flow-dev-env-e2e-converge-testing`, and 5-stage Holon flow launched in background + subagent `35f3a8a6-eb68-4d1b-9680-00e8259801fc` (`bean 0370 - holon flow dev-env-e2e-converge-testing`, + `antigravity-agent` / `gemini-4-argon`). +- 2026-11-23: All 5 Holon flow stages completed cleanly on + [thomashan/dev-env#40](https://github.com/thomashan/dev-env/pull/40) (consensus APPROVED; Stage 5 calibration report + `plans/I-1795414247-dev-env-e2e-converge-testing/P-1795414265-ANA-G4A_calibration.md` included in PR diff; 7/7 CI + checks passed including `Ubuntu Converge E2E` in 5m25s; `MERGEABLE` / `CLEAN`). Keeping `status: in-progress` until + human maintainer merge. + +## Resolution + +Delivered via [PR #40](https://github.com/thomashan/dev-env/pull/40) and merged into `main` (`22ca3862`): + +- **Key Architectural Deliverables**: + - Added tracked `dotfiles/zsh/.zprofile` (non-interactive `~/.zshrc` sourcing + `~/.zprofile.local` without + double-sourcing interactive `zsh -lic`) and registered it in `devenv_links` (`ansible/group_vars/all.yml`). + - Hardened `ansible/roles/node/tasks/main.yml` with `which bash`/`zsh`/`fish` availability probes, isolated `env -i` + + `expand_argument_vars: false` login-shell checks, `not ansible_check_mode` guards, and assertions accepting + `current/bin/node`, `.local/bin/node`, and canonical `versions/node/v{{ devenv_node_version }}/bin/node`. + - Added `follow: true` to `Collect linked fish files` in `ansible/roles/fish/tasks/main.yml`, and passed + `devenv_brew_bin | dirname` (with `omit` fallback) to `path:` across `homebrew`, `packages`, `conda`, and `neovim` + roles. + - Removed the fake `.zprofile` shim from `tests/test_shell_hooks.py`, added `.zprofile` single-source Zsh tests, + updated `tests/test_toolchain.py`, and added hermetic `ansible-playbook` / Stow / Node / Fish integration tests in + `tests/test_converge_integration.py`. + - Added `stow` to `.github/workflows/test-unit.yml`, real end-to-end Ubuntu/WSL converge CI in + `.github/workflows/test-converge.yml` (documented in `.github/workflows/README.md`), and local Docker Ubuntu + converge harness (`tests/docker/ubuntu.Dockerfile`, `.dockerignore`, `make test-ubuntu`). +- **Verification & Tests**: All 7/7 GitHub Actions CI checks passed on clean PR #40 (`Ubuntu Converge E2E` in 5m25s, + `test-unit` on macOS/Ubuntu, `Code Hygiene & Lint`, `Make Check`, `Network Upstream Asset Tests`). Locally on synced + `main` (`22ca3862`), `uv run --extra test ruff check .` passed and `uv run --extra test pytest -q -m "not network"` + reported `193 passed, 1 failed` (`4 deselected`), where the sole failure + (`tests/test_manifest.py::test_readme_manifest_coverage`) came from the pre-existing unstaged local + `dotfiles/nvim-kickstart/.config/nvim/nvim-pack-lock.json` diff (adding `diffview.nvim`, `fzf-lua`, `mini.completion`) + on `/Users/thomashan/git/dev-env/main`. +- **Holon Flow Traversal**: All 5 stages (Intent $\rightarrow$ Plan $\rightarrow$ Execute $\rightarrow$ Review Loop + $\rightarrow$ Calibration) completed cleanly on `antigravity-agent` / `gemini-4-argon` with calibration report + included in PR diff (EV predicted `97.60` / actual `99.09`, delta `+1.49`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0371--ledgers-stop-conflicting-per-flow-fragments-and-promotion.md b/.beans/holon-agentic-coder-ref-metadata-0371--ledgers-stop-conflicting-per-flow-fragments-and-promotion.md new file mode 100644 index 00000000..500bad67 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0371--ledgers-stop-conflicting-per-flow-fragments-and-promotion.md @@ -0,0 +1,188 @@ +--- +# holon-agentic-coder-ref-metadata-0371 +title: "Ledgers stop conflicting: per-flow pending ledger fragments, promoted into the canonical ledgers on main" +status: completed +type: feature +priority: critical +tags: + - flow + - ledger + - merge-conflicts + - holon-agentic-coder + - holon-coherence +created_at: 2026-11-23T06:40:00Z +updated_at: 2026-11-26T04:02:30Z +--- + +## Problem + +Every flow appends rows to the same three files (`holon-knowledge/ledger/{intents,plans,executions}.jsonl`) and to +`holon-knowledge/kb/failure_modes/index.json`. Any two PRs open at the same time therefore conflict as soon as one +merges, even when their code is disjoint. On 2026-11-23 alone, #244, #248 (twice), #250, #251 and the bean 0191 child 3 +branch all went `CONFLICTING`/`DIRTY` against `main` this way: + +- Each conflict forces a merge of `origin/main` into the PR branch, which moves the reviewed head, voids or questions + the approval, re-triggers CI, and (with the PR #250 CI gate) can restart Stage 4. Stage 5 calibration has also + miscounted files merged in this way (bean 0369). +- Ledger-only conflicts are resolved by hand or by `resolve_known.py` interleaving rows by `created_at`. It is + mechanical but costs a subagent run, a push and a CI cycle per PR per merge to `main`. +- `executions.jsonl` is 7,400+ lines and grows with every review iteration, so it collides with every other flow. +- `kb/failure_modes/index.json` is a single JSON object whose closing brace moves on every append, so it always + conflicts too. + +## Goal + +Two concurrent flows never conflict on ledger or KB index files, whatever order their PRs merge in. The three canonical +append-only ledgers on `main` keep their meaning and remain the provenance record. + +## Proposed design (the maintainer's direction: a directory per flow plus promotion) + +1. **Pending fragments on branches.** A flow never writes the canonical `*.jsonl` files. It appends its rows to its own + file, e.g. `holon-knowledge/ledger/pending//.jsonl` (one file per intent, split children + included), so no two flows touch the same path. Row format is unchanged; `LedgerLock` still guards each fragment. +2. **Readers see one ledger.** `ledger/query.py` and every reader (calibration, admission, in-flight, reconcile, touch + set, ...) read canonical rows plus all pending fragments, merged by `created_at` with stable ordering and + de-duplication by row id. No caller reads a `.jsonl` path directly. 2a. **Search covers every pending row, merged or + not (maintainer, 2026-11-23).** Unpromoted rows are useful (what other flows are doing, their failures, their + findings), so `holon ledger` search/query (`cli/commands/ledger.py`, `ledger/query.py`) reads three sources and + labels each row with where it came from: + - `canonical`: the three ledger files on the current branch; + - `pending`: fragments on the current branch (merged flows not yet promoted, plus this flow's own rows); + - `in-flight`: fragments of flows not yet merged, read without a checkout via `git show :` from open PR + head branches and local flow worktrees, discovered the same way `flow/in_flight.py` finds in-flight flows (after a + `git fetch`). A flag (`--in-flight` / `--no-in-flight`) controls this; the source label and the branch name appear + in the output. Rows are de-duplicated by row id (a promoted row wins over its fragment copy). In-flight rows are + unreviewed, so they are for search, admission/overlap checks and the KB/failure-mode lookup only: calibration EV, + outcome and touch-set metrics never count rows that are not on the flow's own branch. +3. **Promotion by CI on every push to `main` (maintainer decision, 2026-11-23: option (a)).** A GitHub Actions workflow + triggered on `push` to `main` runs `holon ledger promote`: it folds every pending fragment into the canonical ledgers + in `created_at` order, deletes the promoted fragment files, and pushes one ledger-only commit to `main` as a bot + identity. Requirements: + - Promotion is idempotent: re-running it on an already promoted tree changes nothing, and a row already in a + canonical ledger is never appended twice. + - The commit touches only `holon-knowledge/ledger/**`; the workflow fails rather than push anything else. + - The workflow does not re-trigger itself (skip when the push is its own promotion commit) and uses a concurrency + group so two pushes to `main` never promote in parallel; a push race is retried after a fetch/rebase of the + ledger-only commit. + - It authenticates with a dedicated bot token or GitHub App that branch protection allows to push to `main`, scoped + to contents write on this repository only. Setting up that token and the protection bypass is a maintainer step, + not something the flow does. + - **Batched, not per merge (maintainer, 2026-11-23).** The workflow runs on every push to `main` but promotes only + when at least `HOLON_LEDGER_PROMOTE_EVERY` merged flows (default 10) have pending fragments on `main`, plus a daily + scheduled run and a manual `workflow_dispatch` so a quiet week still compacts. With per-flow fragments, in-flight + PRs never conflict with each other or with a promotion commit (promotion only appends to the canonical files, which + flows no longer write, and deletes fragments of already merged flows), so batching changes only how often `main` + gets a bot commit, not whether PRs conflict. Fewer promotion commits mean fewer CI runs on `main` and fewer "branch + out of date" updates if branch protection requires up-to-date branches. + - If promotion fails, `main` still works: readers already see pending fragments (point 2), so a failed or delayed + promotion never loses or hides rows. +4. **KB index removed, derived on read.** Nothing in production reads `kb/failure_modes/index.json` (only + `knowledge/wisdom.py::_update_directory_index` writes it; tests assert it exists; docs describe it), and every field + it holds (`kb_id`, `file`, `kb_type`, `status`, `created_ts`, `tags`) is already in the matching + `KB-failure-.json`. Its top-level `updated_ts` changes on every write, so it conflicts on every PR. Remove the + writer, `git rm` the `index.json` files under `kb/` and `wisdom/`, ignore them, and add a `load_index(subfolder)` + that globs the entry files when a lookup is needed (optionally a `holon kb index` command writing an untracked copy). + Update the tests and `docs/knowledgebase_schema.md` / `docs/wisdombase_schema.md`. This part needs no promotion and + can ship first as its own small flow. +5. **Migration.** Existing canonical ledgers stay as they are. In-flight branches that still append to the canonical + files are handled once: promotion/reconcile accepts rows in either place and de-duplicates. + +## Also seen: add/add conflicts on KB entry files (2026-11-23, PR #252) + +Removing `index.json` (Bean 0373) does not remove every KB conflict. Two flows that hit the same failure mode both +create `holon-knowledge/kb/failure_modes/KB-failure-.json` with the same id and content that differs only +in timestamps (`created_ts`, `updated_ts`); merging `main` then reports an add/add conflict per file (16 on PR #252). +`resolve_known.py` only strips `created_ts`, so these still need judgement today. In scope for this bean: either write +KB entries deterministically for a given fingerprint (no wall-clock fields in the file; timestamps live in the ledger +row), or route new KB entries through the same per-flow pending area and let promotion de-duplicate by id. Until then, +teach `resolve_known.py` to settle timestamp-only add/add KB files by keeping the target branch's copy. + +## Decisions + +- **Promotion trigger: (a), a CI job on each push to `main`** (maintainer, 2026-11-23). Rejected: (b) promotion in the + next flow's Stage 1, which leaves fragments on `main` between flows and puts ledger churn into unrelated PRs; (c) no + promotion, which redefines the ledgers as directories. +- **Still to do before the flow runs:** the maintainer creates the bot token / GitHub App and allows it past branch + protection for `main`; rule 14 in `.agents/engineering-rules.md` is reworded to say per-flow pending fragments are the + same three ledgers split by flow (not auxiliary ledgers) and that only the CI promotion job writes the canonical + files. +- **Considered and not enough on its own:** `.gitattributes` `*.jsonl merge=union`. It fixes local merges of append-only + files, but GitHub's server-side mergeability check does not apply custom merge drivers, so PRs would still show + `CONFLICTING`. It may still be added for local merges. + +## Acceptance criteria + +- `holon ledger` search returns canonical, pending and in-flight rows with a source label and branch; an in-flight row + from another open PR appears without checking that branch out, and disappears once its fragment is promoted (shown + once, as `canonical`). Calibration ignores in-flight rows (test with a fixture that has all three sources). +- Two flows started from the same `main`, each writing intent, plan, execution, review and calibration rows, produce PRs + that merge in either order with no conflict on any file under `holon-knowledge/`. +- Every ledger reader returns the same rows, in the same order, before and after promotion. +- The promotion workflow runs on a push to `main`, commits only ledger files, does not re-trigger itself, and a second + run on the same tree is a no-op. +- Promotion is idempotent and loses no row (property test: random fragment sets and promotion orders; the union of rows + is preserved and ordered by `created_at`). +- `kb/failure_modes/index.json` is no longer written by flows; the index is derived from the KB files. +- Calibration and admission produce identical results on a fixture that has rows in both canonical and pending form. +- `resolve_known.py` and the `resolve-conflict` skill no longer need a ledger interleave for new flows (kept only for + legacy branches). +- Applies to both `holon-agentic-coder` and `holon-coherence`. + +## Delivery + +Through the 5-stage Holon flow on `holon-agentic-coder` (then `holon-coherence`), after the maintainer settles the +decisions above. Keep the intent text free of harness paths and bean ids. Update rule 14 in +`.agents/engineering-rules.md` and the `resolve-conflict` skill in the harness to match. Likely overlaps with bean 0369 +(calibration reads the ledger), so run it after 0369 merges or with `--allow-overlap` and a narrow scope. + +## Measured (self-improvement audit 2026-11-24) + +What ledger conflicts cost in the period 2026-11-21 to 2026-11-24 (scripts in the git-ignored +`todo/self-improvement-audit-2026-11-24/`): + +- 57 of 422 pipeline runs were on heads produced by a merge of `main` into the flow branch; the conflict gate merges + only when the pull request is `CONFLICTING` or `DIRTY`, and with append-only canonical ledgers almost every merge of + another pull request makes it so. +- 17 full review iterations (127 minutes) ran because of a conflict with `main` or a merge of `main`; 12 Stage 4 runs + ended "CI signal suppressed: pull request has merge conflicts". +- 12 Stage 3 starts stopped "merging origin/main ... after the admission wait conflicts in holon-knowledge/ledger/" (10 + in `intents.jsonl`, 2 in `executions.jsonl`; Bean 0391). +- One hygiene failure was an invalid ledger after a merge (`jq: parse error`, run 45182713288, PR #263). + +This bean would remove most of these; it is the largest single source of churn after bookkeeping-only pipeline runs +(Bean 0403). + +## Audit evidence, 2026-11-24T12:58Z (self-improvement audit, fifth merge) + +- PR #272 (Bean 0403) was put into conflict three times in 105 minutes (merges of PR #269, #270 and #274); every overlap + with those PRs was `holon-knowledge/ledger/{intents,plans,executions}.jsonl` only. +- PR #275 (Bean 0405) was opened at 12:39:51Z and was `DIRTY` within six minutes, again on the three ledgers only (PR + #274 merged at 12:45:46Z). +- Each conflict cost a halted Stage 4, a hand merge of `origin/main` by an agent and a relaunch, plus up to one full + review iteration on the conflicting head (26 minutes on PR #272). + +## Resolution + +Delivered via [PR #314](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/314) and merged into `main` +(`4e35895`), with its child PRs [#310](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/310) (`ba5e090`), +[#311](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/311) (`0a7f690`), +[#312](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/312) (`153b608`) and +[#313](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/313) (`89ad0fd`) merged into the plan branch +first: + +- **Key Architectural Deliverables**: per-flow pending ledger fragments under + `holon-knowledge/ledger/pending//.jsonl`; every ledger append routed through the ledger + package (#311); a merged reader (`ledger/fragments.py`, `ledger/merged.py`, `ledger/order.py`) used by every + canonical-ledger reader, with canonical rows winning on duplicate ids (#310); `holon ledger promote` with + `HOLON_LEDGER_PROMOTE_EVERY` batching, idempotent and additions-only (#312); `.github/workflows/promote-ledger.yml` on + push to `main`, daily schedule and `workflow_dispatch`, a green no-op until the `HOLON_LEDGER_BOT_TOKEN` secret exists + (#313). +- **Out of scope (separate flows)**: removal of `kb/failure_modes/index.json`, the one-time chronological re-sort of the + canonical ledgers, and the hygiene check on moved ledger rows. +- **Verification & Tests**: unit, CLI and property tests for promotion; a guard test that fails if any append writes a + canonical ledger file; a two-branch test that merges in either order with no conflict under `holon-knowledge/`; a + structural parsed-YAML test for the workflow. +- **Holon Flow Traversal**: all 5 stages (Intent -> Plan -> Execute -> Review Loop -> Calibration) completed for the + parent and each child intent; review iterations were run on each child PR before merge. +- **Still a maintainer step**: the `HOLON_LEDGER_BOT_TOKEN` secret and the branch-protection bypass for `main` are not + yet set, so promotion stays a no-op until they are. diff --git a/.beans/holon-agentic-coder-ref-metadata-0372--approval-survives-main-merge-with-unchanged-pr-diff.md b/.beans/holon-agentic-coder-ref-metadata-0372--approval-survives-main-merge-with-unchanged-pr-diff.md new file mode 100644 index 00000000..09f7ace4 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0372--approval-survives-main-merge-with-unchanged-pr-diff.md @@ -0,0 +1,111 @@ +--- +# holon-agentic-coder-ref-metadata-0372 +title: "An approval survives a merge of main that leaves the PR's own diff unchanged; only CI re-runs" +status: completed +type: feature +priority: critical +tags: + - flow + - stage-4 + - review-loop + - merge-conflicts + - cost + - holon-agentic-coder +created_at: 2026-11-23T06:45:00Z +updated_at: 2026-11-23T09:12:00Z +--- + +## Problem + +Stage 4 (the 3-reviewer ensemble) is the most expensive part of a flow, and it is re-run over and over for code that has +not changed. Every time any PR merges into `main`, every other open PR conflicts on the shared ledgers (see Bean 0371). +Merging `origin/main` in moves the head, and three rules then throw the approval away: + +- `flow/review/conflict_gate.py` (engine): "Ledger-only conflicts are resolved without a test run ... and pushed; the + approval must then be re-earned." +- `pr_review_loop` skill (principle 2) and `FLOW_PR_DRIVER.md`: "Votes count only at the current head. Any push ... + invalidates earlier votes." +- Operator practice (#244 and #248 on 2026-11-23): a fresh 3/3 review after any merge of `main`. + +PR #250 (merged 2026-11-23) already gates Stage 5 on CI of the merged head and withdraws the consensus only when that CI +fails. The review itself is still repeated, though, for merges that added nothing to the PR's own change. + +## Goal + +An approval is bound to the PR's own change, not to a commit SHA. When the head moves only by merges of the target +branch and bookkeeping commits, and the PR's own diff is identical, the approval and its votes carry over to the new +head; only CI must pass on the new head (the existing merged-head gate). A full re-review happens only when the PR's own +diff changed: a hand-resolved code conflict, a resolver or agent code push, or a failed CI on the merged head. + +## Design + +- **PR-own diff fingerprint.** `git diff )> ` excluding `holon-knowledge/**` + (ledgers, KB) and Stage 5 calibration paths, reduced to a stable fingerprint (`git patch-id --stable` or a sorted + per-file blob-hash list). Store it in the approval record and the approval stamp next to the head SHA. +- **Carry-over check.** Wherever an approval or vote is checked against the current head (conflict gate, review loop + vote counting, Stage 5 merged-head gate, `approved_head_of` / `_same_commit`), "same head" becomes "same head, or same + PR-own fingerprint". The carry-over is logged with both SHAs and the fingerprint, and recorded as one append-only + ledger row; no earlier row is edited. +- **Conflict gate.** A target-branch merge whose conflicts were only ledger/KB (resolved mechanically) keeps the + approval when the fingerprint matches; a code conflict still aborts and blocks as today. +- **CI is never skipped.** Carry-over never bypasses CI: the merged-head gate still waits for every check on the new + head and still withdraws the consensus and restarts Stage 4 on a failure. +- **Calibration** evaluates the last code commit (consistent with Bean 0369) and needs no re-run when only a bookkeeping + commit or a fingerprint-preserving merge followed it. + +## Acceptance criteria + +- A PR approved at head A, then merged with `origin/main` (clean or ledger-only conflicts) to head B with the same + PR-own fingerprint: no reviewer is dispatched again; Stage 5 waits for CI on B and proceeds when it passes. +- Same setup but CI fails on B: the consensus is withdrawn and Stage 4 restarts (unchanged behaviour). +- A merge with a hand-resolved code conflict, or any push changing a non-`holon-knowledge` file of the PR's own diff, + changes the fingerprint and requires a fresh review. +- Property test (Hypothesis): random PR changes plus 0-3 merges of a moving `main` with disjoint files; the fingerprint + is invariant across those merges and changes whenever a PR-own file changes. +- The approval stamp names the head, the fingerprint and the CI result at that head. +- All tests pass via `uv run pytest`; `uv run task lint` and `uv run task lint-docs` pass. + +## Harness changes (done with this bean, 2026-11-23) + +`pr_review_loop` SKILL principle 2, `FLOW_PR_DRIVER.md` and the `resolve-conflict` skill now say that a push which is +only a merge of the target branch with mechanically resolved ledger/KB conflicts keeps the votes when the PR's own diff +is unchanged; only CI on the new head must pass. + +## Delivery + +Holon flow on `holon-agentic-coder`, intent `todo/intent-0372-approval-survives-main-merge.json`. Runs before Bean 0371, +since it removes most of the re-review cost immediately. + +## Progress note (holon flow, 2026-11-23) + +- PR #254 (`I-1795416692-approval-survives-main-merge`) is terminal: MERGEABLE/CLEAN on head a1d985dd, all checks green, + calibration report `plans/I-1795416692-approval-survives-main-merge/P-1795418641-CLA-CO5.5_calibration.md` in the PR + diff. Awaiting human merge into main. +- Stages: intent ok, plan ok, execute ok, review completed after 7 iterations (3/3 approval at iteration 4; later rounds + re-earned after each target-branch merge), calibrate completed. +- Stopped and resumed several times: review halt on a nit with no resolver pass; conflict gate re-earned the approval + after merging main (the bean's carry-over was not yet in effect for mechanical ledger merges); Stage 5 blocked once by + the macOS CI Timing Gate (674 s job vs 600 s ceiling, slowdown spread across unrelated tests, not a test failure), + cleared on rerun. +- Conflicts with main resolved mechanically via `resolve-conflict` subagents (ledger rows only) on each target-branch + advance (#251-#256). +- Log: todo/flow-approval-survives-main-merge.log (the runner's own output was largely buffered there). + +## Resolution + +Delivered via [PR #254](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/254) and merged into `main` +(`84b70c1`), subject "feat(approval): Stage 4 review is the most expensive part of a flow and is repeated for code +that... (#254)": + +- **Key Architectural Deliverables**: the PR-own diff fingerprint (merge-base to head, `holon-knowledge/**` and Stage 5 + calibration paths excluded) is stored in the approval record and approval stamp beside the head SHA; the conflict + gate, review-loop vote counting and the Stage 5 merged-head gate accept an approval at a new head when the fingerprint + is unchanged; carry-overs are logged with both SHAs as one append-only ledger row. CI on the new head is never + skipped. +- **Verification & Tests**: PR #254 checks green at head a1d985dd before the merge (per the progress note above). +- **Holon Flow Traversal**: all 5 stages completed (intent, plan, execute, review loop, calibration) after several + resumes; the review loop reached 3/3 approval at iteration 4, with later rounds re-earned after each target-branch + merge. +- **Post-merge cleanup**: flow worktree `flow-approval-survives-main-merge` and all + `I-1795416692-approval-survives-main-merge` branches deleted locally and on origin; no earlier attempts existed. + Bundle backup: `todo/stale-worktree-backups/approval-survives-main-merge-2026-11-23.bundle` (verified). diff --git a/.beans/holon-agentic-coder-ref-metadata-0373--derive-kb-index-instead-of-committing-it.md b/.beans/holon-agentic-coder-ref-metadata-0373--derive-kb-index-instead-of-committing-it.md new file mode 100644 index 00000000..c1a54b3e --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0373--derive-kb-index-instead-of-committing-it.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0373 +title: "Stop committing the KB/WB index.json files; derive the index from the entry files" +status: completed +type: feature +priority: critical +tags: + - knowledge-base + - merge-conflicts + - cost + - holon-agentic-coder +created_at: 2026-11-23T06:45:00Z +updated_at: 2026-11-23T07:33:33Z +--- + +## Problem + +`knowledge/wisdom.py::_update_directory_index` rewrites `holon-knowledge/kb/failure_modes/index.json` (also +`kb/patterns/index.json` and `wisdom/heuristics/index.json`) whenever an entry is added or changes, stamping a new +top-level `updated_ts`. Any two flows that add KB entries both change that line and the closing brackets, so the file +conflicts on nearly every PR, which forces a merge of `main`, a CI cycle and (today) a re-review. + +Nothing in production reads these files: the only references are the writer, tests asserting the file exists, and +`docs/knowledgebase_schema.md` / `docs/wisdombase_schema.md`. Every field an index entry holds (`kb_id`, `file`, +`kb_type`, `status`, `created_ts`, `tags`) is already in the matching `KB-*.json` / `WB-*.json` entry file. + +## Goal + +No flow writes a shared index file. The index is derived from the entry files when needed. + +## Acceptance criteria + +- `_update_directory_index` is removed; writing a KB or WB entry writes only that entry's own file. +- The three tracked `index.json` files are removed from git and ignored. +- A `load_index(subfolder)` helper globs the entry files and returns the same entries the index held, sorted by + `created_ts` then id; tests compare it with the last committed index content. +- Tests that asserted `index.json` exists now assert the derived index; `docs/knowledgebase_schema.md` and + `docs/wisdombase_schema.md` describe the index as derived. +- Two flows that each add KB entries produce PRs that merge in either order with no conflict under + `holon-knowledge/kb/`. +- All tests pass via `uv run pytest`; `uv run task lint` and `uv run task lint-docs` pass. + +## Delivery + +Holon flow on `holon-agentic-coder`, intent `todo/intent-0373-derive-kb-index.json`. Small; split out of Bean 0371. + +## Resolution + +Delivered via [PR #252](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/252) and merged into `main` +(`a1542449`): + +- **Key Architectural Deliverables**: `_update_directory_index` removed; KB/WB writes touch only their own entry file. + The three tracked `index.json` files (`kb/failure_modes`, `kb/patterns`, `wisdom/heuristics`) are deleted from git and + ignored. A `load_index(subfolder)` helper derives the index by globbing entry files, sorted by `created_ts` then id. +- **Verification & Tests**: Tests that asserted `index.json` existence now assert the derived index against the last + committed content; schema docs describe the index as derived. +- **Holon Flow Traversal**: Intent, plan, execute and review completed; calibration report committed under + `plans/I-1795417357-derive-kb-index/`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0374--sidecar-scratch-files-committed-to-execution-branch.md b/.beans/holon-agentic-coder-ref-metadata-0374--sidecar-scratch-files-committed-to-execution-branch.md new file mode 100644 index 00000000..e18bf9b4 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0374--sidecar-scratch-files-committed-to-execution-branch.md @@ -0,0 +1,80 @@ +--- +# holon-agentic-coder-ref-metadata-0374 +title: "Sidecar wire logs and cache land in the target worktree's todo/ and get committed to the execution branch" +status: completed +type: bug +priority: high +tags: + - flow + - sidecar + - stage-3 + - isolation + - holon-agentic-coder +created_at: 2026-11-23T07:05:00Z +updated_at: 2026-11-23T20:58:10Z +pr: https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/266 +--- + +## Problem + +Bean 0191's child 3 execution branch (`…/E-1795415159-CLA-CO5.5/_` at `b676a12b`) tracks 47 scratch files under `todo/` +(`todo/cache/llm_cache.db`, `todo/mitm_wire_logs/*`). `origin/main` has none. A PR from that branch would carry proxy +wire logs (full request/response bodies) and an LLM cache database into the target repository. + +Confirmed cause (2026-11-23), two defects: + +1. **Default sidecar paths sit under the git root's `todo/`.** `launcher/sidecar_plan.py:57` (and the cache branch below + it) defaults the wire-log and cache directories to `/todo/mitm_wire_logs` and `/todo/cache` when + `WIRE_LOG_DIR` / `CACHE_DIR` are unset, using `proxy_paths._find_git_root()` from the current directory. When the + flow is launched from inside the flow worktree (as the bean 0191 resume was), the git root is the target worktree, so + the files are written into it. Every other flow that day was launched from the harness root, whose `todo/` is + git-ignored, and has no such files. The target repository's `.gitignore` does not cover `todo/`, and target code + naming `todo/` breaks the rule that target repositories never reference harness paths. +2. **Stage 3 commits stage untracked files indiscriminately.** The interrupted-run commit (`4278bd02`, "partial work") + and the host's completion commit (`b676a12b`) both added the 47 files; the executor's own cleanup commit (`8c65f5e1`, + "untrack todo/ cache and wire logs") was undone by the later completion commit. + +## Goal + +- Sidecar wire logs and cache never default to a path inside a repository worktree: default to a per-user state + directory outside any worktree (for example under `~/.holon/`), still overridable by `WIRE_LOG_DIR` / `CACHE_DIR`. No + target code names `todo/`. +- Stage 3 partial-work and completion commits never add files outside the executor's change: untracked files that are + not part of the execution (proxy logs, caches, databases) are not staged; a guard fails the commit (or skips the path) + for wire-log/cache directories and for files matching the secret/large-binary rules. +- A test launches the sidecar plan with the current directory inside a temp git worktree and asserts nothing is created + inside it; a test for the completion commit asserts an untracked scratch directory is not committed. + +## Related + +Bean 0191 (blocked by this on child 3; recovery decision pending with the maintainer). Until this lands, always launch +`run_holon_flow.py` from the harness root, never from inside a flow worktree. + +- 2026-11-23: All 5 Holon flow stages completed on + [PR #266](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/266) (`MERGEABLE`, `CLEAN`, 11/11 CI green, + 3/3 ensemble APPROVED, Stage 5 calibration report included in PR diff); awaiting human merge (`status: in-progress`). +- 2026-11-23: Post-#264 `--from-stage calibrate` rerun completed on head `f6f26f35` (covering conflict-gate merge + `c7bbf41e`, Predicted EV `68.51` -> Actual EV `79.55`, `ΔEV +11.04`, calibration included in PR diff); after rerunning + the queue-cancelled `Run Make / build (macos-latest)` job (`run 45196866528`), all `11/11` CI checks passed and PR + #266 is `MERGEABLE` + `CLEAN`, ready for human merge. + +## Resolution + +Delivered via [PR #266](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/266) and merged into `main` +(`e0251206`): + +- **Key Architectural Deliverables**: + - Moved default sidecar wire-log and LLM cache paths out of repository worktrees to per-user state directories under + `~/.holon/` (`launcher/proxy_paths.py`, `launcher/sidecar_plan.py`), preserving `WIRE_LOG_DIR` / `CACHE_DIR` + overrides and removing all `todo/` references from target code/docs (`apps/sandbox-executor/README.md`, + `docs/budgets.md`). + - Hardened Stage 3 partial salvage (`flow/partial_salvage.py`) and executor completion commits + (`entrypoint/execution_workspace.py`, `entrypoint/executor/run.py`, `entrypoint/executor/outcome.py`) to exclude + sidecar scratch/cache/wire-log files using filesystem scanning without extra git commands on clean worktrees. +- **Verification & Tests**: Added hermetic tests in `tests/test_sidecar_scratch_location.py`, + `tests/test_execution_commit_excludes_scratch.py`, `tests/test_partial_salvage.py`, and + `tests/test_launcher_sidecar.py`; all `11/11` CI checks passed on final head `f6f26f35`. +- **Holon Flow Traversal**: All 5 stages completed (`3/3` ensemble APPROVED; post-#264 conflict-gate merge `c7bbf41e` + carried approval over by PR-own fingerprint; Stage 5 calibration report + `plans/I-1795437183-sidecar-scratch-outside-worktree/P-1795440538-ANA-G4A_calibration.md` included in diff with + Predicted EV `68.51` -> Actual EV `79.55`, `ΔEV +11.04`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0375--stage-3-resume-ignores-interrupted-execution-branch.md b/.beans/holon-agentic-coder-ref-metadata-0375--stage-3-resume-ignores-interrupted-execution-branch.md new file mode 100644 index 00000000..c6c68544 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0375--stage-3-resume-ignores-interrupted-execution-branch.md @@ -0,0 +1,78 @@ +--- +# holon-agentic-coder-ref-metadata-0375 +title: "Stage 3 resume ignores an interrupted execution branch that has commits but no ledger row" +status: completed +type: bug +priority: high +tags: + - flow + - stage-3 + - resume + - holon-agentic-coder +created_at: 2026-11-23T07:36:00Z +updated_at: 2026-11-26T13:34:00Z +--- + +## Problem + +When the host process dies during Stage 3 (session restart, 2026-11-23), the execution branch keeps the executor's +commits but has no `executions.jsonl` summary row. On resume the flow cannot continue from that work. Seen three times +in one day: + +- **Bean 0174** (`document-env-variables-v2`): branch `…/E-1795413310-CLA-CO5.5/_` holds steps 1 to 5 (tip `eaaa5b16`) + and an uncommitted change to its tracked evidence file `executions/E-1795413310-CLA-CO5.5.md`. Resume logged "no + failed execution branch carries partial work; starting from the plan tip", then ran + `git checkout -b …/E-1795419188-CLA-CO5.5/_ d254bb21`, which failed: "Your local changes to the following files would + be overwritten by checkout". Stage 3 failed; nothing was salvaged. +- **Bean 0191** child 3: the first resume re-cut a new execution branch from the plan tip and ignored `E-1795406584` + (steps 1 to 4 committed, suite green). The second resume ran a full new execution (`E-1795415159`), but the checkpoint + still named an older execution id, so the flow exited 1 with "no executions.jsonl row" although the executor had + succeeded. + +The partial-work salvage only looks for an execution branch with a _failed_ ledger row; a branch whose host died has no +row at all. + +## Goal + +- Resume detects an execution branch of the current plan that has commits past the plan tip and no summary row, and + adopts it: the executor continues from its tip (with the "partial work" prompt), and uncommitted tracked changes on it + are committed as partial work first, never left to break a checkout. +- The checkpoint's execution branch/id is updated whenever Stage 3 starts or adopts an execution branch, so the + post-execution ledger lookup uses the id the executor actually wrote. +- A dirty worktree never turns into an opaque `git checkout` exit 1: the stage reports which files block it. +- Tests: kill-and-resume fixtures for (a) commits and no row, (b) commits, no row and a dirty tracked file, (c) a second + resume after a new execution id. + +## Related + +Bean 0374 (scratch files committed by the same interrupted runs). Workaround used on 2026-11-23: bean 0191 recovered +manually on the maintainer's instruction; bean 0174 restarted as a fresh `-v3` intent from current `main`. + +## Notes + +- Overlap: Bean 0397 (resume adopts a completed, pushed execution branch) is the same resume lookup for the complete + case. This bean owns the shared branch-adoption code. + +## Flow + +2026-11-26: flow `resume-adopts-unrecorded-branch` (claude-agent, claude-opus-5-5) started; log +`todo/flow-resume-adopts-unrecorded-branch.log`. + +2026-11-26: PR #345 approved by the 3-reviewer ensemble (iteration 2), calibrated, `MERGEABLE`/`CLEAN`; awaiting the +maintainer merge. + +## Resolution + +Delivered via [PR #345](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/345) and merged into `main` +(`1567b6b`): + +- **Key Architectural Deliverables**: new `flow/unrecorded_branch_adoption.py` detects an execution branch of the + current plan with commits past the plan tip and no `executions.jsonl` row and adopts it on Stage 3 resume; + `flow/partial_head.py` and `flow/partial_salvage.py` commit uncommitted tracked changes as labelled partial work + first; `flow/stages/execute.py` calls the new detection and updates the checkpoint's execution branch and id to the + adopted branch; a checkout blocked by a dirty worktree reports the blocking file names. +- **Verification & Tests**: `tests/flow/stages/test_execute_resume_unrecorded_branch.py` (commits without row; commits + without row plus dirty tracked file; second resume after a new execution id) and `tests/test_partial_salvage.py`. Rows + with a success or failure summary keep their existing behaviour. +- **Holon Flow Traversal**: flow `resume-adopts-unrecorded-branch` (claude-agent, claude-opus-5-5) ran through plan, + execute, review (ensemble approval at iteration 2) and calibration before the maintainer merge. diff --git a/.beans/holon-agentic-coder-ref-metadata-0376--flow-resolves-file-conflicts-at-every-stage.md b/.beans/holon-agentic-coder-ref-metadata-0376--flow-resolves-file-conflicts-at-every-stage.md new file mode 100644 index 00000000..849742f0 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0376--flow-resolves-file-conflicts-at-every-stage.md @@ -0,0 +1,200 @@ +--- +# holon-agentic-coder-ref-metadata-0376 +title: "The flow resolves file conflicts itself at every stage: an in-flow conflict resolver" +status: completed +type: feature +priority: critical +tags: + - flow + - merge-conflicts + - resolver + - cost + - holon-agentic-coder +created_at: 2026-11-23T08:40:00Z +updated_at: 2026-11-25T02:27:00Z +--- + +## Problem + +When a flow branch conflicts with its target branch, the flow engine resolves only ledger files. Any other conflicting +file stops the stage, and the conflict is then fixed outside the flow (the `resolve-conflict` skill in a harness +subagent, or by hand). On 2026-11-23 every code conflict was handled that way: PR #248 (twice), bean 0191 child 3, PR +#253 (`flow/stages/calibrate.py`), PR #251, PR #252 (16 KB entry files). + +What each stage does today (`flow/stage_conflicts.py`, `flow/stage_conflict_resolution.py`, +`flow/review/conflict_gate.py`, `flow/stages/sync_conflict.py`): + +| Where | Ledger conflict | Any other file | +| :--------------------------------------------------- | :----------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | +| Before a stage (`check_and_resolve_stage_conflicts`) | append-merged automatically | raises `ConflictResolutionError`; the stage fails (bean 0191 at Stage 3 `prepare_workspace`, bean 0369 at Stage 4 entry) | +| End of Stage 3 | — | records a `sync_conflict` row and reports success ("a resolver or the maintainer must resolve it"); no resolver runs, Stage 4 then fails | +| Stage 4 conflict gate | merges the target and pushes; approval re-earned | aborts the merge and blocks | +| Stage 5 | — | refuses to calibrate; PR #248 was refused for ledger and KB index conflicts reported as "code conflicts" | + +The handling differs per stage (raise, record a row, abort, refuse), none of it resolves a code conflict, and each halt +costs a harness subagent, a manual resume and often a repeated review. + +## Goal + +At any stage of the flow, a file conflict with the target branch is taken care of inside the flow: the engine merges the +target branch, resolves the conflicts, proves the result with lint and tests, and continues. A stage fails on a conflict +only when the resolver cannot produce a passing tree, and then it says exactly which files and why. + +## Design + +1. **One conflict routine for every stage.** Replace the per-stage variants with a single + `sync_with_target(context, stage)` used before Stages 2 to 5, at the end of Stage 3, at the Stage 4 conflict gate and + before Stage 5: fetch, merge the target branch with a normal merge commit (never a rebase or force-push), classify + conflicts, resolve, verify, commit, push. 1a. **Check at the most granular place (maintainer, 2026-11-23): at the + start, at every turn, and at the end.** The check itself is cheap and needs no agent (`git fetch` plus a + `git merge-tree` probe against the target tip, keyed on the target SHA so an unchanged target costs nothing), so it + runs at every boundary the engine controls: + - **start of the flow** and **start of every stage** (Stages 1 to 5); + - **every turn inside a stage**: each executor turn/step boundary in Stage 3, each planner turn in Stage 2 where + there are several, each review iteration in Stage 4 (before the reviewers are dispatched and again before the + consensus is posted), each resolver turn, and each calibration retry in Stage 5; + - **end of every stage** before it pushes, and **end of the flow** (5a below). A conflict found at any of these + points is resolved there by `sync_with_target`, while it is still small, instead of surfacing stages later. Inside + a stage the merge happens only at a turn boundary, never while a role container is writing the worktree; the next + turn's agent is told what the merge changed. **When the target is merged in (maintainer, 2026-11-23):** only when + there is a conflict to resolve, or when a stage is about to start, end, push or calibrate. At a turn boundary + inside a stage, a target that is unchanged, or changed without conflict, is not merged (no head move, no CI run, no + lost approval); the merge waits for the next stage start or end. +2. **Mechanical classes, no agent** (extend `classify_conflicts`): + - ledgers: append-merge (as today); + - KB/WB entry files that differ only in timestamps (add/add): keep the target branch's copy; + - files deleted on the target and only touched mechanically on the branch (for example a removed generated index): + keep the deletion; + - lists both sides appended to (lazy-export maps, `__all__`, changelog-style files): union, keeping order rules. +3. **Conflict resolver role for code conflicts.** A containerised resolver agent (same runner, agent and model ladder as + the Stage 4 resolver) receives the conflicted files, both sides' diffs since the merge-base, and the intent and plan + of this flow. It resolves each file, runs `uv run task lint` and the affected tests, then the full suite, and commits + the merge. It may not change files outside the conflict set except tests whose setup the merge invalidated, may not + touch the frozen module budgets (an over-budget file is split, as elsewhere), and has a bounded number of attempts. + **Model ladder: lowest tier first, escalate on evidence, block last (maintainer question, 2026-11-23).** Resolve + rather than raise or block. The order is: mechanical rules (no model) → resolver on the lowest tier → the same + conflict one tier up when lint or tests fail, or when the resolver reports it cannot decide → fail the stage (block) + only when the top tier is exhausted. The gate is the test suite, lint and the scoped re-review, not the model's + confidence, so a cheap model is safe to try first. Evidence from 2026-11-23: the lowest tier settled every ledger and + KB conflict and correctly escalated the code conflicts; its one attempted code merge (bean 0369, `calibrate.py`) + broke a test, and one tier up produced a green tree (5948 passed). Each attempt and its tier are recorded in the + ledger row. +4. **Approval and calibration after a resolved conflict.** + - Mechanical-only merge: the approval carries over when the PR's own diff fingerprint is unchanged (Bean 0372); only + CI on the new head must pass (PR #250's merged-head gate). + - Agent-resolved code conflict: the fingerprint changes, so Stage 4 re-reviews, scoped to the resolved files and the + tests the resolver changed, not the whole PR. + - Stage 5 calibrates after a clean merge instead of refusing; the report's diff base and evaluated SHA follow + Bean 0369. +5. **Ledger and provenance.** Each sync appends one row to `executions.jsonl` (stage, target SHA, conflicted paths, + class per path, how resolved, resolver attempt count, test result). `sync_conflict` rows are superseded by a later + resolved row (as Bean 0369 treats them). 5a. **End of the flow: a conflicting PR reruns the flow (maintainer, + 2026-11-23).** The pipeline's last step checks the PR against the target branch. If it is `CONFLICTING`/`DIRTY` (the + target moved while Stage 4 or 5 ran), the flow does not finish at the merge boundary: it runs `sync_with_target` and + re-enters Stage 4 and Stage 5 for the merged head (CI on the new head; review only if the PR's own diff changed; + calibration redone), and repeats until the PR is mergeable and clean. "Completed successfully" is never printed for a + conflicting PR (seen on PR #252 and PR #248). Until this lands, the harness `holon-flow` skill does the same from + outside (Step 4.3). 5b. **A merged PR ends the flow.** At every boundary where the engine probes the target it also + checks the pull request's state. Once the PR is merged (or closed) the flow stops: no further review iteration, + calibration or push to the merged branch. Seen on PR #248 (five more review iterations and a fix commit pushed after + the merge) and PR #258 (the rerun was still waiting on CI when auto-merge landed). +6. **Resume.** A resume that finds a merge in progress in the flow worktree adopts it (verifies, completes or aborts and + redoes) rather than failing on a dirty tree (related: Bean 0375). +7. **Fail closed, clearly.** If the resolver exhausts its attempts or the suite stays red, the stage fails with the + conflicted paths, the failing tests and the resolver's last diff saved in the worktree; nothing is pushed. + +## Acceptance criteria + +- The conflict probe runs at flow start, at the start and end of every stage, at every turn boundary listed in 1a and at + the end of the flow; a test per boundary injects a conflicting target change just before it and asserts the conflict + is detected and resolved at that boundary, not later. With an unchanged target the probe makes no merge and no push. + +- For each of Stages 2, 3, 4 and 5: a fixture where the target branch gains a conflicting change to a code file the flow + also changed; the flow resolves it through the resolver role, tests pass, and the stage completes without a human or + an outside agent. +- Mechanical classes (ledgers, timestamp-only KB entries, delete-vs-touch, both-appended lists) resolve with no agent + call; a test per class. +- After a mechanical-only merge no reviewer is dispatched again; after an agent-resolved conflict only the resolved + files are re-reviewed. +- Stage 5 no longer refuses for conflicts the routine can resolve; a ledger-only conflict never produces the message + "code conflicts". +- A resolver that cannot reach a green tree fails the stage with paths, failing tests and saved diff; nothing is pushed; + the checkpoint allows `--from-stage` resume. +- Every sync is recorded as one append-only ledger row; no earlier row is edited. +- Never rebases or force-pushes a flow branch; never edits the module budget file. +- All tests pass via `uv run pytest`; `uv run task lint` and `uv run task lint-docs` pass. + +## Related and ordering + +- Builds on Bean 0372 (approval survives a merge of main; PR #254) and Bean 0369 (calibration diff base; merged as PR + #253): run after #254 merges. +- Bean 0371 (per-flow ledger fragments) and Bean 0373 (KB index, merged) reduce how often conflicts occur; this bean + handles the ones that remain. +- Beans 0374 and 0375 (interrupted-run defects) share the resume path. +- Large: likely a split flow (shared routine and mechanical classes; resolver role; per-stage wiring and scoped + re-review). Once it lands, the harness `resolve-conflict` skill is needed only for hand-authored harness branches. + +## Progress note (2026-11-23, flow run) + +- Run: `holon flow` via run_holon_flow.py, intent `resolve-conflicts-in-flow`, claude-agent / claude-opus-5-5, split + into 5 sequential sub-intents. Log: todo/flow-resolve-conflicts-in-flow.log. +- Sub-intent 1 `add-the-shared-sync-with-target`: PR #259, merged by the maintainer (2026-11-23T10:56Z). +- Sub-intent 2 `add-a-containerised-conflict`: PR #262, merged by the maintainer (2026-11-23T12:14Z). +- Sub-intent 3 `wire-sync-with-target-into-flow`: failed at Stage 2 (plan). The planner container raised + ConflictResolutionError: unresolvable code conflict in apps/sandbox-executor/src/sandbox_executor/flow/**init**.py + (also ledger conflicts in executions, intents and plans jsonl). Main moved with PR #260 (merged 2026-11-23T12:26Z) and + PR #261. The flow worktree is clean with no merge in progress. Sub-intents 4 and 5 not run. +- Terminal state: BLOCKED. Needs a higher-tier resolve-conflict subagent to merge origin/main into the sub-intent 3 + branch (flow/**init**.py needs a decision; ledgers are mechanical), then a rerun. Rerun uses --model claude-fable-5-2 + and HOLON_TURN_STALL_SECONDS=600. +- 2026-11-24: Sub-intent 3 (PR #265) merged into parent plan branch + `I-1795425253-resolve-conflicts-in-flow/P-1795425271-CLA-CO5.5/_` (`1b8894c0`); unblocks sub-intents 4 and 5 (queued + for the next free flow slot). + +## Measured (self-improvement audit 2026-11-24) + +The order matters as well as the resolution: in the period 2026-11-21 to 2026-11-24, 4 review iterations ended with all +three reviewers APPROVED (0/0/0) and still blocked, because the pull request was `DIRTY`; the conflict was found only +after the reviewers had run, and each was followed by a merge and another full iteration (median 6.7 minutes). Design +point 1a (probe before the reviewers are dispatched) would remove them. Also wanted: when the container's ensemble +verdict differs from the reviewers' verdicts, the log names the reason (today it says only "reviewer container reported +ensemble verdict CHANGES_REQUESTED"). Merge-resolution defects reviewers had to catch: 4 findings (a dependency listed +twice after the merge, a 162-character line left by a resolution); the in-flow resolver should run the lint gate of Bean +0408 on its result. + +## Audit evidence, 2026-11-24T12:58Z (self-improvement audit, fifth merge) + +- The review loop already probes mergeability at the start of every iteration (`flow/review/loop.py`, step "1. + Mergeability inspection", `is_dirty`) but dispatches the reviewer ensemble anyway; a conflict ends the stage only + after the reviewers return. PR #273 (sub-intent 4 of this bean, `sync_iteration_mergeability` in + `flow/review/sync_points.py`) replaces exactly this step. +- Cost in this period: PR #272 went `DIRTY` when PR #270 merged (11:31:45Z) and iteration 2 still ran its 26.1 minute + ensemble (11:47:34Z to 12:13:42Z) before the `CI SIGNAL SUPPRESSED` halt; it went `DIRTY` again with PR #274 + (12:45:46Z), and PR #275 (`DIRTY` from the same merge) started iteration 2 at 12:53:13Z on a conflicting head. In each + case the conflict was in the three ledger files only, and an agent merged `origin/main` by hand between the halt and + the resume (`bc4f11ac` at 12:14:07Z on PR #272). +- Ranking: PR #273 is the hub of the current waits. Its merge unblocks Bean 0399 (refused since 11:42:16Z on #273) and + the flows of Beans 0197 and 0216 (blocked since 04:31Z and 04:27Z), and it removes the DIRTY-review churn above. + +- 2026-11-24: All 5 sub-intents (`#259`, `#262`, `#265`, `#273`, `#279`) merged into parent plan branch + `I-1795425253-resolve-conflicts-in-flow/P-1795425271-CLA-CO5.5/_`, and parent + [PR #283](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/283) (head `077c9bd2`) completed Stage 4 + consensus review (`3/3` APPROVED at iteration 5) and Stage 5 calibration with `11/11` CI checks `SUCCESS`, `MERGEABLE` + / `CLEAN`. Ready for maintainer merge. + +## Resolution + +Delivered via [PR #283](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/283) and merged into `main` +(`ce2c4c7a`, merged `2026-11-25T02:25:48Z`): + +- **Key Architectural Deliverables**: Delivered across 5 sequential sub-intents (`#259`, `#262`, `#265`, `#273`, + `#279`): unified `sync_with_target` (`flow/target_sync.py`, `target_sync_hooks.py`, `target_sync_merge.py`, + `target_probe.py`), mechanical conflict classes (`flow/conflict_classes*.py` for ledgers, timestamp-only KB/WB + entries, delete-vs-touch, and ordered list unions), containerised `conflict-resolver` role + (`flow/conflict_resolver_*.py`, `entrypoint/conflict_resolver*.py`) with lowest-tier-first escalation, + per-stage/turn-boundary and Stage 4/5 routing (`flow/review/sync_points.py`, `flow/calibrate_target_sync.py`, + `flow/stages/calibrate.py`), and end-of-flow re-entry sync (`flow/end_of_flow_sync.py`). +- **Verification & Tests**: Hermetic unit and integration test suites added across all conflict classes, sync hooks, + review sync points, calibration target sync, and end-of-flow sync; `11/11` CI checks passed on head `077c9bd2`. +- **Holon Flow Traversal**: All 5 stages (Intent -> Plan -> Execute -> Review Loop `3/3` APPROVED at iteration 5 -> + Calibration) completed cleanly across all 5 sub-intents and the parent PR `#283`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0377--rename-fuzz-tests-make-secrets-reproducible-fix-flake.md b/.beans/holon-agentic-coder-ref-metadata-0377--rename-fuzz-tests-make-secrets-reproducible-fix-flake.md new file mode 100644 index 00000000..40e7e762 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0377--rename-fuzz-tests-make-secrets-reproducible-fix-flake.md @@ -0,0 +1,111 @@ +--- +# holon-agentic-coder-ref-metadata-0377 +title: "Rename the *_fuzz tests after what they protect, make their random secrets reproducible, fix the flaky case" +status: completed +type: bug +priority: high +tags: + - tests + - flaky + - security + - redaction + - holon-agentic-coder +created_at: 2026-11-23T08:45:00Z +updated_at: 2026-11-23T11:40:00Z +--- + +## Problem + +`apps/sandbox-executor/tests/test_url_message_fuzz.py` (906 lines, added by PR #96 on 2026-10-24) fails intermittently +and has blocked unrelated pull requests three times in one day (2026-11-23): PR #244 (stress run), PR #247 (unit) and PR +#254 (`unit (macos-latest)`). The earlier failures were in +`test_invalid_envelope_value_never_echoed_by_doctor_or_run_path` (about 2 of 2,480 cases, `HOLON_TURN_TIMEOUT_SECONDS`). +On PR #254 the failed log shows the file's tests at about twice their usual duration (for example 29.8 s against 15.0 +s); which assertion failed there is not yet confirmed. + +Two defects in the tests themselves: + +1. **The names say nothing about the code under test** (maintainer, 2026-11-23). `test_url_message_fuzz.py` checks that + no message built from a URL-valued setting (proxy URL, local model base URL, gateway URL) echoes any 4-character + fragment of the credential in it, across every entry point (warnings, errors, exception text, log lines, + `holon doctor` text and `--json`, the gateway probe, Docker argv and env files). "fuzz" names the technique, loosely: + it is a fixed shape matrix (5 prefixes x 6 host forms x 3 suffixes x credential shapes), not a Hypothesis property + test. Its sibling `test_config_fuzz.py` (malformed `models.json` and settings never crash `holon doctor` or the run + path) has the same naming problem. +2. **The secrets are random and unseeded.** Both files build credentials with `secrets.choice` on every run + (`test_url_message_fuzz.py:60,65`, `test_config_fuzz.py:41`), so a failing case cannot be reproduced: no seed is + printed, and failure messages deliberately name only the case id. A random credential can collide with ordinary + output or a temp path; the module docstring already masks two such collisions (the `mkstemp` env-file path and the + `mkdtemp` pi-agent dir), which suggests a third is still unmasked. + +## Goal + +1. **Names state the subject.** Rename the files and their test functions after what they protect, for example + `test_url_credential_redaction.py` and `test_malformed_config_never_crashes.py`, and update every reference (CI + configuration, timing baselines, slow-test lists, docs). No test is dropped or weakened. +2. **Reproducible inputs.** Credentials come from a seeded generator: a fixed default seed in CI, overridable by an + environment variable for exploratory runs, and the seed and the failing case id are printed on failure. A stress mode + can still vary the seed across runs. +3. **Find and fix the flaky case.** Reproduce the intermittent failure with a seed sweep (the stress job), identify the + collision or timing dependency (`HOLON_TURN_TIMEOUT_SECONDS` in the envelope cases, or a wall-clock limit on a slow + macOS runner), and fix the cause: mask the colliding text, change the credential alphabet, or remove the timing + dependence. Do not fix it by retrying or loosening the 4-character leak check. +4. **A flaky test is not a red PR.** If the failure on PR #254 is a duration threshold, the timing comparison reports a + finding without failing the unit job, or uses a tolerance suited to the macOS runners. + +## Acceptance criteria + +- The two files and their tests are renamed; a repository search finds no `_fuzz` test name left, and CI and timing + baselines use the new names. +- Running the suite twice with the same seed produces the same credentials; a failure prints the seed and case id. +- A seed sweep of at least 200 runs of the renamed URL-redaction test passes on Ubuntu and macOS. +- The root cause of the intermittent failure is stated in the PR with the seed that reproduces it before the fix. +- All tests pass via `uv run pytest`; `uv run task lint` and `uv run task lint-docs` pass. + +## Touch set + +`apps/sandbox-executor/tests/test_url_message_fuzz.py`, `apps/sandbox-executor/tests/test_config_fuzz.py` (both +renamed), a shared seeded-secret helper in the tests. A search of the repository (outside the ledgers, plans and +execution records) found no other file naming them, so the rename should need no CI or baseline edits; the flow confirms +this. + +## Related + +Noted as "not yet a bean" in the 2026-11-23 queue notes. Blocks nothing, but it keeps failing unrelated PRs; with the +merged-head CI gate (PR #250) a flaky failure on a merged head withdraws an approval and restarts Stage 4. + +## Resolution + +Delivered via [PR #261](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/261) and merged into `main` +(`7ab455c`): + +- **Root cause of the flaky case**: in the forwarded invalid-value cases (`HOLON_TURN_TIMEOUT_SECONDS`, + `HOLON_STAGE_BUDGET_SECONDS`) the run creates the pi-agent session dir with + `tempfile.mkdtemp(prefix="holon-pi-agent-")`. Its 8 random characters (and the per-run `pytest-` path) are mounted + and echoed; when 4 of them equal a 4-character run of the case's random credential, the leak check reports a false + leak twice for one case. The #244 mask over the whole pi-agent path had been hiding this. Product code does not leak. +- **Reproducing seed (before the fix)**: `CREDENTIAL_TEST_SEED=211`, case + `env:HOLON_TURN_TIMEOUT_SECONDS/socks5/user-password/digits6-colon/ipv4/path` (fragment `jvzq` in + `holon-pi-agent-w6tcjvzq`); seed 227 is a second reproducer (`gvzj`). +- **Key Architectural Deliverables**: `test_url_message_fuzz.py` renamed to `test_url_credential_redaction.py` and + `test_config_fuzz.py` to `test_malformed_config_never_crashes.py`, with the matching test-function renames; all 79 + baseline tests kept (one regression test added, 80); every credential and fallback temp name drawn from the new + `tests/seeded_secrets.py` (default seed 0, `CREDENTIAL_TEST_SEED=` to reproduce, `random` for stress); failure + messages print the seed and case ids. No retry, rerun or loosened 4-character check. +- **Verification & Tests**: seed sweep 1000..1199 (200 of 200 passed); deterministic test for the HOME-prefix sharing + case; `ruff` checks pass. +- **Holon Flow Traversal**: intent, plan, execute, review loop and calibration completed (execution record + `E-1795425615-CLA-CO5.5`). + +## Progress + +- 2026-11-23: flow `name-and-seed-redaction-tests` merged as PR #261 (merged by the maintainer, 11:36 UTC). Stages on + claude-agent/claude-opus-5-5: intent ok, plan ok, execute ok (102.7 min), review approved (iteration 1 nit + FIND-R1-001-01, PR body lacked root cause and seed), calibrate ok; final head CI green. +- Root cause: the forwarded invalid-value cases create a `holon-pi-agent-` dir under the isolated HOME; when 4 + characters of its random name match a 4-character run of the case credential, the leak check reports a false leak. +- Reproducing seed: `CREDENTIAL_TEST_SEED=211` (case + `env:HOLON_TURN_TIMEOUT_SECONDS/socks5/user-password/digits6-colon/ipv4/path`, fragment `jvzq`); seed 227 is a second + one. Sweep: seeds 1000..1199, 200 of 200 passed. +- Gap: the PR body does not state the root cause or the seed the intent requires; they are only in + `executions/E-1795425615-CLA-CO5.5.md`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0378--stale-calibration-warning-wrong-after-mechanical-merge.md b/.beans/holon-agentic-coder-ref-metadata-0378--stale-calibration-warning-wrong-after-mechanical-merge.md new file mode 100644 index 00000000..8b8dc166 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0378--stale-calibration-warning-wrong-after-mechanical-merge.md @@ -0,0 +1,88 @@ +--- +# holon-agentic-coder-ref-metadata-0378 +title: "Stale-calibration warning fires on a mechanical merge of main and is not cleared when the fresh report lands" +status: completed +type: bug +priority: high +tags: + - flow + - stage-5 + - calibration + - pr-comments + - holon-agentic-coder +created_at: 2026-11-23T09:25:00Z +updated_at: 2026-11-23T14:57:40Z +--- + +## Problem + +PR #258 (2026-11-23) carried this comment up to and after its merge: + +> ⚠️ Calibration report is stale. The calibration report covers `aad504e` but the pull request head is `a4afb30` (2 +> non-calibration commit(s) landed after the evaluated commit). Stage 5 must rerun; do not merge on this report. + +Nothing but a ledger-only merge of `main`, review ledger rows and a regenerated calibration report had been added (the +PR's own diff patch-id was identical before and after the merge: `25983f3d…`). Timeline (UTC): + +- 09:10:12 `a4afb308` merge of `origin/main` (ledger-only conflict, resolved mechanically); +- 09:18:09 the warning is posted by the rerun's Stage 5, naming the old report (`aad504e`) and head `a4afb30`; +- 09:18:13 `3d95f13b` review ledger rows (before Stage 5); 09:18:34 `2f0c0321` fresh calibration report (evaluated + `3d95f13b`); +- the PR merged (maintainer's auto-merge) with the comment still saying "stale … do not merge". + +Confirmed causes: + +1. **A merge of the target counts as a head move.** `flow/calibrate_rerun.py::head_move_since_calibration` treats "any + merge commit or non-calibration commit" after the evaluated SHA as a move. The two "non-calibration commits" were the + merge commit and `main`'s own squash commit reachable through it. It does not use the PR-own diff fingerprint that PR + #254 introduced for approvals, so a merge that changes nothing of the PR still marks the report stale. Review + ledger-row commits (`chore(review): record review ledger rows`) are not discounted either (`is_calibration_commit` + only knows Stage 5's own commits). +2. **The warning is posted by the same run that is about to regenerate the report**, 25 seconds before the fresh report + is committed, so it is noise at best. +3. **The comment is not edited to "superseded" when the fresh report is pushed.** `flow/calibrate_stale_warning.py` + promises one comment that is edited to superseded once a report covers the head; on PR #258 that edit had not + happened when the PR merged (the flow was still in its final CI wait), so the last word on the PR was "do not merge". +4. **Nothing ties the warning to mergeability.** The text says "do not merge", but the PR was `MERGEABLE` and auto-merge + merged it. + +## Goal + +- Staleness is judged on the PR's own change: a head that differs from the evaluated SHA only by merges of the target + that leave the PR-own fingerprint unchanged, review/ledger-only commits and calibration commits is **not** stale. +- A run that is about to redo Stage 5 does not post the stale warning for the report it is replacing. +- When a fresh report covering the head is pushed, the existing warning is edited to superseded immediately (before the + final CI wait), naming the new evaluated SHA; a flow resuming on an already-covered head clears a leftover warning. +- The comment's text matches what the flow will do: if the report is genuinely stale, the flow reruns Stage 5 itself + (end-of-flow rule, Bean 0376) rather than telling a human not to merge. +- Tests: mechanical merge after calibration (no warning); code push after calibration (warning); warning then fresh + report (edited to superseded before CI wait); Stage 5 rerun (no warning posted for the replaced report). + +## Touch set + +`apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py`, +`apps/sandbox-executor/src/sandbox_executor/flow/calibrate_stale_warning.py`, +`apps/sandbox-executor/src/sandbox_executor/calibration_evaluated_sha.py`, +`apps/sandbox-executor/src/sandbox_executor/flow/review/approval_fingerprint.py` (reuse), their tests +(`tests/test_calibrate_rerun.py` and the stale-warning tests). + +## Related + +Bean 0362 / PR #247 (the warning never cleared: first fix), Bean 0372 / PR #254 (PR-own fingerprint), Bean 0369 / PR +#253 (evaluated SHA), Bean 0376 (end-of-flow rerun; also where "the flow stops when its PR is merged" is recorded). + +## Progress + +- 2026-11-23: PR #263 (`I-1795432203-stale-calibration-warning-fix/P-1795432220-CLA-CF5.2/E-1795433754-CLA-CF5.2/_`, + head `f61ce141`) completed all 5 stages via `cf3b215e-a4cb-41c3-968e-578b183a495f` (`3/3` consensus approved, Stage 5 + calibration included, `11/11` CI checks passed, `MERGEABLE` + `CLEAN`), awaiting human merge. + +## Resolution + +- Delivered via [PR #263](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/263) and merged into `main` + (`e563254e`). +- Key deliverables: PR-own diff fingerprint for staleness checks (`calibrate_rerun.py`), suppressing stale warnings when + Stage 5 is regenerating, editing any existing warning comment to superseded before the final CI wait + (`calibrate_stale_warning.py`), and hermetic tests. +- Verification & Holon Flow traversal: 3/3 consensus approval, 11/11 CI checks green on calibrated head `84c7bb58`, + Stage 5 calibration included. diff --git a/.beans/holon-agentic-coder-ref-metadata-0379--no-logic-in-init-py-package-files-only-expose-names.md b/.beans/holon-agentic-coder-ref-metadata-0379--no-logic-in-init-py-package-files-only-expose-names.md new file mode 100644 index 00000000..024ddb9b --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0379--no-logic-in-init-py-package-files-only-expose-names.md @@ -0,0 +1,64 @@ +--- +# holon-agentic-coder-ref-metadata-0379 +title: "No logic in __init__.py: package files only expose public names" +status: todo +type: task +priority: high +tags: + - refactor + - architecture + - hygiene + - holon-agentic-coder +created_at: 2026-11-23T09:30:00Z +updated_at: 2026-11-23T09:30:00Z +--- + +## Rule (maintainer, 2026-11-23) + +An `__init__.py` is used only to expose a package's public functions and variables. It holds no logic: no function or +class definitions, no constants that are not re-exports, no code that runs work at import time. + +## Problem + +Four of the ten package `__init__.py` files in `apps/sandbox-executor/src/sandbox_executor` (`main` at `84b70c1a`) hold +logic: + +| File | Lines | What is defined there | +| :-------------------------------- | ----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cli/__init__.py` | 690 | 14 definitions: `_CurrentStderrHandler`, `configure_cli_logging`, `run_doctor`, `report_budgets_and_envelope`, `_report_budgets`, `_report_gateways`, `resolve_runner_and_model`, `flow_dispatches_agent`, `preflight_gate`, `_configuration_section`, `build_parser`, `resolve_layered_configuration`, `main`, plus constants and mid-file imports under `# noqa: E402` | +| `entrypoint/executor/__init__.py` | 161 | `main()` and four module-level assignments | +| `cli/commands/__init__.py` | 21 | `discover()` (command module discovery) | +| `flow/__init__.py` | 411 | the lazy-export machinery (`__getattr__`, `__dir__`) and a very long `__all__`; it went over its frozen module budget during the bean 0191 merge | + +Costs: importing the package runs or defines application logic (slow imports, import cycles hidden behind mid-file +imports); the CLI entry point and `holon doctor` live in a file nobody looks for them in; tests patch names on the +package object; and these files are merge-conflict hotspots because every feature adds a line to them. + +The other six (`knowledge`, `launcher`, `ledger`, `flow/stages`, `flow/review`, `flow/github`) only import and +re-export, or are empty. + +## Goal + +1. Move every definition out of the four files into named modules of the same package, for example + `cli/logging_setup.py` (`configure_cli_logging`), `cli/doctor.py` (`run_doctor` and its report helpers), + `cli/runner_resolution.py`, `cli/preflight_gate.py`, `cli/parser.py` (`build_parser`), `cli/main.py` (`main`, + `resolve_layered_configuration`), `entrypoint/executor/main.py`, `cli/commands/discovery.py`. Move only; no behaviour + change. +2. Each `__init__.py` then holds a docstring, imports of the public names and `__all__`, nothing else. Console script + entry points in `pyproject.toml` point at the new modules (`sandbox_executor.cli.main:main`). +3. `flow/__init__.py`: the lazy-export map already lives in `flow/lazy_exports*.py`; reduce the file to the re-export + surface. Decision for the maintainer: a module-level `__getattr__`/`__dir__` pair that only forwards to that map is + an exposing mechanism, not logic, and may stay; if "no logic" is meant strictly, replace it with explicit imports + (which costs import time and risks cycles) or have callers import from the submodules. +4. **Enforce it.** A hygiene test parses every `__init__.py` with `ast` and fails on anything other than a docstring, + `import`/`from … import`, an `__all__` assignment and (if the maintainer allows it) the forwarding + `__getattr__`/`__dir__`. No `# noqa: E402` mid-file imports remain in these files. +5. Tests that patch `sandbox_executor.cli.` are updated to patch the defining module. + +## Notes + +- `cli/__init__.py` (690 lines) is not checked by the module budget at all: `holon-config/hygiene/module_budgets.json` + lists only the `flow/` package. `flow/__init__.py` is covered and carries a grandfathered override of 562 lines. +- Large, mechanical, and touches the CLI entry points: run it on its own, not beside flows that edit `cli/` or + `flow/__init__.py`, and likely as a split flow (cli, entrypoint/executor + cli/commands, flow, enforcement test). +- The intent JSON must not mention bean ids or harness paths. diff --git a/.beans/holon-agentic-coder-ref-metadata-0380--enforce-module-budget-on-every-package.md b/.beans/holon-agentic-coder-ref-metadata-0380--enforce-module-budget-on-every-package.md new file mode 100644 index 00000000..e0ae016b --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0380--enforce-module-budget-on-every-package.md @@ -0,0 +1,132 @@ +--- +# holon-agentic-coder-ref-metadata-0380 +title: "Enforce the module line budget on every package, including new ones, not just flow/" +status: completed +type: task +priority: high +tags: + - hygiene + - module-budget + - architecture + - holon-agentic-coder + - holon-coherence +created_at: 2026-11-23T09:35:00Z +updated_at: 2026-11-26T07:51:00Z +--- + +## Instruction (maintainer, 2026-11-23) + +"Budget should be enforced to all packages, including new packages, not just to `flow`." + +This is the maintainer's explicit instruction to change the frozen budget configuration +(`holon-config/hygiene/module_budgets.json`); the flow's intent carries the `module_budget_change` field for this change +only. + +## Problem + +`scripts/check_module_budgets.py` checks only the directories listed under `packages` in the configuration, and the list +holds one entry: `apps/sandbox-executor/src/sandbox_executor/flow` (added by PR #214 on 2026-11-20, right after the +`flow.py` split). On `main` at `84b70c1a`: + +| Scope | Python files | Over 200 lines | Checked | +| :------------------------------------- | -----------: | -------------: | :------------------------------------------ | +| `sandbox_executor/flow/` | 109 | 21 | yes (200-line default, 22 frozen overrides) | +| rest of `sandbox_executor/` | 147 | 44 | no | +| `scripts/` | 11 | 4 | no | +| tests (`apps/sandbox-executor/tests/`) | 256 | 114 | no | + +So `cli/__init__.py` (690 lines), `calibration.py` (1,637), `review_ensemble.py` (1,055), `local_llm.py` (1,049), +`git_flow.py` (1,008), `entrypoint/review_loop.py` (923) and 38 more oversized modules are never measured, and a new +package added anywhere outside `flow/` has no limit at all. + +## Goal + +1. **Coverage by discovery, not by list.** The check covers every tracked Python source file in the repository (all of + `apps/*/src/`, `scripts/` and any package added later) without naming packages. The `packages` list is replaced by an + explicit, short `exclude` list (generated files, vendored code), so a new package is budgeted the moment it exists. + An excluded path needs a stated reason in the configuration. +2. **Existing oversized modules are frozen, not waved through.** Each module currently over the default gets an override + equal to its current line count. Overrides only ratchet down: growing past an override fails; a module that has + shrunk below its override produces a notice to lower it (or the check lowers it in a dedicated mode); an override can + never be raised or added later without the maintainer's instruction. New modules get the 200-line default with no + override. +3. **`__init__.py` files are covered like any other module** (and Bean 0379 empties them of logic). +4. **Same rule in `holon-coherence`**: the same script and a configuration of its own, as a follow-up flow there. +5. The check stays in `uv run task lint`, the pre-commit hook and CI; the frozen-configuration rule (byte-for-byte + comparison with the merge base, changed only on the maintainer's instruction) is unchanged. + +## Decisions (defaults; change here if the maintainer decides otherwise) + +- **Tests**: not budgeted in this change (114 of 256 test files are over 200 lines; test files are long by nature and + the review cost is different). A later bean can add a separate, larger limit for tests. +- **Default stays 200 lines.** Whether overrides should exist at all is Bean 0340 (draft); this bean only extends + coverage and freezes today's sizes. +- **Paydown**: the 48 newly frozen modules are split over time by their own beans (largest first: `calibration.py` is + Bean 0197; `cli/__init__.py` is Bean 0379; `review_ensemble.py`, `local_llm.py`, `git_flow.py`, + `entrypoint/review_loop.py` need beans). + +## Acceptance criteria + +- A new Python package created anywhere in the repository (outside the exclude list) is checked with no configuration + change; a test creates one with a 201-line module and the check fails. +- Every source module is either within 200 lines or has an override equal to its line count at the time of this change; + the check passes on the resulting tree. +- Growing any frozen module by one line fails the check; shrinking one produces the ratchet notice. +- The configuration lists exclusions with reasons and no `packages` list; the script's docstring and the developer docs + describe the new behaviour. +- All tests pass via `uv run pytest`; `uv run task lint` and `uv run task lint-docs` pass. + +## Notes + +- The intent must set `module_budget_change` (the maintainer's instruction above is the authorisation) and must not + mention bean ids or harness paths. +- Every open flow that grows a newly frozen module will fail lint once this lands: land it when few PRs are open, and + tell running flows. +- Related: Bean 0264 / PR #214 (budget introduced for `flow/`), Bean 0340 (draft: strict default, no overrides), Bean + 0379 (no logic in `__init__.py`), Bean 0197 (split `calibration.py`). + +## Measured (self-improvement audit 2026-11-24) + +Reviewers raised 25 findings in the period 2026-11-21 to 2026-11-24 that a file already over 1,000 lines grew (for +example `executor.py` from 1,580 to 1,852 lines, `test_review_loop.py` from 2,679 to 2,723); 12 percent of all 249 +findings, each settled by a resolver pass and a full re-review. A mechanical check before the push (Bean 0408) would +catch them in Stage 3. + +> 2026-11-24: launched the `holon-coherence` half (`coherence-module-line-budget-all-packages`, intent +> `todo/intent-0380-coherence-module-line-budget-all-packages.json`) via `antigravity-agent` / `gemini-4-neon`. The +> `holon-agentic-coder` half stays queued behind `0376` and `0265`. Holon-Agentic-Coder/holon-coherence#55 +> (`coherence-module-line-budget-all`, merge commit `70dc5e90206bc2ac725a30281868ee0334c14d5c`, merged +> `2026-11-24T12:44:47Z`, 7/7 CI checks green, 3/3 consensus approved, Stage 5 calibrated) landed cleanly. + +- 2026-11-24 (clean-up): stays open. The `holon-coherence` half is delivered by PR #55 (merged 12:44:47Z). Remaining: + the `holon-agentic-coder` half (discovery-based coverage, `exclude` list, frozen overrides), queued behind `0376` and + `0265`. + +> 2026-11-26: launched the `holon-agentic-coder` half as flow `module-line-budget-all-packages` (intent +> `todo/intent-0380-module-line-budget-all-packages.json`, `claude-agent` / `claude-opus-5-5`, runner log +> `todo/flow-module-line-budget-all-packages.log`). The `holon-coherence` half is already merged as +> Holon-Agentic-Coder/holon-coherence#55. + +> 2026-11-26 (resume with 400 default, maintainer: "resume #317 with the new budget value"): the engine has no supported +> way to amend an intent on resume. `holon flow --checkpoint ...` discards the intent file (`intent_data = {}`) +> and uses the checkpoint's `intent_data`; the plan, execution branch and intents row keep the 200-line goal. The +> running flow was left untouched (resolver iteration 10, merge in progress in its worktree). Nothing was stopped or +> hand-patched. Logged as bean 0490. `todo/intent-0380-module-line-budget-all-packages.v2.json` is ready for a fresh +> flow if the maintainer prefers that (new PR, `#317` closed) or for 0490's amend path. + +## Resolution + +Delivered via [PR #317](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/317) and merged into `main` +(`a819f2f1`, merged 2026-11-26T07:50:13Z). The `holon-coherence` half is delivered by +[holon-coherence#55](https://github.com/Holon-Agentic-Coder/holon-coherence/pull/55) (merge `70dc5e90`, 2026-11-24). + +- **Key Architectural Deliverables**: budget coverage by discovery (`packages` list replaced by a reasoned `exclude` + list); existing oversized modules frozen at their current line counts, ratchet-only; new modules get the 200-line + default with no override; budget logic in `scripts/module_budget_config.py` and `scripts/module_budget_freeze.py`. +- **Verification & Tests**: `apps/sandbox-executor/tests/flow/test_module_budget_discovery.py` covers discovery of a new + package; `test_module_budgets.py` extended for ratchet behaviour. +- **Holon Flow Traversal**: flow `module-line-budget-all-packages` reached Stage 5 (execution branch + `E-1795669728-CLA-CO5.5` carries a `calibrated` ref) and was merged. The 200-line default was used; the `.v2` intent + with the 400-line default was not used, because `holon flow --checkpoint` ignores an amended intent file (bean 0490). +- **Follow-up**: the 400-line default with a step-down of 50 per pull request to 250 is bean 0489 (next; its + `blocked_by` 0380 is now clear). diff --git a/.beans/holon-agentic-coder-ref-metadata-0381--direct-holon-flow-resume-keeps-token-reduction-on-reviewers-fail-cache-control.md b/.beans/holon-agentic-coder-ref-metadata-0381--direct-holon-flow-resume-keeps-token-reduction-on-reviewers-fail-cache-control.md new file mode 100644 index 00000000..ebee11b3 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0381--direct-holon-flow-resume-keeps-token-reduction-on-reviewers-fail-cache-control.md @@ -0,0 +1,56 @@ +--- +# holon-agentic-coder-ref-metadata-0381 +title: "Resuming with a bare holon flow leaves token reduction on: every reviewer fails with cache_control.ttl 400" +status: todo +type: bug +priority: high +tags: + - flow + - token-reduction + - stage-4 + - holon-agentic-coder + - holon-coherence +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +Resuming a flow by calling `holon flow … --checkpoint …` directly (not through the harness wrapper `run_holon_flow.py`) +enables the token-reduce sidecar, and every Stage 4 reviewer then fails with `API Error: 400 system.2.cache_control.ttl` +from the holon-coherence proxy. Seen twice on 2026-11-23: PR #250 (iteration 6, all three reviewers) and PR #251. +Resuming through the wrapper, which sets `HOLON_TOKEN_REDUCE=0`, worked both times. + +Two defects: + +1. The proxy rewrites a request into one the API rejects (`system.2.cache_control.ttl`): a holon-coherence bug in how + cache-control blocks are added or ordered. +2. Whether token reduction is on depends on how the flow was launched. PR #248 (Bean 0157) was meant to make the sidecar + opt-in only; a bare `holon flow` resume still turned it on. + +## Goal + +- The proxy never emits a `cache_control` block the API rejects; a regression test replays the failing request shape. +- Token reduction is off unless explicitly opted into, identically for a fresh run, a `--checkpoint` resume and the + wrapper. The checkpoint records the choice and a resume keeps it. +- When the proxy returns a 4xx for a rewritten request, the role retries once without the proxy and reports the proxy + fault instead of failing the stage. + +## Progress + +- 2026-11-24: HAC stale plan `flow-token-reduce-opt-in-resume` deleted after PR #263 merged; restart HAC half from + current `main` once `0376` clears (coherence half already merged in PR #44). + +- 2026-11-23: Launched `holon-coherence` flow (`todo/intent-0381-coherence-cache-control-ttl.json`, slug + `fix-cache-control-ttl-order`, subagent `85c68b2a-9084-4a33-8421-26df8066a765`) and `holon-agentic-coder` flow + (`todo/intent-0381-hac-token-reduce-opt-in.json`, slug `token-reduce-opt-in-resume`, subagent + `be888633-7438-45fc-939d-8780d5cfa53a`) via `antigravity-agent` / `gemini-4-argon`. +- 2026-11-24: The `holon-coherence` half (`fix-cache-control-ttl-order`) was delivered via + [PR #44](https://github.com/Holon-Agentic-Coder/holon-coherence/pull/44) and merged into `main` (`e793d55`; 3/3 + consensus approved, 7/7 CI green, Stage 5 calibrated EV predicted `8.44` / actual `9.03` / delta `+0.59`), + `holon-coherence` image & CLI were rebuilt from `main`, superseded PR #43 was closed, and + `flow-fix-cache-control-ttl-order` worktree/branches were pruned; remaining work is the `holon-agentic-coder` half + (`token-reduce-opt-in-resume`). + +- 2026-11-24 (clean-up): set back to `todo` because the `holon-coherence` half is delivered (PR #44) and the + `holon-agentic-coder` half has no running flow, no flow worktree and no open pull request; it is queued behind `0376`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0382--model-alias-fable-resolves-to-opus-add-fable-5-2-to-the-model-registry.md b/.beans/holon-agentic-coder-ref-metadata-0382--model-alias-fable-resolves-to-opus-add-fable-5-2-to-the-model-registry.md new file mode 100644 index 00000000..0c630800 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0382--model-alias-fable-resolves-to-opus-add-fable-5-2-to-the-model-registry.md @@ -0,0 +1,49 @@ +--- +# holon-agentic-coder-ref-metadata-0382 +title: "The model alias 'fable' resolves to claude-opus-5-5; add claude-fable-5-2 to the model registry" +status: completed +type: bug +priority: high +tags: + - models + - runner + - holon-agentic-coder +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-24T05:47:29Z +pr: https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/267 +--- + +## Problem + +`apps/sandbox-executor/src/sandbox_executor/agent_defaults.py` lists `"fable"` as an alias of the `claude-opus-5-5` +capability (`aliases=["opus", "claude-opus", "fable"]`). `--model fable` therefore runs Opus silently, although the +maintainer's flow model is Fable 5.2 (2026-11-23). There is no `claude-fable-5-2` entry; the full id only works because +unknown ids are passed to the claude CLI verbatim. + +## Goal + +- A `claude-fable-5-2` capability entry with aliases `fable` and `claude-fable`; `fable` no longer aliases Opus. +- `holon doctor` and the resolved-model log line show the canonical id a flag or alias resolved to. +- A test asserts every alias resolves to a model of the same family as its name. +- Related: Bean 0270 (discover runner models dynamically) would remove the hand-kept list; this bean is the small fix. + +## Progress + +- 2026-11-23: Active in `apps/holon-agentic-coder/flow-fable-model-registry-entry` (intent + `todo/intent-0382-fable-model-registry-entry.json`, `antigravity-agent` / `gemini-4-argon`). +- 2026-11-23: Stopped the parallel Claude Code runner for `flow-fable-model-registry-entry` and took over Bean 0382 in + Antigravity background subagent `709edd6a-27ac-4941-93ae-90a64a02b7e4` (`antigravity-agent` / `gemini-4-argon`), + resuming cleanly from the Stage 1 checkpoint (`I-1795444112-fable-model-registry-entry/_`). +- 2026-11-23: All 5 stages completed on [PR #267](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/267) + (head `94f9dff6`, `MERGEABLE`, `CLEAN`, `11/11` CI checks passed, Stage 4 consensus APPROVED, Stage 5 calibration + report included in PR diff); awaiting human merge (`status: in-progress`). + +## Resolution + +- Delivered via [PR #267](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/267) and merged into `main` + (`9f57492d`). +- Key deliverables: added `claude-fable-5-2` capability entry with aliases `fable` / `claude-fable` (removing `fable` + from Opus), displayed canonical resolved model IDs in `holon doctor` and log lines, and added alias-family regression + tests (`test_model_alias_families.py`). +- Verification & Holon Flow traversal: 3/3 consensus approval, 11/11 CI checks green on calibrated head `ec6bc115`, + Stage 5 calibration included (`plans/I-1795444112-fable-model-registry-entry/P-1795444541-ANA-G4A_calibration.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0383--stage-5-waits-for-ci-twice-budget-always-overrun-no-timing-breakdown.md b/.beans/holon-agentic-coder-ref-metadata-0383--stage-5-waits-for-ci-twice-budget-always-overrun-no-timing-breakdown.md new file mode 100644 index 00000000..6d70aaef --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0383--stage-5-waits-for-ci-twice-budget-always-overrun-no-timing-breakdown.md @@ -0,0 +1,298 @@ +--- +# holon-agentic-coder-ref-metadata-0383 +title: "Stage 5 waits for CI twice and always overruns its 10-minute budget; no per-step timing breakdown" +status: todo +type: feature +priority: high +tags: + - flow + - stage-5 + - ci + - performance + - holon-agentic-coder +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +On PR #260 (2026-11-23) Stage 5 took 22.5 minutes against its 10-minute budget, and the calibration work itself took 14 +seconds. From the flow log (UTC): + +- 12:01:29 to 12:13:26 (11 min 57 s): the merged-head CI gate waits for CI on the head that the conflict gate's merge of + `main` and the ledger commit produced. +- 12:13:26 to 12:13:40 (14 s): calibration report, reconciliation, knowledge promotion (three commits). +- 12:14:06 to 12:24:00 (9 min 54 s): the final-head check waits for CI again, because the calibration commits moved the + head. + +So Stage 5 is two full CI runs back to back. The same overrun was logged on PR #250, #251, #253, #256 and #258 ("ran +10.6 to 10.9 min against its 10 min budget") and the flow keeps the success, so the budget has no meaning. The +maintainer noticed the gap from the PR timeline and had no way to see where the time went. + +## Goal + +1. **One CI wait instead of two (maintainer decision needed).** After a merge of the target, calibrate at once, push the + merge and the calibration commits together, and wait for CI once on the final head; a failed check withdraws the + consensus as today. This relaxes PR #250's rule that no calibration commit is pushed before CI passed on the merged + head. +2. **No full CI for calibration-only commits.** Commits touching only `plans/`, `executions/` and `holon-knowledge/` + cannot change a test result: path filters let the workflows finish in seconds for them (or the engine treats such + commits as bookkeeping and reuses the previous head's result). +3. **A budget that means something.** Stage 5's budget covers its own work; time spent waiting for external CI is + accounted separately (it already has a 1800 s CI wait budget) and does not produce an overrun warning. +4. **Timing breakdown.** Every flow summary and the PR's final comment show time per stage split into agent turns, CI + waits, git/merge work and idle time between resumes; `holon flow --timeline ` prints the same from the + checkpoint log. (A harness-side script over the checkpoint logs can provide this before the engine does.) + +## Maintainer direction (2026-11-24) + +For Goal 1 the maintainer prefers this shape: generate the calibration report (and the reconciliation and promotion +commits) in the background while CI runs on the merged head, keep them local, and commit and push them the moment CI +passes. PR #250's rule stays intact (no calibration commit is pushed before CI passed on the merged head); only the 14 s +of calibration work moves into the wait. If CI fails, the prepared commits are discarded and the consensus is withdrawn +as today. This does not remove the second wait (the final-head check after the calibration commits move the head); that +still needs Goal 2. + +## Maintainer direction, extended (2026-11-24, later) + +Maintainer's words: "for posting and calibration report add the promotion of knowledge and wisdom doesn't need to wait +either. we can commit when the pipelines is finished". + +- None of the Stage 5 work waits for CI: posting, the calibration report and the promotion of knowledge and wisdom all + run while the pipeline is still running. Only the commit (and its push) waits, and it happens once the pipeline has + finished. +- This adds knowledge and wisdom promotion, and posting, to the work named in the direction above. +- Corrected by the maintainer (2026-11-24): "posting" here does not mean the Stage 4 consensus review. In Stage 4 the + review is posted only after the pipeline passes (see the Stage 4 section). The agent's remaining reading, unconfirmed: + in Stage 5 "posting" is the posting of the calibration result to the pull request. + +## Maintainer direction, scope confirmed (2026-11-24, later still) + +Maintainer's words: "yes, execution reconciliation, calibration branch prep, stale warning call can be done straight +away. only the commit/push needs to wait for the pipeline pass." + +Work that starts at once in Stage 5, without waiting for the merged-head CI gate: + +- the calibration report; +- the execution reconciliation rows (`executions.jsonl`); +- the promotion of knowledge and wisdom; +- the preparation of the `/calibrated` branch (checkout of the execution branch, creation of the branch); +- the stale-warning supersede call; +- posting of the calibration result (agent's reading, unconfirmed; the Stage 4 review post is not in this list). + +Only the commit and the push wait, and they happen when the pipeline passes. If it fails, the prepared work is discarded +and the consensus is withdrawn as today. + +Stage 4 was brought into scope by the maintainer afterwards; see the next section. Still unconfirmed: preparing the flow +summary before the final-head CI wait ends. + +## Stage 4: work that does not wait for the pipeline (2026-11-24) + +Maintainer's words: "review loop can do a lot of things before the pipelines pass as well. add your notes to phase 4 as +well". This puts Stage 4 in scope; the notes below are the agent's, from reading `flow/review/loop.py`, +`flow/review/posting.py`, `flow/review/ledger_commit.py` and `flow/github/ci_wait.py` on `main`. + +Today, when every reviewer approves cleanly, the iteration does this in order: wait for CI registration, wait for +pending checks (budget 1800 s), decide the verdict, then build finding ids and trailers, write the ledger rows, build +the consensus data and the approval fingerprint, post the review, check calibration freshness, write the summary row, +and commit and push the ledger rows at stage exit. Everything after the two waits is held up by them although little of +it depends on CI. An iteration where a reviewer objects already probes CI once and does not wait, and the resolver does +not wait either; those paths need no change. + +Work to start as soon as the reviewers return, while CI is still running: + +- **Reviewer rows**: the per-reviewer ledger rows, reviewer finding ids, severity and the adjudication of rejected nits + depend only on the reviewer results. +- **Approval fingerprint and consensus data**: the PR-own fingerprint, the reviewer summaries, dispositions and the + review title and body depend on the diff and the reviewers; only the CI line and the final verdict are filled in when + CI settles. +- **Conflict gate before the wait**: mergeability against the target is checked, and the target merged when needed, + before waiting for CI rather than at posting time. Today a conflict found at posting sends the approval back to be + re-earned on the merged head, which costs a second full CI wait. (Inferred from the `conflict_gate` branch after + `post_review_consensus`; confirm when planning.) +- **Calibration freshness check** and the **summary row** of the loop. +- **Stage 5 fail-early checks** (replaces "prepare Stage 5 during the Stage 4 wait"; maintainer, 2026-11-24: "yes that + sounds correct. do it"): see "Stage 5 pre-flight during Stage 4" below. + +What waits for the pipeline to pass: + +- the final verdict and the outcome field of the iteration row (`success` or `failure`), and a `FIND-CI` finding when a + check failed; +- **posting**: the consensus review is posted to the pull request only after the pipeline passes (maintainer, + 2026-11-24: "for phase 4 only the posting and commit/push is done after the pipeline passes"). The review body is + prepared during the wait and posted on the pass; +- nothing else. Commits do not wait (maintainer, 2026-11-24: "bring stage 4 inline"). The review ledger rows are + committed at once but never pushed by themselves: a lone bookkeeping push would restart the pipeline the approval is + waiting on. They go out with the next push that happens anyway, the resolver's or Stage 5's single push (agent's + refinement under the maintainer's "use your free will", 2026-11-24; see Bean 0394, recommendation 6). + +If CI fails, the prepared rows are kept as the record of the iteration with outcome `failure`, the Stage 5 preparation +is discarded, and the loop continues to the resolver as today. + +## Posting rule: failures early, successes after the push (2026-11-24) + +Maintainer's words: "we you usual tell if it's stale even before the pipelines passes right? the only posting that can +be done after the push is the success (pr concensus approve, calibration done) posting. The failures can fail early". + +This rule replaces the per-item posting notes above, for Stage 4 and Stage 5 alike: + +- **Success postings wait**: the consensus approval review and the "calibration done" result are posted only after the + pipeline has passed and the commits are pushed. The same holds for editing the stale-calibration warning to + "superseded", because it states that a fresh report covers the head (agent's classification). +- **Failure postings go out as soon as the failure is known**, without waiting for the pipeline: a stale calibration + report (staleness is known from the evaluated commit and the head, before CI finishes), a terminal review that is not + an approval, a withdrawn consensus, a conflict that cannot be resolved, a failed check (as soon as the first check + fails, without waiting for the rest). +- Unchanged: intermediate review iterations are still not posted (Bean 0260); "failure posting" means the postings the + flow already makes, made earlier. + +Agent's notes for planning, not yet confirmed by the maintainer: + +- Reconciliation and promotion also write a local index database that is not in git + (`holon-knowledge/.index/action_index.db`), so on a CI failure the prepared rows are kept uncommitted for the next run + (the engine already commits rows a failed calibration left behind) rather than discarded. +- The time is in the number of CI runs, not in the prepared work (14 s on PR #260): the conflict gate before the Stage 4 + wait, one push for ledger rows and Stage 5 commits, and Goal 2 are what save minutes and should be planned first. + +## Stage 5 pre-flight during Stage 4 (maintainer-confirmed, 2026-11-24) + +Calibration can only be done on an approved head, so Stage 5 is not prepared during Stage 4. Instead Stage 4 runs these +as fail-early checks, so a Stage 5 failure surfaces while reviewers or CI are still running: + +- **Trial calibration, no commit**: generate the calibration report for the reviewed head and run its self-check, + without creating `/calibrated`, writing the report, appending the ledger row or committing. `run_calibrate` already + generates and self-checks before any branch checkout or file write, so the trial does not disturb the worktree Stage 4 + is using. The part of the self-check that needs the approved head cannot run yet. A trial that fails is a failure and + is reported early (see the posting rule). +- **Tooling pre-flight**: at the start of Stage 4, confirm the Prettier check can run (Stage 5 fails closed when it + cannot) and that the pull request number resolves. +- **Fetch and conflict gate**: fetch origin and merge the target before the CI wait (already listed above). + +Still done only once the approved head exists: creating `/calibrated` at the approved commit, the real report, the +ledger row, reconciliation and promotion. The real report is regenerated on the approved head and the trial is never +reused, because Stage 4's ledger-row commit moves the head after the trial ran. + +## Conflict gate: resolve on discovery (maintainer, 2026-11-24) + +Maintainer's words: "conflict gate: as soon as you find a conflict resolve it straight away". + +- A conflict with the target is resolved the moment it is found, in whichever stage finds it, and never deferred to + posting time or to the next stage. Nothing waits for the pipeline first: the merge produces the head CI has to run on, + so resolving at once is also what keeps it to one CI wait. +- This settles the open point in the Stage 4 section ("Conflict gate before the wait"): whether or not a conflict found + at posting costs a second CI wait today, the gate runs on discovery. +- Agent's notes: the check should run at the start of each review iteration and again when reviewers return, so a target + that moved during the review is merged before the CI wait begins. Resolution itself (ledgers mechanically, other files + through the conflict-resolver role, scoped re-review when the PR's own diff changed) is Bean 0376's work; this bean + only fixes when the gate runs. An unresolvable conflict is a failure and is posted early (see the posting rule). + +## Hard rule for the calibration report (maintainer, 2026-11-24) + +Maintainer's words: "calibration report, only success report can be posted after pipeline passes. that is the hard rule. +everything else can be done before that". + +- **Hard rule**: the success posting of the calibration report (the "calibration done" result on the pull request) is + made only after the pipeline has passed. No other Stage 5 step is bound to the pipeline by this rule: generating the + report, its self-check and Prettier check, the ledger row, reconciliation, promotion, branch preparation and every + failure posting run before it. +- This closes the open point on whether the report reads anything from the CI run: the report is generated before the + pipeline finishes, so it must not depend on that run's result; the success posting carries the CI outcome. +- **Open, asked of the maintainer**: whether the commit and push of the calibration commits also stop waiting. The + earlier direction in this bean says "only the commit/push needs to wait for the pipeline pass"; read literally, the + hard rule leaves only the success posting waiting. Pushing the calibration commits together with the merge of the + target, and waiting for CI once on that final head, is Goal 1 as first written and removes the second CI run, but it + relaxes PR #250's rule that no calibration commit is pushed before CI passed on the merged head. Until answered, the + commit and push keep waiting. + +## Hard rule: fail early (maintainer, 2026-11-24) + +Maintainer's words, on "Reconciliation and promotion on a CI failure": "failures should be recognised as soon as +possible and actions should be taken as soon as possible. this is a hard rule. fail early". + +- **Hard rule, every stage**: a failure is recognised at the earliest moment it can be known, and the action it calls + for starts at once. Nothing waits for the rest of a pipeline, the end of a stage or a budget to run out once the + outcome is already a failure. +- Applied to a CI failure while Stage 5 work is prepared: the first failed check is the failure. The flow stops waiting + for the remaining checks, posts the failure, withdraws the consensus and hands the failure to the resolver (Stage 4 + restarts) immediately. The prepared report is abandoned at that moment, not at the end of the wait. +- Applied elsewhere in this bean: a failed trial calibration or tooling pre-flight, a stale report, an unresolvable + conflict and a non-approving terminal review are each acted on when found (see the posting rule and the conflict + gate). +- Agent's note on the prepared reconciliation and promotion rows, still to confirm at planning: the action on failure is + immediate either way; what remains a design choice is whether the rows already written (ledger file and the local + index database outside git) are rolled back or left uncommitted for the next run, which the engine already picks up. + Leaving them is the smaller change; they do not depend on the CI result. + +## Only the success posting waits (maintainer, 2026-11-24) + +Maintainer's words: "you don't need superseded post to wait for the pipeline to pass. you can detect this early. yes +only sucess posting is waiting for the pipeline to pass. every failure is existed or posted early." + +- The "superseded" edit of the stale-calibration warning does not wait for the pipeline; it is made as soon as a fresh + report covers the head. This overrides the agent's classification of it as a success posting in the posting rule. +- The only things that wait for the pipeline to pass are the two success postings: the consensus approval and the + "calibration done" result. Every failure exits or is posted early. +- Agent's reading of "only success posting is waiting", applied to the question left open under the hard rule for the + calibration report: the commit and push of the calibration commits no longer wait either. They go out with the merge + of the target and CI is waited for once on the final head (Goal 1 as first written), which relaxes PR #250's rule that + no calibration commit is pushed before CI passed on the merged head. Reported to the maintainer as the reading taken; + reverse it here if that was not meant. + +### Reconciliation and promotion after a failure (agent's recommendation, asked by the maintainer; not yet confirmed) + +- **Reconciliation rows: neither roll back nor hold back; keep them.** The ledgers are append-only, so a written row is + never removed. The row records the execution's own verdict (from the Stage 3 result), which a later CI failure on a + merged head does not make false, and Stage 5 already treats a second run as "already recorded". If a later outcome + changes the verdict, a correcting row is appended. The local index database is derived from the ledger and needs no + rollback of its own. +- **Promotion: roll back.** Promoted knowledge and wisdom files are derived, cheap to regenerate and the one output that + does harm if it lingers: a lesson promoted on the strength of a run that then failed would steer later plans. On a + failure the new files are deleted at once (fail early) and promotion runs again on the head that finally passes. + +## One push, one pipeline (maintainer-confirmed, 2026-11-24) + +Maintainer's words: "when you merge main into the pull request, can't you push the report, reconcilation, promotion at +the same time then you only have one ci pipeline running for the whole thing". + +- Confirmed: Stage 5 merges the target locally, generates the report on the merged head, writes the reconciliation rows + and the promotion, and pushes all of it in one push. One pipeline runs on that final head; only the "calibration done" + posting waits for it. This is Goal 1 as first written and replaces PR #250's rule that no calibration commit is pushed + before CI passed on the merged head. The agent's reading in the previous section is no longer a reading. +- When no merge of the target is needed, Stage 4's pipeline has already passed on the approved head, and the calibration + push still starts one more pipeline on commits that only touch bookkeeping files. Goal 2 (no full CI for such commits) + removes that one. +- Consequence for a failure after the push (agent's note, to confirm): the calibration commits are already on the + branch. Reconciliation rows stay (append-only). Promotion is rolled back with a revert commit, not by deleting + uncommitted files, and the report is regenerated on the head that finally passes. + +## Stage 4 in line; report regenerated on the passing commit (maintainer-confirmed, 2026-11-24) + +Maintainer's words: "bring stage 4 inline. regenerate the report on the commit that finally passes." + +- Stage 4 follows the same rule as Stage 5: only its success posting (the consensus approval) waits for the pipeline. + Its commits and pushes are not held back. The Stage 4 section above is corrected accordingly. +- After a failure that follows the calibration push, the calibration report is regenerated on the commit that finally + passes. This confirms that part of the agent's note under "One push, one pipeline". Keeping the reconciliation rows + and undoing the promotion with a revert commit remain the agent's recommendation, not yet confirmed. + +## After a failure that follows the push (maintainer-confirmed, 2026-11-24) + +Maintainer's words: "keep the reconciliation row and undo the promotion with a revert commit". + +- **Reconciliation rows are kept.** The ledger is append-only; nothing is removed or rewritten. +- **Promotion is undone with a revert commit** on the pull request branch, made as soon as the failure is known (fail + early). No history is rewritten and nothing is force-pushed. +- **The report is regenerated** on the commit that finally passes (confirmed earlier), and promotion runs again there. + +This settles the agent's recommendation under "Only the success posting waits" and the note under "One push, one +pipeline"; the earlier wording about deleting uncommitted promotion files no longer applies. + +## Split (2026-11-24) + +Goal 2 (no full CI for bookkeeping-only commits) is now Bean 0403 so it can run by itself; it changes workflow files, +not the flow engine. The other recommendations for the whole flow are listed in Bean 0394. + +## Notes + +- Overlap: Bean 0412 records timing for every step, including the Stage 5 breakdown in Goal 4. This bean owns the double + CI wait and the budget; Bean 0412 owns the timing breakdown. diff --git a/.beans/holon-agentic-coder-ref-metadata-0384--stall-budget-cuts-long-thinking-models-fable-reviewers-fail-at-90s.md b/.beans/holon-agentic-coder-ref-metadata-0384--stall-budget-cuts-long-thinking-models-fable-reviewers-fail-at-90s.md new file mode 100644 index 00000000..742b2953 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0384--stall-budget-cuts-long-thinking-models-fable-reviewers-fail-at-90s.md @@ -0,0 +1,45 @@ +--- +# holon-agentic-coder-ref-metadata-0384 +title: + "The 90 s stall budget cuts long-thinking models: every Fable 5.2 reviewer failed, and the loop retried unchanged" +status: todo +type: bug +priority: high +tags: + - flow + - budgets + - stage-4 + - models + - holon-agentic-coder +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-23T12:40:00Z +--- + +## Problem + +With `--model claude-fable-5-2` every Stage 4 reviewer was cut: "review turn cut short: review stall budget of 90 s +exceeded after 90.2 s" (PR #260 iterations 1 to 3, PR #263 iteration 1, 2026-11-23). `HOLON_TURN_STALL_SECONDS` defaults +to 90 s of silence on the stream; Fable thinks longer than that before it streams anything. Planning and execution on +Fable were not cut. Setting `HOLON_TURN_STALL_SECONDS=600` fixed it (PR #260 approved 3/3 in a 38.8-minute round). + +Each failed round cost a full ensemble launch, and the flow was resumed three times with nothing changed before the +cause was noticed: the failure reads as "the reviewer ensemble did not complete", not as a configuration problem. + +## Goal + +- Liveness is not only streamed text: thinking, tool-call and keep-alive events count, so a model that is working is not + treated as stalled. +- The stall default depends on the runner and model capability (or scales with the turn timeout) instead of one 90 s + constant; the resolved value is in the budgets log line. +- When every reviewer of a round is cut by the stall budget, the stage fails with a message that names the budget and + the variable to raise, and the review loop does not count it as a review iteration. +- A resume that would repeat a round that failed identically (same head, same budget) refuses with that message instead + of running it again. + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- Not only Fable Stage 4 reviewers: on `2026-11-26T01:04:45Z`, `0371` sub-intent 2 (`#311`) Stage 3 executor on + `claude-agent / claude-opus-5-5` was killed by + `Stopping agent turn: execute stall budget of 90 s exceeded after 90.5 s` after **`20.93 min`** + (`todo/flow-ledger-fragments-and-promotion.log:1782-1820`), forcing a manual resume with + `HOLON_TURN_STALL_SECONDS=600`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0385--flow-log-file-stays-empty-until-the-run-ends.md b/.beans/holon-agentic-coder-ref-metadata-0385--flow-log-file-stays-empty-until-the-run-ends.md new file mode 100644 index 00000000..a0fb775d --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0385--flow-log-file-stays-empty-until-the-run-ends.md @@ -0,0 +1,49 @@ +--- +# holon-agentic-coder-ref-metadata-0385 +title: "The flow log file stays empty until the run ends, so a running flow cannot be followed" +status: completed +type: bug +priority: normal +tags: + - harness + - holon-flow + - logging +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +The harness wrapper's log (`todo/flow-.log`) is often 0 bytes for the whole run and gets its content only when the +process exits (seen on 2026-11-23: `flow-github-issues-replace-beads.log` "empty while the flow ran", +`flow-resume-adopts-pushed-plan-branch.log` 0 lines 15 minutes into the run, `flow-document-env-variables-v2.log` 0 +bytes after the host died, so the whole log was lost). Output is block-buffered when stdout is a file, and some agents +launch the wrapper with `nohup`/redirects that buffer again. Progress and failure causes were read from the checkpoint's +`context.logs` instead. + +## Goal + +- `run_holon_flow.py` writes the flow's output to its log line by line as it happens (unbuffered child, `flush` on every + line, or `PYTHONUNBUFFERED=1` for the child and line-buffered file). +- The skill tells flow subagents one way to launch and log, so no second layer of buffering is added. +- A killed run leaves everything it printed up to that point in the log. +- Harness-only change (`.agents/skills/holon_flow/`). + +## Notes + +- Overlap: Bean 0412 (every flow step timed, every flow keeps its log). This bean owns the log flushing; Bean 0412 owns + the step timings and the log for every flow. + +## More evidence (2026-11-26) + +Seen on almost every flow run on 2026-11-26 (beans 0496, 0501, 0504 were logged as duplicates and scrapped): the +wrapper's redirected log stays 0 bytes until the flow exits, for runs of 30-80 minutes, so nobody can monitor a running +flow from its log. The wrapper has no unbuffered or flush handling for the child's output. + +## Resolution (2026-11-26) + +Cause: the wrapper read the child line by line (child already had `PYTHONUNBUFFERED=1`), but its own `print` calls went +to a block-buffered stdout once redirected to a file, so nothing reached the log until exit. Fix in `run_holon_flow.py`: +`enable_line_buffering()` reconfigures stdout and stderr line-buffered at the start of `main`, and the child-output loop +and the command echo print with `flush=True`. Hermetic test: `tests/test_flow_log_streaming.py`. Takes effect on the +next launch. Duplicates 0496, 0501 and 0504 were scrapped earlier. diff --git a/.beans/holon-agentic-coder-ref-metadata-0386--tests-fail-together-in-one-serial-run-and-one-test-hangs-with-redirected-output.md b/.beans/holon-agentic-coder-ref-metadata-0386--tests-fail-together-in-one-serial-run-and-one-test-hangs-with-redirected-output.md new file mode 100644 index 00000000..1bd814a4 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0386--tests-fail-together-in-one-serial-run-and-one-test-hangs-with-redirected-output.md @@ -0,0 +1,32 @@ +--- +# holon-agentic-coder-ref-metadata-0386 +title: + "Some review tests fail when run together in one serial invocation, and test_backgrounded_sleep hangs with redirected + output" +status: todo +type: bug +priority: normal +tags: + - tests + - hygiene + - holon-agentic-coder +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +Two test-hygiene defects reported by agents on 2026-11-23, both present on `main` (not caused by the PRs that hit them): + +1. **Order dependence.** Some review test files fail when run together in one serial pytest invocation and pass on their + own or under xdist; identical at the PR #255 base (`11b66276`). Reviewers treated it as out of scope. +2. **A hanging test.** The host-only `test_backgrounded_sleep` appears to hang when pytest's output is redirected to a + file; a full serial run also takes about 25 minutes when the hermetic canary test (`test_sandbox_hermetic_guard`, + which runs the suite in a nested sandbox) is included. + +## Goal + +- Find the shared state (module globals, environment, git config, monkeypatched module attributes) behind the order + dependence and isolate it; add a CI job or a periodic check that runs the suite serially in random order. +- `test_backgrounded_sleep` does not depend on a TTY or an unredirected stdout, and has a timeout. +- State the expected wall time of a full local run in the developer docs, with the flag that skips the nested canary. diff --git a/.beans/holon-agentic-coder-ref-metadata-0387--flow-ledger-temp-worktree-left-registered.md b/.beans/holon-agentic-coder-ref-metadata-0387--flow-ledger-temp-worktree-left-registered.md new file mode 100644 index 00000000..8516bb80 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0387--flow-ledger-temp-worktree-left-registered.md @@ -0,0 +1,46 @@ +--- +# holon-agentic-coder-ref-metadata-0387 +title: "The flow leaves a detached temp ledger worktree registered in the repository" +status: completed +type: bug +priority: low +tags: + - flow + - git + - cleanup + - holon-agentic-coder +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-24T11:34:00Z +--- + +## Problem + +`git worktree list` in `holon-agentic-coder` shows a detached worktree under the system temp directory, +`…/T/holon-flow-ledger-w_4qqobl/worktree` (`71b0befa`), left by a flow's ledger step (`flow/git_refs.py`: +`git worktree add --detach` for a ledger commit). It was there all day on 2026-11-23, outlived the flow that made it, +and every cleanup agent had to decide whether it was safe to touch. + +## Goal + +- The ledger step removes its temp worktree in a `finally` (and runs `git worktree prune` for an entry whose directory + is gone), including when the step fails or the host is killed and the next run starts. +- A test kills the step midway and asserts the next run leaves no `holon-flow-ledger-*` worktree registered. + +## Progress (2026-11-24) + +- Flow started from this Claude Code session: intent `todo/intent-0387-ledger-temp-worktree-cleanup.json`, slug + `ledger-temp-worktree-cleanup`, `claude-agent` / `claude-fable-5-2`, worktree `flow-ledger-temp-worktree-cleanup`. + +## Resolution + +Delivered via [PR #270](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/270) and merged into `main` +(`bfbd9f4`) on 2026-11-24: + +- **Key Architectural Deliverables**: the ledger step now removes its temporary `holon-flow-ledger-*` worktree in a + `finally` (including when the step raises or returns an error); a new `flow/ledger_worktree.py` runs + `git worktree prune` and clears stale leftover ledger worktrees (no live owner) at the start of each step. +- **Verification & Tests**: `apps/sandbox-executor/tests/flow/test_ledger_worktree_cleanup.py` covers a step killed by + `SIGKILL` midway and during `git worktree add`, asserting the next run leaves no `holon-flow-ledger-*` worktree + registered. +- **Holon Flow Traversal**: the flow completed intent, plan, execute and review; the PR was merged through the merge + queue while the calibrate stage was re-running. diff --git a/.beans/holon-agentic-coder-ref-metadata-0388--bean-progress-shows-stale-halted-stage-and-triage-narrative-goes-stale.md b/.beans/holon-agentic-coder-ref-metadata-0388--bean-progress-shows-stale-halted-stage-and-triage-narrative-goes-stale.md new file mode 100644 index 00000000..3868fe56 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0388--bean-progress-shows-stale-halted-stage-and-triage-narrative-goes-stale.md @@ -0,0 +1,33 @@ +--- +# holon-agentic-coder-ref-metadata-0388 +title: "Bean progress shows a stale 'Halted' stage while a role is live, and the triage narrative goes stale" +status: todo +type: bug +priority: normal +tags: + - harness + - bean-progress + - prioritise-beans +created_at: 2026-11-23T12:40:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +Two harness reporting defects seen on 2026-11-23: + +1. **bean_progress Stage column.** While a review round was running, the Stage cell still read "Stage 4 (Halted iter N)" + from the last checkpoint (Bean 0191, 0367, 0378 rows), although the script's own Last Activity cell said "now: review + iter N+1 running". The maintainer was told "halted" for flows that were live. +2. **Triage narrative.** `prioritise_beans.py` keeps hand-written narrative strings (Executive Summary, per-bean notes). + After a day of merges the matrix said HAC PRs #243, #244 and #245 were open and recommended Bean 0333 as "ready now" + after it had merged (PR #258). The counts are computed; the prose is not. + +## Goal + +- `bean_progress.py`: when a role container is live for the flow, the Stage cell shows the live stage and iteration (for + example "Stage 4 (Review iter 3)"); "Halted" appears only when nothing is running. +- `prioritise_beans.py`: statements about open PRs, the current `main` commit and "ready now" recommendations are + derived from `gh` and the bean files at generation time, or the script fails when a hand-written note names a PR or + bean whose state no longer matches. No recommendation ever names a completed bean. +- Harness-only change. diff --git a/.beans/holon-agentic-coder-ref-metadata-0389--bean-progress-tests-stale-after-table-rework.md b/.beans/holon-agentic-coder-ref-metadata-0389--bean-progress-tests-stale-after-table-rework.md new file mode 100644 index 00000000..087b8898 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0389--bean-progress-tests-stale-after-table-rework.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0389 +title: + "Four bean-progress tests fail on the committed harness: they still expect the table from before the column rework" +status: completed +type: bug +priority: normal +tags: + - harness + - tests + - bean-progress +created_at: 2026-11-23T14:31:54Z +updated_at: 2026-11-24T11:05:50Z +--- + +## Problem + +`uv run pytest` in the harness gives `4 failed`, all in `tests/test_bean_progress.py`, on committed code (neither the +test file nor the `bean_progress` skill has uncommitted changes): + +- `TestLiveProcessesAndChecks::test_ancestor_owner_ignores_child_claude_agent_flag` +- `TestLiveProcessesAndChecks::test_table_escaping_and_empty_cli` +- `TestTimesAndColumns::test_row_columns_and_runner_in_notes` +- `TestMappingFixes::test_duplicate_attempts_merge_per_bean` + +## Cause + +Commits `90f751a` (Agent and Model columns), `d7139f3` (Last Activity column) and `5d75a17` (compact table, details as a +list, `--wide`) changed the output without updating the tests. The tests still expect the header +`| Bean # | Target | Title | Stage | Time in Stage | PR & CI | Total Time | Notes |` and the model in the notes cell +(`opus-5-5 · 32m (PID ...)`); the code now prints +`| Bean # | Target | Title | Agent | Model | Stage | In Stage | PR & CI | Total |` and `live · 32m (PID ...)`, with +notes moved to the list under the table. + +## Goal + +- The four tests assert the current compact table, the `--wide` table and the details list. +- `uv run pytest` is green in the harness; the pre-commit check runs it so a stale test cannot be committed again. + +## Notes + +- Found on 2026-11-23 while verifying the importer of Bean 0215. Related: Bean 0388 (stale stage in bean progress). + +## Resolution + +Only the tests were stale; the script matches its documented behaviour and was not changed. In +`tests/test_bean_progress.py`: + +- `test_ancestor_owner_ignores_child_claude_agent_flag`: the live runner string is now + `live · 32m (PID ..., Antigravity)` (the model moved to its own column), so the assertion expects that. +- `test_table_escaping_and_empty_cli`: notes no longer sit in the compact table. It now asserts the title is escaped in + the compact table, the note appears in the details list, and the `--wide` table escapes both title and note. +- `test_row_columns_and_runner_in_notes`: asserts the compact header (`Agent`, `Model`, `In Stage`, `Total`), the time + cells, the idle state in the details list, and the exact `--wide` header. +- `test_duplicate_attempts_merge_per_bean`: asserts `live · 1h00m (PID 1, Claude Code)` in the notes cell and the model + on the row. + +Result: `tests/test_bean_progress.py` 17 passed (was 4 failed, 13 passed). diff --git a/.beans/holon-agentic-coder-ref-metadata-0390--two-runners-on-one-flow-checkpoint-are-not-excluded.md b/.beans/holon-agentic-coder-ref-metadata-0390--two-runners-on-one-flow-checkpoint-are-not-excluded.md new file mode 100644 index 00000000..393a4ad5 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0390--two-runners-on-one-flow-checkpoint-are-not-excluded.md @@ -0,0 +1,101 @@ +--- +# holon-agentic-coder-ref-metadata-0390 +title: "Two runners can drive the same flow checkpoint at once; nothing locks a flow or a bean against a second launch" +status: in-progress +type: bug +priority: high +tags: + - holon-flow + - harness + - holon-agentic-coder + - concurrency +created_at: 2026-11-23T15:20:54Z +updated_at: 2026-11-26T20:59Z +--- + +## Problem + +On 2026-11-23 two sessions picked up Bean 0382 within 20 seconds of each other (14:28 UTC): one Claude Code session and +one Antigravity session that backfilled a free slot. Two flows were launched for the same bean, then two runners drove +the **same** intent and checkpoint (`fable-model-registry-entry`): both dispatched Stage 2, and the run halted with +`Plan stage failed: ambiguous P-branches under I-1795444112-fable-model-registry-entry: 2 appeared during dispatch`. The +resulting pull request (#267) carries two plan files. One runner was also killed from outside (exit 144) and left no +reason in its log. + +## Cause + +- **Harness:** the bean was claimed only by setting `status: in-progress`, which both sessions did at the same moment; + `.agents/coordination.md` "Task Locking" names no atomic claim, and `run_holon_flow.py` does not check whether a flow + for the same bean or slug is already live. +- **Target:** `holon flow` takes no lock on its checkpoint or flow worktree, so a second process resumes the same + checkpoint and dispatches the same stage. + +## Goal + +- `holon flow` holds an exclusive lock per checkpoint (or flow worktree) for the life of the run and refuses a second + runner with a message naming the holder's PID; a stale lock from a dead PID is taken over. Through the Holon flow. +- `run_holon_flow.py` refuses to launch when a live runner already drives an intent for the same bean id or slug, and + the claim of a bean is atomic (for example an exclusive-create claim file naming the session). Harness edit. +- A runner stopped by a signal writes the signal and time to its log before exiting. + +## Notes + +- Related: Bean 0360 (duplicate P- branch after an interrupted plan stage), Bean 0385 (empty flow log). + +## Occurrence (2026-11-24, bean 0387) + +- A session restart at about 07:19Z killed the wrapper of `ledger-temp-worktree-cleanup` but left its Stage 3 executor + container running. A resume at 07:22Z took its pre-dispatch snapshot while that container was still to push + `E-1795504454`; the new run pushed `E-1795504981`, and Stage 3 failed with "ambiguous E-branches ... 2 appeared during + dispatch; refusing to guess" (`flow/git_refs.py`, `_discover_child_branch`). Two full executions were wasted. +- Asks for this bean: a resume must detect a live role container on the same worktree (not only a live host runner) and + wait or refuse; and a resume should be able to adopt a completed, pushed execution branch of a killed run instead of + executing again. + +## Progress (2026-11-26) + +- in-progress: flow `single-runner-per-checkpoint` (intent `todo/intent-0390-single-runner-per-checkpoint.json`, log + `todo/flow-single-runner-per-checkpoint.log`), covering this bean and 0472 (same defect). Stage 3 overlap refusals are + parked, not waited out. +- parked 2026-11-26: blocked by flow `tests-fewer-git-stage-pipeline` (I-1795684868, worktree + flow-tests-fewer-git-stage-pipeline) on apps/sandbox-executor/tests/flow/conftest.py; Stage 3 admission refused the + plan's touch set. Checkpoint kept at + apps/holon-agentic-coder/flow-single-runner-per-checkpoint/.holon/flow/checkpoint-single-runner-per-checkpoint.json + (stage execute); resume with --checkpoint only once that flow merges or releases conftest.py. +- 2026-11-26 (post-merge of PR #332): the blocker is released (flow `tests-fewer-git-stage-pipeline` merged; its + worktree and branches are removed). Still parked: open PR #334 (`I-1795665991-no-unneeded-full-review`) also touches + `apps/sandbox-executor/tests/flow/conftest.py`, so resume only after #334 merges or releases that file. +- resumed 2026-11-26 10:55Z from checkpoint (stage execute, `--checkpoint`, claude-agent / claude-opus-5-5): PR #332 + (the earlier blocker) has merged, but Stage 3 admission refused again on a touch-set overlap with open PR #334 + (`I-1795665991-no-unneeded-full-review`, flow worktree `flow-no-unneeded-full-review`) on + `apps/sandbox-executor/tests/flow/conftest.py`. Parked again; checkpoint kept (stage execute), no runner live. Resume + with `--checkpoint` once PR #334 merges or releases conftest.py. + +- resumed 2026-11-26 13:03Z from checkpoint (stage execute, `--checkpoint`, claude-agent / claude-opus-5-5): PR #334 + (the blocker) merged at 13:01Z, so the conftest.py overlap is released. Flow running; log + `todo/flow-single-runner-per-checkpoint.log`. +- parked 2026-11-26 13:04Z: resume attempt at 13:03Z refused by Stage 3 on a touch-set overlap with the older waiting + flow `split-calibration-package` (I-1795669744, worktree flow-split-calibration-package, blocked since 05:16Z) on + apps/sandbox-executor/tests/flow/conftest.py. PR #334 itself merged at 13:01Z, so that blocker is gone. Checkpoint + kept (stage execute); no runner live. Resume with `--checkpoint` once split-calibration-package merges or releases + conftest.py. +- resumed 2026-11-26 14:29Z from checkpoint (stage execute, `--checkpoint`, claude-agent / claude-opus-5-5, + no-wait-on-overlap). Blocker split-calibration-package has completed (checkpoint stage completed); its PR #347 is open + and does not touch conftest.py. Log `todo/flow-single-runner-per-checkpoint.log`. +- parked 2026-11-26 14:50Z: resume 14:29Z admitted Stage 3 and executed (E-1795703416), but execute failed: the + execution touched apps/sandbox-executor/src/sandbox_executor/flow/lazy_exports.py and launcher/run_tracking.py outside + the plan touch set; re-plan (P-1795704471) widened the touch set and Stage 3 then refused on a touch-set overlap with + open PR #342 (I-1795694671-ledgers-sorted-chronologically) on flow/lazy_exports.py. Checkpoint kept (stage execute, + worktree flow-single-runner-per-checkpoint); no runner or container live. Resume with `--checkpoint` once PR #342 + merges or releases lazy_exports.py. + +- resumed 2026-11-26T20:59Z from checkpoint (stage execute, `--checkpoint`, claude-agent / claude-opus-5-5, + no-wait-on-overlap): blocker PR #342 (lazy_exports.py) merged 2026-11-26 20:58Z. Log + `todo/flow-single-runner-per-checkpoint.log`. + +- parked 2026-11-26T21:21Z: resumed run executed Stage 3 (E-1795726850, touch set admitted, PR #342 merged) and Stage 4 + ran one review iteration (CHANGES_REQUESTED, 5 open findings). The resolver then halted at its pre-push tests on bean + 0547 (review-loop identity overlay in os.environ reaches the test run; deterministic). Checkpoint kept at stage + review; no runner live. Resolver's uncommitted fixes remain in the flow worktree (patch copy: + /private/tmp/claude-501/-Users-thomashan-git-holon-agentic-coder-ref-metadata/f956a41e-6830-4ee3-9257-8c114a4af5b9/scratchpad/resolver-uncommitted-0390.patch). + Resume with `--from-stage review` once 0547 is merged and the branch has merged origin/main. diff --git a/.beans/holon-agentic-coder-ref-metadata-0391--stage-3-admission-wait-merge-stops-on-ledger-conflict.md b/.beans/holon-agentic-coder-ref-metadata-0391--stage-3-admission-wait-merge-stops-on-ledger-conflict.md new file mode 100644 index 00000000..6ae6dc14 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0391--stage-3-admission-wait-merge-stops-on-ledger-conflict.md @@ -0,0 +1,49 @@ +--- +# holon-agentic-coder-ref-metadata-0391 +title: "Stage 3 stops after an overlap wait when merging main into the plan branch conflicts only in the ledgers" +status: todo +type: bug +priority: high +tags: + - flow + - stage-3 + - ledger + - conflicts + - holon-agentic-coder +created_at: 2026-11-24T06:08:11Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +On 2026-11-24 the flow `ledger-temp-worktree-cleanup` (Bean 0387) waited 1 h 43 min at Stage 3 admission for PR #265 to +merge. When the overlap cleared, Stage 3 merged `origin/main` into the plan branch, hit conflicts in +`holon-knowledge/ledger/intents.jsonl` and `plans.jsonl` only, aborted the merge and failed the stage: + +> Stage 3 stopped before dispatch: merging origin/main into '.../P-1795493432-CLA-CF5.2/\_' after the admission wait +> conflicts in holon-knowledge/ledger/intents.jsonl, holon-knowledge/ledger/plans.jsonl; the merge was aborted and +> nothing was pushed. Merge origin/main into the plan branch by hand (merge, do not rebase) and resume the flow. + +A resume from the checkpoint failed the same way, so the runner exited. Every flow that waits out an overlap will hit +this, because the merges it waited for always append ledger rows: the wait ends in a guaranteed stop. + +## Cause + +The post-admission-wait merge in Stage 3 does not use the mechanical ledger resolution that the Stage 4 and Stage 5 +conflict gates already apply (keep both sides' rows, ordered by `created_at`). The installed `holon` at the time +predated the merge of PR #265 (Bean 0376, in-flow conflict resolution); check whether `main` after #265 already covers +this path before changing code. + +## Goal + +- A ledger-only (or knowledge-base-only) conflict in the post-wait merge is resolved mechanically and Stage 3 + dispatches; only a conflict in other files stops the stage. +- `run_holon_flow.py` does not resume a second time into the same deterministic failure. +- A test: plan branch and target both append ledger rows, admission wait ends, Stage 3 dispatches. + +## Notes + +- Overlap: Bean 0371 (per-flow ledger fragments) removes the ledger conflicts at source and Bean 0376 (in-flow conflict + resolver) handles the rest. Bean 0376 owns the in-flow merge handling; this bean is the Stage 3 admission-wait case. +- Through the Holon flow for the engine part. Related: Bean 0376, Bean 0371 (ledger fragments remove the conflict + altogether), Bean 0387 (worked around by a resolve-conflict run and a resume). diff --git a/.beans/holon-agentic-coder-ref-metadata-0392--stage-4-resolver-runs-repo-wide-prettier-and-edits-historical-plans.md b/.beans/holon-agentic-coder-ref-metadata-0392--stage-4-resolver-runs-repo-wide-prettier-and-edits-historical-plans.md new file mode 100644 index 00000000..9661775f --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0392--stage-4-resolver-runs-repo-wide-prettier-and-edits-historical-plans.md @@ -0,0 +1,41 @@ +--- +# holon-agentic-coder-ref-metadata-0392 +title: "Stage 4 resolver runs repo-wide Prettier and mutates untouched historical plans/ files" +status: todo +type: bug +priority: high +tags: + - review-loop + - resolver + - hygiene + - prettier + - holon-agentic-coder +created_at: 2026-11-24T07:20:00Z +updated_at: 2026-11-24T07:20:00Z +--- + +## Problem + +During Stage 4 of PR #268 (`claude-code-mode-default-on`, 2026-11-24), the resolver polluted the PR diff with 36 +unrelated historical files under `plans/` (34 historical `plans/*/*_calibration.md` reports plus 2 old plan files): + +1. In iteration 2 (`1676ccbf`, `FIND-CI-002`), to fix a `hygiene` formatting finding, the resolver ran Prettier across + the whole repository instead of scoping formatting to PR-changed files. Because the container Prettier version + wrapped LaTeX math lines (`$cost\_error = ...$`) differently from GitHub Actions' Prettier version, 36 untouched + historical files were modified. +2. In iteration 3 (`23d6f9c7`, `FIND-CI-003`), when CI `hygiene` flagged those newly reformatted historical files, the + resolver inserted `` above the math paragraphs across all 34 historical calibration reports + instead of reverting untouched files back to `origin/main`. + +A maintainer-instructed host-side cleanup (`ce56b34d`) was required to restore those 36 historical files before +re-running Stage 4 review. + +## Goal + +- The Stage 4 resolver (prompts and pre-push/post-turn guard) formats only files changed by the PR itself, never the + entire repository. +- Any Stage 4 resolver commit touching historical `plans/` files outside the current intent's own `plans//` + directory is refused fail-closed (or reverted before commit/push). +- Container Prettier version matches CI (`hygiene` workflow) so formatting checks are deterministic across host, + container, and CI. +- Add hermetic tests verifying out-of-scope historical `plans/` edits by a resolver are rejected. diff --git a/.beans/holon-agentic-coder-ref-metadata-0393--preflight-probe-times-out-after-ok-reply-and-aborts-the-flow.md b/.beans/holon-agentic-coder-ref-metadata-0393--preflight-probe-times-out-after-ok-reply-and-aborts-the-flow.md new file mode 100644 index 00000000..7c06deec --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0393--preflight-probe-times-out-after-ok-reply-and-aborts-the-flow.md @@ -0,0 +1,67 @@ +--- +# holon-agentic-coder-ref-metadata-0393 +title: "Pre-flight probe that replied OK but exited late is classed UNKNOWN and aborts the flow" +status: completed +type: bug +priority: high +tags: + - flow + - preflight + - holon-agentic-coder +created_at: 2026-11-24T08:12:00Z +updated_at: 2026-11-24T12:45:46Z +--- + +## Problem + +On 2026-11-24 at about 07:45Z the flows `flow-references-github-issues` (Bean 0216) and `split-calibration-package` +(Bean 0197) left their Stage 3 overlap wait when PR #268 merged, resumed, and aborted at once: + +```text +Pre-flight claude-agent (claude-fable-5-2) via holon/agent-claude: UNKNOWN + hint: The probe did not finish within 60s; the runner may be waiting on an interactive login. ... + output (redacted): + OK + Claude Code doesn't recognize the model "claude-fable-5-2", so it assumes a context window of 200k tokens. ... +Aborting before any branch, checkpoint or ledger write. Use --skip-preflight to bypass this check. +``` + +The probe had already printed the expected `OK` reply; the container only failed to exit within 60 s. Twenty-five +minutes later the same probe (`holon doctor --agent claude-agent --model claude-fable-5-2`, same image, same +credentials) returned OK in 4.8 s with code mode on and 4.1 s with it off, so the model id, the credentials and code +mode are not the cause. The `holon/agent-claude` image was rebuilt at 07:45:07Z (post-merge install after PR #268), at +the moment the two flows resumed; a Docker daemon busy with the build is the probable cause of the slow exit (not +confirmed). + +## Defects + +1. `preflight._run_probe` returns UNKNOWN on a timeout without looking at the output it captured. A probe whose output + carries the expected `OK` reply has proved the runner, the credentials and the model; only the exit was slow. +2. The hint blames an interactive login and the excerpt shows the unrecognised-model warning, so the abort reads as a + model-id problem. The flow subagent reported it that way. +3. A transient pre-flight result ends the whole wrapper run. `run_holon_flow.py` waits out limits and overlaps but + treats one UNKNOWN probe as terminal, so a flow that waited hours for its overlap died in its first minute. +4. Flows that leave an overlap wait when a pull request merges restart at the same moment the post-merge image rebuild + runs. + +## Goal + +- A timed-out probe whose output contains the expected reply is classed OK (with a note that the exit was slow). +- An UNKNOWN probe is retried (for example three attempts with a pause) before the flow aborts, in the engine or the + wrapper. +- The hint for a timeout names the timeout and does not suggest a login when a reply was received. +- Flows resuming after a merge do not race the image rebuild, or the probe tolerates it. + +## Notes + +- Found while driving Beans 0216 and 0197; both are relaunched from their checkpoints. +- Related: Bean 0385 (flow log empty while the wrapper waits; the overlap wait was invisible in the logs here too). + +> 2026-11-24: launched `preflight-ok-reply-slow-exit-and-retry` (intent +> `todo/intent-0393-preflight-ok-reply-slow-exit-and-retry.json`) via `antigravity-agent` / `gemini-4-neon`. + +## Resolution + +Holon-Agentic-Coder/holon-agentic-coder#274 (`preflight-retry`, merge commit `27dd49afc5e83c18abcbdefc2db6b4ca15ba0948`, +merged `2026-11-24T12:45:46Z`, 11/11 CI checks green, 3/3 consensus approved, Stage 5 calibrated +`plans/I-1795520307-preflight-retry/P-1795520326-ANA-G4N_calibration.md`, EV `64.18` -> `83.24`, `+19.06`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0394--no-unnecessary-waiting-anywhere-in-the-holon-flow.md b/.beans/holon-agentic-coder-ref-metadata-0394--no-unnecessary-waiting-anywhere-in-the-holon-flow.md new file mode 100644 index 00000000..49bba4a1 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0394--no-unnecessary-waiting-anywhere-in-the-holon-flow.md @@ -0,0 +1,146 @@ +--- +# holon-agentic-coder-ref-metadata-0394 +title: "No unnecessary waiting anywhere in the holon flow: recommendations" +status: todo +type: epic +priority: high +tags: + - flow + - performance + - ci + - holon-agentic-coder +created_at: 2026-11-24T08:25:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +Maintainer, 2026-11-24: "you use you free will to make the whole process as frictionless as possible and there is no +unncessary waiting anywhere in the whole holon flow. put your recommendations!" + +These are the agent's recommendations, ranked by time saved. Each is marked **measured** (from the flow logs or the +engine on `main`), **seen** (observed once, 2026-11-24) or **unverified** (to check when planned). Stage 4 and Stage 5 +rules the maintainer already confirmed live in Bean 0383 and are not repeated. + +## Principles (maintainer's hard rules) + +1. Only success postings wait for the pipeline. Everything else runs as soon as its inputs exist. +2. Fail early: a failure is recognised and acted on the moment it can be known. +3. Resolve a conflict the moment it is found. +4. At the end of the review process only two things matter: the pipeline passes and the consensus passes. Everything + else is churn (maintainer, 2026-11-24). A step is kept on the critical path only if it helps reach those two. + +## Where the time goes (measured, all flow logs to 2026-11-24) + +| Stage | Median | Longest | What it is made of | +| :-------- | :------ | :-------- | :--------------------------------------------- | +| Intent | 0.2 min | 0.3 min | agent turn | +| Plan | 4.0 min | 25.3 min | agent turn | +| Execute | 9.2 min | 141.8 min | agent turn and tests | +| Review | 6.7 min | 69.7 min | reviewers, resolver, then a CI wait | +| Calibrate | 8.5 min | 12.6 min | about 14 s of work; the rest is waiting for CI | +| CI wait | 7.9 min | 11.9 min | one pipeline run, 33 waits measured | + +Outside the stages: three flows waited about 3.5 hours at Stage 3 admission for a pull request that was approved and +only needed the maintainer's merge (**seen**), and a session restart stopped four flows until someone noticed +(**seen**). + +## Recommendations + +### A. Waits measured in hours + +1. **Do not idle at Stage 3 admission; work during the overlap wait.** Today a plan whose touch set overlaps an open + pull request does nothing until that pull request merges. On 2026-11-24 the overlap was partly on `README.md` alone. + Apply the same rule as Stage 5: execute now on the current base, hold only the push, and when the blocking pull + request merges, sync with the target and resolve on discovery (Bean 0376 supplies the resolver). Start with low-risk + overlaps (documentation, registries, generated lists); keep strict waiting for overlaps on core engine files, where + the maintainer earlier found sequential runs cheaper. **Measured** wait, **unverified** design. +2. **Flows survive the session that started them.** The wrapper runs as a child of the agent session, so a restart kills + every flow and leaves role containers behind (Bean 0390). Run the wrapper under a supervisor that is independent of + the session, with one lock per checkpoint, so a restart changes nothing. **Seen.** +3. **A resume adopts finished work.** A killed Stage 3 whose execution branch is complete and pushed is executed again + from scratch (three wasted executions on Bean 0387). Resume should adopt it, as Bean 0360 did for plan branches. + **Seen.** +4. **Stacked starts for dependent work (larger, optional).** A flow blocked only by an approved, calibrated pull request + could branch from that pull request's head instead of waiting for the merge. **Unverified**; needs a maintainer + decision because it changes what a flow's base is. + +### B. Waits measured in minutes, every flow + +5. **No full pipeline for bookkeeping-only commits** (Bean 0383, Goal 2). Commits touching only `plans/`, `executions/` + and `holon-knowledge/` cannot change a test result. Saves one pipeline, about 8 minutes, in every flow. **Measured.** +6. **One push per step, never a push of bookkeeping by itself.** Stage 4 commits its ledger rows at once but pushes them + with the next push that happens anyway (the resolver's, or Stage 5's single push). A lone ledger push restarts the + pipeline the approval is waiting on. **Measured** from the engine's order of work. +7. **React to pipeline events instead of polling.** The CI wait backs off to one poll every 120 s, so each wait can idle + up to 2 minutes after the pipeline has finished; the logs show check results arriving in 2-minute steps. Use the + event stream (Bean 0352) or cap the poll at 15 s. The same applies to the 60 s overlap poll and the 15 s registration + poll. **Measured.** +8. **Cancel superseded pipelines and fail fast inside the pipeline.** A push that replaces a head should cancel the run + on the old head, and a failed job should stop its siblings, so the engine learns of a failure in the first failing + job's time. **Unverified** whether the workflows already do this. +9. **Shorten the pipeline itself.** Median 7.9 minutes; the last checks to finish are `Workspace survival` and + `unit (macos-latest)`. Cache dependencies, split or shard the slow jobs, and run the macOS job only where the change + can affect it. **Measured** duration, **unverified** remedy. +10. **Start the resolver on the first objection.** Consensus needs every reviewer, so one objection already decides the + iteration. Hand findings to the resolver as each reviewer returns instead of waiting for the slowest one (Bean + 0255). **Unverified** saving. +11. **Registration wait that ends unknown.** "The PR head did not match the pushed head before the registration wait ran + out" leaves CI unverified after a 180 s wait (**seen** twice on 2026-11-23). Wait on the event for the pushed + commit, and retry once before reporting unknown. + +### C. Failures that stop a flow when they need not + +12. **Pre-flight: a slow exit is not a failure, and one bad probe is retried** (Bean 0393). **Seen.** +13. **Stage 3 ledger merge after the admission wait resolves itself** (Bean 0391) instead of stopping the stage. +14. **Image rebuilds do not disturb running flows.** The post-merge rebuild replaces `latest` while flows are starting + containers. Build to a new tag and switch when the build is done; a running flow keeps the image it started with. + **Seen** (probable cause of Bean 0393). +15. **Stall budget per model.** The 90 s default cut every Fable reviewer until the wrapper was told 600 s. The default + should come from the model, not from whoever launches the flow. **Seen** (2026-11-23). + +### D. Seeing a wait is half of removing it + +16. **Budgets that mean something and a timing breakdown** (Bean 0383, Goals 3 and 4): agent time, CI wait, git work and + idle time per stage, in the flow summary and on the pull request. +17. **Unbuffered wrapper logs** (Bean 0385). An overlap wait is invisible in the log today, so a stalled flow and a + waiting flow look the same. + +## Suggested order + +5, 6 and 7 first (every flow, small changes, about 10 minutes each flow), then 2 and 3 (they turn hours of unnoticed +stoppage into nothing), then 1 (largest saving, largest change), then the rest. 5 and 6 belong in Bean 0383's flow. + +## Notes + +- Overlap: Beans 0395 (work during the overlap wait), 0399 (CI waits react in seconds), 0397 (resume adopts a pushed + execution branch) and 0396 (flow survives the session) were split from this bean. This bean is the umbrella and + recommendation list; each of those owns its own fix. +- Not removable: the maintainer's merge of pull requests into `main`. Recommendation 1 and 4 only stop other flows from + idling behind it. +- Each recommendation becomes its own bean and flow when taken up; this bean is the list. + +## Beans logged for these recommendations (2026-11-24) + +| Rec. | Bean | Note | +| :--- | :--- | :----------------------------------------------------------------------------------- | +| 1 | 0395 | new | +| 2 | 0396 | new; with 0390 | +| 3 | 0397 | new | +| 4 | 0398 | new, draft: needs a maintainer decision | +| 5 | 0403 | new, split out of 0383 Goal 2 | +| 6 | 0383 | in the Stage 4 section | +| 7 | 0399 | new; event stream is 0352 | +| 8 | 0400 | folded in: superseded runs are already cancelled; only `fail-fast` is left to decide | +| 9 | 0400 | new; with 0168 and 0166 | +| 10 | 0255 | existing | +| 11 | 0401 | new | +| 12 | 0393 | existing | +| 13 | 0391 | existing | +| 14 | 0402 | new | +| 15 | 0384 | existing | +| 16 | 0383 | Goals 3 and 4 | +| 17 | 0385 | existing | + +Correction to recommendation 8: the workflows already cancel a superseded run on pull requests (`cancel-in-progress`), +so that half needs nothing. diff --git a/.beans/holon-agentic-coder-ref-metadata-0395--work-during-the-stage-3-overlap-wait.md b/.beans/holon-agentic-coder-ref-metadata-0395--work-during-the-stage-3-overlap-wait.md new file mode 100644 index 00000000..83c9275e --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0395--work-during-the-stage-3-overlap-wait.md @@ -0,0 +1,47 @@ +--- +# holon-agentic-coder-ref-metadata-0395 +title: "Stage 3 works during an overlap wait instead of idling until the blocking pull request merges" +status: todo +type: feature +priority: high +tags: + - flow + - stage-3 + - admission + - performance + - holon-agentic-coder +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +When a plan's touch set overlaps a pull request in flight, Stage 3 admission refuses it and the flow does nothing until +that pull request merges or closes. On 2026-11-24 three flows (Beans 0197, 0216, 0225) idled for about 3.5 hours behind +PR #268, which was approved and calibrated and only needed the maintainer's merge. Part of the overlap was `README.md` +alone. + +## Goal + +- An overlap no longer stops the work, only the push. Stage 3 executes at once on the current base and keeps the result + local (or on a branch that opens no pull request). +- When the blocking pull request merges or closes, the flow syncs with the target, resolves any conflict on discovery + (Bean 0376's resolver), re-runs the tests, and publishes. +- First step: apply this to low-risk overlaps (documentation, registries, generated lists). Overlaps on core engine + files keep the strict wait until the first step has proved itself; the maintainer found sequential runs cheaper there. +- The class of an overlap (low-risk or strict) is decided by rule from the overlapping paths and shown in the refusal. + +## Notes + +- Overlap: Bean 0394 recommendation 1 is the same change. This bean owns the fix. +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. +- Depends on Bean 0376 (conflict resolution at every stage). +- Fail early applies: a conflict the resolver cannot settle is reported at once, not at the end. + +## Measured (self-improvement audit 2026-11-24) + +In the period 2026-11-21 to 2026-11-24, 50 of 140 flow runs ended at a Stage 3 overlap refusal and were launched again; +the 48 measured waits total 39.8 hours of flow time (median 1.1 minutes, longest 17.5 hours on execute-stage-object). +Each wait is a full relaunch (pre-flight, admission) rather than a wait inside one run, and its time cannot be read from +the logs as a wait (Bean 0412). The files behind most refusals are a handful of shared files (README 106 refusal lines, +`flow_module_budgets.json` 67, `flow/__init__.py` 53); Bean 0410 removes them from touch sets. diff --git a/.beans/holon-agentic-coder-ref-metadata-0396--flow-runs-survive-the-session-that-started-them.md b/.beans/holon-agentic-coder-ref-metadata-0396--flow-runs-survive-the-session-that-started-them.md new file mode 100644 index 00000000..9ff9e593 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0396--flow-runs-survive-the-session-that-started-them.md @@ -0,0 +1,45 @@ +--- +# holon-agentic-coder-ref-metadata-0396 +title: "A flow run survives the agent session that started it" +status: todo +type: feature +priority: high +tags: + - flow + - wrapper + - harness + - reliability +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-26T05:25:00Z +--- + +## Problem + +`run_holon_flow.py` runs as a child of the agent session that launched it. On 2026-11-24 a session restart at about +07:19Z killed four wrappers at once (Beans 0387, 0197, 0216, 0225), left a role container running without an owner, and +the flows stayed stopped until the maintainer asked for them to be resumed. An earlier network outage did the same to +the watchers. + +## Goal + +- A flow is started under a supervisor that does not depend on any agent session, so a restart, a crash or a closed + terminal changes nothing for the flow. +- One runner per checkpoint, enforced by a lock that also sees live role containers (Bean 0390). +- Any session can list the supervised flows, attach to their logs and ask one to stop. +- The driving subagent becomes a watcher: it can die and be replaced without touching the flow. + +## Notes + +- Occurrence (2026-11-24, about 12:50Z): the Docker restart that applied the memory increase killed every running flow's + containers and stopped two flows. A flow supervisor that survives such events would have restarted or reported them. +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. +- Harness-side first (the wrapper and the skill); an engine-side `holon flow --detach` can follow. +- Related: Bean 0390 (two runners on one checkpoint), Bean 0385 (flow log empty while the wrapper waits). + +## Audit evidence, 2026-11-26 (flow time audit) + +Flow time audit (`todo/flow-time-audit-2026-11-26.md`): one network outage on 2026-11-25 about 06:24 to 07:01Z stopped +three flows (pre-flight UNKNOWN in the overlap poll of `ledger-fragments-and-promotion`, resolver ENOTFOUND in +`workspace-survival-job-parallel`, Docker down in the `calibration-merge-adapted-file` resync). None was relaunched +until 22:47 to 23:11Z: about 16.5 h idle each, 67 % of all measured flow time in the sample. See Bean 0480 for the +wrapper-side wait-and-retry; this bean's supervisor is what would relaunch after it gives up. diff --git a/.beans/holon-agentic-coder-ref-metadata-0397--resume-adopts-a-completed-pushed-execution-branch.md b/.beans/holon-agentic-coder-ref-metadata-0397--resume-adopts-a-completed-pushed-execution-branch.md new file mode 100644 index 00000000..1cc68136 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0397--resume-adopts-a-completed-pushed-execution-branch.md @@ -0,0 +1,40 @@ +--- +# holon-agentic-coder-ref-metadata-0397 +title: "A resume adopts a completed, pushed execution branch instead of executing Stage 3 again" +status: todo +type: bug +priority: high +tags: + - flow + - stage-3 + - resume + - holon-agentic-coder +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +When a run is killed after its executor finished and pushed, the checkpoint still says `execute` with no execution +branch, and a resume dispatches a new executor. Bean 0387's flow executed Stage 3 four times on 2026-11-24 +(`E-1795500528`, `E-1795504454`, `E-1795504981`, `E-1795505480`); only the last was used, and three complete execution +branches remain on origin. + +## Goal + +- On resume at Stage 3, the engine looks for execution branches of this plan (and the recovery ref + `refs/holon/recovery/E-*`) that completed: the executor's final commit and ledger row are present. It adopts the + newest complete one, records the adoption in the checkpoint and goes to Stage 4. +- An incomplete branch is not adopted; the engine says which branches it found and why each was or was not used. +- Superseded execution branches are listed in the flow summary so they can be cleaned up. + +## Notes + +- Overlap: Bean 0375 (resume ignores an interrupted execution branch with commits but no ledger row) covers the unpushed + or ledger-less case; this bean covers a completed, pushed branch. Both change the Stage 3 resume lookup, so Bean 0375 + owns the shared branch-adoption code and this bean follows it. +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. +- Mirrors Bean 0360 (a resume adopts a pushed plan branch). +- Related: Bean 0390 (the ambiguity guard that fired when two branches appeared during one dispatch). +- 2026-11-26: prerequisite Bean 0375 delivered via PR #345, merged into `main` (`1567b6b`). Ready to start from current + `main`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0398--stacked-start-from-an-approved-unmerged-pull-request.md b/.beans/holon-agentic-coder-ref-metadata-0398--stacked-start-from-an-approved-unmerged-pull-request.md new file mode 100644 index 00000000..e9a61666 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0398--stacked-start-from-an-approved-unmerged-pull-request.md @@ -0,0 +1,44 @@ +--- +# holon-agentic-coder-ref-metadata-0398 +title: "A flow blocked only by an approved pull request can start from that pull request's head" +status: draft +type: feature +priority: low +tags: + - flow + - stage-3 + - admission + - performance + - holon-agentic-coder +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-25T05:45:00Z +--- + +## Problem + +A flow that depends on, or overlaps, a pull request that is already approved and calibrated waits for the maintainer's +merge before it starts, although the code it needs is final in all but name. + +## Goal (needs a maintainer decision before any work) + +- Such a flow may take the approved pull request's head as its base, run all five stages, and open its own pull request + stacked on the first. +- When the first pull request merges, the stacked one is retargeted to `main` and synced; if the first is changed or + closed, the stacked flow is told at once and re-syncs or stops. + +## Open questions + +- Whether the maintainer wants stacked pull requests into `main` at all; review and merge order become coupled. +- Whether Bean 0395 (work during the overlap wait) already removes enough of the wait to make this unnecessary. + +## Notes + +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. Recorded as + a draft: it changes what a flow's base is. +- Related: Bean 0266 (CI on pull requests into any branch). + +## Audit evidence, 2026-11-25T05:45Z (self-improvement audit, fifth merge #288 to #299) + +- 0371 (Claude Code) was refused at 05:32:48Z only because approved PR #305 (Antigravity, ready since 01:49Z) touches + `flow/git_refs.py`. In the period, ready PRs waited a median of 335.7 min for the merge, and 8 approved self-doc + slices (#300 to #307) held 8 to 15 files each while they waited. diff --git a/.beans/holon-agentic-coder-ref-metadata-0399--ci-waits-react-within-seconds-not-poll-every-two-minutes.md b/.beans/holon-agentic-coder-ref-metadata-0399--ci-waits-react-within-seconds-not-poll-every-two-minutes.md new file mode 100644 index 00000000..0e55097b --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0399--ci-waits-react-within-seconds-not-poll-every-two-minutes.md @@ -0,0 +1,53 @@ +--- +# holon-agentic-coder-ref-metadata-0399 +title: "CI waits react within seconds of a check finishing instead of polling every two minutes" +status: completed +type: feature +priority: high +tags: + - flow + - ci + - performance + - holon-agentic-coder +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-25T00:20:30Z +--- + +## Problem + +`wait_for_pending_ci` doubles its poll interval up to `CI_WAIT_POLL_CEILING_SECONDS = 120`. Once a wait has run a few +minutes the engine looks at CI once every two minutes, so it can idle up to two minutes after the pipeline has finished +or a check has failed. The flow logs show check results arriving in two-minute steps (for example 08:02:44, 08:04:45, +08:06:47, 08:08:48 on 2026-11-21). A flow has two or three such waits. The Stage 3 overlap wait in the wrapper polls +every 60 s in the same way. + +## Goal + +- The engine learns of a finished or failed check within about 15 seconds: cap the backoff at 15 s now, and use the pull + request event stream when it is available (Bean 0352). +- A failed check ends the wait at once (fail early); this already holds in the review loop and must hold in the + merged-head gate and the final-head check too. +- The overlap wait in the wrapper wakes on the merge event, with the 60 s poll kept as the fallback. + +## Notes + +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. +- Small engine change (`flow/github/ci_wait.py`, `flow/github/ci_final_head.py`); the event stream is Bean 0352. +- Watch the GitHub API rate limit when lowering the cap; one checks call every 15 s per flow is well inside it. + +> 2026-11-24: launched `ci-wait-fast-poll-and-early-fail` (intent +> `todo/intent-0399-ci-wait-fast-poll-and-early-fail.json`) via `antigravity-agent` / `gemini-4-neon`. + +## Resolution + +Delivered via [PR #277](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/277) and merged into `main` +(`29e28f52cf1e6c7a77411dcfc67f18038f7aeabc`, `2026-11-25T00:18:17Z`): + +- **Fast 15 s CI Poll Backoff Cap**: Lowered `CI_WAIT_POLL_CEILING_SECONDS` from `120.0` to `15.0` in + `sandbox_executor/flow/github/ci_wait.py` and clamped initial poll intervals to `policy.ceiling` in both + `wait_for_pending_ci` and `merged_head_gate._poll_head`. +- **Consistent Fail-Early CI Waits**: Enabled `stop_on_failure=True` (default) in `ci_final_head._settled_status` and + guarded `_eligible_run_ids` when checks remain pending, matching the review-loop and merged-head gates. +- **Verification & Follow-up**: Expanded hermetic unit tests in `test_review_ci_wait.py`, `test_merged_head_ci_gate.py`, + and `test_calibrate_final_head_ci.py` across the 5-stage Holon flow. Follow-up event-stream / `gh webhook forward` + subscription remains tracked under Bean `0352`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0400--shorten-the-ci-pipeline.md b/.beans/holon-agentic-coder-ref-metadata-0400--shorten-the-ci-pipeline.md new file mode 100644 index 00000000..6ac96304 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0400--shorten-the-ci-pipeline.md @@ -0,0 +1,98 @@ +--- +# holon-agentic-coder-ref-metadata-0400 +title: "Shorten the CI pipeline: the slowest jobs set every wait in the flow" +status: in-progress +type: task +priority: normal +tags: + - ci + - performance + - holon-agentic-coder +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-26T06:14:00Z +--- + +## Problem + +Every flow waits for the pipeline at least twice. Over 33 measured waits the median was 7.9 minutes and the longest 11.9 +minutes. The checks that finish last are `Workspace survival (ubuntu-latest)` and `unit (macos-latest)`. + +## Goal + +- Measure each job's queue time and run time (Bean 0166 has the dashboard) and name the two that set the total. +- Bring the pipeline's wall-clock time down: dependency and image caching, sharding the unit suite, running the macOS + unit job only for changes that can behave differently there, moving `Workspace survival` off the critical path if it + cannot be made faster. +- Fail fast inside the pipeline: `fail-fast` is `false` on the unit, make and integration matrices today, so a failed + leg lets its sibling run to the end. Decide per workflow whether that is still wanted. (Superseded runs are already + cancelled on pull requests.) + +## Notes + +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. +- Related: Bean 0168 (unit suite runs 1.7x slower on macOS), Bean 0166 (pipeline duration dashboard), Bean 0300 (CI runs + once per change). +- No target is set here; the first step is the measurement. + +## Audit evidence, 2026-11-25T05:45Z (self-improvement audit, fifth merge #288 to #299) + +- Measured after #275 and #278 (74 PR heads, 00:33Z to 05:30Z, + `todo/self-improvement-audit-2026-11-25a/pipeline-fixes.md`): full pipeline wall median 7.6 min, p90 8.7 min, down + from 10.8 / 24.2 min before #272. Bookkeeping heads are gated to 0.9 min. +- The critical path is now `unit (macos-latest)`: median 7.0 min, longest 9.5 min, against 3.2 min for + `unit (ubuntu-latest)` on the same heads. `Test - Stress` (Workspace survival) is second at 6.3 min. Running the macOS + leg only for changes that can behave differently there would take about 3 min off every code and main-merge head. +- Main-merge heads now cost more than code heads: 28 of 78 heads in the period, 409 runner-min, against 167 runner-min + for the 13 code heads (see Bean 0458 for the hand syncs behind most of them). + +## Progress + +- 2026-11-26 06:11Z: macOS part delivered by PR #319 + (https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/319), merged as `412bed21` (flow slug + `macos-unit-sensitive-paths-only`, plan `P-1795669298-CLA-CO5.5`). Rule: the `unit (macos-latest)` steps after + `Install uv` run on a pull request only when a changed file (new or old version, deleted or renamed files judged by + their old path and content) matches a platform-sensitive path or content list (`scripts/macos_relevance_rules.py`); + otherwise the gate skips them and the job succeeds under the same check name. The leg always runs on push to `main`, + with the `ci-macos` label, and when the changed-file list is empty or unreadable. Accepted risk: a macOS-only break in + a file judged neutral is caught by the push-to-main run after merge. Replay share: `1 / 62` merged pull requests #241 + to #314 would skip the macOS leg (1.6%, only #264; 46 runs by `sensitive-content`, 15 by `sensitive-path`), so the + saving is small on past history. Measured macOS time: the approved code head `b159b7d` ran the full leg in 8.9 min + (job 05:57:40Z to 06:06:34Z; `Run unit tests` 9.5 min); the bookkeeping-only heads `af89e4c` and `4e9af1d` skipped it + in about 0.3 min. Replay counts are from the execution record (`executions/E-1795670038-CLA-CO5.5.md`); the PR body's + "74 pull requests" is not what the replay counted. Superseded attempt PR #315 closed unmerged; its branches and + worktree were removed after #319 merged. +- Remaining scope (bean stays in-progress): dependency and image caching; sharding the unit suite; moving + `Workspace survival` off the critical path (or making it faster); the fail-fast decision per workflow. + +- 2026-11-26: #315's neutral-list gate (skip the macOS leg when every changed file is platform-neutral) would have + skipped 0 of 74 merged pull requests #241 to #314, because every flow pull request changes code. Replaced by intent + `macos-unit-sensitive-paths-only` (sensitive-path rule: run the macOS leg only when a changed file matches a stated + platform-sensitive path or content list; maintainer choice 2026-11-26). Flow launched 2026-11-26 05:01Z by + `run_holon_flow.py` (claude-agent / claude-opus-5-5, worktree `flow-macos-unit-sensitive-paths-only`, log + `todo/flow-macos-unit-sensitive-paths-only.log`). PR #315 is superseded by #319 (closed unmerged; see the 2026-11-26 + 06:11Z entry). +- In progress, 2026-11-25: holon flow `macos-unit-only-when-relevant` (scope: the macOS leg only, the + `unit (macos-latest)` relevance gate), run by `run_holon_flow.py` with claude-agent / claude-opus-5-5 in worktree + `flow-macos-unit-only-when-relevant`, log `todo/flow-macos-unit-only-when-relevant.log`. +- Stage 1 and Stage 2 done (plan P-1795647426-CLA-CO5.5, EV 34.1). Stage 3 refused for a touch-set overlap with the + local flow `intent-0371-ledger-fragments-and-promotion` on `.github/workflows/README.md`; the wrapper exited instead + of waiting (Bean 0468). Resume from the checkpoint once that flow finishes; no `--allow-overlap`. +- 2026-11-25 23:33Z: flow parked at Stage 3 admission. Overlap with `intent-0371-ledger-fragments-and-promotion` (PR + #310, open, MERGEABLE) on `.github/workflows/README.md`. No `--allow-overlap`. Resume from + `/Users/thomashan/git/holon-agentic-coder-ref-metadata/apps/holon-agentic-coder/flow-macos-unit-only-when-relevant/.holon/flow/checkpoint-macos-unit-only-when-relevant.json` + after #310 merges (see Bean 0468 for the wrapper's missing overlap wait). +- 2026-11-26 04:49Z: flow completed through Stage 5 for PR #315 + (https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/315, OPEN, MERGEABLE/CLEAN, head ddb315bf). Review + approved (iteration 3, head a913aafb); calibration report `P-1795666532-CLA-CO5.5_calibration.md` is in the PR diff; + final head CI success per the flow summary. Awaiting human merge. Bean stays in-progress until the maintainer merges + PR #315. + +## Audit evidence, 2026-11-26 (flow time audit) + +Flow time audit (`todo/flow-time-audit-2026-11-26.md`), all workflow jobs of PRs #296 to #316 (21 PRs, 146 heads with +CI): queue time is negligible (median 2 s, p90 4 s for every job). Run time median / p90: `unit (macos-latest)` 6.0 / +8.8 min, `Workspace survival (ubuntu-latest)` 5.2 / 7.7, `unit (ubuntu-latest)` 3.0 / 4.2, `integration` 2.2 / 2.5, +`build` 1.7 / 2.0, `hygiene` 1.0 / 1.1. Full-pipeline heads take about 8 to 10 min; bookkeeping-only heads are now quick +(Stage 5 CI wait 1.2 to 1.7 min, Bean 0403 working). The approving review iteration of every flow ends when the pipeline +ends (reviewers wait for it, Bean 0478), so the macOS unit leg sets about 6 to 9 min of every flow. Up to 46 superseded +runs per long PR were cancelled (for example 46 of 138 on #308, 40 of 102 on #310). diff --git a/.beans/holon-agentic-coder-ref-metadata-0401--ci-registration-wait-ends-unknown-on-the-pushed-head.md b/.beans/holon-agentic-coder-ref-metadata-0401--ci-registration-wait-ends-unknown-on-the-pushed-head.md new file mode 100644 index 00000000..0f621fa7 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0401--ci-registration-wait-ends-unknown-on-the-pushed-head.md @@ -0,0 +1,57 @@ +--- +# holon-agentic-coder-ref-metadata-0401 +title: "The CI registration wait ends unknown when the pull request head lags the pushed head" +status: completed +type: bug +priority: normal +tags: + - flow + - ci + - stage-5 + - holon-agentic-coder +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-26T12:10:00Z +--- + +## Problem + +After Stage 5 pushes, the final-head check waits up to 180 s for the pull request to show the pushed commit and for +checks to register. Twice on 2026-11-23 it gave up with "final head CI: unknown (the PR head did not match the pushed +head before the registration wait ran out)", so the flow finished with CI on its final head not verified, after waiting +three minutes for nothing. + +## Goal + +- The check waits for the pushed commit itself (the commit's check runs), not for the pull request object to catch up, + so a lagging pull request head does not hide checks that are already running. +- When registration truly has not happened, one retry with a fresh read before reporting unknown; the report says which + of the two it was. +- An unknown result is treated as a failure to verify and reported at once (fail early), not folded into a success. + +## Notes + +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. +- Code: `flow/github/ci_final_head.py`, `flow/github/ci.py` (`CI_REGISTRATION_TIMEOUT_SECONDS = 180`, + `CI_REGISTRATION_POLL_SECONDS = 15`). + +## Progress + +- 2026-11-26: flow ci-final-head-wait-on-pushed-commit launched (intent + todo/intent-0401-ci-final-head-wait-on-pushed-commit.json, log todo/flow-ci-final-head-wait-on-pushed-commit.log). +- 2026-11-26: PR #335 open, review approved 3/3, Stage 5 calibration included, MERGEABLE/CLEAN; awaiting maintainer + merge. + +## Resolution + +Delivered via [PR #335](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/335) and merged into `main` +(`f0d6c56d`): + +- **Key Architectural Deliverables**: the final-head check in `flow/github/ci_final_head.py` probes the check runs of + the pushed commit itself instead of waiting for the pull request head to catch up. When no checks have registered, it + retries once with a fresh read; the unknown reason names which case occurred. An unknown result is reported at once as + a failure to verify. +- **Verification & Tests**: `tests/flow/github/test_ci_final_head_registration.py`, + `tests/test_calibrate_final_head_ci.py`. +- **Holon Flow Traversal**: flow `ci-final-head-wait-on-pushed` completed all 5 stages (review 3/3 approved, calibration + included). Flow worktree and its `I-*` branches removed locally and on origin. +- **Follow-up**: `ci_final_head.py` is 368 lines on `main`, over the 350 step-2 budget; bean 0489 records it. diff --git a/.beans/holon-agentic-coder-ref-metadata-0402--image-rebuilds-do-not-disturb-running-flows.md b/.beans/holon-agentic-coder-ref-metadata-0402--image-rebuilds-do-not-disturb-running-flows.md new file mode 100644 index 00000000..959cc1cc --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0402--image-rebuilds-do-not-disturb-running-flows.md @@ -0,0 +1,32 @@ +--- +# holon-agentic-coder-ref-metadata-0402 +title: "A post-merge image rebuild does not disturb flows that are running or starting" +status: todo +type: bug +priority: normal +tags: + - harness + - docker + - post-merge + - reliability +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-24T08:30:00Z +--- + +## Problem + +After a pull request merges, the post-merge steps rebuild the agent images and reinstall the CLI in place. On 2026-11-24 +the `holon/agent-claude` image was rebuilt at 07:45:07Z, the moment two flows left their overlap wait and started +containers; both aborted at pre-flight (Bean 0393). A flow can also start a stage on one image and finish it on another. + +## Goal + +- Images are built under a new tag and `latest` is switched only when the build is complete. +- A flow records the image it started with and keeps using it until it ends; the next flow picks up the new one. +- The post-merge skill does not rebuild while a flow is in pre-flight, or the engine tolerates it (Bean 0393). + +## Notes + +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. +- The link between the rebuild and the slow pre-flight exit is probable, not confirmed (see Bean 0393). +- Harness side: the `install-holon`, `install-coherence` and `post-pr-merge` skills. diff --git a/.beans/holon-agentic-coder-ref-metadata-0403--no-full-ci-for-bookkeeping-only-commits.md b/.beans/holon-agentic-coder-ref-metadata-0403--no-full-ci-for-bookkeeping-only-commits.md new file mode 100644 index 00000000..6b5b1903 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0403--no-full-ci-for-bookkeeping-only-commits.md @@ -0,0 +1,76 @@ +--- +# holon-agentic-coder-ref-metadata-0403 +title: "No full CI run for commits that only touch bookkeeping files" +status: in-progress +type: feature +priority: high +tags: + - ci + - flow + - performance + - holon-agentic-coder +created_at: 2026-11-24T08:30:00Z +updated_at: 2026-11-25T03:08:00Z +--- + +## Problem + +Stage 4's ledger rows and Stage 5's calibration commits touch only `plans/`, `executions/` and `holon-knowledge/`. They +cannot change a test result, yet each push of them starts the whole pipeline (median 7.9 minutes) and the flow waits for +it. No workflow has a path filter today. This is the second CI wait of every Stage 5. + +## Goal + +- A push whose changes since the last fully tested commit lie only in those paths finishes its required checks in + seconds: path filters with a matching always-green job for each required check, or one gate job that decides and skips + the rest. +- The engine may equally treat such a head as covered by the last full run and not wait at all; pick one mechanism and + make the other consistent with it. +- A change outside those paths, however small, always gets the full pipeline. The rule is tested with a mixed commit. +- Formatting checks that do apply to these files (Prettier on the calibration report) still run. + +## Notes + +- Logged from Bean 0394 (no unnecessary waiting in the holon flow), on the maintainer's word of 2026-11-24. Split out of + Bean 0383 (Goal 2) so it can run by itself: it changes the workflow files, not the flow engine. +- Saves about 8 minutes in every flow. + +## Progress + +- 2026-11-24: flow `ci-skip-bookkeeping-only-pushes` launched (`claude-agent` / `claude-fable-5-2`). Design chosen: an + in-job gate, not workflow path filters, because on pull request events GitHub evaluates path filters against the whole + pull request diff. The main ruleset has no required status checks, so job names are kept only for continuity. + +- 2026-11-24 21:10Z: PR #272 merged (`4c82c0f`) through the merge queue. The gate (`scripts/ci_bookkeeping_gate.py`, the + composite action, six workflow wirings, 225 tests) is on `main`. Not closed: the live effect is not yet shown. On PR + #272 the calibration and reconciliation pushes had no workflow runs at all, and the promotion push fell back to a full + run (unit macOS 259 s). The engine-side wait is not changed by this PR. Next step: confirm on a real bookkeeping-only + push that every job finishes in seconds. Flow worktree and branches pruned after post-merge; backup in + `todo/post-merge-backups/ci-skip-bookkeeping-only-pushes-2026-11-25.bundle`. + +## Measured (self-improvement audit 2026-11-24) + +From GitHub check runs of the 47 pull requests merged 2026-11-21 to 2026-11-24 (both target repositories; scripts in the +git-ignored `todo/self-improvement-audit-2026-11-24/`, `pipelines.py`): 422 pipeline runs, 230 of them (55 percent) on +heads whose diff against the previous tested head lies only in `holon-knowledge/`, `plans/` and `executions/`. Every +pull request had at least two such runs; PR #263 had 11, PR #267 and #268 had 9 each. 14 of these bookkeeping-only heads +failed a check anyway: 7 involving `hygiene` (Prettier on engine-written `executions/E-*.md` and calibration reports, +Bean 0408) and 8 involving `unit` (mostly the macOS timing ceiling, Bean 0404), each of which withdrew or delayed an +approval of unchanged code. The Stage 4 ledger commit (148 in the logged flows) is the main source. + +## Audit evidence, 2026-11-25T02:54Z (self-improvement audit, fifth merge) + +- Verified live effect across `22` post-Stage-3 bookkeeping heads in `2026-11-25T00:28Z–02:54Z` (`#278`, `#298`–`#307`, + `#296`): `Test - Unit` skipped in `13–23 s`, `Test - Stress` in `9–19 s`, `Test - Integration` in `11–16 s`, + `Docker Build` in `9–18 s`, `Run Make` in `11–23 s`, and `Test - Hygiene` finished in `38–62 s`, dropping Stage 5 + `final_head_ci` wait across `13` runs to a median of `0.82 min` (`max 1.81 min` on `#296`) vs `7.92 min` on + `merged_head_ci`. +- Remaining gap: when Stage 4 pushes `chore(review): record review ledger rows` `9–12 s` after a resolver or + conflict-gate push (`#296`, `#305`, `#306`), the earlier head's CI is cancelled before finishing, so the ledger-row + push cannot skip CI and runs the full `6–9 min` suite anyway; tracked in Bean `0443`. + +## Evidence (audit 2026-11-26T10:50Z) + +Heads that ran full CI per PR (unit workflow runs, all green): #325 8 (19 commits), #326 14 (22), #327 7 (17), #329 3 +(9), #330 5 (13), #331 7 (15): 44 heads, 0 failed unit runs, so every extra head was bookkeeping or review-resolver +churn. Each head also runs six other workflows. diff --git a/.beans/holon-agentic-coder-ref-metadata-0404--macos-unit-timing-ceiling-fails-on-runner-variance.md b/.beans/holon-agentic-coder-ref-metadata-0404--macos-unit-timing-ceiling-fails-on-runner-variance.md new file mode 100644 index 00000000..7f8d67f0 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0404--macos-unit-timing-ceiling-fails-on-runner-variance.md @@ -0,0 +1,125 @@ +--- +# holon-agentic-coder-ref-metadata-0404 +title: "The 600 s timing ceiling on the macOS unit job fails pull requests on runner variance" +status: in-progress +type: bug +priority: high +tags: + - ci + - timing-gate + - flake + - holon-agentic-coder +created_at: 2026-11-24T09:35:00Z +updated_at: 2026-11-26T08:49:03Z +--- + +## Problem + +`unit (macos-latest)` has an absolute ceiling of 600 s in the CI Timing Gate (`test-unit.yml`, `--ceiling 600`), and the +`timing-regression-accepted` label does not lift it. The job's duration swings by a factor of two to three between runs +of the same code, and its normal value sits just under the ceiling, so the gate fails pull requests at random: + +| Branch (2026-11-24, UTC) | macOS unit job durations | +| :------------------------------ | :-------------------------------------- | +| `main` (07:42) | 565 s | +| `claude-code-mode-default-on` | 576 s, 588 s, 549 s | +| `flow-e2e-test-teardown` | 387 s, **744 s (failed)**, 555 s, 577 s | +| `ledger-temp-worktree-cleanup` | 451 s, 598 s, 250 s | +| `claude-token-os-keychain-only` | 234 s, 257 s, **663 s (failed)** | + +The last row is the same pull request (#271): 234 s and 257 s on two heads, then 663 s on a head that added only +calibration commits. The ubuntu job stayed between 204 s and 302 s throughout. On #271 the failure withdrew a 3/3 +approval in Stage 5 and stopped the flow of Bean 0225; the engine's one automatic rerun failed the same way. + +## Goal + +- A slow runner does not fail a pull request: judge the gate on test time measured inside the job (the JUnit total) + rather than on wall-clock time that includes runner start-up and dependency install, or take the best of the rerun + attempts, or set the ceiling from the measured spread instead of a fixed 600 s. +- Find why the macOS job is bimodal (about 250 s or about 570 s for the same code): runner hardware class, cache hit or + miss, or worker count. +- The engine's timing-noise rerun (`_retry_timing_noise`) covers this case: it should retry a ceiling failure on a head + whose code did not change, more than once if needed, before withdrawing an approval. + +## Notes + +- Overlap: Bean 0419 is the same defect (the timing gate failing a green job on a slow runner and withdrawing + consensus). This bean owns the fix; Bean 0419 is covered by the same flow. +- Found on Bean 0225's flow, 2026-11-24. The flow subagent could not tell whether the pull request or the runner was + slow; the table above shows it is the runner. +- Related: Bean 0168 (unit suite runs 1.7x slower on macOS), Bean 0400 (shorten the CI pipeline), Bean 0163 (the timing + gate, completed), Bean 0403 (no full CI for bookkeeping-only commits would have avoided this run entirely). + +## Second occurrence (2026-11-24T09:40Z, Bean 0387) + +- Pull request #270 (`ledger-temp-worktree-cleanup`): 3/3 approval, then Stage 5 failed with "CI is red on final head + 6c7be9a after one automatic rerun of the timing gate: unit (macos-latest) (CI Timing Gate, 11.1 min)". The same branch + ran that job in 250 s an hour earlier. Two flows were stopped by this gate within one hour, and Stage 5 ran 33 minutes + against its 10-minute budget waiting for it. +- Separate defect seen in the same log: straight after "Not ready to merge. The approval covered 8605f54 and no longer + stands" the flow prints "[REVIEW APPROVED] Review Loop reached consensus approval; the PR is ready for the maintainer + to merge". The closing banner must follow the final state of the flow, not the Stage 4 result. + +- 2026-11-24: the flows of Beans 0403 and 0405 attack the cause (fewer full pipeline runs and a faster unit suite); this + bean still needs the maintainer's choice between judging test time and raising the ceiling. + +## Third occurrence — Workspace survival (`ubuntu-latest`) also hits `--ceiling 600` (2026-11-24T10:59Z, Bean 0226) + +- Pull request #269 (`flow-e2e-test-teardown`, Bean 0226): `Workspace survival (ubuntu-latest)` (`test-stress.yml`) + failed at `2026-11-24T10:59:27Z` with `Job took 609 s, above the 600 s ceiling` while reporting + `Per-test report: no test grew by more than 50 % and 5 s against its baseline median`. +- Recent `Workspace survival (ubuntu-latest)` durations were already near saturation: `513 s` on #267 and `554 s` on + #268. +- Scope note: any fix for `unit (macos-latest)`'s fixed `--ceiling 600` (judging JUnit test time instead of runner + wall-clock, raising the ceiling, or retrying ceiling-only noise) should cover all `--ceiling 600` timing-gate jobs + including `test-stress.yml` (`Workspace survival`). + +## Progress + +- 2026-11-24: flow `timing-gate-judges-test-time` launched (`claude-agent` / `claude-fable-5-2`), covering this bean and + Bean 0419 together. Approach taken, on the agent's recommendation after the maintainer asked for the highest-priority + bean to be picked up: the gate judges summed test time from the JUnit report instead of job wall-clock time and treats + a slowdown spread across the whole suite as runner variance; the 600 s ceiling value and the workflow file are + unchanged. Not in this flow: the engine retrying a timing-only failure before withdrawing an approval (it touches the + review and calibrate code that Beans 0376, 0407 and 0399 are changing). + +## Fourth occurrence — PR #273 `unit (macos-latest)` ceiling failure (2026-11-24T12:17:52Z) + +- `holon-agentic-coder#273` (`route-stage-4-and-stage-5`, Bean `0376` child 4), run `45390444554` on commit `8994dec5`: + `unit (macos-latest)` failed `CI Timing Gate (compare with main)` with `Job took 634 s, above the 600 s ceiling` while + all pytest cases passed (`test_child_halting_at_its_own_review_is_a_success_and_records_its_pr` `8.5 s` -> `13.7 s`). +- 2026-11-24: pull request #278 (flow `timing-gate-judges-test-time`) is approved, calibrated and green, awaiting the + maintainer's merge. Remaining scope found on its own pipeline: the `Workspace survival (ubuntu-latest)` job has its + own timing gate with a fixed 600 s ceiling on job wall-clock time and failed twice at 611 s and 602 s with no test + grown; #278 does not change that job's gate. Also unexplained: `build (macos-latest)` and `unit (macos-latest)` were + cancelled (not failed) once each on #272 and #278 and passed on a rerun. + +- 2026-11-25: PR #278 merged into `main` as `0c933519`. Delivered: the CI Timing Gate (`scripts/ci_timing_gate.py`, with + `scripts/ci_timing_noise.py`) judges summed JUnit test time, not job wall-clock, and treats a slowdown spread across + the whole suite as runner variance. The 600 s ceiling value and the workflow files are unchanged. Still open, not + delivered by #278: (1) the `Workspace survival (ubuntu-latest)` fixed 600 s wall-clock ceiling in `test-stress.yml` + (see the scope note above); (2) the engine retrying a timing-only failure before withdrawing an approval + (`_retry_timing_noise` in `apps/sandbox-executor/src/sandbox_executor/flow/github/ci_final_head.py` predates #278 and + #278 did not change it); (3) why the macOS job is bimodal (about 250 s or 570 s on the same code); (4) the cancelled + `build (macos-latest)` and `unit (macos-latest)` jobs on #272 and #278, unexplained. + +## Flow launch, 2026-11-26 + +- 2026-11-26: flow `timing-gate-runner-variance` launched (`claude-agent` / `claude-opus-5-5`), covering the items still + open here and in the other bean: the bounded rerun of a timing-gate-only failure on unchanged code in the final-head + check (`ci_final_head.py`), and the CI timing section of `docs/git_flow.md`. Main already judges summed JUnit test + time and the Workspace survival job runs at `--ceiling 900` with `--junit`, so no workflow file changes. Bimodal + runner cause and the cancelled-job question stay open. + +- 2026-11-26: flow `timing-gate-runner-variance` completed: PR #321 (head `b3ef0e4`) is OPEN, MERGEABLE/CLEAN, 11 of 11 + checks green, review approved (consensus score 1, ensemble of 3, two passes), calibration report in the PR diff, + final-head CI success. Delivered: the final-head timing-noise rerun is bounded and covers unchanged-code heads + (`ci_final_head.py`), the Workspace survival bare `Timing gate` step is recognised as a timing gate + (`ci_failure_detail.py`, outside the intent scope, see bean 0492), and `docs/git_flow.md` states the rule. Awaiting + the maintainer's merge. + +- 2026-11-26: PR #321 merged into `main` as `903aafe4`; bean 0419 closed by it. Delivered: the final-head timing-noise + rerun is bounded and covers unchanged-code heads (`ci_final_head.py`, `ci_timing_rerun.py`); the Workspace survival + bare `Timing gate` step is recognised (`ci_failure_detail.py`); `docs/git_flow.md` states the rule. Still open, so the + bean stays `in-progress`: (1) the bimodal macOS runner cause (about 250 s or 570 s on the same code); (2) the + cancelled `build (macos-latest)` and `unit (macos-latest)` jobs on #272 and #278, unexplained. diff --git a/.beans/holon-agentic-coder-ref-metadata-0405--clean-up-unnecessary-unit-tests.md b/.beans/holon-agentic-coder-ref-metadata-0405--clean-up-unnecessary-unit-tests.md new file mode 100644 index 00000000..089a9c18 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0405--clean-up-unnecessary-unit-tests.md @@ -0,0 +1,260 @@ +--- +# holon-agentic-coder-ref-metadata-0405 +title: "Clean up unnecessary unit tests: the suite has outgrown the pipeline" +status: in-progress +type: task +priority: high +tags: + - tests + - ci + - performance + - holon-agentic-coder +created_at: 2026-11-24T09:55:00Z +updated_at: 2026-11-26T11:37:00Z +--- + +## Why + +Maintainer, 2026-11-24: "the tests are getting quiet long now. ubuntu unit test take 4m, workspace survival takes 7m, +and macos unit test takes more than 8m. make a bean to clean up all unncessary unit tests". + +## Problem + +The unit suite of `apps/sandbox-executor` has grown faster than anything prunes it, and every flow waits for it at least +twice. + +| Measure (2026-11-24) | Value | +| :----------------------------------- | :----------------------------------------------------------- | +| Test files | 243 | +| Lines of test code | about 71,800 | +| Test functions | 3,486 (6,470 collected cases with parametrisation) | +| `unit (ubuntu-latest)` | 204 to 302 s today; about 120 s when the timing gate was set | +| `unit (macos-latest)` | 234 to 744 s today; 235 to 370 s when the gate was set | +| `Workspace survival (ubuntu-latest)` | 6.5 to 7 minutes | +| Largest files | `test_review_loop.py` 2,579 lines, `test_cli.py` 1,859, | +| | `test_calibration.py` 1,780, `test_local_llm.py` 1,327 | + +The suite roughly doubled in run time since the gate's thresholds were written into `test-unit.yml`. The macOS job now +sits at the 600 s ceiling and fails approved pull requests on runner variance (Bean 0404); two flows were stopped by it +within an hour on 2026-11-24. Every flow adds tests (review findings and surviving mutants each add more) and nothing +removes any. + +## Goal + +1. **Measure first.** From the JUnit reports of recent runs on `main`: time per test, per file and per fixture, on both + runners; list the slowest 50 tests and the files that carry most of the time. No test is removed on a guess. +2. **Remove what is unnecessary**, each removal with its reason: + - duplicates: tests that assert the same behaviour through the same path (often one per review finding); + - tests that only restate the implementation (mock in, same mock out) and cannot fail for a real defect; + - parametrised cases that add no new branch; + - tests for code that has been deleted or is unreachable; + - tests superseded by a broader test that covers the same lines and mutants. +3. **Make the necessary ones cheap**: real sleeps, real subprocesses, real git repositories and real timeouts in unit + tests replaced by fakes or injected clocks (Bean 0167 is one instance); expensive fixtures shared at module or + session scope where it is safe; anything that needs Docker, the network or a real repository moved to the integration + or stress suite. +4. **Keep the safety net**: line and branch coverage do not fall, and the mutation score of the touched modules does not + fall. A removed test that was the only killer of a mutant is kept or replaced. +5. **Workspace survival**: say why it takes 7 minutes and whether it must run on every push or only when the paths it + protects change. +6. **Stop the regrowth**: a per-test time limit in the unit suite and a note in the review rules that a finding is + answered by strengthening an existing test where one exists, not always by adding one. + +## Targets (to confirm after the measurement) + +- `unit (ubuntu-latest)` back to about 2 minutes, `unit (macos-latest)` under 5 minutes on a slow runner. +- The suite's size reported in the pull request so growth is visible. + +## Notes + +- Large: plan it as a split flow, one package or test area per sub-intent (review loop, CLI, calibration, local LLM, + flow stages), each with its own before and after timings. Touch sets are test files, so they rarely overlap feature + work but do overlap each other; run the sub-intents in sequence. +- Module budgets apply to test code as they do to source; do not change the budget file. +- Related: Bean 0404 (timing ceiling fails on runner variance; this bean removes the cause, 0404 the symptom), Bean 0400 + (shorten the pipeline), Bean 0168 (unit suite slower on macOS), Bean 0167 (real 50 ms reader join in a test), Bean + 0386 (tests that fail together in one serial run), Bean 0403 (no full CI for bookkeeping-only commits). + +## Measurement (2026-11-24, main at bb71d60c) + +- Command: `uv run pytest -n auto --dist worksteal -m "not integration_test and not stress" --durations=120`, run + locally on an 18-core macOS machine in a throwaway worktree (since removed). +- Result: 6,635 passed, 3 skipped, 78 s wall, 1,193 s summed test time. +- System time 557 s against 394 s user time, so most of the cost is real subprocesses (git repositories, process + spawns). +- Concentration: + - 25 cases of 5 s or more carry 21 percent of the time; + - 130 of 2 s or more carry 45 percent; + - 330 of 1 s or more carry 68 percent; + - 565 of 0.5 s or more (8.5 percent of cases) carry 82 percent. + +Slowest files: + +| File | Summed seconds | Cases | +| :---------------------------------------------------- | -------------: | ----: | +| `tests/flow/stages/test_decomposition.py` | 94.7 | 79 | +| `tests/test_calibrate_rerun.py` | 77.6 | 42 | +| `tests/test_approval_fingerprint.py` | 68.2 | 13 | +| `tests/flow/test_dispatch.py` | 64.8 | 43 | +| `tests/test_url_credential_redaction.py` | 57.2 | 77 | +| `tests/flow/github/test_merge.py` | 38.5 | 58 | +| `tests/flow/stages/test_plan_decision.py` | 32.8 | 19 | +| `tests/flow/stages/test_plan_resume_adopts_branch.py` | 29.4 | 16 | +| `tests/flow/stages/test_children.py` | 29.1 | 26 | +| `tests/test_resume_tip.py` | 23.9 | 13 | +| `tests/test_executor_run_salvage.py` | 21.3 | 13 | +| `tests/flow/review/test_conflict_gate.py` | 21.2 | 29 | +| `tests/flow/test_git_refs.py` | 20.3 | 10 | +| `tests/test_turn_supervisor.py` | 19.9 | 47 | +| `tests/test_calibration_diff_property.py` | 19.8 | 12 | +| `tests/flow/stages/test_integration.py` | 19.6 | 5 | + +Slowest single cases: + +- Two property tests in `test_approval_fingerprint.py` take 32.8 s and 28.8 s. +- `test_calibration_diff_property.py::test_counted_files_are_exactly_the_pr_files` takes 15.2 s. +- The `doctor-*` parametrised cases of `test_url_credential_redaction.py` take 6 to 10.5 s each. + +Finding: the pipeline runs the unit selection four times per run: unit on ubuntu, unit on macOS, and twice more inside +the "Workspace survival" job (`test-stress.yml`: once from the executor's workspace path, once more by the hermetic +canary guard under a simulated container HOME). That job runs pytest without `-n auto`, which is why it takes 7 minutes. +A later sub-flow should make that job parallel or run it only when the paths it protects change; it must wait for Bean +0403's flow because both edit `test-stress.yml`. + +## Progress + +- 2026-11-24: first flow `unit-suite-slowest-tests-speedup` launched (`claude-agent` / `claude-fable-5-2`), intent + `todo/intent-0405-unit-suite-slowest-tests-speedup.json`. +- Scope: the 13 slowest test files not touched by an open pull request, plus three conftest files. +- Target: at least 60 percent less summed time for those files, with no production code change and no loss of coverage. +- Left out for now because open pull requests or running flows touch them: `test_git_refs.py`, `test_conflict_gate.py`, + `test_calibration_diff_property.py`. + +- 2026-11-25 (post-merge of PR #275, merged as `acbf790e`): first slice delivered. Scope: the 13 slowest files plus + three conftest files; no production code change. Six tests removed as duplicates of a test that proves the same, the + rest made cheap (shared repository fixtures, fakes for real subprocesses and sleeps). Measured with the same command + on the same machine, median of four alternating runs: summed time of the 13 in-scope files 323.3 s to 117.6 s, a fall + of 63.6 percent (62.0 percent counting the three test files the plan added). Target of 60 percent met. The 55.5 + percent figure in an earlier audit is the first measurement of Step 8 (235.0 s to 104.5 s), which missed the threshold + and is superseded. Coverage 93.863 to 93.873 percent; mutants killed before are killed after. +- Still open on this bean (not closed): + - Workspace survival job (`test-stress.yml`) still runs the unit selection twice without `-n auto` (about 7 minutes). + Make it parallel or run it only when the paths it protects change. Waits for Bean 0403, which also edits that file. + - Regrowth rules (goal 6): no per-test time limit in the unit suite and no review-rule note yet. + - Test areas left out: `tests/flow/test_git_refs.py` (20.3 s), `tests/flow/review/test_conflict_gate.py` (21.2 s) and + `tests/test_calibration_diff_property.py` (19.8 s), deferred because open pull requests or running flows touch them. + About 870 s of the 1,193 s summed time sits outside the 13 files. + - Targets for the pipeline (ubuntu unit about 2 minutes, macOS unit under 5 minutes) not yet re-measured on `main`. +- 2026-11-24: second slice launched, flow `workspace-survival-job-parallel` (`claude-agent` / `claude-opus-5-5`, since + `claude-fable-5-2` is over its monthly spend limit): cut the Workspace survival job's time (two stress tests that each + re-run the unit suite, run one after the other) without weakening either guarantee. Bean 0403 has landed (#272), so + the shared `test-stress.yml` is free. +- 2026-11-26 (post-merge of PR #308, merged as `a8cfaf80`): second slice delivered. The two stress tests of the + Workspace survival job now run concurrently (`-n auto --dist worksteal` in `test-stress.yml`), each with its own HOME, + workspace, TMPDIR and basetemp (`tests/stress_support.py`; `tests/test_stress_support.py` proves they share none of + them). The canary child runs only the modules picked by the rule in `tests/stress_selection.py`, and each child uses + every usable CPU. Negative controls show both guards still trip. Local measurement in the CI shape: serial 276 s, + concurrent median about 160 s (about 42 percent less). The CI job itself is not yet re-measured on `main` (run + 45725903403 in progress at merge time). The timing gate and the 'Assert the stress suite really ran' step are + unchanged. +- Still open on this bean (stays in-progress): + - Regrowth rules (goal 6): no per-test time limit in the unit suite and no review-rule note yet. + - Re-measure the pipeline targets on `main` (ubuntu unit about 2 minutes, macOS unit under 5 minutes) once the + post-merge runs finish. + - Test areas still left out: `tests/flow/test_git_refs.py` (20.3 s), `tests/flow/review/test_conflict_gate.py` (21.2 + s) and `tests/test_calibration_diff_property.py` (19.8 s), deferred while open pull requests touched them (PR #310 + and its neighbours). About 870 s of the 1,193 s summed time sits outside the 13 files of the first slice. + +## Test suite audit 2026-11-26 + +Measured on main `412bed21` (report: `todo/test-suite-audit-2026-11-26.md`, raw data in +`todo/test-suite-audit-2026-11-26/`; no code changed, no flow launched). + +- Suite: 8,311 unit cases (+25 percent since 2026-11-24), 19 integration, 2 stress. CI on the last three main pushes: + unit ubuntu 159 to 255 s (2 workers), unit macOS 478 to 530 s (3 workers), Workspace survival 207 to 321 s. Workers + end within 4 s of each other: wall is summed test time / workers, no single test sets it. +- Two causes carry the time. (1) git processes: 45,157 per unit run, about 25 ms each on macOS and 5 ms on ubuntu; + git-using files are 1,195 of 1,424 s summed on macOS. (2) A quadratic per-test fixture cost: the autouse fixtures' + `tmp_path_factory.mktemp` lists the whole worker base temp each call; 4,200 empty tests take 56.4 s, 5.7 s with a + constant-time numbered dir; median unit test 26 ms to 3 ms in an A/B at `-n 3`. +- Coverage per test: 866 identical-coverage groups, mostly cheap data cases; only about 25 s macOS summed is worth + folding, and no clean deletions beyond folds were found. +- Plan, eight test-only batches with draft intents `todo/intent-0405-tests-*.json`: constant-time temp dirs (about 40 / + 38 / 35 s off ubuntu / macOS / Workspace survival), stage-pipeline git cut (11 / 45 / 11), worktree/executor (7.5 / 30 + / 7.5), calibration (7 / 25 / 7, after the calibration split), CPU-bound matrices (10 / 14 / 10), review and + decomposition (4 / 18 / 4, after `no-unneeded-full-review`), self-doc consolidation in two parts (about 1 s, -2,400 + lines). Projected: ubuntu 250 to 170 s, macOS 512 to 339 s, Workspace survival 247 to 172 s. Running the git-heavy + pipeline tests only on ubuntu would take macOS to about 100 to 150 s (maintainer decision, Bean 0400). +- Bug found: running a subset of files loses the `flow_repos` fixture (Bean 0491). + +- Batch 1 flow started 2026-11-26 (intent `todo/intent-0405-tests-constant-time-tmp-dirs.json`, worktree + `flow-tests-constant-time-tmp-dirs`, claude-agent / claude-opus-5-5, log + `todo/flow-tests-constant-time-tmp-dirs.log`). +- Batch 3 flow started 2026-11-26 (intent `todo/intent-0405-tests-fewer-git-worktree-exec.json`, worktree + `flow-tests-fewer-git-worktree-exec`, claude-agent / claude-opus-5-5, `--no-wait-on-overlap`, log + `todo/flow-tests-fewer-git-worktree-exec.log`). + - Result 2026-11-26: flow completed; PR #323 (`I-1795677070-tests-fewer-git-worktree-exec`) APPROVED 3/3 on 907a29c2 + (iteration 1), calibrated + (`plans/I-1795677070-tests-fewer-git-worktree-exec/P-1795677093-CLA-CO5.5_calibration.md`), MERGEABLE/CLEAN at head + c8fb0b0b. Execution notes measure the in-scope files at git processes 8,819 to 5,669 (-35.7%) and summed time 91.04 + s to 58.17 s (-36.1%): the 40 percent acceptance target is missed, recorded there per the plan's discard rule, not + closed by cutting tests. CI on the head: unit macOS 553 s pytest (job 593 s, against 543 s on 907a29c2 and a 506 s + main median); ubuntu unit and Workspace survival skipped by the bookkeeping gate (carried over the 907a29c2 real + success: 263 s and 210 s); no CI saving shown yet. Bug logged: bean 0496 (flow log empty until exit). +- 2026-11-26 (post-merge of PR #323, merged as `b7b3bef`): batch 3 delivered. Test-only change; no production code + changed. Git processes in the 15 in-scope files 8,819 to 5,669 (-35.7 percent); summed test time 91 s to 58 s (-36 + percent). The 40 percent target is missed, recorded as such. CI saving not yet visible: the first post-merge runs on + `main` are not measured yet. Install step skipped (test-only change). +- Still open on this bean (stays in-progress): the remaining batches of the audit plan (batch 5 + `tests-cpu-bound-redaction-ledger` is running); regrowth rules (goal 6); re-measure the pipeline targets on `main` + once the batches have merged. +- Batch 5 flow started 2026-11-26 (intent `todo/intent-0405-tests-cpu-bound-redaction-ledger.json`, worktree + `flow-tests-cpu-bound-redaction-ledger`, claude-agent / claude-opus-5-5, `--no-wait-on-overlap`, log + `todo/flow-tests-cpu-bound-redaction-ledger.log`). + - Result 2026-11-26: PR #327 (`I-1795679415-tests-cpu-bound-redaction-ledger`) APPROVED 3/3 on 64a2ed9 (iteration 2), + calibrated on dface60f (calibrate rerun after main merged in), CI green, MERGEABLE/CLEAN; maintainer merged it + 2026-11-26 09:38:33Z. Measured saving 27.8 percent (summed scope time 68.16 s to 49.24 s, 370 to 373 cases, git + processes 1,319 to 1,193): NOT the 35 percent the intent requires. The whole unit selection still shows 9 failures + in `test_stress_support.py` (out of scope per the notes). Bugs logged: bean 0503 (review approved unmet acceptance + criteria); bean 0501 (log empty, second occurrence). + - 2026-11-26 (post-merge of PR #327, merged as `58c66198`): test-only change; install step skipped. Batch 5 CI figures + are not yet measured on `main`: re-measure with the next pushes. Bean stays in-progress. +- Batch 1 outcome (2026-11-26 09:19): flow completed all 5 stages, PR #325 + (`I-1795676983-tests-constant-time-tmp-dirs/...`), MERGEABLE/CLEAN at the wrapper exit, 3/3 ensemble consensus + APPROVED (one review iteration with two findings, fixed), calibration + `plans/I-1795676983-tests-constant-time-tmp-dirs/P-1795677012-CLA-CO5.5_calibration.md` in the PR diff. Left for the + maintainer to merge. +- Saving, measured by the flow on a shared Linux container: empty-test run 2.5x faster (5x required), median unit test + 1.5x at `-n 2` and 1.14x at `-n 3` (3x required). The acceptance thresholds are NOT met; the flow did not claim them. + Full-suite figures are noisy (load average 7 to 33). +- CI on the execution head 68fc39e4: `unit (ubuntu-latest)` 169 s and `unit (macos-latest)` 506 s for the + `Run unit tests` step, against 185 to 220 s and 537 to 621 s on two main runs (45786178112, 45785970686). Two baseline + runs only, so the saving is indicative, not measured to the 40 s / 38 s claimed. +- The final PR head 205da7f6 (calibration commit only) skipped the unit steps (bookkeeping-only push, bean 0403), so the + green unit check there is the 68fc39e4 run. The PR body is the auto-generated summary and lacks the before/after CI + comparison the intent asks for. +- Bug from this batch: bean 0501 (wrapper log stays empty until exit). +- 2026-11-26 (post-merge of PR #325, merged as `0fc9efa4`): batch 1 delivered (constant-time per-test temp dirs; + test-only change, no production code). Local empty-test run 2.5x faster (5x target), median unit test 1.14 to 1.5x (3x + target) on a noisy host: thresholds still NOT met. Single CI run on `main` shows unit ubuntu 169 s (185 to 220 s + before) and unit macOS 506 s (537 to 621 s before). Two baseline runs only, so indicative. Install step skipped + (test-only change). Re-measure on `main` over the next pushes before counting batch 1 as met. Bean stays in-progress. + +## Batch 2 flow + +- 2026-11-26: batch 2 flow started for intent `tests-fewer-git-stage-pipeline` (flow-tests-fewer-git-stage-pipeline off + origin/main, claude-agent / claude-opus-5-5, log todo/flow-tests-fewer-git-stage-pipeline.log). +- 2026-11-26: batch 2 flow finished at the merge boundary: PR #332 (MERGEABLE/CLEAN, 3/3 APPROVED at iteration 2, + calibration in diff, final-head CI green). Measured saving missed the 40 percent floor: in-scope git processes 12,177 + to 8,832 (-27.5 percent), summed time 125.8 s to 113.7 s (-9.6 percent, noisy; about -17 percent on quieter runs). + Shortfall reported on the PR; not closed by cutting tests. Bug bean 0511 logged (out-of-order pytest fixture). +- 2026-11-26 (post-merge of PR #332, merged as `29fa09b3`): batch 2 delivered (test-only change; no production code). + In-scope git processes 12,177 to 8,832 (-27.5 percent); summed time 125.8 s to 113.7 s (-9.6 percent under load, about + -17 percent estimated on quieter runs). The 40 percent target is missed; the maintainer merged it as a partial result. + Per-job CI saving not measured yet. Install step skipped (test-only change). Bean stays in-progress. + +## Batch 7 (self-doc consolidation) + +- 2026-11-26 (post-merge of PR #336, merged as `6d68e5dc`): batch 7 delivered by bean 0453 / PR #336 (26 standalone + `test_*_self_doc.py` files consolidated into one data-driven test; test-only change). Install step skipped. Bean stays + in-progress. diff --git a/.beans/holon-agentic-coder-ref-metadata-0406--the-flow-wrapper-could-not-find-the-claude-token-a.md b/.beans/holon-agentic-coder-ref-metadata-0406--the-flow-wrapper-could-not-find-the-claude-token-a.md new file mode 100644 index 00000000..ceaca14f --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0406--the-flow-wrapper-could-not-find-the-claude-token-a.md @@ -0,0 +1,38 @@ +--- +# holon-agentic-coder-ref-metadata-0406 +title: "The flow wrapper could not find the Claude token after it moved to the OS keychain" +status: completed +type: bug +priority: high +tags: + - harness + - flow + - credentials +created_at: 2026-11-24T10:05:00Z +updated_at: 2026-11-24T10:05:00Z +--- + +## Problem + +Pull request #271 (Bean 0225) merged at 09:55Z on 2026-11-24. The post-merge install migrated the Claude OAuth token +from `~/.holon/secrets/claude-oauth-token` into the OS keychain (service `holon`, account `claude-oauth-token`) and +deleted the file at 09:56Z. + +The harness wrapper's `.agents/skills/holon_flow/scripts/flow_env.py` read only `CLAUDE_CODE_OAUTH_TOKEN` or that file, +so every new `claude-agent` flow launch stopped with "claude-agent needs credentials, but none were found". The flows of +Beans 0197, 0216 and 0403 stopped within three minutes of the move. Wrappers already running kept working because they +held the token in their environment. + +## Resolution + +- `flow_env.py` now looks in the environment, then the legacy file, then the OS secret store + (`security find-generic-password` on macOS, `secret-tool lookup` on Linux). It never prints the token, and its error + message names the keychain entry. +- Four tests added in `tests/test_flow_env.py`, with an autouse fixture so no test reads the real store. +- `uv run pytest tests/test_flow_env.py` passes (22 tests). +- Verified with a real lookup that a token is found. + +## Notes + +- Uncommitted on the harness branch `docs/harness-20261123`. +- Lesson: a target-repo change that moves where a secret lives needs the harness wrapper changed in the same step. diff --git a/.beans/holon-agentic-coder-ref-metadata-0407--review-is-rerun-in-full-when-nothing-reviewable-changed.md b/.beans/holon-agentic-coder-ref-metadata-0407--review-is-rerun-in-full-when-nothing-reviewable-changed.md new file mode 100644 index 00000000..d5d7e16e --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0407--review-is-rerun-in-full-when-nothing-reviewable-changed.md @@ -0,0 +1,357 @@ +--- +# holon-agentic-coder-ref-metadata-0407 +title: "The full review ensemble is re-run when nothing reviewable changed" +status: completed +type: feature +priority: critical +tags: + - flow + - stage-4 + - review + - performance + - holon-agentic-coder +created_at: 2026-11-24T10:55:00Z +updated_at: 2026-11-26T13:06:00Z +--- + +## Why + +Maintainer, 2026-11-24: "it looks like the most time consuming pr review process is called over and over. is there a +churn on this process? is there something we can improve to not call review process if it's a simple mechanical merge, +pipeline failure, etc?" And earlier the same day: at the end of the review process only the pipeline pass and the +consensus pass matter; everything else is churn. + +## Evidence (2026-11-24) + +A full review iteration is the most expensive step of the flow: three reviewers on the whole diff, 26.6 minutes for +iteration 1 of the re-review on pull request #270. + +- **#270** (ledger temp worktree cleanup): approved 3/3 at 09:07Z after four iterations. The macOS unit job then failed + its timing ceiling on a head that had added only calibration commits (runner variance, Bean 0404). Stage 5 withdrew + the approval. `main` was merged in (ledger rows only). The whole ensemble ran again for 26.6 minutes on a diff it had + already approved, and one reviewer that had approved now raised a new nit, so the resolver and another iteration + followed. No line of the change had been touched since the approval. Verified: the pull request's own diff against + `main`, bookkeeping excluded, is byte-identical at the approved head `8605f54d` and at the re-reviewed head `4ec2e848` + (4 files, 710 insertions, 20 deletions; same hash). The only commits between them are calibration rows, a merge of + `main` and review ledger rows. +- **#271** (Claude token in the OS keychain): approved 3/3 at 09:03Z, approval withdrawn for the same timing failure on + a bookkeeping-only head. +- **#269** (flow end-to-end test): eleven review iterations in under six hours; several ended "CI signal suppressed: + pull request has merge conflicts", each time another pull request merged, and the next iteration reviewed everything + again. + +The rule that produces this is in Stage 5's merged-head gate: when the approval fingerprint still matches, the approval +is kept only if CI passes on the merged head; "when they differ, or CI fails, it withdraws the consensus and restarts +Stage 4". A pipeline failure is treated as if the review were wrong. + +## Goal + +The review ensemble runs on the whole diff once per version of the change, and never because of something the reviewers +cannot judge. + +1. **An approval belongs to the pull request's own diff.** It is withdrawn only when that diff changes. It is not + withdrawn by a merge of the target that leaves the diff unchanged, by bookkeeping commits, or by a pipeline result. +2. **A pipeline failure after approval goes to the pipeline, not to the reviewers.** + - Noise (timing gate, runner or infrastructure failure, a cancelled run): rerun the job; the approval stands. + - A real failing test: the resolver fixes it. The approval of everything else stands, and only the resolver's fix is + reviewed (see 4). +3. **A merge of the target goes to the conflict gate, not to the reviewers.** A mechanical merge (no conflict, or ledger + and knowledge-base files only) changes nothing reviewable. A resolved code conflict is reviewed as a delta (see 4). +4. **Scoped re-review.** When the change does move after a review (a resolver fix for findings, a fix for a failing + test, a resolved code conflict), the next pass reviews the delta since the reviewed head together with the findings + it answers: are they resolved, and does the delta introduce a defect? Parts of the diff that were reviewed and did + not change are not reviewed again, so a reviewer cannot raise a new nit on code it has already passed. +5. **Consensus is the conjunction of the two gates.** The flow records "consensus on diff D" and "pipeline green on head + H" separately and is ready when both hold for the current head; losing one does not erase the other. +6. **Churn is counted.** Each flow summary and calibration report says how many full reviews, scoped reviews and + pipeline runs it took, and how many were caused by something other than a defect in the change. + +## Notes + +- Overlap: Bean 0409 covers the rejected-finding and no-change resolver cases of the same skip. This bean owns the skip + rule. +- Builds on Bean 0372 (approval survives a merge of main with an unchanged diff; the fingerprint exists) and Bean 0376 + (conflicts resolved in the flow, with scoped re-review named in its plan). This bean extends the same idea to pipeline + failures and to resolver fixes. +- Nits are still actioned by the resolver, applied or rejected with a reason; this bean changes what is reviewed + afterwards, not whether a nit is handled. +- Related: Bean 0404 (timing ceiling fails on runner variance), Bean 0403 (no full CI for bookkeeping-only pushes), Bean + 0383 (Stage 4 and 5 ordering), Bean 0394 (principles). +- Risk to weigh when planning: a scoped review can miss an interaction between the delta and unchanged code. Mitigate by + giving the scoped reviewer the whole file around the delta, and by one full review if the delta exceeds a size limit. + +## Measured (self-improvement audit) + +Self-improvement audit of 2026-11-24, period 2026-11-21 to 2026-11-24T11:00Z, from the 35 flow logs with timestamps in +the period (scripts and output in the git-ignored `todo/self-improvement-audit-2026-11-24/`, `review_iterations.py`). +Flows of the period whose logs were not kept (all `holon-coherence` flows, 14 `holon-agentic-coder` pull requests) are +not counted; see Bean 0412. + +**Totals.** 126 full review iterations in 26 flows; 125 with a duration: median 6.7 minutes, longest 26.6 minutes (PR +#270), 934 minutes in all. After each flow's first iteration, the reason the next one ran: + +| Reason the iteration ran | Iterations | Minutes | +| :--------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------: | ------: | +| Reviewer findings fixed by the resolver (a new head) | 52 | 406 | +| Conflict with `main` or merge of `main` (approval re-earned, "CI signal suppressed") | 17 | 127 | +| Resolver pass that pushed no new head, so the same head was reviewed again (18), or another stop and resume (old safety halt 2, interrupted run 2, other stop 4) | 26 | 160 | +| Approval withdrawn for a CI failure or unknown CI after approval | 2 | 30 | +| Infrastructure failure (reviewer API error, stall, session limit) | 3 | 22 | + +Of the 100 repeat iterations, only the 52 in the first row were caused by a change to the code under review; the other +48 (339 minutes) were churn by the maintainer's definition. + +- 4 iterations ended with all three reviewers APPROVED (0/0/0) and still "reviewer container reported ensemble verdict + CHANGES_REQUESTED" because the pull request was conflicting (`DIRTY`); each was followed by a merge of `main` and + another full iteration (flows checkpoint-and-ledger-ownership twice, ci-gate-after-main-merge, + no-fallback-calibration-report). The mergeability probe ran after the reviewers instead of before them, and the log + does not say why the container verdict differs. +- Per flow (columns after the second count only iterations after the first): + +| Flow | Full review iterations | Minutes in reviews | After the first: findings fixed | conflict / main merge | CI failure | infrastructure | other churn | +| :------------------------------ | ---------------------: | -----------------: | ------------------------------: | --------------------: | ---------: | -------------: | ----------: | +| admission-uses-actual-pr-files | 3 | 12 | 2 | 0 | 0 | 0 | 0 | +| antigravity-tmpfs-empty-diff | 3 | 18 | 1 | 1 | 0 | 0 | 0 | +| approval-survives-main-merge | 7 | 46 | 3 | 2 | 1 | 0 | 0 | +| calibration-report-correctness | 3 | 23 | 0 | 2 | 0 | 0 | 0 | +| checkpoint-and-ledger-ownership | 19 | 156 | 6 | 1 | 0 | 1 | 10 | +| ci-gate-after-main-merge | 7 | 34 | 3 | 2 | 0 | 1 | 0 | +| claude-code-mode-default-on | 1 | 2 | 0 | 0 | 0 | 0 | 0 | +| claude-token-os-keychain-only | 2 | 45 | 1 | 0 | 0 | 0 | 0 | +| derive-kb-index | 1 | 10 | 0 | 0 | 0 | 0 | 0 | +| document-env-variables-v3 | 3 | 23 | 1 | 1 | 0 | 0 | 0 | +| execute-stage-object | 2 | 13 | 1 | 0 | 0 | 0 | 0 | +| executor-execution-run | 8 | 74 | 4 | 0 | 0 | 0 | 3 | +| flow-no-auto-sidecar-spawn-v2 | 14 | 85 | 3 | 2 | 0 | 0 | 8 | +| github-issues-replace-beads | 2 | 15 | 0 | 0 | 0 | 0 | 1 | +| intent-plan-stage-decomposition | 3 | 8 | 0 | 0 | 0 | 1 | 1 | +| layered-env-config-v2 | 11 | 70 | 6 | 3 | 0 | 0 | 1 | +| ledger-query-knowledge-index | 1 | 8 | 0 | 0 | 0 | 0 | 0 | +| ledger-temp-worktree-cleanup | 6 | 89 | 3 | 1 | 1 | 0 | 0 | +| name-and-seed-redaction-tests | 2 | 22 | 1 | 0 | 0 | 0 | 0 | +| no-fallback-calibration-report | 4 | 45 | 1 | 1 | 0 | 0 | 1 | +| remove-token-reduction-copy | 5 | 24 | 3 | 1 | 0 | 0 | 0 | +| resolve-conflicts-in-flow | 12 | 76 | 10 | 0 | 0 | 0 | 1 | +| resolver-honours-turn-budgets | 3 | 13 | 2 | 0 | 0 | 0 | 0 | +| review-approved-and-fresh-tests | 1 | 4 | 0 | 0 | 0 | 0 | 0 | +| stale-calibration-warning-fix | 1 | 11 | 0 | 0 | 0 | 0 | 0 | +| unlimited-stage-budgets | 2 | 8 | 1 | 0 | 0 | 0 | 0 | +| total | 126 | 934 | 52 | 17 | 2 | 3 | 26 | + +- Pipeline runs per pull request in the same period (from GitHub check runs, 47 merged pull requests): 422 runs, 302 of + them (72 percent) on heads that differed from the previous tested head only in bookkeeping files (230), by a merge of + `main` (57) or were job re-runs (15). Median 6 runs per pull request, of which 2 on heads with a code change. +- Resolver passes without a new head and rejected findings that come back are logged separately in Bean 0409. + +## Timing findings (self-improvement audit, added at the maintainer's request) + +From the first self-improvement audit (2026-11-24), period 2026-11-21 to 2026-11-24T11:00Z: 35 flow logs, 140 flow runs, +47 merged pull requests. Full tables and scripts are in the git-ignored `todo/self-improvement-audit-2026-11-24/` +(`timing.md`, `pipelines.md`, `churn.md`, `review-iterations.md`). + +### Every step of the flow + +| Step | Count | Median (min) | Longest (min) | +| :-------------------------------------------- | ----: | -----------: | ------------: | +| Intent agent turn | 29 | 0.1 | 0.2 | +| Planner agent turn | 34 | 4.0 | 34.3 | +| Stage 3 admission check | 49 | 0.1 | 0.2 | +| Stage 3 overlap wait (refusal, then relaunch) | 48 | 1.1 | 1053 | +| Executor turn (including tests) | 39 | 10.5 | 102.5 | +| Pull request create or edit | 61 | 0.1 | 0.2 | +| Reviewer ensemble turn (3 reviewers) | 121 | 6.6 | 26.5 | +| Local test run after reviewers | 32 | 1.3 | 2.6 | +| Resolver turn (including push) | 83 | 3.0 | 22.0 | +| Ledger commit | 148 | 0.1 | 8.5 | +| CI registration wait | 26 | 0.0 | 0.3 | +| CI wait | 35 | 7.9 | 18.0 | +| Calibration work and promotion | 37 | 0.2 | 0.4 | +| Reconciliation | 8 | 0.2 | 0.3 | +| Final-head check | 36 | 0.0 | 3.8 | +| Idle after a review failure, until resume | 28 | 1.1 | 129 | +| Waiting for the maintainer's merge | 10 | 1.9 | 26.8 | + +### Each stage, split by what the time was spent on (hours) + +| Stage | Working | Waiting on CI | Waiting on another flow | Waiting on a human | Idle | +| :-------- | ------: | ------------: | ----------------------: | -----------------: | ---: | +| Intent | 0.07 | 0 | 0 | 0 | 0 | +| Plan | 3.56 | 0 | 0 | 0 | 0 | +| Execute | 9.72 | 0 | 39.8 | 0 | 1.6 | +| Review | 20.9 | 0.44 | 0 | 0 | 9.2 | +| Calibrate | 0.16 | 5.1 | 0 | 0.75 | 0 | + +### What the timing says about churn + +- **Review is the largest block of working time**: 20.9 hours, more than planning and execution together (13.3 hours). + The reviewer ensemble ran 121 times against 39 executor turns and 34 planner turns, about three reviews per execution. + Of the 100 repeat iterations, 48 (339 minutes) were not caused by a change to the code under review (table in the + section above). +- **Review also carries 9.2 hours of idle time**: a review failure stops the flow, and the median 1.1 minutes until a + resume hides a longest gap of 129 minutes. Each such stop was followed by another full iteration. +- **Calibrate is almost entirely waiting**: 0.16 hours of work against 5.1 hours waiting on CI. The CI wait (median 7.9 + minutes) runs on a head that changed only bookkeeping. +- **Pipelines**: 422 runs for the 47 merged pull requests, a median of 6 per pull request, of which 2 were on a head + with a code change. 302 runs (72 percent) were churn: 230 on heads that differed from the last tested head only in + bookkeeping files, 57 on heads produced by a merge of `main`, 15 job re-runs. 20 of the 33 failed heads were churn + heads, and each failed churn head can withdraw an approval and start another full review. +- **The reviewers ran before the conflict check** in 4 iterations: all three approved, the pull request was conflicting, + and the whole iteration was repeated after a merge of `main`. +- **Execute waits on other flows, not on itself**: 39.8 hours of overlap waiting against 9.72 hours of work (Beans 0395 + and 0410). This is not review churn but it is the largest single wait in the table. +- **Not on the critical path**: the maintainer's merge (median 1.9 minutes), calibration work (about 14 seconds), CI + registration (near zero). + +### What this means for this bean's goals + +| Goal of this bean | Measured cost it removes | +| :----------------------------------------------- | :----------------------------------------------------------------- | +| Approval belongs to the diff (goal 1) | 17 re-reviews after a conflict or merge of `main`, 127 minutes | +| Pipeline failure goes to the pipeline (goal 2) | 2 re-reviews after a CI failure, 30 minutes; 20 failed churn heads | +| Merge goes to the conflict gate (goal 3) | the 4 approved-but-conflicting iterations, and part of the 17 | +| Scoped re-review (goal 4) | shortens the 52 legitimate repeat iterations, 406 minutes in full | +| Unchanged head is not reviewed again (Bean 0409) | 18 re-reviews of a head the resolver did not move | + +### Not measured + +Pre-flight, each push, each conflict probe and merge of `main`, each individual reviewer, and the overlap wait inside a +run could not be timed from the logs; 22 of the 47 merged pull requests (all of `holon-coherence`, 14 of +`holon-agentic-coder`) left no flow log and were counted from GitHub only. Bean 0412 makes the engine and the wrapper +record these. + +## Audit evidence, 2026-11-24T12:58Z (self-improvement audit, fifth merge) + +- PR #272 iteration 3 (12:18:50Z to 12:44:21Z): two reviewers approved, one raised a single documentation nit; the + resolver fixed it in 3.4 minutes and the loop started a full three-reviewer iteration 4 at 12:47:53Z. On + `claude-fable-5-2` a full iteration takes a median of 18.4 minutes (Bean 0425); a scoped check of the one-line fix + would take a few minutes. + +## Audit evidence, 2026-11-25T00:28Z (self-improvement audit, fifth merge) + +- **PR #276 (`launcher-proxy-self-doc`):** `unit (macos-latest)` `CI Timing Gate (compare with main)` failures on + bookkeeping-only ledger commits (`c1f20b9e`, `f5baea47`) triggered `FIND-CI-002` and `FIND-CI-004`, forcing two extra + resolver passes and full ensemble re-reviews (6 iterations total). +- **PR #292 (`config-env-self-doc`):** reached 3/3 consensus approval three separate times (`20:39:44Z`, `23:05:50Z`, + `00:11:00Z`) across 7 review iterations (30 commits: 20 bookkeeping, 4 `main`-merges) driven by `main`-merge and + timing-gate failures (`fa8df26b`, `d0632b67`, `7eed7d7f`). +- **PR #290 (`knowledge-self-doc`):** `unit (macos-latest)` timing-gate failures on bookkeeping-only commits + (`9b4d2bd4`, `b15549be`) triggered `FIND-CI-002` / `FIND-CI-003` and 4 review iterations. +- **PR #283 (`resolve-conflicts-in-flow`):** conflict-merge commit `221f9d73` caused consensus withdrawal on `e1e7150` + (`PR-own change changed since approval`) after adapting a test added on `main`. + +> 2026-11-25: launched `holon-agentic-coder` flow (`no-unneeded-full-review`, intent +> `todo/intent-0407-no-unneeded-full-review.json`) via `antigravity-agent` / `gemini-4-neon`. + +## Audit evidence, 2026-11-25T02:54Z (self-improvement audit, fifth merge) + +- **`PR #300` (`decomposition-rule-self-doc`):** all 3 reviewers `APPROVED (0/0/0)` at `01:06:34Z`, then post-review + mergeability check saw `DIRTY` (ledger conflict against `#280`) and halted Stage 4 (`CHANGES_REQUESTED`); after + merging `main` (`ef1e6129`), Stage 4 ran a full `6.0 min` iteration 2 re-review (`01:08:16Z`–`01:14:19Z`) on an + unchanged PR-own diff. +- **`PR #306` (`github-pr-merge-self-doc`):** all 3 reviewers `APPROVED (0/0/0)` at `02:02:59Z`, blocked solely by + `FIND-CI-001` (`Test - Hygiene` Prettier check on `executions/E-1795571328-ANA-G4N.md`); after formatting that file + only, Stage 4 ran a full `7.6 min` iteration 2 re-review (`02:07:20Z`–`02:14:56Z`). + +## Audit evidence, 2026-11-25T04:02Z (self-improvement audit, fifth merge) + +- **`PR #308` (`workspace-survival-job-parallel`):** + - After 1-file resolver fixes (`0b986f9b` `stress_support.py` stderr fix; `11721091` `test_stress_support.py` git + identity fix), Stage 4 logged `"proceeding to re-review in full"` and ran full 3-reviewer iterations (`9.55 min` on + `8f533e24`, and `2.73+ min` in progress at cutoff on `a27a4ce4`). + - At `03:39:20Z`, `End-of-flow sync round 1/3` (`end_of_flow_sync.py:199`) merged a **ledger-only** `origin/main` + update (`adaf72a8`, `558646ae`, zero code diff) and unconditionally re-entered full Stage 4 (`15.3+ min` in window: + `7.13 min` review + local tests, `5.17 min` resolver, `2.73+ min` iter 2), instead of preserving approval via PR-own + fingerprint as `conflict_gate` did earlier on `b14bd3dd`. +- **Stage 3 admission block on `0407` itself (`no-unneeded-full-review`):** remained blocked in Stage 3 for the entire + `60.75 min` window (`02:41:40Z`–`03:54:45Z+`, `73.08 min` total) on `apps/sandbox-executor/tests/` and `budgets.py` + (see Bean `0446`). + +## Audit evidence, 2026-11-25T05:07Z (self-improvement audit, fifth merge #290–#294) + +- **`PR #308` (`workspace-survival-job-parallel`):** + - At `04:14:22Z`, `End-of-flow sync round 2/3` merged another **ledger-only** `origin/main` update (`1a6c1ab1`) and + unconditionally re-entered full Stage 4 (`49.6+ min` in window `04:14:18Z..05:04:00Z+`, still live in Iter 3 at + `05:01:27Z+`), allowing reviewers to reverse their Round 1 Iter 2 approval on unchanged PR code. +- **Stage 3 admission block on `0407` itself (`no-unneeded-full-review`):** remained idle in Stage 3 for the entire + additional `69.25 min` window (`03:54:45Z..05:04:00Z+`, now `142.33 min` total since `02:41:40.517Z` — see Bean + `0446`). + +## Audit evidence, 2026-11-25T05:41Z (self-improvement audit, fifth merge #295–#299) + +- **`PR #308` (`workspace-survival-job-parallel`):** ledger-only Round 2 Stage 4 re-entry reached **`86+ min`** + (`04:14:18Z..05:40:24Z+`, through Iter 4 `CHANGES_REQUESTED` `3/3` at `05:21:18Z` and live Iter 4 resolver + `05:25:12Z+`), as Reviewer 3 reversed Iter 3 approval (`05:06:12Z`) on unchanged code. +- **`PR #309` (`0438`, `calibration-merge-adapted-file`):** all `3/3` reviewers `APPROVED (0/0/0)` at `05:40:16Z`, yet + Stage 4 blocked and dispatched a resolver (`05:40:17Z`) solely on unformatted Markdown + (`plans/.../P-1795584464-CLA-CO5.5.md`, `Test - Hygiene`), triggering another full re-review cycle once formatted. +- **`0407` itself (`no-unneeded-full-review`):** reached `178+ min` since `02:41:40Z` halted in Stage 3 (`33.40 min` in + window). + +## Audit evidence, 2026-11-25T06:05Z (self-improvement audit, fifth merge #300–#304) + +- **`PR #309` (`0438`, `calibration-merge-adapted-file`):** finished Stage 4 in **`21.63 min`** total + (`05:36:09Z..05:57:47Z`, `checkpoint-calibration-merge-adapted-file.json`): after `3/3` `APPROVED (0/0/0)` in Iter 1 + (`3.9 min`, `05:40:16Z`), formatting a single `.md` plan file cost `6.58 min` resolver + `29 s` 4-push burst + + `10.15 min` full Iter 2 re-review (`05:47:26Z..05:57:35Z`) even though no Python/logic code changed. +- **`PR #300` (`decomposition-rule-self-doc`, merged `05:31:18Z`):** counted **`1` churn review iteration** (`2` total): + Iter 1 (`01:06:34Z`) had `3/3` reviewers approved but recorded `FIND-DIRTY-001` due to `main` drift, merging `main` + (`ef1e6129`) and running a full Iter 2 (`01:14:30Z`). +- **`PR #308` (`workspace-survival-job-parallel`):** remains stuck in its Round 2 Iter 4 resolver container + (`d7a5f5ec82a1`, running `37+ min` since `05:25:12Z`) triggered by the ledger-only Round 2 re-entry. + +Note (2026-11-25): stale plan `no-unneeded-full-review` deleted after PR #309 merged; restart from current main via the +kept `todo/intent-0407-no-unneeded-full-review.json`. + +## Flow + +- 2026-11-26: `holon flow` run `no-unneeded-full-review` launched (claude-agent, claude-opus-5-5) in worktree + `flow-no-unneeded-full-review` off origin/main 4e358955; log `todo/flow-no-unneeded-full-review.log`. Intent scope + narrowed to listed test files. + +## Audit evidence, 2026-11-26 (flow time audit) + +Flow time audit (`todo/flow-time-audit-2026-11-26.md`), PRs #308 to #316 (claude-agent, opus): 22 blocked review +iterations; 8 of them were blocked by Nits only (no Critical, no Important, no CI failure), for example #310 iterations +3 and 7, #312 iteration 2, #313 iteration 1, #315 iterations 1 and 2, #316 iteration 1. A blocked iteration costs about +10.8 min (reviewers 3.9, host `review_local` 2.3, resolver 4.5) and forces a further full approving iteration that is +bound by CI (about 9.5 min). Median 3 iterations per flow (max 9 on #308, 8 on #310). A scoped check of the resolver's +Nit fixes (point 4) would save about 10 min per Nit-only iteration. + +- 2026-11-26 11:30-12:12Z: flow finished. Decomposed into 5 child PRs (#316, #318, #322, #324, #328; all merged into the + parent branch). Parent PR #334 into main: 3/3 APPROVED (Stage 4 at restart 1 of 3), calibration committed and in the + PR diff, hygiene passing, MERGEABLE/CLEAN at head 3a93c72e at 12:12Z. Maintainer merge pending. Bugs logged: + bean 0513. + +## Resolution + +Delivered via [PR #334](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/334) (decomposed parent of flow +`no-unneeded-full-review`) and merged into `main` (`20687d43`). The five child pull requests merged into the parent's +plan branch first: + +- **[PR #316](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/316)** (`b123517b`): approval keyed to the + PR's reviewable own diff (shared bookkeeping path filter). A merge of `main` or bookkeeping commits no longer + withdraws an approval (goal 1). +- **[PR #318](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/318)** (`108d0da6`): split verdict. Stage + 4 records `consensus_on_diff` and `pipeline_green` separately; losing one does not erase the other (goal 5). +- **[PR #322](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/322)** (`8f284d07`): scoped delta review + (new `flow/review/delta_review.py`). After a resolver fix, a resolved code conflict or a test fix, only the delta and + the findings it answers are reviewed; unchanged reviewed code is not re-reviewed (goal 4). +- **[PR #324](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/324)** (`22b72b60`): post-approval CI + routing by failure class. Noise (timing gate, runner or infrastructure, cancelled) is rerun with the approval + standing; a real failing test goes to the resolver, and only its fix is reviewed (goal 2). +- **[PR #328](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/328)** (`d047a533`): scope and count + reporting. Each flow summary and calibration report counts full reviews, scoped reviews, pipeline runs, reruns and + non-defect churn (goal 6). +- **Parent [PR #334](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/334)**: the children were merged + into its branch; the parent itself was approved 3/3 at its restart 1 and merged. A budget breach in `sandbox_executor` + was fixed by moving code into new modules; no budget override was changed (`holon-config/hygiene/module_budgets.json` + is byte-identical between the pre- and post-merge `main`). + +Verification: the parent was MERGEABLE/CLEAN with hygiene passing at head 3a93c72e before merge (flow log); +`install-holon` rebuilt the images and reinstalled `holon` and `holon-coherence` after the merge (review loop and engine +code changed). Flow `no-unneeded-full-review` was decomposed into five children and ran from 04:06Z to 12:12Z +(claude-agent, claude-opus-5-5). Bean 0407's own Stage 3 admission and scope issues were tracked separately in Beans +0414, 0446 and 0508. + +Holon Flow Traversal: Intent, Plan (decomposed into five children), Execute, Review Loop (split verdict, scoped delta +review, post-approval CI routing) and Calibration completed for the parent and all five children. diff --git a/.beans/holon-agentic-coder-ref-metadata-0408--every-push-passes-the-ci-hygiene-and-lint-checks-l.md b/.beans/holon-agentic-coder-ref-metadata-0408--every-push-passes-the-ci-hygiene-and-lint-checks-l.md new file mode 100644 index 00000000..2a1a4da1 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0408--every-push-passes-the-ci-hygiene-and-lint-checks-l.md @@ -0,0 +1,97 @@ +--- +# holon-agentic-coder-ref-metadata-0408 +title: "Every push passes the CI hygiene and lint checks locally before it leaves the machine" +status: todo +type: feature +priority: high +tags: + - flow + - ci + - hygiene + - pipeline + - holon-agentic-coder +created_at: 2026-11-24T11:00:00Z +updated_at: 2026-11-25T05:41:00Z +--- + +## Why + +At the end of the review process only the pipeline pass and the consensus pass matter. A push that fails a check CI runs +in seconds on any machine (Prettier, ruff, JSON and JSONL validity, file growth) costs a full pipeline (median 7.9 +minutes) and usually a resolver pass and a full review iteration (median 6.7 minutes) to undo. + +## Evidence + +Logged by the self-improvement audit of 2026-11-24 (first audit, period 2026-11-21 to 2026-11-24T11:00Z). The scripts +and their output are in the git-ignored audit folder `todo/self-improvement-audit-2026-11-24/`. + +- 33 pull request heads failed a pipeline in the period; 17 of them failed `hygiene`. Samples read from the failed job + logs: + - run 44847881284 (PR #222): Prettier on `executions/E-1795184522-ANA-G3.8F.md`, a file the engine wrote itself. + - run 45328034281 (PR #268): Prettier on 37 files, among them historical `plans/*_calibration.md` reports and + `holon-config/metrics/README.md` (Bean 0392 is the resolver's half of this). + - run 45182713288 (PR #263): `jq: parse error: Invalid numeric literal at line 8175` in the JSON and JSONL validation, + on a head produced by a merge of `main` (a ledger left invalid by a merge). +- 20 of the 33 failed heads differed from the previous tested head only in bookkeeping files or by a merge of `main`. +- Reviewers raised 10 pure lint findings (ruff E501, F401, I001, E402, RUF022, for example a 162-character help string + left by a merge resolution) and 25 findings that a file already over 1,000 lines grew (the review prompt's rule in + `holon-config/prompts/review_loop.template.md`, item 11). Each was settled by a resolver pass and a full re-review. +- Stage 3 has no deterministic lint gate: the executor is only asked in its prompt to follow formatting and linting. The + resolver has a Markdown gate (`entrypoint/review_markdown_gate.py`) for the Markdown it changed, and nothing for + engine-written files. + +## Proposed change + +1. One local gate, the same commands CI's `hygiene` and lint jobs run, scoped to the files the push changes: ruff check + and format check on changed Python, Prettier check on changed Markdown, `jq` on changed JSON and JSONL, and the + growth rule for files over 1,000 lines. +2. It runs at the end of every executor turn, after every resolver turn, and before the engine pushes its own commits + (ledger rows, calibration report, reconciliation, promotion, merge of the target). +3. A failure in an agent turn goes back to the same agent in the same turn (fail early). A failure in an engine-written + file is fixed by the engine (format the file it wrote) or stops the push with the file named; an invalid JSONL after + a merge stops the merge. +4. The container's Prettier is the version CI uses, so the local answer and CI's answer are the same. + +## Expected gain + +- Removes the 17 hygiene failures and the 10 lint findings seen in the period: about 17 pipelines (about 2.2 hours of + flow waiting at 7.9 minutes each) and 10 resolver passes and re-reviews. +- With the growth rule, removes most of the 25 file-growth findings (12 percent of all 249 findings) before a reviewer + sees them. + +## Cost + +Small to medium engine change (`entrypoint/`, `flow/review/`, `flow/stages/calibrate.py`): reuse the existing Markdown +gate, add ruff, `jq` and the growth check. A few seconds per turn. + +## Notes + +- Related: Bean 0392 (resolver's repo-wide Prettier), Bean 0380 (module budget on every package), Bean 0403 (no full + pipeline for bookkeeping-only pushes), Bean 0371 (ledgers stop conflicting). + +## Audit evidence, 2026-11-25T00:28Z (self-improvement audit, fifth merge) + +- **PR #296 (`split-cli-init-modules`):** failed `Test - Hygiene` (`Lint with Ruff` and `make lint` -> `lint-md` + Prettier check) on `5cc97090` (`chore(review): record review ledger rows (before iteration 1)`), and failed + `make lint` -> `lint-md` again on `bd5fccc2` (after Stage 4 resolver pass `01418f78`) because the engine-generated + `executions/E-1795563737-ANA-G4N.md` failed Prettier. +- **PR #289 (`core-helpers-self-doc`):** failed `Test - Hygiene` on Stage 3 push `80126bd7`. + +## Audit evidence, 2026-11-25T02:54Z (self-improvement audit, fifth merge) + +- **`PR #306` (`github-pr-merge-self-doc`):** Stage 3 push `2c31f500` (`01:55:03Z`) failed `Test - Hygiene` (run + `45529262231`, `make lint` $\rightarrow$ `lint-md` Prettier check) solely on engine-generated + `executions/E-1795571328-ANA-G4N.md`. This was the sole CI failure across all `276` workflow runs (`46` heads) in + `00:28Z–02:54Z`, yet it blocked 3/3 `APPROVED` reviewers via `FIND-CI-001` and added a `4.2 min` resolver pass, a + cancelled CI head, and a `7.6 min` full re-review (`20.2 min` Stage 4 vs `7.0 min` median). + +## Audit evidence, 2026-11-25T05:41Z (self-improvement audit, fifth merge #295–#299) + +- **`PR #309` (`0438`, `calibration-merge-adapted-file`):** Stage 3 push `4cdc1913` (`05:36:24Z`) failed + `Test - Hygiene` (`run 45554742211`, `make lint` $\rightarrow$ `lint-md` Prettier check) at `05:37:23Z` solely on + Stage 2's unformatted `plans/I-1795584436-calibration-merge-adapted-file/P-1795584464-CLA-CO5.5.md` (after + `formatting.py` Prettier timed out twice — Bean `0442`), blocking `3/3` `APPROVED (0/0/0)` reviewers at `05:40:16Z` + into an unnecessary resolver turn (`05:40:17Z`). This was the sole CI failure across `86` `hac` runs in + `05:07Z–05:40:24Z`. +- **`PR #296` (`split-cli-init-modules`, cadence merge):** full lifetime showed `2` `Hygiene` failures (`5cc97090` Ruff + - Prettier, `bd5fccc2` `executions/*.md` Prettier). diff --git a/.beans/holon-agentic-coder-ref-metadata-0409--a-finding-the-resolver-rejected-or-a-resolver-pass.md b/.beans/holon-agentic-coder-ref-metadata-0409--a-finding-the-resolver-rejected-or-a-resolver-pass.md new file mode 100644 index 00000000..16628597 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0409--a-finding-the-resolver-rejected-or-a-resolver-pass.md @@ -0,0 +1,65 @@ +--- +# holon-agentic-coder-ref-metadata-0409 +title: "A finding the resolver rejected, or a resolver pass that changed nothing, does not start another full review" +status: todo +type: feature +priority: high +tags: + - flow + - stage-4 + - review + - resolver + - holon-agentic-coder +created_at: 2026-11-24T11:00:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +The consensus pass is one of the two gates that matter. In the period, review iterations were spent re-reviewing a head +that had not changed, because the resolver rejected the findings (or produced no new commit) and the loop started a full +review again. The reviewers then raised the same finding, or a new one on code they had already passed. + +## Evidence + +Logged by the self-improvement audit of 2026-11-24 (first audit, period 2026-11-21 to 2026-11-24T11:00Z). The scripts +and their output are in the git-ignored audit folder `todo/self-improvement-audit-2026-11-24/`. + +- 18 full review iterations (median 6.7 minutes each, 160 minutes of re-review in total together with 8 other churn + iterations) followed a resolver pass that pushed no new head: the log shows "Dispatching review-loop agent", then + "Committed ledger rows", and no "Resolver pushed new head". + - PR #248 (flow-no-auto-sidecar-spawn-v2): 14 full iterations, 10 of them churn. Reviewers raised the same finding 18 + times ("the intent requires the confirmed cause of the in-network 'Failed to connect to holon-proxy port 8080' + failure, but the PR description omits it"); the resolver rejected it 13 times. + - Flow checkpoint-and-ledger-ownership (2026-11-21): 19 full iterations, 10 of them on an unchanged head after a + resolver pass. +- 26 of 249 findings were rejected by the resolver; reviewers are not told which findings were rejected and why. + +## Proposed change + +1. **No new head, no full review.** When a resolver pass ends without changing the pull request's diff, the next step is + not a full review of the same diff. +2. **Rejected findings are adjudicated once.** Each reviewer of the next pass receives the previous findings with their + dispositions and rejection reasons. A rejected finding that a reviewer raises again with no new evidence goes to one + adjudication turn (a single reviewer reading the finding, the rejection reason and the code), whose answer is final + for that finding: either the resolver must apply it, or it is closed and not raised again. +3. **Intent evidence is checked in Stage 3.** When the intent's goal asks for a stated outcome (a confirmed cause, a + reproducing seed), Stage 3 checks the execution record and the pull request description for it before the review + starts, and sends it back to the executor if missing. + +## Expected gain + +Up to 18 full iterations in the period (about 2 hours of reviewer time and three reviewer turns each), and the ping-pong +that kept PR #248 in review for 10 extra iterations. + +## Cost + +Medium engine change in the review loop (`flow/review/loop.py`, the review prompt). Nits are still actioned: applied, or +rejected with a reason (maintainer's rule); this bean only stops the same rejection from being argued again in full. + +## Notes + +- Overlap: Bean 0407 (no full review when nothing reviewable changed) is the same family. Bean 0407 owns the skip rule; + this bean covers the rejected-finding and no-change resolver cases and builds on it. +- Related: Bean 0407 (scoped re-review when nothing reviewable changed; this bean covers the resolver-without-change and + rejection cases), Bean 0255 (streaming resolvers), Bean 0323 (crashed resolver records findings as rejected). diff --git a/.beans/holon-agentic-coder-ref-metadata-0410--remove-the-conflict-magnets-generated-readme-and-e.md b/.beans/holon-agentic-coder-ref-metadata-0410--remove-the-conflict-magnets-generated-readme-and-e.md new file mode 100644 index 00000000..73221add --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0410--remove-the-conflict-magnets-generated-readme-and-e.md @@ -0,0 +1,68 @@ +--- +# holon-agentic-coder-ref-metadata-0410 +title: + "Remove the conflict magnets: generated README and env docs, and a module budget file that does not serialise flows" +status: todo +type: feature +priority: high +tags: + - architecture + - flow + - merge-conflicts + - admission + - holon-agentic-coder +created_at: 2026-11-24T11:00:00Z +updated_at: 2026-11-24T11:00:00Z +--- + +## Why + +A few shared files are in almost every touch set, so Stage 3 admission keeps flows waiting on each other and merges of +`main` conflict on them. Flows waited 39.8 hours in total on other flows in the period. + +## Evidence + +Logged by the self-improvement audit of 2026-11-24 (first audit, period 2026-11-21 to 2026-11-24T11:00Z). The scripts +and their output are in the git-ignored audit folder `todo/self-improvement-audit-2026-11-24/`. + +Files named in Stage 3 overlap refusals (count of refusal lines) and in unresolvable merge conflicts: + +| File | Overlap refusals | Unresolvable conflicts | +| :------------------------------------------------------------------ | ---------------: | ---------------------: | +| `apps/sandbox-executor/README.md` | 106 | 0 | +| `apps/sandbox-executor/flow_module_budgets.json` | 67 | 8 | +| `apps/sandbox-executor/src/sandbox_executor/flow/__init__.py` | 53 | 5 | +| `docs/environment_variables.md` | 43 | 0 | +| `apps/sandbox-executor/src/sandbox_executor/env_registry.py` | 43 | 0 | +| `docs/git_flow.md` | 34 | 0 | +| `apps/sandbox-executor/src/sandbox_executor/flow/stages/execute.py` | 31 | 0 | + +- 50 of the 140 flow runs in the period ended at a Stage 3 overlap refusal; the 48 measured waits total 39.8 hours + (median 1.1 minutes, longest 17.5 hours on execute-stage-object). +- Reviewers raised 20 documentation-drift findings (README key tables and module maps out of step with the code, for + example "The README Accepted keys paragraph lists only 8 of the 14 PROJECT_REFUSED_KEYS"). + +## Proposed change + +1. The README's module map and key tables, and `docs/environment_variables.md`, are generated from the code (the env + registry, the package tree) by a script that CI checks for drift. A flow changes the registry, never the generated + text by hand, so the README drops out of touch sets. +2. `flow_module_budgets.json` stops being a single shared file every refactor edits: per-package budget files, or + budgets derived from a rule with only the exceptions listed. **Needs the maintainer's word before any change to the + budget mechanism** (standing rule: the budget file is not touched without explicit instruction). +3. `flow/__init__.py` holds no logic and no growing re-export list (Bean 0379). +4. Admission treats a generated file as non-overlapping, since it is regenerated after a merge. + +## Expected gain + +The README alone appears in 106 refusals and the budget file in 67 refusals and 8 unresolvable conflicts. Removing them +from touch sets lets most of the 39.8 hours of overlap waiting run in parallel and removes the 20 drift findings. + +## Cost + +Medium: one generator script and a drift test in the target repository; the budget change is a maintainer decision. + +## Notes + +- Related: Bean 0379 (no logic in `__init__.py`), Bean 0380 (module budget on every package), Bean 0395 (work during the + overlap wait), Bean 0376 (in-flow conflict resolver), Bean 0174 (environment variable documentation). diff --git a/.beans/holon-agentic-coder-ref-metadata-0411--harness-instructions-contradict-each-other-on-runn.md b/.beans/holon-agentic-coder-ref-metadata-0411--harness-instructions-contradict-each-other-on-runn.md new file mode 100644 index 00000000..8f158f20 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0411--harness-instructions-contradict-each-other-on-runn.md @@ -0,0 +1,70 @@ +--- +# holon-agentic-coder-ref-metadata-0411 +title: "Harness instructions contradict each other on runner switching, model ladders and file size" +status: todo +type: bug +priority: high +tags: + - harness + - instructions + - agents +created_at: 2026-11-24T11:00:00Z +updated_at: 2026-11-25T05:45:00Z +--- + +## Why + +Subagents read different files and get different answers. The audit protocol asks for instructions that contradict each +other. + +## Evidence + +Logged by the self-improvement audit of 2026-11-24 (first audit, period 2026-11-21 to 2026-11-24T11:00Z). The scripts +and their output are in the git-ignored audit folder `todo/self-improvement-audit-2026-11-24/`. + +1. **Switching runner on a quota limit.** `.agents/holon-flow.md` ("Cross-Runner Fallback ... automatically switch + `--agent`"), `.agents/instructions.md` ("Cross-Runner Continuation") and `.agents/workflows.md` (same) say switch + automatically; `.agents/skills/holon_flow/SKILL.md` ("No Cross-Runner Switch: never switch `--agent` ... on your + own") says never. The maintainer's word is the skill's: stay on the Claude ladder and ask before switching runner. +2. **Model ladders written out in eight places** (`AGENTS.md`, `.agents/holon-flow.md`, `.agents/instructions.md`, + `.agents/workflows.md`, `.agents/coordination.md`, `.agents/subagents.md`, `.agents/skills/holon_flow/SKILL.md`, + `.agents/skills/pr_review_loop/SKILL.md`). The Antigravity default changed from `gemini-4-argon` to `gemini-4-neon` + on 2026-11-24 and had to be edited in each; the next change will miss one. +3. **Which runner a flow uses by default.** `AGENTS.md` says `antigravity-agent` for all Holon coding tasks; the Claude + ladder in `.agents/holon-flow.md` and the flow practice of 2026-11-23/24 put `claude-fable-5-2` first. A subagent + cannot tell which applies. +4. **File size.** `.agents/engineering-rules.md` rule 15 calls 200 lines "a recommended guideline ... rather than a + rigid hard rule"; the module budgets are enforced and force splits, and the target's review prompt flags any growth + of a file over 1,000 lines as Important (25 findings in the period). Three different limits. + +## Proposed change + +- One canonical section per rule (runner and model ladder in `.agents/model-tiers.md` or `.agents/holon-flow.md`, file + size in `.agents/engineering-rules.md`); every other file links to it and states nothing of its own. +- Runner switching: write the maintainer's rule (ask first) in the canonical place and delete the automatic-switch text. +- File size: state the three limits as they are enforced (200-line guideline, enforced module budgets, no growth over + 1,000 lines) in rule 15. + +## Expected gain + +Fewer wrong launches and wrong fallbacks by subagents; one edit per future change instead of eight. + +## Cost + +Small harness-only edit. + +## Audit evidence, 2026-11-25T05:45Z (self-improvement audit, fifth merge #288 to #299) + +- Item 2 happened. `AGENTS.md` (hard rule, committed) still says "`antigravity-agent` with `gemini-4-argon` ... then + `gemini-4-hydrogen` → `gemini-3.8-flash`" (maintainer, 2026-11-22). `.agents/holon-flow.md` lines 67 to 68 say + `gemini-4-neon` first, then `gemini-4-argon`. Every Antigravity flow in the period ran `gemini-4-neon` (ledger `model` + and `review_model` fields on #288 to #307). +- The same split shows up across sessions: rules held only in Claude Code's private memory never reach the Antigravity + session (Bean 0459). + +- Progress (2026-11-25): aligned with the skill's "No Cross-Runner Switch" and the maintainer's rule of 2026-11-23 (stay + on the runner's ladder, ask before switching): `.agents/holon-flow.md`, `.agents/instructions.md`, + `.agents/workflows.md`, `.agents/coordination.md` section 5 and the PR driver note in the review-loop skill. + +- Item 3 follow-up (2026-11-26): Bean 0483 measures runner and model wall time on comparable flows to choose the + default. diff --git a/.beans/holon-agentic-coder-ref-metadata-0412--every-flow-step-is-timed-and-every-flow-keeps-its.md b/.beans/holon-agentic-coder-ref-metadata-0412--every-flow-step-is-timed-and-every-flow-keeps-its.md new file mode 100644 index 00000000..9a1beef7 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0412--every-flow-step-is-timed-and-every-flow-keeps-its.md @@ -0,0 +1,182 @@ +--- +# holon-agentic-coder-ref-metadata-0412 +title: "Every flow step is timed and every flow keeps its log: the steps the audit could not measure" +status: todo +type: feature +priority: normal +tags: + - flow + - harness + - logging + - timing + - holon-agentic-coder +created_at: 2026-11-24T11:00:00Z +updated_at: 2026-11-25T06:05:00Z +--- + +## Why + +The audit protocol requires a timing table of every step of the flow and says missing timing is itself a finding. These +steps could not be measured from the evidence. + +## Evidence + +Logged by the self-improvement audit of 2026-11-24 (first audit, period 2026-11-21 to 2026-11-24T11:00Z). The scripts +and their output are in the git-ignored audit folder `todo/self-improvement-audit-2026-11-24/`. + +Not measured, and why: + +| Step | Why it could not be measured | +| :------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------- | +| Pre-flight (credential probe, image check, worktree creation) | the wrapper's own lines carry no timestamp | +| Each push (execution branch, resolver, ledger rows, calibration) | no start or end line; pushes are folded into the turn around them | +| Each conflict probe and each merge of the target | only the outcome is logged, not its start | +| Each reviewer of the ensemble | only the ensemble's end is logged; the slowest reviewer is unknown | +| The overlap wait inside a run | the engine exits on refusal and the wait shows only as a gap before the next launch | +| Idle between a stop and its resume when the resume is written to another log | logs are per launch name, not per flow | +| 22 of the 47 merged pull requests (all 8 of `holon-coherence`, 14 of `holon-agentic-coder`) | no flow log was kept at all; their review iterations could not be counted | + +- The wrapper prints to its stdout; whether a log exists depends on how the launching subagent redirected it. The + `holon-coherence` flows of 2026-11-24 left none. + +## Proposed change + +1. The wrapper owns its log: it writes `flow-.log` itself in append mode, every line prefixed with a UTC + timestamp, including its own pre-flight lines, whatever runtime launched it. +2. The engine logs a start and an end line, with the elapsed seconds, for every push, conflict probe, merge of the + target, reviewer and wait, and records the same in the checkpoint's step log (Bean 0383 Goal 4 builds the per-stage + breakdown on these). +3. The overlap wait is logged as a wait with its start and end, not as a series of refused runs. + +## Expected gain + +The next audit can time every step for every flow, and a flow suggestion can name the time it saves. No direct time +saving. + +## Cost + +Small: wrapper (`.agents/skills/holon_flow/scripts/run_holon_flow.py`) and logging calls in the engine. + +## Notes + +- Overlap: Bean 0385 (the log stays empty until the run ends) owns the flushing; Bean 0383 Goal 4 (Stage 5 timing + breakdown) is a subset of the timing this bean records. This bean owns the timing for all other steps. +- Related: Bean 0385 (log stays empty until the run ends; buffering), Bean 0383 Goal 4 (timing breakdown in the flow + summary). + +## Audit evidence, 2026-11-24T12:58Z (self-improvement audit, fifth merge) + +- Flows launched from the Antigravity session (Beans 0265, 0399, 0376 and 0153, and the flows of PR #274 and coherence + PRs #53 to #55) wrote no `todo/flow-.log`. For them only stage start and end could be read, from the + checkpoints; see Bean 0423. +- Checkpoint timing disagrees with itself: `flow-intent-0393-preflight-retry` records calibrate `start_time` 12:11:32Z, + `end_time` 12:11:45Z and `elapsed_seconds` 641.9. +- An executor turn is one opaque step. Bean 0405's Stage 3 took 125.4 minutes; its notes list 39 test runs with about 15 + minutes of reported pytest time and a mutant run that hung until the tool's 10-minute limit, so roughly 95 minutes + were model time, but nothing records it. Add: the engine logs each tool call's start and duration from the runner's + event stream (or at least the summed tool time and model time per turn). + +## Audit evidence, 2026-11-25T00:28Z (self-improvement audit, fifth merge) + +- **19 of 24 active flows** (`18` `holon-agentic-coder` flows + `holon-coherence#56`) left **no** `todo/flow-.log` + entries between `2026-11-24T12:59Z` and `2026-11-25T00:19Z` (only 5 flows wrote logs). +- `checkpoint-split-cli-init-modules.json` recorded `review: status=failed start=None end=None elapsed=1.161`, leaving + failed Stage 4 entry timestamps unmeasured. +- `todo/flow-unit-suite-slowest-tests-speedup.log` logged container error timestamps in `+11:00` local time inside a + `[2026-11-24T23:52:07Z]` prefix (`time="2026-11-24T23:52:07+11:00"`), mixing UTC and local timezones. +- Stage 5 `calibrate.elapsed_seconds` includes `merged_head_ci` + `final_head_ci` waits while `start_time..end_time` + covers only `run_calibrate` (`config-env-self-doc`: `2.6 min` vs `5.0 min`; `timing-gate-judges-test-time`: `0.3 min` + vs `30.8 min`). +- Pre-flight, individual pushes, conflict probes/merges, per-reviewer turns, Stage 4 ledger commits, Stage 3 re-plans, + and Stage 4 empty-diff/PR guards remain unmeasured in checkpoints. + +## Audit evidence, 2026-11-25T02:54Z (self-improvement audit, fifth merge) + +- **12 of 14 active flows** (`11` Antigravity flows + `split-cli-init-modules`) left **no** `todo/flow-*.log` entries + between `2026-11-25T00:28Z` and `02:54Z` (only `flow-timing-gate-judges-test-time.log` and + `flow-workspace-survival-job-parallel.log` logged in the window; wrapper pre-flight lines in the latter carry no + timestamps). +- Stage 5 `calibrate.end_time` (`calibrate.py:300`) is recorded before `publish_calibration` and `final_head_ci` wait, + so `calibrate.elapsed_seconds` (`3.9–12.6 min`) diverges from `start_time..end_time` (`2.6 min` across `11` flows). +- Pre-flight, individual pushes, target conflict merges, per-reviewer latencies inside the `~7.0 min` ensemble, and + executor inner tool-vs-model split remain unmeasured. + +## Audit evidence, 2026-11-25T04:02Z (self-improvement audit, fifth merge) + +- **`1 of 2` active flows (`no-unneeded-full-review`)** left **no** `todo/flow-*.log` in the `02:54Z–03:54:45Z` window. +- **`todo/flow-workspace-survival-job-parallel.log`:** wrapper pre-flight lines (`lines 1–11`, `88–98`) still lack UTC + timestamps; `calibrate.end_time` (`03:37:54Z`) again preceded `final_head_ci` wait (`03:38:05Z–03:39:13Z`); and + `End-of-flow sync` re-entry (`03:39:20Z–03:54:45Z+`) is unrecorded in `checkpoint.context.logs` and + `checkpoint.stage_results` while running (see Bean `0445`). +- Pre-flight, individual pushes, conflict merges, per-reviewer latencies inside the `3.7 / 9.5 / 4.2 min` ensembles, and + executor inner tool-vs-model split (`42.1 min` Stage 3) remain unmeasured. + +## Audit evidence, 2026-11-25T05:07Z (self-improvement audit, fifth merge #290–#294) + +- **`dev-env#42` (`tmux-focus-events-on`) and `0407` (`no-unneeded-full-review`)** left no `todo/flow-*.log` in the + window, leaving pre-flight (credential probe, image check, worktree creation) `not measured`. +- Individual git pushes, conflict probe/merge timings, per-reviewer latencies inside the `4.40 / 4.13 min` (`hac#308`) + and `14.85 min` (`dev-env#42`) ensembles, and inner tool-vs-model splits inside Stage 3 (`4.80 min` on `dev-env#42`) + and Stage 4 resolvers (`27.02 min` + `4.47 min` on `hac#308`) remain unmeasured. +- `review_local` drops `TestMeasurement.output_excerpt` and failing test node IDs from logs and `executions.jsonl` + (tracked separately in Bean `0450`). + +## Audit evidence, 2026-11-25T05:41Z (self-improvement audit, fifth merge #295–#299) + +- New flows `0371` (`todo/flow-ledger-fragments-and-promotion.log`) and `0438` + (`todo/flow-calibration-merge-adapted-file.log`) wrote timestamped stage logs, yet wrapper pre-flight lines + (`lines 1–13` in both logs) still carry no UTC timestamps. +- Antigravity flows (`#295–#301` and `0407`) still leave no `todo/flow-*.log` (e.g., `#301`'s `05:32:48Z` `origin/main` + merge); individual git pushes, conflict merges, per-reviewer latencies inside `4.47 / 3.83 min` ensembles (`#308` i4, + `#309` i1), and inner tool-vs-model splits inside `4.98 min` Stage 3 (`#309`) and `7.45 / 15.20+ min` Stage 4 + resolvers (`#308`) remain unmeasured. + +## Audit evidence, 2026-11-25T05:45Z (self-improvement audit, fifth merge #288 to #299) + +- Antigravity flows still write no wrapper log. The ledger rows give iteration times (13 iterations, median 7.5 min) and + resolver times (2, median 3.2 min). They give no per-reviewer split, no push times and no idle time. +- Gaps between checkpoint stages that nothing records: plan end to execute start of 76 to 109 s on all 8 Antigravity + flows (median 86 s; Claude flows go straight to admission, 16 to 44 s); execute end to review start of 28.9 min on + #308 (03:10:31Z to 03:39:28Z) and 6.0 min on `decomposition-rule-self-doc`; review end to calibrate start of 8.0 min + on #308 and 7.5 min on `github-pr-merge-self-doc`. +- Hand `resolve-conflict` syncs done outside a flow (13 in the period, Bean 0458) leave no timing record at all; only + commit times show them. + +## Audit evidence, 2026-11-25T06:05Z (self-improvement audit, fifth merge #300–#304) + +- Wrapper pre-flight (`lines 1–13` of `todo/flow-ledger-fragments-and-promotion.log` and + `todo/flow-calibration-merge-adapted-file.log`) still prints no UTC timestamps, leaving wrapper startup time + unmeasured. +- Stage 4 inner sub-steps remain opaque: + - Per-reviewer latencies inside ensembles (`#309` Iter 1 `3.9 min`, Iter 2 `10.1 min`; `#308` Iter 4 `8.4 min`) are + not recorded individually. + - Inside `#309`'s **`6.58 min`** Markdown-only resolver pass (`05:40:17Z..05:47:06Z`) and `#308`'s **`37+ min`** + active Iter 4 resolver (`d7a5f5ec82a1` since `05:25:12Z`), container boot vs LLM turns vs `lint`/`pytest` + verification time are unmeasured. + - Individual git push latencies and exact `review_local` wall duration (vs logged test rate/verdict) remain + unmeasured. +- On `#309`, Stage 5 calibration work (`05:57:50Z..06:00:26Z`, `2.60 min`) vs `chore(calibration)` push/head settle + (`11 s` before `06:00:37Z` CI registration wait) vs `final_head_ci` inner check registration (`18 s`) + polling + (`48.93 s`, total `3.98 min` stage) must still be reconstructed by grepping text logs instead of structured step + metrics in checkpoint JSON. +- On `#300–#304` (worktrees already pruned) and live `0407` (idle since `02:41:40Z`), Antigravity flow wrapper logs do + not exist on disk, leaving exact pre-flight, admission-poll, push, and inter-stage idle gaps unmeasured. + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- Still unmeasured in `2026-11-25T22:49:00Z..2026-11-26T03:50:09Z`: + - Wrapper pre-flight timestamps before `Pipeline run initiated` (`run_holon_flow.py`). + - Per-reviewer latency inside the Stage 4 ensemble and the inner `review_local` reviewer-turn vs CI-wait split. + - Individual Stage 4 git push and conflict-merge durations. + - Missing flow logs for `holon-coherence#56` and `thomashan/dev-env#42`–`#44`, plus the final `36+ min` of + `todo/flow-macos-unit-only-when-relevant.log` (`03:01:05Z..03:37:15Z+` buffered under `0385`). + +## Audit evidence, 2026-11-26 (flow time audit) + +Instrumentation gaps from section 4 of `todo/flow-time-audit-2026-11-26.md`: + +- Wrapper log lines carry no timestamps. +- Per-reviewer timing is missing; only the ensemble end is logged. +- Executor and resolver test runs and pushes inside agent turns are not logged. +- `executions.jsonl` rows have no turn durations or token counts. +- No flow log exists for the antigravity flows #296 to #307 or for #316 (0-byte log; Bean 0385). diff --git a/.beans/holon-agentic-coder-ref-metadata-0413--coding-rules-from-what-the-reviewers-keep-finding.md b/.beans/holon-agentic-coder-ref-metadata-0413--coding-rules-from-what-the-reviewers-keep-finding.md new file mode 100644 index 00000000..42b3d412 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0413--coding-rules-from-what-the-reviewers-keep-finding.md @@ -0,0 +1,64 @@ +--- +# holon-agentic-coder-ref-metadata-0413 +title: "Coding rules from what the reviewers keep finding, given to the planner and executor up front" +status: todo +type: task +priority: normal +tags: + - coding-standards + - review + - flow + - holon-agentic-coder +created_at: 2026-11-24T11:00:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +Every finding a reviewer raises costs a resolver pass and a full re-review. Findings that recur across flows point at +rules the planner and executor could follow from the start. + +## Evidence + +Logged by the self-improvement audit of 2026-11-24 (first audit, period 2026-11-21 to 2026-11-24T11:00Z). The scripts +and their output are in the git-ignored audit folder `todo/self-improvement-audit-2026-11-24/`. + +249 distinct findings in the resolver results of the period's flow logs (126 important, 121 nits, 2 critical; 216 +applied, 26 rejected, 7 open). Recurring kinds: + +| Kind | Findings | Example | +| :------------------------------------------------------- | -------: | :------------------------------------------------------------------------------------------------------- | +| A file already over 1,000 lines grows | 25 | "executor.py, already over 1,000 lines, grows from 1580 to 1852 lines" | +| Documentation out of step with the code | 20 | README key tables and module maps listing removed or missing items | +| The pull request does not state what the intent asks for | 18 | "the PR description omits the confirmed cause" (one flow) | +| A failing check found during the review | 17 | "CI checks failed in iteration N: local_tests" | +| A deny-list misses another repository-controlled key | 12 | "PROJECT_REFUSED_KEYS omits HOLON_COHERENCE_IMAGE" (PR #251, found one key at a time over 11 iterations) | +| Helper copied instead of reused | 12 | "_MARKER_PREFIXES and _has_markers duplicate flow/target_sync_merge.py verbatim" | +| New tests added to an oversized test module | 13 | "Grows test_review_loop.py from 2679 to 2723 lines" | +| Lint errors | 10 | ruff E501, F401, I001, E402, RUF022 | + +## Proposed change + +Add these rules to the target repository's own agent guidance that the planner and executor prompts include +(target-native wording only, no harness paths): + +1. Never grow a file over 1,000 lines; put new code and new tests in a new focused module. +2. Inputs a repository controls are checked against an allow-list, never a deny-list. +3. Reuse an existing helper; never copy one. +4. Documentation that lists code items (keys, modules, commands) is generated or drift-tested, never hand-maintained. +5. When the intent asks for a stated outcome (a cause, a seed, a measurement), the pull request description states it. +6. Run lint and the tests of the touched area before ending the turn (made mechanical by Bean 0408). + +## Expected gain + +The recurring kinds above are about 120 of 249 findings; each avoided finding saves a resolver pass and part of a +re-review (median iteration 6.7 minutes). + +## Cost + +Small: one guidance document and prompt includes in the target repository, delivered by a flow. + +## Notes + +- Related: Bean 0408 (local gate), Bean 0409 (rejected findings), Bean 0410 (generated docs), Bean 0380 (module + budgets). diff --git a/.beans/holon-agentic-coder-ref-metadata-0414--an-edit-outside-the-plan-s-touch-set-is-caught-dur.md b/.beans/holon-agentic-coder-ref-metadata-0414--an-edit-outside-the-plan-s-touch-set-is-caught-dur.md new file mode 100644 index 00000000..4146be34 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0414--an-edit-outside-the-plan-s-touch-set-is-caught-dur.md @@ -0,0 +1,101 @@ +--- +# holon-agentic-coder-ref-metadata-0414 +title: "An edit outside the plan's touch set is caught during the executor turn, not after it" +status: todo +type: feature +priority: normal +tags: + - flow + - stage-3 + - touch-set + - holon-agentic-coder +created_at: 2026-11-24T11:00:00Z +updated_at: 2026-11-26T05:25:00Z +--- + +## Why + +Fail early: a breach of the touch set is knowable the moment the executor writes the file, but the flow learns of it +only after the turn, discards the whole execution and plans again. + +## Evidence + +Logged by the self-improvement audit of 2026-11-24 (first audit, period 2026-11-21 to 2026-11-24T11:00Z). The scripts +and their output are in the git-ignored audit folder `todo/self-improvement-audit-2026-11-24/`. + +Six executions in the period were discarded with "the execution changed N file(s) outside the plan's touch set; +returning to Stage 2 (re-plan attempt N of N)": + +| Flow | Executor time discarded | +| :----------------------------- | ----------------------: | +| approval-survives-main-merge | 26.3 min | +| layered-env-config-v2 | 19.1 min | +| execute-stage-object | 18.5 min | +| resolve-conflicts-in-flow | 15.6 min | +| no-fallback-calibration-report | 13.9 min | +| claude-code-mode-default-on | 8.6 min | + +Total about 102 minutes of executor time, plus a re-plan (median 4.0 minutes) and a second execution each. The files +outside the touch set were mostly companions of the planned change: `flow/__init__.py`, `README.md`, +`flow_module_budgets.json`, test helpers. + +## Proposed change + +1. The executor is given the touch set and a write guard that refuses a write outside it during the turn, with a message + that names the file; the executor either stays inside it or ends the turn asking for a re-plan with the reason. +2. The planner adds the usual companions of a change to the touch set (the package's `__init__.py` re-exports, the + budget entry, the README section) when it touches a module that has them. + +## Expected gain + +About 102 minutes of executor time and six re-plans in the period; more as flows grow. + +## Cost + +Medium engine change in Stage 3 and the planner prompt. + +## Notes + +- Related: Bean 0410 (fewer shared companion files), Bean 0151 (planner touch set). + +## Audit evidence (`2026-11-24T11:05Z–12:47Z`) + +- `holon-agentic-coder#273` (`route-stage-4-and-stage-5`, Bean `0376` child 4): at `2026-11-24T11:07:42Z`, Stage 3 + execution (`21.3 min`) was discarded by `touch_set_guard` over 18 out-of-set files (`flow/__init__.py`, + `lazy_exports_sync.py`, and 16 test files), forcing a `4.7 min` Stage 2 re-plan (`P-1795518467-ANA-G4N`) and a + `25.2 min` Stage 3 re-execution. + +## Audit evidence (`2026-11-26T03:50Z`, fifth-merge audit) + +- In `ledger-fragments-and-promotion` (`0371`, `todo/flow-ledger-fragments-and-promotion.log`), **`3` of `4` sequential + sub-intents** had a completed Stage 3 execution discarded post-turn by `touch_set_guard`, plus sub-intent 2 hit it on + resume: `#310` (`15.57 min` discarded over `2` test files + `2.29 min` re-plan), `#311` (`2.63 min` resume discarded + over `3` files + `2.52 min` re-plan), `#312` (`9.12 min` discarded over `3` files + `2.61 min` re-plan), `#313` + (`12.53 min` discarded over `env_registry.py` and `docs/environment_variables.md` + `3.15 min` re-plan) — + **`39.85 min`** discarded Stage 3 and **`10.57 min`** re-planning in one flow. + +## Audit evidence, 2026-11-26 (flow time audit) + +Flow time audit (`todo/flow-time-audit-2026-11-26.md`), PRs #296 to #316: 6 of 9 claude-agent flows had their first +executor turn discarded for a touch-set breach, then re-planned and executed again. + +| Flow (PR) | Discarded executor turn | Re-plan | Files outside the touch set (from the log) | +| :-------------- | ----------------------------------: | ------: | :----------------------------------------------- | +| #310 child 1 | 15.4 min | 2.0 min | (see flow log) | +| #311 child 2 | 2.5 min (+20.8 min executor exit 1) | 2.3 min | `calibration_e...` | +| #312 child 3 | 9.0 min | 2.4 min | `ledger/promote...` | +| #313 child 4 | 12.4 min | 2.9 min | `env_registry...` | +| #315 macos | 12.3 min | 1.8 min | `tests/test_ci_bookkeeping_gate.py` and one more | +| #316 review-key | 15.6 min | 2.3 min | (see checkpoint log) | + +Total 81 min (median 11.4 min per flow, 11 % of all active flow time): the second largest structural sink after the +review loop. The kept executions took 3.9 to 5.0 min each, so the discarded turn usually costs 2 to 3 times the real +work. + +## Update 2026-11-26T12:20Z (audit) + +Flow 0407 (PR #334): 4 of 5 children discarded a finished executor turn for out-of-touch-set files (15.6, 11.8, 26.0 and +13.3 min, about 67 min, plus 3 re-plans of 2.5 to 3 min). The escapes were `flow/__init__.py` re-exports, an app README +and a test fixture, always companions of a listed file. Classify these companions (re-export of a new public name, +README of the touched app, fixture of a listed test) and accept them without a Stage 2 round trip; see 0508 for the +intent-side fix. diff --git a/.beans/holon-agentic-coder-ref-metadata-0415--cap-pytest-workers-in-containers-to-stop-oom-kill.md b/.beans/holon-agentic-coder-ref-metadata-0415--cap-pytest-workers-in-containers-to-stop-oom-kill.md new file mode 100644 index 00000000..8373f98c --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0415--cap-pytest-workers-in-containers-to-stop-oom-kill.md @@ -0,0 +1,55 @@ +--- +# holon-agentic-coder-ref-metadata-0415 +title: "Cap pytest workers inside containers to stop OOM SIGKILL (-9) failures" +status: scrapped +type: bug +priority: high +tags: + - flow + - stage-3 + - docker + - tests + - holon-agentic-coder +created_at: 2026-11-24T11:05:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +With up to 4 concurrent `holon-flow` runs sharing the host Docker Desktop VM RAM, running +`uv run pytest -n auto --dist worksteal` across 6,856 tests inside each role container spawns unbounded worker processes +and hits the Linux OOM killer (`SIGKILL` / `exit code -9`), wasting ~30 minutes per failed turn and requiring a manual +resume. + +## Evidence + +- `todo/flow-ci-skip-bookkeeping-only-pushes.log` (Bean 0403, `2026-11-24T10:17:02Z`–`10:48:42Z`): Stage 3 ran for 30.5 + min and failed with + `Execute stage failed: executor agent recorded status 'failure': Plan execution failed with exit code -9` + (`entrypoint/executor/outcome.py:70`). +- On resume (`10:54:38Z`–`11:00:43Z`), partial code work was adopted and the suite completed in `5.7 min` + (`6856 passed, 0 failed, 0 errored`). +- `holon-config/prompts/executor.template.md` and `holon-config/prompts/planner.template.md` instruct agents to run + `-n auto --dist worksteal` with no worker cap or memory check inside the container. + +## Proposed change + +1. Bound pytest worker count inside role containers (e.g. a configurable `HOLON_PYTEST_WORKERS` / default `-n 4` cap + derived from container/VM available memory when `-n auto` is used in Docker, or enforcing a max worker cap in + `pytest` / container env). +2. Detect `returncode == -9` / `137` in `entrypoint/executor/outcome.py` and surface an explicit OOM / worker-cap + diagnostic instead of a generic exit code `-9`. + +## Expected gain + +Prevents 30+ minute Stage 3 executor failures and manual resume cycles under 4-way concurrent flow execution. + +## Cost + +Small change in `holon-config/prompts/` and `apps/sandbox-executor/src/sandbox_executor/entrypoint/executor/outcome.py`. + +## Resolution + +Scrapped 2026-11-24. The maintainer said: "you don't need 415 since I've increased the docker ram". Docker Desktop's +memory was raised from 8 GB to 32 GB at about 12:50Z on 2026-11-24, which removes the cause of the out-of-memory kills +this bean addressed. Overlaps with Bean 0421, which recorded the same cause and is also closed. diff --git a/.beans/holon-agentic-coder-ref-metadata-0416--fix-relative-quota-reset-and-watcher-token-lookup.md b/.beans/holon-agentic-coder-ref-metadata-0416--fix-relative-quota-reset-and-watcher-token-lookup.md new file mode 100644 index 00000000..9d5e34c9 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0416--fix-relative-quota-reset-and-watcher-token-lookup.md @@ -0,0 +1,55 @@ +--- +# holon-agentic-coder-ref-metadata-0416 +title: "Fix relative quota reset tail scanning, seconds parsing, and watcher keychain lookup" +status: todo +type: bug +priority: high +tags: + - harness + - holon-flow + - run-247 + - credentials + - reliability +created_at: 2026-11-24T11:05:00Z +updated_at: 2026-11-24T11:05:00Z +--- + +## Why + +The harness flow wrapper and limit watcher parse quota reset messages inconsistently and `watch_limits.py` still reads a +deleted plaintext secret file after Bean 0225 moved the Claude OAuth token to the OS keychain. + +## Evidence + +Inspected in the self-improvement audit of `2026-11-24T11:05Z`: + +1. **Full-output vs tail scan mismatch (`.agents/skills/holon_flow/scripts/run_holon_flow.py`)**: + `is_quota_error(output)` scans only the last `QUOTA_SCAN_TAIL_LINES = 200` lines (to ignore intent prose, commit + `90fe069`), whereas `parse_limit_reset(output)` and `parse_relative_limit_reset(output)` (lines 362–400) run + `re.search` over the **entire** `output` from the start. An earlier reset string in intent prose or a previous + attempt overrides the latest error at the tail. +2. **Seconds dropped in `limit_reset.py` (`.agents/skills/run_247/scripts/limit_reset.py`, lines 86–98)**: `parse_reset` + uses `re.search` from the start of the message and its relative regex `in ... h ... m` omits seconds (`s`). + Antigravity messages like `"Resets in 51m58s"` drop `58s`, and `"Resets in 45s"` returns `None` (misclassified as + credit exhaustion). +3. **Stale plaintext token path & Claude-only relaunch (`.agents/skills/run_247/scripts/watch_limits.py`, lines 10, + 46, 133)**: `TOKEN_FILE` still reads `~/.holon/secrets/claude-oauth-token` directly (deleted at `2026-11-24T09:56Z` + when PR #271 / Bean 0225 moved it to the OS keychain; Bean 0406 fixed only `flow_env.py`), and `watch_limits.py` + still excludes `antigravity-agent` flows from automatic relaunch. + +## Proposed change + +1. Make `parse_limit_reset` in `run_holon_flow.py` scan only the tail (matching `QUOTA_SCAN_TAIL_LINES`) and take the + **last** matching reset expression. +2. Add seconds (`s`/`sec`/`seconds`) support and last-match semantics to `limit_reset.py`'s `parse_reset`. +3. Reuse `flow_env.py`'s OS-keychain-aware token resolution in `watch_limits.py`, support `antigravity-agent` relaunch + alongside `claude-agent`, and add unit tests in `tests/test_flow_fallback.py` and `limit_reset.py --self-test`. + +## Expected gain + +Prevents early/missed quota wakeups and broken `watch_limits.py` relaunches after the keychain migration. + +## Cost + +Small harness-only change in `.agents/skills/holon_flow/scripts/run_holon_flow.py`, `.agents/skills/run_247/scripts/`, +and `tests/`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0417--gate-flow-wrapper-completion-against-premature-end.md b/.beans/holon-agentic-coder-ref-metadata-0417--gate-flow-wrapper-completion-against-premature-end.md new file mode 100644 index 00000000..a902efe1 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0417--gate-flow-wrapper-completion-against-premature-end.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0417 +title: "Gate flow wrapper completion against premature end" +status: completed +type: bug +priority: high +tags: + - harness + - holon-flow + - reliability +created_at: 2026-11-24T11:05:00Z +updated_at: 2026-11-25T05:30:00Z +--- + +## Why + +`run_holon_flow.py` ends a flow without checking that the flow delivered what it promised, and the state file that a +resuming agent reads is left to the driving subagent's prose. A flow can therefore be reported finished while it has no +pull request, no calibration report or a conflicting pull request. + +## Evidence + +Reconstructed on 2026-11-24 from the self-improvement audit of 11:05Z, which names this bean as "Make +`run_holon_flow.py`'s `verify_pr_and_calibration` fail non-zero on missing PR/calibration/conflicting PR and write +`.subagent/flow__state.json` deterministically instead of trusting `flash_lite` prose". The file's first version +was a copy of Bean 0416 and carried none of this text. + +- `.agents/skills/holon_flow/scripts/run_holon_flow.py`, `verify_pr_and_calibration`: when no open pull request matches + the slug it only calls `log_warn("No open PR found ...")` and returns, and a GitHub query failure is also only a + warning. The wrapper then exits 0. +- The same function checks the calibration report in the pull request diff, but a missing report does not change the + exit code, and a conflicting pull request is only logged with `log_error`, so the exit code is unchanged. +- The `.subagent/flow__state.json` files are written by the driving subagent, not by the wrapper. + +## Proposed change + +1. `verify_pr_and_calibration` returns a result and the wrapper exits non-zero when there is no pull request for the + slug, when the calibration report is absent from the pull request diff, or when the pull request is conflicting or + not mergeable. A merged pull request (Bean 0420) is a clean finish. +2. The wrapper writes `.subagent/flow__state.json` itself, deterministically, with the outcome and the pull + request number, so a replacement driver does not depend on a model's summary. +3. Tests in `tests/test_flow_fallback.py` or a new test file cover each failing case. + +## Notes + +- Related: Bean 0420 (a flow whose pull request merges while running), Bean 0396 (a flow survives its session), Bean + 0416 (same wrapper script, different defect). +- Harness-only change; no target repository is touched. + +## Resolution + +`verify_pr_and_calibration` now returns a result (ok, problems, pr, calibration, mergeable, merge state, checks) and +`run_flow` exits 1 when the flow exits 0 but the PR is missing or unqueryable, closed unmerged, lacks the calibration +report in its diff, or is CONFLICTING/DIRTY; a merged PR is a clean finish. Pending checks are waited for (bounded 45 +min, 30 s poll, via `gh pr checks`) and still-pending at the bound fails. The wrapper writes +`.subagent/flow__state.json` itself (status, PR number/url, stage reached, consensus, calibration EV when logged, +merge state, next action). Dry runs are unchanged. Tests (fakes only, no gh) in `tests/test_flow_completion.py`. Full +suite: 179 passed. diff --git a/.beans/holon-agentic-coder-ref-metadata-0418--preserve-passing-execution-on-touch-set-expansion.md b/.beans/holon-agentic-coder-ref-metadata-0418--preserve-passing-execution-on-touch-set-expansion.md new file mode 100644 index 00000000..a0eeafd7 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0418--preserve-passing-execution-on-touch-set-expansion.md @@ -0,0 +1,62 @@ +--- +# holon-agentic-coder-ref-metadata-0418 +title: "Preserve passing executions on touch-set expansion and decompose re-plan failures" +status: todo +type: feature +priority: normal +tags: + - flow + - stage-2 + - stage-3 + - touch-set + - holon-agentic-coder +created_at: 2026-11-24T11:05:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +When Stage 3 finishes with a passing test suite and only a small out-of-touch-set companion edit (e.g. `README.md` or +tests), `pipeline._replan_after_over_budget` discards the entire passing execution branch and reruns Stage 2 and Stage 3 +from scratch (and aborts decomposed parent flows if Stage 2 re-plan hits an error). Bean 0414 blocks out-of-set writes +_during_ an executor turn; this bean covers preserving passing work and safely resuming decomposed flows when +expansion/re-planning still triggers. + +## Evidence + +- `todo/flow-claude-code-mode-default-on.log` (lines 139–165): Stage 3 finished in `8.3 min` (`6437 passed, 0 failed`), + then `touch_set_guard` discarded the execution over 1 file (`holon-config/metrics/README.md`) and reran Stage 2 + (`3.6 min`) + Stage 3 (`7.2 min`) from scratch. +- `todo/flow-resolve-conflicts-in-flow.log` (lines 1796–1833): sub-intent 3/5 ran `15.8 min` (`6350 passed`), hit + `touch_set_guard` on 3 files, returned to Stage 2 (`re-plan attempt 1 of 2`), immediately hit + `ConflictResolutionError` in `plan` stage, and aborted `198.7 min` of a decomposed flow. +- `apps/sandbox-executor/src/sandbox_executor/flow/pipeline.py` (lines 242–308) and `budgets.py` + (`MAX_REPLAN_ATTEMPTS = 2`): on exhaustion, `touch_set_replan_exhausted` throws away the execution branch even when + tests are green. + +## Proposed change + +1. When `touch_set_guard` triggers on a passing execution (`rate == 1.0`) and the out-of-set paths are bounded companion + files (or the executor explicitly requests touch-set expansion), widen the plan's touch set and re-run admission + against the expanded set **preserving the execution branch** rather than discarding it and re-executing from scratch. +2. When a decomposed sub-intent fails during re-plan (`_replan_after_over_budget`), persist the sub-intent + checkpoint/branch state cleanly so resume continues from that sub-intent rather than throwing away earlier progress. + +## Expected gain + +Saves 10–30+ minutes per touch-set expansion on passing executions and prevents parent decomposed flow restarts. + +## Cost + +Medium change in `apps/sandbox-executor/src/sandbox_executor/flow/pipeline.py` and `flow/stages/touch_set_guard.py`. + +## Notes + +- Complementary to Bean 0414 (in-turn write guard) and Bean 0376 (in-flow conflict resolution in Stage 2). + +## Audit evidence (`2026-11-26T03:50Z`, fifth-merge audit) + +- `ledger-fragments-and-promotion` (`0371`, `todo/flow-ledger-fragments-and-promotion.log`): all `4` sub-intents + (`#310`–`#313`) lost `39.85 min` of Stage 3 work + `10.57 min` of Stage 2 re-planning to post-turn `touch_set_guard` + discards (`15.57 min`, `2.63 min`, `9.12 min`, `12.53 min`), even on `#311` where `7958 passed, 0 failed` + (`rate 1.000`) had just completed. diff --git a/.beans/holon-agentic-coder-ref-metadata-0419--ci-timing-gate-fails-green-unit-job-on-slow-runner.md b/.beans/holon-agentic-coder-ref-metadata-0419--ci-timing-gate-fails-green-unit-job-on-slow-runner.md new file mode 100644 index 00000000..2c838130 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0419--ci-timing-gate-fails-green-unit-job-on-slow-runner.md @@ -0,0 +1,116 @@ +--- +# holon-agentic-coder-ref-metadata-0419 +title: "CI Timing Gate fails a green unit job on a slow runner and withdraws flow consensus" +status: completed +type: bug +priority: high +tags: + - ci + - flow + - holon-agentic-coder +created_at: 2026-11-24T11:45:00Z +updated_at: 2026-11-26T08:49:03Z +--- + +## Problem + +On 2026-11-24 the `unit (ubuntu-latest)` check of holon-agentic-coder PR #270 failed on head `c341f784` (run +45384726497, job 138412602406, finished 11:36:14Z). The failure was not a test failure. Every step before the gate +passed; pytest reported `6706 passed, 1 skipped, 678 subtests passed in 351.12s`. The failing step was +`CI Timing Gate (compare with main)`: + +```text +Timing regression: job took 360 s against a baseline median of 229 s over 5 main runs (tolerance 50%, minimum delta +120 s). +``` + +The merge into the branch changed only ledger files under `holon-knowledge/ledger/`, so the code was identical to head +`2678fa5b`, whose run 45382741619 took 240 s and passed. The flow read the failed check, withdrew its consensus (ledger +row `ACT-WITHDRAW-1795520273-bfbde73b`) and restarted Stage 4, although the maintainer merged the PR through the merge +queue at 11:31:45Z, before the check finished. + +### Evidence that the runner was slow, not the code + +The per-test report lists tests that normally take under a second and took 6 to 13 s each. They are spread across +unrelated files, which points at a contended runner and not at one regressed test: + +| Test (under `apps/sandbox-executor/tests/`) | Baseline | Current | +| ----------------------------------------------------------------------------------------------------------- | -------- | ------- | +| `flow/stages/test_decomposition.py::TestEntropyBudgetHandoffInFlow::test_stage3_never_halts_for_a_human` | 0.8 s | 13.4 s | +| `test_flow_default_branch_worktree.py::test_an_existing_flow_worktree_is_reused` | 0.1 s | 11.1 s | +| `flow/stages/test_plan_resume_adopts_branch.py::TestRecordPlanBranchBeforePush::test_checkpoint_records...` | 0.8 s | 10.9 s | +| `test_review_carried_findings.py::test_a_failed_carried_pass_records_its_rejected_attempt` | 0.1 s | 8.5 s | +| `test_git.py::test_has_effective_diff_reverted_change_is_empty` | 0.0 s | 6.2 s | + +Recent `unit (ubuntu-latest)` durations on the same workflow: 203 s, 226 s, 240 s, 283 s, 298 s, 302 s, then 368 s on +this run. The median-of-5 baseline is 229 s, so a 50% tolerance (344 s) sits inside the normal spread when the runner is +busy. The same job on main (run 45385001779, commit `bfbd9f4e`) was still running when this was written, so main's +health is not yet confirmed. + +## Goal + +- The gate does not fail a job whose pytest result is green on runner noise alone. Options: compare the sum of per-test + times with a larger tolerance, require two consecutive breaches, retry the gate once on a fresh run, or raise the + tolerance or minimum delta to cover the observed spread (the 2026-10-26 evidence in Bean 0163 already showed about 20% + variance between identical runs). +- The flow's merged-head CI gate treats a timing-gate failure with all tests passing as a distinct, retryable outcome + and does not withdraw consensus on it without one rerun. Never rerun CI from a diagnosis; the flow or maintainer + decides. +- Record the decision in the CI timing documentation. + +## Notes + +- Overlap: Bean 0404 is the same defect on the macOS unit job. Bean 0404 owns the fix; this bean adds the + withdrawn-consensus consequence and is covered by the same flow. +- Related: Bean 0163 (introduced the gate), Bean 0405 (unit suite slowest tests), Bean 0420 (the flow outcome after the + merge). +- Not confirmed: the cause of the slow runner. The job log has no resource data. + +## Progress + +- 2026-11-24: covered by the flow of Bean 0404 (`timing-gate-judges-test-time`), launched today; see that bean. + +## Audit evidence, 2026-11-24T12:58Z (self-improvement audit, fifth merge) + +- Every failed pipeline run in holon-agentic-coder from 09:58Z to 12:55Z failed on a timing gate and on nothing else: + seven runs, all tests green. `CI Timing Gate (compare with main)` on `unit (macos-latest)`: `03cd2f88`, `6827b0d1`, + `65d5f906`, `d07ba894` (PR #272, 631 s), `8994dec5` (PR #273, 652 s); on `unit (ubuntu-latest)`: `c341f784` (PR #270, + 368 s); `Timing gate` on `Workspace survival (ubuntu-latest)`: `770fd6fe` (PR #269). Main had no failure in 24 push + runs. +- Spread of the same job on unchanged code in this window: macOS unit 246 s to 652 s, Ubuntu unit 203 s to 368 s. +- Forecast to check: PR #275 (Bean 0405) brings the unit jobs to about 190 to 210 s. A median-of-5 baseline of about 200 + s with 50 percent tolerance and a 120 s minimum delta puts the bar near 320 s, while the runner spread seen above is + up to 400 s. Unless the gate changes first, expect more timing-gate failures after #275 merges, not fewer. + +- 2026-11-25: PR #278 merged into `main` as `0c933519`. Delivered for the unit gate: the gate now judges summed JUnit + test time, the first option in the Goal, so a slow runner with green tests no longer fails the gate on wall-clock + alone. Still open: (1) the flow outcome, where a timing-gate failure with all tests green withdraws consensus with no + retry (Goal bullet 2); this is the same engine retry that Bean 0404 lists, so it is not moved here; (2) recording the + decision in the CI timing documentation, not verified in this merge. Bean stays open for those two items. + +## Flow launch, 2026-11-26 + +- 2026-11-26: flow `timing-gate-runner-variance` launched (`claude-agent` / `claude-opus-5-5`), covering the items still + open here and in the other bean: the bounded rerun of a timing-gate-only failure on unchanged code in the final-head + check (`ci_final_head.py`), and the CI timing section of `docs/git_flow.md`. Main already judges summed JUnit test + time and the Workspace survival job runs at `--ceiling 900` with `--junit`, so no workflow file changes. Bimodal + runner cause and the cancelled-job question stay open. + +- 2026-11-26: flow `timing-gate-runner-variance` completed: PR #321 (head `b3ef0e4`) is OPEN, MERGEABLE/CLEAN, 11 of 11 + checks green, review approved (consensus score 1, ensemble of 3, two passes), calibration report in the PR diff, + final-head CI success. Delivered: the final-head timing-noise rerun is bounded and covers unchanged-code heads + (`ci_final_head.py`), the Workspace survival bare `Timing gate` step is recognised as a timing gate + (`ci_failure_detail.py`, outside the intent scope, see bean 0492), and `docs/git_flow.md` states the rule. Awaiting + the maintainer's merge. + +## Resolution + +Delivered via [PR #321](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/321) and merged into `main` +(`903aafe4`): + +- **Key Architectural Deliverables**: the final-head timing-noise rerun is bounded and covers unchanged-code heads + (`ci_final_head.py`, `ci_timing_rerun.py`), so a timing-gate-only failure with green tests is retried before consensus + is withdrawn; `docs/git_flow.md` records the rule. The summed-JUnit gate itself came earlier with PR #278. +- **Verification & Tests**: 11 of 11 checks green on the final head; review consensus (ensemble of 3, two passes). +- **Holon Flow Traversal**: flow `timing-gate-runner-variance` completed Intent -> Plan -> Execute -> Review Loop -> + Calibration; the maintainer merged the pull request. diff --git a/.beans/holon-agentic-coder-ref-metadata-0420--flow-fails-when-its-pull-request-is-merged-while-running.md b/.beans/holon-agentic-coder-ref-metadata-0420--flow-fails-when-its-pull-request-is-merged-while-running.md new file mode 100644 index 00000000..95eb5041 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0420--flow-fails-when-its-pull-request-is-merged-while-running.md @@ -0,0 +1,54 @@ +--- +# holon-agentic-coder-ref-metadata-0420 +title: "A flow whose pull request is merged while it is running fails instead of finishing cleanly" +status: todo +type: bug +priority: high +tags: + - flow + - review + - holon-agentic-coder +created_at: 2026-11-24T11:45:00Z +updated_at: 2026-11-24T11:45:00Z +--- + +## Problem + +The flow `ledger-temp-worktree-cleanup` (Bean 0387, holon-agentic-coder PR #270) exited with code 1 after the pull +request had merged. The maintainer merged PR #270 through the merge queue at 2026-11-24T11:31:45Z (merge commit +`bfbd9f4e`) and GitHub deleted the remote head branch. The flow was still in its merged-head CI wait. The log +`todo/flow-ledger-temp-worktree-cleanup.log` shows: + +```text +[11:37:53Z] Merged-head CI on c341f7845d34: failed; ... unit (ubuntu-latest) ...: failure +[11:37:55Z] Consensus withdrawn: CI failed on merged head c341f7845d34; restarting Stage 4 at iteration 1 (restart 1 of 3). +[11:38:04Z] [Review Loop] Skipping PR creation: could not verify the execution diff (fetching 'I-.../_' and + 'I-.../E-1795505480-CLA-CF5.2/_' from origin failed: fatal: couldn't find remote ref refs/heads/I-.../E-.../_). +[11:38:07Z] Stage 4 failed: Autonomous review halted: Refusing to create or update a PR ...: could not verify the + execution diff +[11:38:07Z] Pipeline halted due to failure in stage 'review'. +``` + +The message is raised in `sandbox_executor/flow/review/loop.py` (line 246, the empty-diff guard that fetches the plan +and execution branches) and, for Stage 3, in `sandbox_executor/flow/stages/execute.py` (line 376). Neither checks +whether the pull request is already merged. The flow therefore treated a finished delivery as a failed review, left +calibration skipped ("calibration report not refreshed for the current head") and told the maintainer to resume a flow +that has nothing left to do. Its CI failure trigger (Bean 0419) made it re-enter Stage 4 for a pull request that no +longer existed. + +## Goal + +- At each Stage 4 and Stage 5 entry, and before any consensus withdrawal or Stage 4 restart, the flow queries the pull + request state. A merged (or closed with a merge commit) pull request ends the loop. +- On a merged pull request the flow stops its remaining stages, records the outcome as merged (a ledger row and the + checkpoint status, with the merge commit), and exits 0. It does not post a withdrawal, restart Stage 4 or print the + manual resume hint. +- A missing remote branch for a merged pull request is not an error; a missing remote branch for an open pull request + stays one. +- A regression test simulates a merge and branch deletion while the CI wait is in progress and asserts exit 0 and the + merged outcome. + +## Notes + +- Related: Bean 0419 (the timing-gate failure that triggered the withdrawal), Bean 0376, Bean 0403. +- Calibration after a merge is a separate question; this bean only requires a clean exit and a recorded outcome. diff --git a/.beans/holon-agentic-coder-ref-metadata-0421--executor-killed-by-container-oom-when-role-containers-share-the-docker-vm.md b/.beans/holon-agentic-coder-ref-metadata-0421--executor-killed-by-container-oom-when-role-containers-share-the-docker-vm.md new file mode 100644 index 00000000..66b6e61d --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0421--executor-killed-by-container-oom-when-role-containers-share-the-docker-vm.md @@ -0,0 +1,60 @@ +--- +# holon-agentic-coder-ref-metadata-0421 +title: "Executor killed with exit code -9 when concurrent role containers exhaust the shared Docker VM memory" +status: completed +type: bug +priority: high +tags: + - flow + - docker + - reliability + - holon-agentic-coder +created_at: 2026-11-24T12:20:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Problem + +The Stage 3 executor of the flow for Bean 0403 failed at 10:47:34Z on 2026-11-24 with +`Plan execution failed with exit code -9`, 30.5 minutes into execution and after four plan steps were committed. The +wrapper exited 1 and no pull request existed. + +## Evidence + +- Docker Desktop's VM has 7.75 GiB and 18 CPUs, shared by every role container; no per-container memory limit is set on + the role containers (only the sidecar sets `--memory=256m`). +- `docker events` for 10:40Z to 10:52Z shows `oom` events on four `holon/agent-claude` containers, including the + executor's own container (started 10:17:03Z, the execution id E-1795515423) at 10:42:11Z and 10:44:51Z. That container + then ended with exit 0 at 10:47:34Z, the instant the engine recorded -9: the kernel killed the agent process inside + the VM and the entrypoint exited cleanly, so the host saw only a SIGKILL status. +- At that time six or more role containers ran at once (Antigravity and Claude, two of them near 1.7 GiB each while + running test suites). Host memory was healthy (96 percent free, no swap), so the pressure was inside the Docker VM. +- The turn supervisor did not kill the turn: no stall, budget or timeout line sits in the flow log before the failure. + +Not confirmed: which process inside the container held the memory at the moment of the kill (no per-process figures were +captured). + +## Goal + +- Raise the concurrency guard so that the number of concurrent role containers (or their summed memory) is checked + against the Docker VM's `MemTotal` before Stage 3 starts a container. +- Give each role container an explicit `--memory` limit so that one container is killed alone rather than starving + others, and report an OOM kill (`docker inspect` `OOMKilled`) as its own failure reason instead of `exit code -9`. +- Treat an OOM kill as resumable: the resume should adopt the committed steps (it did on 2026-11-24, finishing Stage 3 + in 6 minutes). + +## Notes + +- The 0403 resume at 10:54Z, with four containers running, completed Stage 3 without a further kill. +- Related: Bean 0396 (flow runs and sessions), Bean 0418 (preserving a passing execution). + +## Notes + +- 2026-11-24: the maintainer raised Docker Desktop's memory from 8 GB to 32 GB at about 12:50Z, removing the shared-VM + memory pressure recorded above. Overlaps with Bean 0415 (same cause, scrapped). + +## Resolution + +Completed 2026-11-24. The cause (the shared Docker VM having 7.75 GiB for six or more concurrent role containers) was +removed when the maintainer raised its memory from 8 GB to 32 GB at about 12:50Z. Reopen this bean if an exit code -9 +kill recurs at 32 GB. diff --git a/.beans/holon-agentic-coder-ref-metadata-0422--allow-overlap-override-is-sticky-across-resumes-and-sub-intents.md b/.beans/holon-agentic-coder-ref-metadata-0422--allow-overlap-override-is-sticky-across-resumes-and-sub-intents.md new file mode 100644 index 00000000..6b8bdb0a --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0422--allow-overlap-override-is-sticky-across-resumes-and-sub-intents.md @@ -0,0 +1,63 @@ +--- +# holon-agentic-coder-ref-metadata-0422 +title: + "An --allow-overlap override is sticky: kept in the checkpoint and inherited by every later sub-intent and resume" +status: todo +type: bug +priority: high +tags: + - flow + - admission + - holon-agentic-coder +created_at: 2026-11-24T12:58:00Z +updated_at: 2026-11-25T03:08:00Z +--- + +## Problem + +`holon flow --allow-overlap` is meant to admit one refused Stage 3 run. The engine stores it in the checkpoint and never +clears it: + +- `cli/commands/flow.py:259`: + `context.allow_overlap = bool(context.allow_overlap or getattr(args, "allow_overlap", False))`, so a resume without + the flag keeps a value loaded from the checkpoint (`flow/context.py:221` and `:262`). +- `flow/stages/children.py:76` copies it into every decomposed child. + +## Evidence (self-improvement audit, 2026-11-24T12:58Z) + +- Every checkpoint of the `resolve-conflicts-in-flow` flow (Bean 0376) holds `"allow_overlap": true` (the main + checkpoint and sub-intents 1 to 4); only `checkpoint-parent.json` holds `false`. The running wrapper (launched + 2026-11-24T10:46Z from the Antigravity session) passes no `--allow-overlap`. +- Sub-intent 4 (PR #273) was admitted at 11:12Z with `override: true` over two flows that did not exist when the + override was first given: PR #270 (`tests/flow/test_git_refs.py`) and the live local flow of Bean 0405 + (`tests/flow/stages/test_decomposition.py`, `tests/test_calibrate_rerun.py`), launched from the other agent session. +- Consequences in this period: PR #273 and PR #275 now both change `tests/test_calibrate_rerun.py`, so whichever merges + second gets a code conflict; and admission, which treats #273 as in flight, keeps Bean 0399 refused since 11:42:16Z. + +## Goal + +- An override admits exactly the run it was given to. It is not written back as a standing flag; the checkpoint records + the overridden conflicts (already done) for the record only. +- A resume or a child re-checks admission without an override unless the flag is passed again. +- A regression test: a checkpoint saved with `allow_overlap` true, resumed without the flag against a new overlapping + flow, is refused. + +## Notes + +- Same class as completed Bean 0356 (resume inherited `--skip-review` and the agent from the checkpoint). +- Related: Bean 0423 (two sessions launching flows in one workspace), Bean 0395 (work during the overlap wait). +- Through the Holon flow (target change). + +## Audit evidence, 2026-11-25T00:28Z (self-improvement audit, fifth merge) + +- **14 of 23** active `holon-agentic-coder` flows in the `2026-11-24T12:59Z–2026-11-25T00:19Z` window ran with + `allow_overlap=True` in their checkpoints, contributing to `main`-merge churn (e.g. `PR #292`: 4 merges, `PR #293`: 3 + merges, `PR #296`: 3 merges plus an unresolvable conflict in `cli/__init__.py` against `PR #276`). + +## Audit evidence, 2026-11-25T02:54Z (self-improvement audit, fifth merge) + +- **11 of 13** `holon-agentic-coder` checkpoints active in `2026-11-25T00:28Z–02:54Z` (`split-cli-init-modules`, + `touch-set-self-doc`, `in-flight-pr-files-fallback`, `decomposition-rule-self-doc`, `preflight-self-doc`, + `review-report-self-doc`, `agent-defaults-self-doc`, `github-ci-self-doc`, `git-refs-self-doc`, + `github-pr-merge-self-doc`, `github-misc-self-doc`) ran with `allow_overlap=True` (triggered by the `#283` HTTP 406 + storm; see Bean `0433`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0423--two-agent-sessions-launch-flows-with-no-shared-registry-cap-or-log.md b/.beans/holon-agentic-coder-ref-metadata-0423--two-agent-sessions-launch-flows-with-no-shared-registry-cap-or-log.md new file mode 100644 index 00000000..b0eaab35 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0423--two-agent-sessions-launch-flows-with-no-shared-registry-cap-or-log.md @@ -0,0 +1,77 @@ +--- +# holon-agentic-coder-ref-metadata-0423 +title: "Two agent sessions launch flows into one workspace with no shared registry, cap or log" +status: todo +type: bug +priority: high +tags: + - harness + - flow + - concurrency +created_at: 2026-11-24T12:58:00Z +updated_at: 2026-11-25T05:45:00Z +--- + +## Problem + +Two agent sessions drive flows in this workspace at the same time: this Claude Code session (wrappers started with +`python3 -u .agents/skills/holon_flow/scripts/run_holon_flow.py ... > todo/flow-.log`) and an Antigravity CLI +session (`agy`, PID 2573, wrappers started with `uv run python ... run_holon_flow.py` and no log file). Neither sees the +other's flows except through Stage 3 admission. + +## Evidence (self-improvement audit, 2026-11-24T12:58Z) + +- At 12:47Z six wrappers were alive: Beans 0403 and 0405 (Claude Code, `claude-fable-5-2`) and Beans 0265, 0399, 0376 + and 0153 (Antigravity, `gemini-4-neon`). The cap in `AGENTS.md` and `.agents/coordination.md` is 4. Four of the six + had an engine running; 0265 and 0399 were waiting on admission. Each session kept to its own count. +- The four Antigravity flows write no `todo/flow-.log`; their steps can be read only from the checkpoints (stage + start and end), so no step inside Stages 3 to 5 of PRs #273, #274 or coherence #53 to #55 can be timed. +- Cross-session overlap: the Antigravity flow for Bean 0376 (PR #273) was admitted over the Claude Code flow of Bean + 0405 through a sticky override (Bean 0422); then the Antigravity flow for Bean 0265 was launched at 12:23Z onto files + the Claude Code flow of Bean 0405 (PR #275) was changing and has been refused since 12:29:50Z. +- Bean 0393 got two worktrees (`flow-preflight-ok-reply-slow-exit-and-retry`, failed in 3 ms at 11:38:06Z on a 38 + character slug, and `flow-intent-0393-preflight-retry`, which delivered PR #274); the first is left behind. +- Shared host: the Bean 0405 executor measured unit-suite times on a host running four to six flows and wrote "the + difference is load from other tenants of the machine"; its three baseline runs spread 16.8 percent against a 15 + percent tolerance in its own plan. The OOM kill of Bean 0421 happened under the same load. + +Two sessions are not what makes the ledger conflicts (any two merges do that, Bean 0371), but they are the cause of the +over-cap load and of the cross-session overlap above. + +## Goal + +- One workspace-wide registry of live flows that every launcher writes and reads: an exclusive-create claim file per + flow under `.subagent/flows/` naming the session, PID, runtime, bean, slug, worktree and log path, removed on exit and + taken over when its PID is dead. +- `run_holon_flow.py` refuses to start an engine when four engines are live in the registry (waiting wrappers do not + count), whatever session launched them, and says which four. +- The wrapper writes `todo/flow-.log` itself whatever launched it (Bean 0412 Goal 1), so every runtime is timed. +- A flow whose acceptance is a timing measurement takes an exclusive host slot (no other engine in Stage 3 or 4 while it + measures), or measures in CI. +- `AGENTS.md` says that only one session launches flows at a time, or how two share the registry. + +## Notes + +- Related: Bean 0390 (two runners on one checkpoint), Bean 0396 (flows survive the session), Bean 0421 (OOM under + concurrent role containers), Bean 0422 (sticky override). +- Harness-only change (`.agents/skills/holon_flow/`, `AGENTS.md`, `.agents/coordination.md`). + +## Audit evidence, 2026-11-25T05:45Z (self-improvement audit, fifth merge #288 to #299) + +- Concurrency measured from the ledger rows and checkpoints, 00:28Z to 05:41Z: never more than 4 flows at a time across + both sessions (3 Antigravity + 1 Claude Code at 00:28Z). The Antigravity session launched in waves of 3 (00:51Z, + 01:17Z to 01:20Z, 01:42Z to 01:43Z). No over-cap minute was seen, but each session still counts only its own flows. +- Cross-session blocking: the Claude Code flow for Bean 0371, launched at 05:27Z, was refused at 05:32:48Z on + Antigravity PR #305 (`flow/git_refs.py`, a self-doc slice approved at 01:49Z and waiting for the merge). The + Antigravity flow for Bean 0407 has been refused since 02:41:40Z, partly on Claude Code's #308 (Bean 0459 for the + directory in its scope). +- Same-session blocking with an engine cause: #308 (Claude Code) waited 181.5 min (23:26:48Z to 02:28:17Z) because + `gh pr diff 283` returned HTTP 406. Antigravity's #299 fixed this and merged at 05:20:56Z. +- No duplicate flow for one bean was found in the period. Bean 0407 has a single flow (Antigravity), and no Claude Code + flow was started for it. +- Every merge shows `mergedBy: thomashan`, the account all sessions share, so the record cannot tell who merged into + `main` (Bean 0458, step 5). +- Bean files and the audit log are shared too, and nothing claims an id. While this audit ran (05:41Z to 05:50Z), both + sessions created 0452 and 0453, then both renamed to 0456 and 0457. One write to `.beans/self-improvement-audits.md` + and one to Bean 0412 replaced the other session's text, which had to be written again. Bean ids need an + exclusive-create claim, the same as flows, and edits to shared files should append rather than rewrite the whole file. diff --git a/.beans/holon-agentic-coder-ref-metadata-0424--transient-dns-or-docker-failure-ends-the-review-stage.md b/.beans/holon-agentic-coder-ref-metadata-0424--transient-dns-or-docker-failure-ends-the-review-stage.md new file mode 100644 index 00000000..57a31ef4 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0424--transient-dns-or-docker-failure-ends-the-review-stage.md @@ -0,0 +1,48 @@ +--- +# holon-agentic-coder-ref-metadata-0424 +title: "A transient DNS or Docker failure ends the review stage and throws away finished reviewer work" +status: todo +type: bug +priority: high +tags: + - flow + - review + - reliability + - holon-agentic-coder +created_at: 2026-11-24T12:58:00Z +updated_at: 2026-11-24T12:58:00Z +--- + +## Problem + +At 2026-11-24T12:52:22Z the host lost DNS for a short time. Two flows failed in the same second: + +- Bean 0405 (PR #275): Stage 4 failed with "Reviewer ensemble container dispatch exited with code 125 without writing + results" after 12.5 minutes of iteration 1. The three reviewers' work was lost; the resume at 12:53:01Z started + iteration 2 from nothing. +- Bean 0403 (PR #272): iteration 4 ended `verdict FAILED` after 4.5 minutes, and the ledger push failed with + `ssh: Could not resolve hostname github.com`. + +Both wrappers relaunched within 50 seconds, so the network was back at once. The same signatures appear at +2026-11-23T21:17:09Z (exit 125) and 2026-11-24T06:23:58Z (Stage 3 failed on the same DNS error), and on 2026-11-21 +(ledger push). + +## Goal + +- The engine classifies these as transient infrastructure failures: `docker run` exit 125, DNS resolution failure, + connection reset or refused to github.com or the model API. +- A transient failure is retried in place with backoff (for example 3 tries over 2 minutes) before the step fails. It + does not count as a review iteration, and reviewer results already written are kept. +- A reviewer container writes each reviewer's result as soon as that reviewer finishes, so a later failure of the + ensemble container loses at most the unfinished reviewers. +- The log names the failure as transient infrastructure, with the retry count. + +## Expected gain + +12.5 minutes of reviewer time and one iteration on PR #275 in this event alone; the previous audit counted 3 iterations +(22 minutes) of infrastructure churn. + +## Notes + +- Related: Bean 0384 (stall budget), Bean 0417 (wrapper completion gate), Bean 0421 (OOM kill, a different + infrastructure failure). diff --git a/.beans/holon-agentic-coder-ref-metadata-0425--review-iterations-on-fable-take-three-times-as-long-as-on-opus.md b/.beans/holon-agentic-coder-ref-metadata-0425--review-iterations-on-fable-take-three-times-as-long-as-on-opus.md new file mode 100644 index 00000000..e0da5376 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0425--review-iterations-on-fable-take-three-times-as-long-as-on-opus.md @@ -0,0 +1,48 @@ +--- +# holon-agentic-coder-ref-metadata-0425 +title: "Review iterations on claude-fable-5-2 take three times as long as on claude-opus-5-5" +status: todo +type: task +priority: medium +tags: + - flow + - review + - models + - holon-agentic-coder +created_at: 2026-11-24T12:58:00Z +updated_at: 2026-11-24T12:58:00Z +--- + +## Problem + +Since the flow model moved to `claude-fable-5-2` (2026-11-23), each Stage 4 review iteration (three reviewers in +parallel) takes about three times as long, and the number of iterations a flow needs has not fallen. + +## Evidence (self-improvement audit, 2026-11-24T12:58Z, `todo/self-improvement-audit-2026-11-24b/`) + +| Reviewer model | Iterations measured | Median (min) | Longest (min) | +| :----------------- | ------------------: | -----------: | ------------: | +| `claude-opus-5-5` | 95 | 5.9 | 23.0 | +| `gemini-3.8-flash` | 18 | 7.8 | 13.0 | +| `claude-fable-5-2` | 14 | 18.4 | 28.0 | + +- PR #272 (Bean 0403): iterations of 27.9, 26.1 and 25.5 minutes; iteration 3 had two approvals and one documentation + nit, and the full ensemble ran again for a one-line fix (12:47:53Z). +- PR #270 (Bean 0387): six iterations of 14.8 to 26.6 minutes. +- Flows reviewed on Fable so far needed 1, 2, 6 and (still running) 5 or more iterations; the 21 Opus flows since + 2026-11-21 needed a median of 3. The sample is small, but Fable has not reduced the count. + +At the overall mean of 4.7 iterations a flow (131 iterations in 28 logged flows), Fable reviewers add roughly 50 minutes +of Stage 4 time per flow. + +## Proposal (needs the maintainer's word; the flow model is the maintainer's choice) + +- Keep Fable for the first full review and run later passes, which only check a resolver's fix, on the next tier down or + on one reviewer (Bean 0407 point 4 gives the scoped re-review this would use). +- Or give the review stage its own model setting (`--review-model`), so the executor stays on Fable. +- Measure for a week: iterations to consensus and defects found per iteration, by model. + +## Notes + +- Related: Bean 0407 (full re-review when nothing reviewable changed), Bean 0384 (stall budget cuts long-thinking + models). diff --git a/.beans/holon-agentic-coder-ref-metadata-0426--fix-slug-truncation-bean-progress-intent-rewrites.md b/.beans/holon-agentic-coder-ref-metadata-0426--fix-slug-truncation-bean-progress-intent-rewrites.md new file mode 100644 index 00000000..d0de4c05 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0426--fix-slug-truncation-bean-progress-intent-rewrites.md @@ -0,0 +1,67 @@ +--- +# holon-agentic-coder-ref-metadata-0426 +title: "Fix run_holon_flow slug truncation, bean-progress truncated-slug attribution, and subagent intent rewrites" +status: todo +type: bug +priority: high +tags: + - harness + - holon-flow + - bean-progress + - attribution +created_at: 2026-11-24T13:00:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +During the `2026-11-24T11:05Z–12:47Z` fifth-merge audit window, three interacting harness defects broke bean +attribution, completion notifications, and worktree hygiene across `run_holon_flow.py`, `bean_progress.py`, and +`holon-flow` subagents: + +1. **Uncommitted slug truncation & hardcoded `0380` hack in `.agents/skills/holon_flow/scripts/run_holon_flow.py`**: + - Lines 184–189 and 495–510 truncate `slug` > 32 chars and write `todo/intent-modified-.json` + (stripping the `` from the filename!). For Bean `0380` + (`todo/intent-0380-coherence-module-line-budget-all-packages.json`, 41-char slug), this launched + `holon-coherence#55` on branch `I-1795521016-coherence-module-line-budget-all/...` while leaving + `todo/intent-modified-coherence-module-line-budget-all.json` in `todo/`. + - Lines 501–504 hardcode a one-off Bean `0380` mutation + (`if "0380" in intent_path.name ...: intent_data["module_budget_change"] = ...`) inside the shared flow wrapper. + - Line 754 in `main()` calls `parse_intent_file(args.intent)["slug"]` (untruncated) when passing `slug` to + `_notify_outcome`, so `_calibration_done` and `find_flow_pr` fail to match the checkpoint or PR whenever slug + truncation ran. +2. **Broken truncated-slug attribution in `.agents/skills/bean_progress/scripts/bean_progress.py`**: + - `INTENT_FILE_RE` (`^intent-((?:\d{4}-)+)(.+)\.json$`) ignores `intent-modified-*` and `intent-truncated-*` files, + and `build_in_flight_rows` indexes only `intent.slug` and `intent.file_slug` — not the 32-char truncated slug used + on the git branch (`coherence-module-line-budget-all`). As a result `holon-coherence#55` rendered with `Bean # = —` + in `bean_progress` output. +3. **`flash_lite` subagents rewriting/copying `todo/intent-*.json` files**: + - `todo/intent-0393-preflight-ok-reply-slow-exit-and-retry.json` (38-char slug) was overwritten in place with + `"slug": "preflight-retry"` after an initial attempt created + `apps/holon-agentic-coder/flow-preflight-ok-reply-slow-exit-and-retry`, then launched a second worktree + `flow-intent-0393-preflight-retry` (with `intent-0393-` in the worktree name) that delivered + `holon-agentic-coder#274`, leaving `bean_progress` reporting a stale Stage 1 attempt. + - `todo/intent-truncated-coherence-module-line-budget-all.json` was also left behind as an unattributed copy. + +## Proposed change + +1. Remove the hardcoded `"0380"` injection from `run_holon_flow.py`; validate `len(slug) <= 32` cleanly or preserve + `` in any derived intent filename, and pass the effective (truncated) `slug` to `resolve_flow_worktree`, + `verify_pr_and_calibration`, and `_notify_outcome` in `main()`. +2. In `bean_progress.py` (`scan_intents` / `build_in_flight_rows`), index `truncate_slug(intent.slug, 32)` and + `truncate_slug(intent.file_slug, 32)` alongside the full slug so truncated flow branches and PRs always attribute to + their bean ID. +3. Update `.agents/skills/holon_flow/SKILL.md` to forbid `holon-flow` subagents from editing, copying, or rewriting + `todo/intent-*.json` files or adding `intent--` prefixes to `flow-` worktree names. +4. Add regression tests in `tests/test_bean_progress.py` and `tests/test_flow_fallback.py`. + +## Expected gain + +Eliminates `Bean # = —` misattribution on truncated-slug PRs (like `holon-coherence#55`), ensures `ntfy` completion +notifications work on truncated slugs, removes one-off bean hacks from `run_holon_flow.py`, and stops `flash_lite` +subagents from creating duplicate/stale worktrees and mutated intent files. + +## Cost + +Small harness-only change in `.agents/skills/holon_flow/scripts/run_holon_flow.py`, +`.agents/skills/bean_progress/scripts/bean_progress.py`, `.agents/skills/holon_flow/SKILL.md`, and `tests/`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0427--strip-gh-stderr-hints-from-consensus-review-pr-url.md b/.beans/holon-agentic-coder-ref-metadata-0427--strip-gh-stderr-hints-from-consensus-review-pr-url.md new file mode 100644 index 00000000..8656c781 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0427--strip-gh-stderr-hints-from-consensus-review-pr-url.md @@ -0,0 +1,84 @@ +--- +# holon-agentic-coder-ref-metadata-0427 +title: "Strip gh CLI stderr hints from pr_url so consensus review links are not corrupted" +status: completed +type: bug +priority: high +tags: + - flow + - stage-4 + - github + - holon-agentic-coder +created_at: 2026-11-24T13:00:00Z +updated_at: 2026-11-26T10:41:00Z +--- + +## Why + +Consensus review comments posted on `holon-agentic-coder#273`, `holon-agentic-coder#274`, and `holon-coherence#55` +contain broken Markdown links polluted with multi-line `gh event listen` CLI hint text: + +```text +Reviewed [preflight-retry](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/274 + +hint: if you need to wait for this pull request to be reviewed, merged, or closed before continuing, use this instead of polling: + gh event listen --resource https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/274 ... +``` + +## Evidence (`2026-11-24T11:05Z–12:47Z` audit) + +- `apps/sandbox-executor/src/sandbox_executor/flow/github/adapter_runner.py:46-48`: `GhResult.output` concatenates + `f"{self.stdout or ''}\n{self.stderr or ''}".strip()`. +- `apps/sandbox-executor/src/sandbox_executor/flow/github/adapter.py:246`: `create_or_update_pr` returns + `"output": result.output` without a separate clean `pr_url` parsed from `stdout`. +- `apps/sandbox-executor/src/sandbox_executor/flow/review/loop.py:722-724`: + `"pr_url": pr_res.get("pr_url") or (pr_res.get("output") if str(pr_res.get("output", "")).startswith("http") else None)` + matches whenever `stdout` begins with `https://...` and passes the entire `stdout + "\n" + stderr` string into + `build_pr_review_consensus_report`, corrupting `[slug]()` whenever `gh` emits a `hint:` on `stderr`. +- `adapter_runner.py:51-53`: `gh_env` sets only `DOCKER_CLI_HINTS=false`, leaving `gh` hint environment flags unset. + +## Proposed change + +1. Parse a clean single-line `pr_url` (`re.search(r"https://\S+", result.stdout)`) in `GitHubAdapter.open_or_update` / + `create_or_update_pr` and return it explicitly as `pr_res["pr_url"]`. +2. In `loop.py` and `review_report.py`, sanitize `pr_url` to a single HTTP(S) URL line (never accepting multi-line + `stderr` text) and add `GH_NO_UPDATE_NOTIFIER=1` / `GH_PROMPT_DISABLED=1` to `gh_env`. +3. Add a unit test in `tests/flow/github/` and `tests/test_review_loop.py` simulating `gh pr create` returning a URL on + `stdout` plus a `hint:` block on `stderr`. + +## Expected gain + +Clean, clickable PR links in every posted consensus review across `holon-agentic-coder` and `holon-coherence`, with no +`gh` wrapper noise leaked into GitHub PR threads. + +## Cost + +Small target-repo change through the Holon flow (`adapter_runner.py`, `adapter.py`, `pr.py`, `review/loop.py`). + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- Still active across every target repository in this window: `gh event listen` stderr hints remain embedded inside the + Markdown link URL of consensus review comments on `holon-agentic-coder#310`–`#313` and `thomashan/dev-env#42`–`#43`. + +## Progress + +- 2026-11-26: in-progress, flow `pr-url-without-gh-hints` (worktree flow-pr-url-without-gh-hints, claude-agent + claude-opus-5-5). Scope narrowed to `flow/github/pr.py`, `adapter_runner.py` and a new test, so it is disjoint from + the live review-loop and issue-tracking flows; the `loop.py` consumer already prefers `pr_res["pr_url"]`. +- 2026-11-26: PR #330 approved (3/3 consensus, review iteration 2), calibrated, MERGEABLE/CLEAN, all checks green; + awaiting maintainer merge. + +## Resolution + +Delivered via [PR #330](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/330) and merged into `main` +(`a71b8a6b`, 2026-11-26T10:39:00Z): + +- **Key Architectural Deliverables**: `create_or_update_pr` (`flow/github/pr.py`) returns an explicit single-line + `pr_url` parsed from `gh` stdout only (`https://\S+`), never the stdout+stderr concatenation; `gh_env` + (`flow/github/adapter_runner.py`) also sets `GH_PROMPT_DISABLED=1` and `GH_NO_UPDATE_NOTIFIER=1`. + `flow/review/loop.py` drops the fallback to the combined `output` (outside the intent scope, the same consumer-side + edit as bean 0502; the change is a 2-line simplification). +- **Verification & Tests**: new `apps/sandbox-executor/tests/flow/github/test_pr_url.py` simulating a URL on stdout with + a `hint:` block on stderr; module budgets untouched. +- **Holon Flow Traversal**: Intent -> Plan -> Execute completed; Stage 4 review reached 3/3 consensus at iteration 2 + (one nit, R1-F1, applied); calibration recorded; PR checks green before merge. diff --git a/.beans/holon-agentic-coder-ref-metadata-0428--use-3-dot-pr-own-diff-in-ci-final-head-and-overlap.md b/.beans/holon-agentic-coder-ref-metadata-0428--use-3-dot-pr-own-diff-in-ci-final-head-and-overlap.md new file mode 100644 index 00000000..85f82a53 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0428--use-3-dot-pr-own-diff-in-ci-final-head-and-overlap.md @@ -0,0 +1,61 @@ +--- +# holon-agentic-coder-ref-metadata-0428 +title: "Use PR-own 3-dot diff instead of 2-dot diff in ci_final_head and touch-set inspection" +status: todo +type: bug +priority: medium +tags: + - flow + - stage-3 + - stage-5 + - diff + - holon-agentic-coder +created_at: 2026-11-24T13:00:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +Two-dot `git diff A..B` sweeps in every commit that `main` landed between `A` and `B` across a target-branch merge, +misclassifying a clean merged head as having code edits when only `main` moved. + +## Evidence (`2026-11-24T11:05Z–12:47Z` audit) + +1. **`apps/sandbox-executor/src/sandbox_executor/flow/github/ci_final_head.py:213`**: `_git_changed_paths` runs + `git diff --name-only {approved}..{head} --`. When `origin/main` is merged into the PR branch between `approved` and + `final` (as in `holon-agentic-coder#270` at `11:29:55Z`, commit `c341f784`, where `unit (ubuntu-latest)` then failed + the timing gate at `360 s > 344 s`), `{approved}..{head}` includes all non-bookkeeping files from `main`, causing + `_bookkeeping_only(paths)` (`line 230`) to return `False` and blocking `_retry_timing_noise` even though the PR's + `approval_fingerprint` is unchanged. +2. **2-dot vs 3-dot touch-set inspection on active PRs**: + - On `PR #273` (`resolve-conflicts-in-flow`), `git diff --name-only origin/main..head` (2-dot) reports **407** files + (**190** extra `main` files such as `README.md` and `models.py`), vs **217** files with 3-dot `origin/main...head` + (which `gh pr diff` in `in_flight.py` correctly uses). + - On `PR #275` (`unit-suite-slowest-tests-speedup`), 2-dot reports **33** files (**14** extra `main` files including + `preflight.py`, `test_preflight.py`, `test_preflight_retries.py`), vs **19** files with 3-dot. +3. **Shared test-file overlap waits in this window**: + - Bean `0399` (`ci-wait-fast-poll-and-early-fail`) has been blocked for **65.3 min** (`11:42:16Z`–`12:47:33Z`) on + `PR #273` (`test_calibrate_final_head_ci.py`, `test_review_ci_wait.py`). + - Bean `0265` (`split-cli-init-modules`) was blocked for **17.7 min** (`12:29:50Z`–`12:47:33Z`) first on `PR #274` + (`test_preflight.py`) and local flow `0405`, then on `PR #275` (`test_url_credential_redaction.py`) because its + plan listed 10+ unrelated test files for `mock.patch` target rewrites. + +## Proposed change + +1. In `ci_final_head.py`, replace the raw 2-dot `{approved}..{head}` check in `_eligible_run_ids` with a PR-own diff + comparison (e.g. `approval_fingerprint` match or `changed_paths` ignoring content that arrived only from + `origin/main` merges), so mechanical `main` merges remain eligible for `_retry_timing_noise` when only timing-gate + variance fails. +2. Document and enforce 3-dot (`origin/main...head`) semantics in any touch-set inspection or harness overlap helper so + `main` commits are never misattributed to an open branch. +3. Add a regression test in `tests/test_calibrate_final_head_ci.py` where `origin/main` merges code commits into a + bookkeeping-unchanged PR and a timing-gate failure still triggers `_retry_timing_noise`. + +## Expected gain + +Prevents false consensus withdrawals on merged-head timing-gate variance (like `PR #270` at `11:37:55Z`) and eliminates +2-dot diff noise during overlap and touch-set inspection. + +## Cost + +Small target-repo change in `ci_final_head.py` + tests via the Holon flow. diff --git a/.beans/holon-agentic-coder-ref-metadata-0429--validate-beans-header-id-and-title-in-pre-commit.md b/.beans/holon-agentic-coder-ref-metadata-0429--validate-beans-header-id-and-title-in-pre-commit.md new file mode 100644 index 00000000..2f85ac03 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0429--validate-beans-header-id-and-title-in-pre-commit.md @@ -0,0 +1,45 @@ +--- +# holon-agentic-coder-ref-metadata-0429 +title: "Validate .beans/ header ID, title uniqueness, and filename consistency in pre_commit_check.py" +status: todo +type: bug +priority: normal +tags: + - harness + - beans + - hygiene +created_at: 2026-11-24T13:00:00Z +updated_at: 2026-11-24T13:00:00Z +--- + +## Why + +During commit `907c0255`, +`.beans/holon-agentic-coder-ref-metadata-0417--gate-flow-wrapper-completion-against-premature-end.md` was committed with +`# holon-agentic-coder-ref-metadata-0416` and the exact frontmatter and body of Bean `0416`, silently erasing Bean +`0417`'s content until the next audit reconstructed it. + +## Evidence + +- `.agents/scripts/pre_commit_check.py` (lines 19–135) checks only disallowed scratch file globs and credential + patterns; it performs no integrity check on `.beans/*.md` files. +- `git show 907c0255:.beans/holon-agentic-coder-ref-metadata-0417--gate-flow-wrapper-completion-against-premature-end.md` + had `# holon-agentic-coder-ref-metadata-0416` and duplicate `title` matching Bean `0416`. + +## Proposed change + +1. Extend `.agents/scripts/pre_commit_check.py` (or a dedicated helper called by it) so when staged/checked paths + include `.beans/holon-agentic-coder-ref-metadata---*.md`: + - Verify the `# holon-agentic-coder-ref-metadata-` comment line (if present) matches `` from the filename. + - Verify `title` is non-empty and not identical to another active `.beans/` file's `title`. + - Verify `status` is one of the valid `beans` CLI values (`draft`, `todo`, `in-progress`, `completed`, `scrapped`) + and `created_at`/`updated_at` are unquoted RFC3339 UTC timestamps. +2. Add unit tests in `tests/test_pre_commit_check.py`. + +## Expected gain + +Catches copy-paste or parallel-session bean overwrites before commit. + +## Cost + +Small harness-only change in `.agents/scripts/pre_commit_check.py` and `tests/`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0430--resolver-turn-has-no-turn-budget-and-spinning-tests-defeat-the-stall.md b/.beans/holon-agentic-coder-ref-metadata-0430--resolver-turn-has-no-turn-budget-and-spinning-tests-defeat-the-stall.md new file mode 100644 index 00000000..fd588950 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0430--resolver-turn-has-no-turn-budget-and-spinning-tests-defeat-the-stall.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0430 +title: "The review-loop resolver turn has no turn budget, and a spinning test run defeats the stall budget" +status: todo +type: bug +priority: high +tags: + - flow + - budgets + - stage-4 + - holon-agentic-coder +created_at: 2026-11-24T15:55:00Z +updated_at: 2026-11-24T17:45:00Z +--- + +## Problem + +On 2026-11-24 the Stage 4 resolver container for bean 0405 (`festive_swirles`, PR #275, `claude-fable-5-2`) was +dispatched at 13:45:14Z and was still running at 15:49Z (2 h 4 min) with the flow log silent since 13:45:17Z. The +wrapper had `HOLON_TURN_STALL_SECONDS=600` and the default 3600 s turn budget. Neither fired. + +Two gaps in `sandbox_executor/turns.py` and `entrypoint/review_loop.py`: + +1. The resolver calls `run_turn(cmd, cwd=repo_dir, turn_budgets=...)` with no `watch_path` and no `watch_tree`. + `turn_observable` is therefore false and `_turn_breach` never fires. The only bound left is the stall window, so the + resolver turn is effectively unlimited whenever the stall window keeps being reset. +2. The stall window is reset by tool progress: any descendant of the runner that burns at least + `TOOL_CPU_PROGRESS_SECONDS` (0.5 s) of CPU in a `TOOL_SCAN_INTERVAL_SECONDS` (10 s) scan counts as activity. The + agent here looped an A/B timing harness (`ab.sh` running `pytest -n auto` many times, container CPU about 1200 + percent), so the stall budget was reset every ten seconds for two hours. A hung or merely endless test loop looks + identical to progress. + +In this occurrence the agent was genuinely working (it was benchmarking the test suite for the speed-up task), so the +outcome was benign, but nothing would have cut it had it been stuck in a spinning child. + +## Occurrence 2026-11-24 (17:26Z): the unbounded turn ended in SIGABRT + +The same resolver container (`festive_swirles`) ran 221 min (dispatched 13:45:14Z, `docker events` die at 17:26:20Z with +`execDuration=13264`, container exit code 1, no `oom` event). The agent inside reported exit code -6 (SIGABRT), and the +flow failed at 17:32:22Z with `review: failed (227.5 min / 120 min)`: the 120 min review iteration budget was exceeded +by 107 min without cutting the turn, which confirms the missing resolver bound. The flow log was silent from 13:45:17Z +to 17:32:22Z. The turn left 18 modified test files (835 insertions, 422 deletions) uncommitted in the worktree; they +were saved to a patch outside it. The abort cause itself is unconfirmed (see bean 0432). Likely a long-lived runner +failing after hours of accumulated output, which a bounded turn would have prevented. + +## Fix direction + +- Give the resolver turn a bound that does not depend on artefact progress: apply `turn_seconds` as a wall-clock ceiling + on the whole resolver turn (or watch the worktree), so a resolver cannot outlive the turn budget. +- Count tool CPU as progress only for a bounded time per response (for example cap consecutive tool-progress resets at + the turn budget), so a spinning child cannot hold the stall window open indefinitely. +- Log a periodic heartbeat naming the live descendants while a turn is held open by tool progress, so the flow log is + not silent for hours. + +## Notes + +- Related: 0384 (stall budget too short for Fable), 0394 (no unnecessary waiting), 0425 (review iterations on Fable are + slow). Target repository: holon-agentic-coder, flow `unit-suite-slowest-tests-speedup`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0431--claude-token-visible-in-process-listing-of-role-containers.md b/.beans/holon-agentic-coder-ref-metadata-0431--claude-token-visible-in-process-listing-of-role-containers.md new file mode 100644 index 00000000..d9322168 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0431--claude-token-visible-in-process-listing-of-role-containers.md @@ -0,0 +1,68 @@ +--- +# holon-agentic-coder-ref-metadata-0431 +title: "The Claude token is visible in the process listing of a role container" +status: completed +type: bug +priority: high +tags: + - security + - credentials + - sandbox + - holon-agentic-coder +created_at: 2026-11-24T15:55:00Z +updated_at: 2026-11-26T12:10:00Z +--- + +## Problem + +On 2026-11-24 at about 15:49Z a read-only diagnosis of a running resolver container (image `holon/agent-claude`, flow of +Bean 0405) ran `docker top ` and saw the Claude OAuth token in the output. The token was not copied or +repeated. A value that appears in `docker top` is on a process command line or otherwise readable from the process +table, so anyone who can run `docker top` or `ps` on the host, and any process inside the container, can read it. + +Pull request #271 (Bean 0225) moved the token out of the plaintext file into the OS keychain on the host. This is the +next leak in the chain: the token is handed to the container in a way that puts it in a process listing. + +## To establish first + +- Which process shows it, and whether it is in the arguments or the environment as rendered by `docker top`: the + `docker run` client on the host (the engine passes an `--env-file`, which should keep it off the host command line), + the role dispatcher, or the `claude` process and its children inside the container. The harness wrapper builds + `HOLON_AGENT_SETTINGS` as a JSON string that carries the token; check whether any entrypoint passes that string, or + the token, as a command-line argument (for example `claude --settings ''`). +- Whether the same holds for the other runners' credentials. + +## Goal + +- The token never appears in any process's arguments, on the host or in the container. It reaches `claude` through the + environment or a file readable only by the agent user (mode 600, on a tmpfs), never through `argv`. +- A test starts a role with a fake token and asserts the token is absent from the argument vectors of every process it + spawns. +- The echo-padding workaround that keeps the token out of truncated logs is reviewed at the same time: if the token no + longer travels inside a settings string, the padding may no longer be needed. + +## Notes + +- Found by the diagnosis subagent for Bean 0430 (resolver turn with no budget); reported, not exploited. +- Until fixed: avoid pasting `docker top` or `ps` output of role containers into logs, beans or reports. +- Related: Bean 0225 (token in the OS keychain, completed), Bean 0406 (wrapper reads the keychain). + +## Flow + +In progress 2026-11-26: flow settings-token-off-argv (claude-agent, claude-opus-5-5) moves inline settings JSON carrying +the token into a private temp file so it leaves argv. Same defect as 0471. + +PR #338 open 2026-11-26: 3/3 approved (4 iterations), calibrated, MERGEABLE/CLEAN, 11 checks green; awaiting maintainer +merge. Rotate the exposed token after merge. + +## Resolution + +Delivered via [PR #338](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/338) and merged into `main` +(`5440e923`), the same fix as bean 0471: the claude runner passes the settings file path, never the token-bearing JSON, +on the command line. + +- **Echo padding**: reviewed and kept as is by the PR (the settings content keeps its padding entry). +- **Scope note**: `preflight.py`, `preflight_secret_args.py` and `test_preflight.py` were changed outside the intent + scope. +- **ACTION FOR THE MAINTAINER**: rotate the Claude OAuth token now that the fix is merged; the exposure observed on + 2026-11-24 and 2026-11-26 is not closed until it is rotated. diff --git a/.beans/holon-agentic-coder-ref-metadata-0432--resolver-turn-abort-loses-its-edits-and-blames-the-model-warning.md b/.beans/holon-agentic-coder-ref-metadata-0432--resolver-turn-abort-loses-its-edits-and-blames-the-model-warning.md new file mode 100644 index 00000000..d9c5a608 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0432--resolver-turn-abort-loses-its-edits-and-blames-the-model-warning.md @@ -0,0 +1,59 @@ +--- +# holon-agentic-coder-ref-metadata-0432 +title: "A resolver turn aborted with code -6 leaves unsalvaged edits and an error that blames a harmless warning" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - salvage + - holon-agentic-coder +created_at: 2026-11-24T17:45:00Z +updated_at: 2026-11-25T07:20:00Z +--- + +## Problem + +On 2026-11-24 the Stage 4 resolver turn for bean 0405 (PR #275, `claude-fable-5-2`) ran 221 min and exited with code -6 +(SIGABRT) at about 17:26Z. Three defects showed up together: + +1. **Edits are not salvaged.** The resolver had modified 18 test files (835 insertions, 422 deletions) and committed + nothing. The Stage 3 salvage (`flow/partial_salvage.py`, bean 0397) only covers a killed executor. After a failed + resolver turn the host just records ledger rows and leaves the dirty worktree ("uncommitted changes remain ... they + are carried over"). Any `git clean`, worktree prune or fresh run would lose three hours of work. +2. **The error blames the wrong thing.** `_run_resolver_agent` reports `Resolver agent exited with code -6` and the + output tail holds only the line "Claude Code doesn't recognize the model claude-fable-5-2 ... assumes a context + window of 200k tokens". That is a warning printed on every run (PRs #270, #271, #272 and #278 all passed on the same + image), so the flow summary points operators at a non-cause. No signal name, no last agent output and no turn + duration are reported. +3. **Timing of the failure is unexplained.** The container died at 17:26:20Z but the host logged the failure at + 17:32:22Z, six minutes later, with no log line in between. + +## Fix direction + +- On a failed or aborted resolver turn, commit the leftover edits as labelled partial work on the execution branch + (reuse `partial_salvage`), or at least write a patch to a stable path and log it, before the stage returns. +- Name a negative exit code as its signal (`-6` as SIGABRT) and keep the last non-warning lines of agent output in the + tail; drop known benign warnings from the tail. +- Log what the host does between container exit and the failure line. + +## Notes + +- Cause of the SIGABRT is unconfirmed: no OOM event, no usage-limit text, no output after the warning. Most likely the + runner process aborting (for example a heap or resource failure) after hours of test output with no turn bound (bean + 0430). The warning only means the assumed window was 200k tokens; it did not itself abort the process. +- Related: 0397, 0430, 0405. Target repository: holon-agentic-coder, flow `unit-suite-slowest-tests-speedup`. + +## Occurrence (2026-11-25, flow of pull request #308) + +- The iteration-4 resolver of `workspace-survival-job-parallel` died with exit 1 on "API Error: Can't reach the API + server ... (ENOTFOUND)" (a network outage) and left 5 tracked and 4 untracked files of partial work in the worktree. +- A resume with `--from-stage review` now stops at once: "Review stage failed at flow_start: target sync ... was + blocked: the worktree has uncommitted tracked changes; commit them before the target sync". The target sync added with + pull request #283 refuses a dirty worktree, so a flow whose resolver died mid-turn cannot be resumed at all without a + person committing or discarding the dead turn's edits. +- Wanted: on resume, the engine salvages a dead resolver turn's edits itself (for example commits them as a "resolver + partial work" commit that the next review sees as a delta, or stashes them under a recorded name and hands them to the + next resolver turn), and a resolver turn that fails on a network error is retried in place before the stage is failed + (Bean 0424). diff --git a/.beans/holon-agentic-coder-ref-metadata-0433--stage-3-in-flight-discovery-fails-on-pr-diff-too-large-406.md b/.beans/holon-agentic-coder-ref-metadata-0433--stage-3-in-flight-discovery-fails-on-pr-diff-too-large-406.md new file mode 100644 index 00000000..cdcd5d71 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0433--stage-3-in-flight-discovery-fails-on-pr-diff-too-large-406.md @@ -0,0 +1,79 @@ +--- +# holon-agentic-coder-ref-metadata-0433 +title: + "Stage 3 in-flight PR discovery fails when an open PR diff exceeds 20,000 lines (HTTP 406 PullRequest.diff too_large)" +status: completed +type: bug +priority: high +tags: + - flow + - admission + - github + - holon-agentic-coder +created_at: 2026-11-24T18:33:00Z +updated_at: 2026-11-25T05:23:00Z +--- + +## Problem + +During Stage 3 admission, `apps/sandbox-executor/src/sandbox_executor/flow/in_flight.py:125` runs +`gh pr diff --name-only` for every open pull request. Once any open PR crosses GitHub REST API's 20,000-line +diff ceiling, `gh pr diff` fails with `HTTP 406: PullRequest.diff too_large`, and Stage 3 admission fails closed for +every new flow—even when the new flow's touch set is completely disjoint. + +## Evidence (2026-11-24T18:31Z) + +- Open PR `Holon-Agentic-Coder/holon-agentic-coder#283` (`0376`, `resolve-conflicts-in-flow`, 300 changed files, + `17,856+ / 1,062-`) crossed the 20,000-line diff limit after Stage 5 calibration/merge. +- `core-helpers-self-doc` (Bean `0153`) completed Stages 1–2 cleanly (`overlap: []` verified independently via local + 3-dot `git diff origin/main...HEAD` and open PR inspection), then Stage 3 refused admission with exit code 1: + + ```text + Stage 3 refused: the flows in flight could not be discovered: 'gh pr diff 283' failed: could not find pull request diff: HTTP 406: Sorry, the diff exceeded the maximum number of lines (20000) (https://api.github.com/repos/Holon-Agentic-Coder/holon-agentic-coder/pulls/283) + PullRequest.diff too_large; or rerun with --allow-overlap to admit it anyway. + ``` + +- Note also that `gh pr view --json files` (GraphQL) silently truncates at 100 files, whereas the paginated + REST `/pulls/{number}/files` endpoint returns up to 3,000 changed filenames without hitting the 20,000-line diff + limit. + +## Goal + +1. In `in_flight.py`, fetch changed paths via paginated REST `pulls/{number}/files` + (`gh api --paginate repos/{owner}/{repo}/pulls/{number}/files --jq '.[].filename'`) or fall back to it (and/or local + 3-dot `git diff --name-only origin/...origin/`) whenever `gh pr diff` returns `406` / `too_large` + (avoiding GraphQL `files` 100-file truncation). +2. Add a hermetic unit test simulating a `406 PullRequest.diff too_large` response from `gh pr diff` and asserting Stage + 3 discovery succeeds and accurately computes overlap. + +## Notes + +- Target repo change through the Holon flow; wait until `PR #283` merges since both touch `flow/`. + +## Audit evidence, 2026-11-25T00:28Z (self-improvement audit, fifth merge) + +- Recurred at `2026-11-24T19:32:54Z` on `infra-helpers-self-doc` + (`Stage 3 refused: the flows in flight could not be discovered: 'gh pr diff 283' failed: HTTP 406`) and again at + `2026-11-24T23:26:48Z` on `workspace-survival-job-parallel` (also logged separately in companion Bean `0437` when PR + #283 crossed 300 files). Both should be fixed together in `in_flight.py` via paginated REST `pulls/{number}/files`. + +## Audit evidence, 2026-11-25T02:54Z (self-improvement audit, fifth merge) + +- Recurred on **every single one of the 9 new flows** launched between `00:28Z` and `02:25Z` (`PR #299` itself, `#300`, + `#301`, `#302`, `#303`, `#304`, `#305`, `#306`, `#307`) on `gh pr diff 283` HTTP 406 (`>300 files`), forcing `9` + manual `--allow-overlap` resumes (`0.5–1.1 min` failed admission + `0.8–1.0 min` resume gap each), while + `workspace-survival-job-parallel` idled `181.5 min` (`23:26:48Z`–`02:28:17Z`) waiting for `#283` to merge. `PR #299` + (`in-flight-pr-files-fallback`, delivering this fix) reached consensus approval and Stage 5 calibration at `00:49:18Z` + and awaits maintainer merge. + +## Resolution + +Delivered via [PR #299](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/299) and merged into `main` +(`599630f8`, `2026-11-25T05:20:56Z`): + +- **Deliverables**: Added the HTTP 406 (`too_large`) paginated REST `/pulls/{number}/files` fallback in + `apps/sandbox-executor/src/sandbox_executor/flow/pr_changed_files.py` and wired it into + `apps/sandbox-executor/src/sandbox_executor/flow/in_flight.py`, with unit tests in + `apps/sandbox-executor/tests/flow/test_in_flight.py`. +- **Holon Flow Traversal**: All 5 stages (Intent -> Plan -> Execute -> Review Loop -> Calibration) completed on + `I-1795566347-in-flight-pr-files-fallback`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0434--wrapper-does-not-step-down-the-ladder-on-a-monthly-spend-limit.md b/.beans/holon-agentic-coder-ref-metadata-0434--wrapper-does-not-step-down-the-ladder-on-a-monthly-spend-limit.md new file mode 100644 index 00000000..f33263fe --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0434--wrapper-does-not-step-down-the-ladder-on-a-monthly-spend-limit.md @@ -0,0 +1,50 @@ +--- +# holon-agentic-coder-ref-metadata-0434 +title: "The flow wrapper does not step down the model ladder on a monthly spend limit" +status: completed +type: bug +priority: high +tags: + - harness + - wrapper + - flow + - quota +created_at: 2026-11-24T20:50:00Z +updated_at: 2026-11-25T05:30:00Z +--- + +## Problem + +On 2026-11-24 the flow of Bean 0405 (pull request #275) stopped in Stage 4: every reviewer on `claude-agent` / +`claude-fable-5-2` exited 1 with "You've hit your monthly spend limit. Switch to another model to continue." The review +loop ran to its iteration cap with the ensemble FAILED and the wrapper exited 1, leaving the flow stopped until the +maintainer intervened. + +The skill's rule for a limit that names no reset time is to step down the ladder on the same runner (`claude-fable-5-2` +then `claude-opus-5-5`). `run_holon_flow.py` has that ladder (`FALLBACK_LADDER_CLAUDE`, `resolve_next_model`), but +`is_quota_error` only matches `QUOTA_ERROR_PATTERNS` ("hit your session limit", "hit your usage limit", "hit your +limit", "quota exceeded" and similar). "hit your monthly spend limit" matches none of them, so the wrapper treated the +run as an ordinary failure and stopped instead of stepping down. + +## Goal + +- `QUOTA_ERROR_PATTERNS` recognises a spend limit ("spend limit", "hit your monthly spend limit") and the wrapper steps + down to the next model on the same runner and resumes from the checkpoint; a test replays the exact message. +- A spend limit that names a reset time is waited out like any named reset. +- The engine's review loop does not spend all its iterations on a limit error: a reviewer that exits with a quota or + spend message ends the stage at once with that reason (fail early), so the wrapper can act on it. + +## Notes + +- Resolved by hand on 2026-11-24 at about 20:47Z: the maintainer switched the session to Opus 5.5 and the flow was + resumed from review on `claude-opus-5-5`. +- Related: Bean 0416 (quota reset parsing in the wrapper), Bean 0425 (review on Fable is three times slower than on + Opus). + +## Resolution + +Added "monthly spend limit" and "spend limit" to `QUOTA_ERROR_PATTERNS` (tail-only scan unchanged). A spend limit with +no reset time steps down the Claude ladder on the same runner and resumes from the checkpoint; one that names a reset +time (for example "Resets in 51m58s") is waited out on the same model. Tests in `tests/test_flow_completion.py` replay +the exact message. Not done: the engine-side fail-early of the review loop (a target-repository change, outside this +harness-only fix). Full suite: 179 passed. diff --git a/.beans/holon-agentic-coder-ref-metadata-0435--dev-env-improvements-and-cross-platform-fixes.md b/.beans/holon-agentic-coder-ref-metadata-0435--dev-env-improvements-and-cross-platform-fixes.md new file mode 100644 index 00000000..8e73bade --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0435--dev-env-improvements-and-cross-platform-fixes.md @@ -0,0 +1,76 @@ +--- +# holon-agentic-coder-ref-metadata-0435 +title: "dev-env improvements and cross-platform fixes" +status: in-progress +type: epic +priority: high +tags: + - dev-env + - macos + - windows + - wsl + - tmux +created_at: 2026-11-24T23:12:00Z +updated_at: 2026-11-26T05:53:00Z +--- + +Generic ongoing umbrella bean for improvements, bug fixes, and cross-platform parity updates to the `dev-env` repository +(`git@github.com:thomashan/dev-env.git`, canonical worktree `/Users/thomashan/git/dev-env/main`) across macOS and +Windows/WSL. + +## Tracked Changes + +| Item | Summary | Intent File | PR / Status | +| ---- | -------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | Restore `Shift+Enter` newline forwarding in `tmux` for Claude Code + PTY regression test | `todo/intent-0435-tmux-shift-enter-extkeys.json` | [PR #41](https://github.com/thomashan/dev-env/pull/41) (merged `2026-11-25T04:03:06Z`, commit `605559f`) | +| 2 | Enable `tmux` `focus-events` (`set -g focus-events on`) for Neovim `autoread`/`FocusGained` + test | `todo/intent-0435-tmux-focus-events-on.json` | [PR #42](https://github.com/thomashan/dev-env/pull/42) (merged `2026-11-26T03:46:21Z`, commit `649168b`, EV `94.83` predicted / `96.62` actual / `+1.79` delta) | +| 3 | Install `xterm-ghostty` terminfo on Ubuntu WSL and Linux hosts | `todo/intent-0464-ubuntu-wsl-ghostty-terminfo.json` | [PR #43](https://github.com/thomashan/dev-env/pull/43) (merged `2026-11-26T00:03:54Z`, commit `77a7910`, Bean `0464`) | +| 4 | Fix Warp `Shift+Enter` (`0x0a`) swallowed by `tmux` `C-j` binding + split-pane PTY test | `todo/intent-0470-warp-shift-enter-tmux-cj.json` | [PR #45](https://github.com/thomashan/dev-env/pull/45) (merged `2026-11-26T05:49:19Z`, commit `6a50860`, Bean `0470`, EV `96.46` predicted / `99.30` actual / `+2.84` delta) | + +## Item 1: `Shift+Enter` Multiline Newline Regression & Automated PTY Test (macOS & Windows/WSL) + +- **Reported symptom**: Pressing `Shift+Enter` on macOS and Windows submits instead of inserting a new line in the + Claude Code agent. +- **Confirmed regression (`2026-11-18`, PR #27)**: Before PR #27 (`I-1794983648-tmux-home-conf`, `92a78b8`), the user's + pre-existing `~/.tmux.conf` (archived in `~/.local/share/dev-env/backup/20261118184638/Users__thomashan__.tmux.conf`) + explicitly configured: + - `set -g extended-keys on` + - `set -g extended-keys-format csi-u` When Stow began managing `~/.tmux.conf` with `dotfiles/tmux/.tmux.conf`, those + extended-key settings were dropped. +- **Verified fix (live `tmux 3.8` PTY probe)**: + - `set -s extended-keys always` (forwards modified keys such as `Shift+Enter` even when an inner TUI such as Claude + Code inside `tmux` does not emit the xterm `modifyOtherKeys` activation handshake, while keeping plain `Enter` as + `\r` and preserving bracketed multi-line paste). + - `set -sq extended-keys-format csi-u` (selects CSI-u `\x1b[13;2u` on `tmux >= 3.5` while `-q` suppresses unknown + option errors on Ubuntu 24.04 / WSL `tmux 3.4`, which cleanly falls back to `\x1b[27;2;13~`). + - `set -as terminal-features 'xterm*:extkeys'` (advertises `extkeys` for `xterm-256color`, `xterm-ghostty`, etc.). +- **Automated regression coverage**: Static checks on `dotfiles/tmux/.tmux.conf` and + `dotfiles/ghostty/.config/ghostty/config.ghostty` plus live isolated-socket `tmux` PTY tests across + `TERM=xterm-256color` and `TERM=xterm-ghostty`, with `tmux` installed in `.github/workflows/test-unit.yml` on both + `ubuntu-latest` and `macos-latest`. + +## Item 2: Enable `tmux` `focus-events` (`set -g focus-events on`) + +- **Reported issue**: Neovim `:checkhealth` warns: `tmux focus-events off` — + `add 'set -g focus-events on' to ~/.tmux.conf and reattach for autoread / FocusGained`. +- **Confirmed regression (`2026-11-18`, PR #27)**: Pre-PR-#27 backup + `~/.local/share/dev-env/backup/20261118184638/Users__thomashan__.tmux.conf` configured + `set -g focus-events on # 'autoread' and FocusGained`, which was dropped alongside `extended-keys` when Stow replaced + `~/.tmux.conf` with `dotfiles/tmux/.tmux.conf`. +- **Planned fix & regression test (queued behind Item 1)**: + - Add `set -g focus-events on` to `dotfiles/tmux/.tmux.conf`. + - Add a static config check plus a live `tmux show-options -g focus-events` regression check in `dev-env` tests. + - Queued until Item 1 (`tmux-shift-enter-extkeys`) merges so two concurrent flows do not conflict on + `dotfiles/tmux/.tmux.conf`. + +## Notes + +- Target repository: `/Users/thomashan/git/dev-env/main` (all target changes executed via `holon flow` in isolated + sibling worktrees). + +## Resolution + +Ongoing umbrella bean (`Item 1` merged in `dev-env#41` / `605559f`; `Item 2` merged in `dev-env#42` / `649168b`, EV +`94.83` predicted / `96.62` actual / `+1.79` delta; `Item 3` merged in `dev-env#43` / `77a7910`; `Item 4` merged in +`dev-env#45` / `6a50860`, Bean `0470`, EV `96.46` predicted / `99.30` actual / `+2.84` delta). Status remains +`in-progress` as the ongoing umbrella epic for `dev-env` improvements. diff --git a/.beans/holon-agentic-coder-ref-metadata-0436--sort-the-ledgers-chronologically-and-keep-them-sorted.md b/.beans/holon-agentic-coder-ref-metadata-0436--sort-the-ledgers-chronologically-and-keep-them-sorted.md new file mode 100644 index 00000000..480f5e16 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0436--sort-the-ledgers-chronologically-and-keep-them-sorted.md @@ -0,0 +1,85 @@ +--- +# holon-agentic-coder-ref-metadata-0436 +title: "Sort the three ledgers into chronological order once, and keep them sorted" +status: in-progress +type: task +priority: high +tags: + - ledger + - flow + - conflicts + - holon-agentic-coder +created_at: 2026-11-24T23:15:00Z +updated_at: 2026-11-26T20:59:53Z +--- + +## Why + +Maintainer, 2026-11-24: "create another bean to sort the ledgers in chronological order". + +## Problem + +The three append-only ledgers on `main` of holon-agentic-coder (`holon-knowledge/ledger/executions.jsonl`, +`intents.jsonl`, `plans.jsonl`) are not strictly in `created_at` order. Measured on `main` at 2026-11-24T23:12Z: + +| Ledger | Rows | Adjacent rows out of order | Timestamp styles | +| :----------------- | ----: | -------------------------: | :--------------- | +| `executions.jsonl` | 8,832 | 13 | `Z` and `+00:00` | +| `intents.jsonl` | 205 | 3 | `Z` | +| `plans.jsonl` | 206 | 2 | `Z` | + +Every row has a `created_at`. The disorder comes from merges that appended one side's rows after the other's, and from +rows written with a `+00:00` offset next to rows written with `Z`, which sort differently as strings. + +The cost was seen on pull request #275 the same day: resolving its ledger conflict, an agent interleaved the rows by +`created_at` as the harness rule says, and because `main`'s files were not already in that order the sort moved existing +rows. The pull request's diff showed 310 ledger lines removed and 418 added where a merge should only add, no row was +lost (verified), and every other open pull request touching the ledgers is set up to conflict over the moved lines. As +long as the base is unsorted, the rule "interleave by `created_at`" and the rule "append-only" contradict each other. + +## Goal + +1. **One-time normalisation on `main`**, through the Holon flow: sort each ledger by `created_at` parsed as a UTC + datetime (not as a string), with a stable tie-break (the existing order within the same instant), and write every + `created_at` in one canonical form (`Z`). The change is a pure reordering and reformatting: the set of rows is + identical before and after, proved by a test or a check script that compares the parsed rows. +2. **Keep them sorted from then on**: + - every writer (`record_*`, the ledger step, the reconcilers) writes `created_at` in the canonical form; + - the conflict reconcilers (`flow/ledger_reconcile.py`, `flow/ledger_interleave.py`, `ledger/reconcile.py`) produce a + merge that keeps the base's rows in place and only inserts the incoming rows, so a merge is additions only; + - a hygiene check fails a pull request whose ledger diff removes or moves any row of `main`, or that leaves a ledger + out of order. +3. **Timing**: the normalisation commit touches every row, so land it when few pull requests are open, and resolve the + open ones once against it; say so in the pull request. + +## Notes + +- The one-time reorder is a deliberate exception to the append-only rule, authorised by the maintainer's request above. + After it, the append-only rule holds without exception. +- Overlaps Bean 0371 (per-flow ledger fragments), which removes most ledger conflicts by design. This bean is smaller + and independent: it makes the existing files and merges well-formed now, and stays useful if 0371 keeps the canonical + files. If 0371 lands first, apply goal 1 to whatever canonical ledgers remain. +- Intent note for the flow: do not name harness paths or bean ids in the intent text. + +- Progress (2026-11-25): the harness docs now say a ledger conflict keeps main's file in main's order and appends only + the branch's rows. `.agents/skills/resolve_conflict/scripts/resolve_known.py` still inserts the branch's rows among + main's by `created_at`; its code is unchanged, and it must keep main's order (append the branch's rows after main's) + once this bean is done. `.agents/skills/holon_flow/scripts/run_holon_flow.py` also carries a prompt string saying + "resolve ledger conflicts by chronological interleaving". +- Progress (2026-11-25): `resolve_known.py` now appends: main's ledger file is kept byte for byte and only the branch's + new rows are appended, sorted by `created_at` (UTC, `Z` or `+00:00`); the flow prompt string was reworded to match; + tests in `tests/test_resolve_known.py`. + +- Flow started 2026-11-26T12:04Z: `ledgers-sorted-chronologically` (intent + `todo/intent-0436-ledgers-sorted-chronologically.json`, log `todo/flow-ledgers-sorted-chronologically.log`, + claude-agent / claude-opus-5-5). Scope: normalise script, three canonical ledgers, three reconcilers; writers left out + (follow-up). + +- 2026-11-26T14:08Z: flow `ledgers-sorted-chronologically` produced PR #342: 3/3 consensus at review iteration 6 (after + a code conflict in `flow/__init__.py` resolved via resolve-conflict and a rerun from review), calibrated, + MERGEABLE/CLEAN, green CI. Awaiting maintainer merge. Not in scope and still open: writers of `created_at` (many + review modules) to canonical `Z` form; keep the bean open for that remainder. + +- 2026-11-26T20:58Z: PR #342 merged into `main` (`57a8aa38`). `scripts/normalise_ledgers.py --check` exits 0 on `main`; + the three conflict reconcilers keep the base's rows in place and insert only the incoming rows. Bean stays in-progress + for the remaining scope: `created_at` writers in the review modules (canonical `Z` form). diff --git a/.beans/holon-agentic-coder-ref-metadata-0437--flow-admission-discovery-fails-on-large-pr-diff.md b/.beans/holon-agentic-coder-ref-metadata-0437--flow-admission-discovery-fails-on-large-pr-diff.md new file mode 100644 index 00000000..c2f08b7b --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0437--flow-admission-discovery-fails-on-large-pr-diff.md @@ -0,0 +1,45 @@ +--- +# holon-agentic-coder-ref-metadata-0437 +title: "Stage 3 admission discovery stops the flow when gh pr diff exceeds 300 files" +status: completed +type: bug +priority: high +tags: + - holon-flow + - admission + - overlap +created_at: 2026-11-24T23:27:00Z +updated_at: 2026-11-25T05:23:00Z +--- + +## Problem + +During Stage 3 admission for the 0405 flow (`workspace-survival-job-parallel`), the in-flight flow discovery ran +`gh pr diff 283` for the overlapping pull request (`I-1795425253-resolve-conflicts-in-flow`). GitHub answered HTTP 406 +`diff exceeded the maximum number of files (300)`, so discovery failed and the wrapper stopped with "Stage 3 refused: +the flows in flight could not be discovered". The overlap was real (PR 283 touches `.github/workflows/test-unit.yml`), +but because discovery failed the wrapper did not poll the pull request (the overlap wait only runs on a touch-set +refusal), so the flow stopped instead of waiting for PR 283 to merge or close. + +## Expected + +Discovery should read the changed files through the paginated files API (`gh api repos//pulls//files`) when +`gh pr diff` returns too-large, and a touch-set overlap should then take the overlap wait path. + +## Notes + +- Found 2026-11-24 while driving 0405 by hand; the flow was not hand-patched, the run stopped at execute with checkpoint + at + `apps/holon-agentic-coder/flow-workspace-survival-job-parallel/.holon/flow/checkpoint-workspace-survival-job-parallel.json`. +- Stage 3 refusal text: "the flows in flight could not be discovered: 'gh pr diff 283' failed". + +## Resolution + +Delivered via [PR #299](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/299) and merged into `main` +(`599630f8`, `2026-11-25T05:20:56Z`): + +- **Deliverables**: Added the HTTP 406 (`too_large`) paginated REST `/pulls/{number}/files` fallback in + `apps/sandbox-executor/src/sandbox_executor/flow/pr_changed_files.py` and wired it into + `apps/sandbox-executor/src/sandbox_executor/flow/in_flight.py`, resolving the companion report in Bean `0433`. +- **Holon Flow Traversal**: All 5 stages (Intent -> Plan -> Execute -> Review Loop -> Calibration) completed on + `I-1795566347-in-flight-pr-files-fallback`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0438--stage-5-counted-target-only-file-false-positive.md b/.beans/holon-agentic-coder-ref-metadata-0438--stage-5-counted-target-only-file-false-positive.md new file mode 100644 index 00000000..0f15d137 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0438--stage-5-counted-target-only-file-false-positive.md @@ -0,0 +1,78 @@ +--- +# holon-agentic-coder-ref-metadata-0438 +title: "Stage 5 counted_target_only_file fails calibration after a conflict-merge adapts a main file" +status: completed +type: bug +priority: high +tags: + - flow + - stage-5 + - calibration + - conflict-resolution + - holon-agentic-coder +created_at: 2026-11-25T00:28:00Z +updated_at: 2026-11-25T22:52:00Z +--- + +## Problem + +Stage 5 calibration fails with `CalibrationSelfCheckError: counted_target_only_file` whenever a flow merges +`origin/main` and its merge commit adapts a file that `main` added since the plan branch. + +## Evidence (2026-11-24, PR #283) + +- On `holon-agentic-coder#283` (`resolve-conflicts-in-flow`, checkpoint + `apps/holon-agentic-coder/flow-resolve-conflicts-in-flow/.holon/flow/checkpoint-resolve-conflicts-in-flow.json`), + Stage 5 failed at `2026-11-24T23:36:28Z` (`0.3 min`): + `Calibrate stage failed: the calibration report self-check found counted_target_only_file, so nothing was committed or pushed.` +- Reproduced on head `08f788a7` (`merge_base_sha=acbf790ea691cf89a53dd8f986eeb01a1855386b`): + - `origin/main` (`acbf790e`, PR #275) added `apps/sandbox-executor/tests/flow/stages/test_replan_request.py`. + - Merge commit `221f9d73` merged `origin/main` into PR #283 and adapted 1 line of `test_replan_request.py` + (`check_and_resolve_stage_conflicts` $\rightarrow$ `at_stage_boundary`) to match PR #283's refactor. + - `execution_patch_numstat` (`git diff --numstat acbf790e...08f788a7`) therefore legitimately includes + `test_replan_request.py` (1 insertion, 1 deletion), and `git diff --name-only ...acbf790e` (`on_target`) also + includes it. + - However, `target_only_paths` in + `apps/holon-agentic-coder/main/apps/sandbox-executor/src/sandbox_executor/calibration_self_check.py:112-120` + computes `own` via `git log --no-merges --name-only --format= {merge_base_sha}..{head_sha} --`, which skips merge + commits (`221f9d73`). Because `--no-merges` omits the conflict-resolution edit, `test_replan_request.py` falls into + `on_target - own` (`337` paths) and intersects `counted_paths` (`301` paths), falsely failing Stage 5. + +## Proposed change + +1. Fix `target_only_paths` in `calibration_self_check.py` so `own` includes paths actually modified relative to + `merge_base_sha` across merge commits (e.g. `git diff --name-only {merge_base_sha}...{head_sha} --` or inspecting + merge-commit diffs against their target parent), instead of relying solely on `git log --no-merges`. +2. Add a hermetic regression test in `tests/test_calibration_self_check.py` where the target branch adds a file after + the plan branch, a merge commit adapts that file on the execution branch, and `self_check_report` returns `[]`. + +## Expected gain + +Unblocks Stage 5 calibration on PR #283 and prevents false-positive `counted_target_only_file` failures (saving ~15–30 +min of halted-PR triage and manual recovery per affected conflict-merging flow). + +## Cost + +Small: single-function fix and unit test in `sandbox_executor`, delivered via the Holon flow (touches +`calibration_self_check.py` and `test_calibration_self_check.py`). + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0428` (3-dot PR-own diff semantics), Bean `0376` (`PR #283` in-flow conflict resolution). + +## Resolution + +Delivered via [PR #309](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/309) and merged into `main` +(`a144e65c`): + +- **Key Architectural Deliverables**: `target_only_paths` in `calibration_self_check.py` now counts a path as the pull + request's own when the PR side changed it relative to the merge base, including edits made inside merge commits + (three-dot diff of merge base against head), instead of relying on `git log --no-merges`. A file changed only on the + target branch and never touched by the PR is still reported. Other self-check conditions are unchanged. +- **Verification & Tests**: Hermetic regression tests in `tests/test_calibration_self_check.py` on real temporary git + repositories cover (a) a target-added file adapted by a merge commit on the execution branch reports no violation, (b) + a target-only file never touched by the PR is still reported, and (c) a clean merge with no adaptation reports no + violation. +- **Holon Flow Traversal**: Flow ran Intent -> Plan -> Execute -> Review Loop -> Calibration; calibration report + committed on the flow branch (`E-1795584671-CLA-CO5.5`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0439--stage-4-resolver-has-no-scope-guard-against-out.md b/.beans/holon-agentic-coder-ref-metadata-0439--stage-4-resolver-has-no-scope-guard-against-out.md new file mode 100644 index 00000000..456284a2 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0439--stage-4-resolver-has-no-scope-guard-against-out.md @@ -0,0 +1,89 @@ +--- +# holon-agentic-coder-ref-metadata-0439 +title: "Stage 4 resolver edits out-of-scope files and reacts to timing-gate CI failures" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - resolver + - scope + - holon-agentic-coder +created_at: 2026-11-25T00:28:00Z +updated_at: 2026-11-25T04:02:00Z +--- + +## Problem + +Unlike Stage 3 (which checks edits against the plan's touch set), the Stage 4 review-loop resolver has no scope or +touch-set guard, and it is dispatched on `FIND-CI-*` findings triggered by `CI Timing Gate (compare with main)` variance +on bookkeeping-only commits. As a result, a scoped flow silently edits unrelated modules and weakens unrelated tests +across the repository. + +## Evidence (2026-11-24) + +- **PR #276 (`launcher-proxy-self-doc`):** scoped to 9 `launcher/` modules and `test_launcher_proxy_self_doc.py`. + - Bookkeeping ledger commits `c1f20b9e` and `f5baea47` failed `unit (macos-latest)` at + `CI Timing Gate (compare with main)`, producing `FIND-CI-002` and `FIND-CI-004`. + - Stage 4 resolver commits `d937c11b`, `43c1119d`, and `00cc36cc` edited **8 files outside the plan's scope**: + `apps/sandbox-executor/src/sandbox_executor/cli/__init__.py`, `config_env_report.py`, `scripts/pre_commit_check.py`, + `tests/test_approval_fingerprint.py` (halving Hypothesis `max_examples` from `25` to `12`), + `tests/test_calibration_diff_property.py`, `tests/test_turn_supervisor.py`, `tests/test_turns.py`, and + `tests/test_url_credential_redaction.py`. + - Merging those out-of-scope `cli/__init__.py` edits into `main` directly caused **PR #296 + (`split-cli-init-modules`)** to fail Stage 4 at `2026-11-24T23:47:23Z` with + `Unresolvable merge conflicts detected in stage 'review': apps/sandbox-executor/src/sandbox_executor/cli/__init__.py`. +- **PR #292 (`config-env-self-doc`):** scoped to `config_env*.py`, yet Stage 4 resolver commit `66f45713` + (`FIND-CI-004`, `R1-F1`, `R2-F1`, `R3-F1`) modified out-of-scope `redaction.py` and `test_redaction.py`. + +## Proposed change + +1. Enforce a touch-set / scope boundary on Stage 4 resolver commits (matching the plan's touch set plus scoped test + files, or rejecting/reverting out-of-scope edits and marking the finding `unresolvable_out_of_scope` rather than + silently mutating unrelated packages). +2. Do not convert `CI Timing Gate (compare with main)` failures—especially on bookkeeping-only heads—into actionable + `FIND-CI-*` code-edit tasks for the resolver (coordinate with Bean `0419` / `0407`). +3. Add a hermetic test in `tests/flow/` asserting a Stage 4 resolver edit outside the allowed scope is caught before + commit/push. + +## Expected gain + +Prevents cross-PR merge collisions (`PR #276` $\rightarrow$ `PR #296`), protects property-test budgets from silent +weakening, and eliminates wasted Stage 4 resolver turns (`9.4 min` median, `33.4 min` max) plus subsequent full +re-reviews (`26.6 min` median). + +## Cost + +Medium: Stage 4 resolver guard and `FIND-CI` filter in `sandbox_executor`, delivered via the Holon flow. + +## Notes + +- Related: Bean `0414` (Stage 3 touch-set enforcement), Bean `0419` (CI timing gate false failures), Bean `0407` (no + full re-review when nothing reviewable changed), Bean `0392` (resolver repo-wide Prettier). +- Target repo change through the Holon flow (`holon-agentic-coder`). + +## Audit evidence, 2026-11-25T04:02Z (self-improvement audit, fifth merge) + +- **`PR #287` (`ledger-self-doc`, merged `03:21:48Z`):** `9f75f261` failed `unit (macos-latest)` at + `CI Timing Gate (compare with main)` (`18:16Z–18:27Z`). Stage 4 resolver commit `ba6b525a` (`FIND-CI-001`) edited **7 + files outside `ledger/` scope**: `cli/__init__.py`, `config_env_report.py`, `redaction.py`, + `tests/test_approval_fingerprint.py`, `tests/test_calibration_diff_property.py`, + `tests/test_url_credential_redaction.py`, and `scripts/pre_commit_check.py`. +- **`PR #290` (`knowledge-self-doc`):** `9b4d2bd4` and `b15549be` failed `unit (macos-latest)` at + `CI Timing Gate (compare with main)`. Stage 4 resolver commits `a06586a6` (`FIND-CI-002`) and `0b7f019c` + (`FIND-CI-003`) edited **12 files outside `knowledge/` scope**: `cli/__init__.py`, `config_env_report.py`, + `redaction.py`, `config_env.py`, `tests/flow/conftest.py`, `tests/test_approval_fingerprint.py`, + `tests/test_calibration_diff_property.py`, `tests/test_credential_hermeticity.py`, + `tests/test_executor_agent_output_redaction.py`, `tests/test_turn_supervisor.py`, + `tests/test_url_credential_redaction.py`, and `scripts/pre_commit_check.py`. +- **Downstream collision in window:** When `#287` merged (`03:21:48Z`), `#290`'s `Merge origin/main` commit `a344ce2f` + (`03:50:30Z`) hit **9 code/test merge conflicts** on those shared out-of-scope files (plus 3 ledgers), and both `#287` + and `#290` appeared in Bean `0407`'s Stage 3 `blocked_by` list on `apps/sandbox-executor/tests/`. + +## Recurrence, 2026-11-26 + +- Flow `preflight-outage-wait-resume` (PR #320): the Stage 4 resolver edited + `apps/sandbox-executor/src/sandbox_executor/preflight.py`, which is outside the intent's three-file scope, to expose + `is_model_error`. That file is 548 lines on main, so the frozen module-budget override will reject the growth once the + all-packages budget lands. diff --git a/.beans/holon-agentic-coder-ref-metadata-0440--harness-pre-commit-prettier-checks-unstaged-md.md b/.beans/holon-agentic-coder-ref-metadata-0440--harness-pre-commit-prettier-checks-unstaged-md.md new file mode 100644 index 00000000..b36ca6df --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0440--harness-pre-commit-prettier-checks-unstaged-md.md @@ -0,0 +1,54 @@ +--- +# holon-agentic-coder-ref-metadata-0440 +title: "Harness pre-commit Prettier check blocks commits on unstaged files from parallel sessions" +status: todo +type: bug +priority: high +tags: + - harness + - pre-commit + - prettier + - concurrency +created_at: 2026-11-25T00:28:00Z +updated_at: 2026-11-25T00:28:00Z +--- + +## Problem + +The harness `.git/hooks/pre-commit` script runs `npx prettier --check "**/*.md"` across the entire working tree. When +multiple agent sessions run concurrently in the shared `holon-agentic-coder-ref-metadata` checkout, any unstaged or +untracked `.md` file left mid-edit by another session causes `git commit --only ` to fail for every other +session. + +## Evidence (2026-11-25) + +- `.git/hooks/pre-commit` executes: + ```sh + npx prettier --check "**/*.md" + ``` +- In the shared harness checkout (`git status --short` showing `50+` concurrent modified/untracked files across + `.beans/`, `.agents/`, and root), sessions committing only their own formatted files via `git commit --only ` + are blocked whenever any concurrent session holds an unformatted `.md` file in the working tree. + +## Proposed change + +1. Update `.git/hooks/pre-commit` (and any hook template/installer or harness documentation) to check **only staged + Markdown files** (`git diff --cached --name-only --diff-filter=ACMR -- '*.md'`), matching the staged-files-only + pattern already used by `.agents/scripts/pre_commit_check.py`. +2. Keep full-tree `npx prettier --check "**/*.md"` available for explicit CI/manual sweeps rather than blocking + per-session commits on unrelated unstaged files. + +## Expected gain + +Eliminates cross-session commit blocks in the multi-agent harness without weakening Prettier enforcement on committed +files or tempting agents to edit another session's files. + +## Cost + +Tiny: small harness shell-hook change (and corresponding hook test/doc update if tracked). + +## Notes + +- Harness change (`holon-agentic-coder-ref-metadata`). +- Related: Bean `0423` (multi-session coordination), Bean `0429` (`pre_commit_check.py` `.beans/` validation), Bean + `0002` (initial pre-commit hook setup). diff --git a/.beans/holon-agentic-coder-ref-metadata-0441--stage-5-final-head-ci-reports-unknown-after-book.md b/.beans/holon-agentic-coder-ref-metadata-0441--stage-5-final-head-ci-reports-unknown-after-book.md new file mode 100644 index 00000000..c202f6f0 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0441--stage-5-final-head-ci-reports-unknown-after-book.md @@ -0,0 +1,61 @@ +--- +# holon-agentic-coder-ref-metadata-0441 +title: "Stage 5 final_head_ci reports unknown on bookkeeping-gated or transient-probe heads" +status: todo +type: bug +priority: normal +tags: + - flow + - stage-5 + - ci + - holon-agentic-coder +created_at: 2026-11-25T00:28:00Z +updated_at: 2026-11-25T00:28:00Z +--- + +## Problem + +After `PR #272` (`ci_bookkeeping_gate`) merged on `2026-11-24T21:10:12Z`, Stage 5 `final_head_ci` settled cleanly as +`success` in `47.7–47.9 s` on some flows (`git-flow-self-doc`, `local-llm-self-doc`), but settled as `state: "unknown"` +(`reason: "CI checks were not measured on GitHub."`) on others (`knowledge-self-doc` in `46.6 s`, `review-meta-self-doc` +in `16.0 s`) even though `merged_head_ci` had passed all 11 checks and `CodeQL`/`Analyze` passed on the final +calibration head. + +## Evidence (2026-11-24) + +- Checkpoints after `21:10:12Z`: + - `knowledge-self-doc` (`PR #290`): `merged_head_ci.state = "passed"` (`07239e02`, 11 checks), then `final_head_ci` on + `57152552` returned + `{"state": "unknown", "ci_wait": {"state": "settled", "waited_seconds": 46.591}, "reason": "CI checks were not measured on GitHub."}` + while `CodeQL`, `Analyze (python)`, and `Analyze (actions)` completed `success` on `57152552`. + - `review-meta-self-doc` (`PR #293`): `merged_head_ci.state = "passed"` (`0175c138`, 11 checks), then `final_head_ci` + returned + `{"state": "unknown", "ci_wait": {"state": "settled", "waited_seconds": 16.047}, "reason": "CI checks were not measured on GitHub."}`. +- In `apps/holon-agentic-coder/main/apps/sandbox-executor/src/sandbox_executor/flow/github/ci_final_head.py:155-156`, + `classify_final_head` returns `"unknown"` whenever `ci_status.get("source") != "github_cli"`, including if a later + poll inside `wait_for_pending_ci` returns a non-`github_cli` payload or if bookkeeping-gated workflows emit no + `all_passed=True` probe result. + +## Proposed change + +1. Audit `wait_for_pending_ci` and `classify_final_head` in `ci_final_head.py` so transient non-`github_cli` poll errors + are retried within the wait budget instead of overwriting an active `github_cli` poll and short-circuiting to + `unknown`. +2. Ensure skipped-by-bookkeeping-gate checks on calibration-only commits (`conclusion: skipped` with `CodeQL`/`Analyze` + passing) classify deterministically as `success` (or explicitly `bookkeeping_skipped`) rather than `unknown`. +3. Add a unit test in `tests/test_calibrate_final_head_ci.py` covering both transient poll hiccups and bookkeeping-gated + final heads. + +## Expected gain + +Eliminates spurious `final head CI: unknown` warnings at the merge boundary and ensures Stage 5 completes cleanly once +`PR #272`'s bookkeeping gate skips redundant suites. + +## Cost + +Small: `ci_final_head.py` + unit test, delivered via the Holon flow. + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0403` (`PR #272` bookkeeping gate), Bean `0401` (CI registration wait `unknown` on pushed head). diff --git a/.beans/holon-agentic-coder-ref-metadata-0442--stage-5-calibration-invokes-npx-prettier-twice.md b/.beans/holon-agentic-coder-ref-metadata-0442--stage-5-calibration-invokes-npx-prettier-twice.md new file mode 100644 index 00000000..490b083c --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0442--stage-5-calibration-invokes-npx-prettier-twice.md @@ -0,0 +1,99 @@ +--- +# holon-agentic-coder-ref-metadata-0442 +title: "Stage 5 calibration invokes npx prettier twice instead of local binary" +status: todo +type: bug +priority: high +tags: + - flow + - stage-5 + - calibration + - prettier + - performance + - holon-agentic-coder +created_at: 2026-11-25T03:08:00Z +updated_at: 2026-11-25T06:05:00Z +--- + +## Problem + +Stage 5 calibration work (`Starting Stage 5: Post-Execution Calibration` to `Stage 5 promoted ...`) jumped from +`0.2–0.4 min` (`12–24 s`) to `2.57–2.65 min` (`154–159 s`) on every flow because `format_calibration_report` in +`apps/holon-agentic-coder/main/apps/sandbox-executor/src/sandbox_executor/calibration.py:66,1359-1409` invokes +`npx --yes prettier` twice (`--write`, then `--check`). On the host, `npx --yes prettier` takes `>30–70 s` per call even +when `prettier` is already cached in `~/.npm/_npx`, whereas calling the cached `prettier` binary directly takes +`0.064 s`. + +## Evidence (2026-11-25T00:28Z–02:54Z fifth-merge audit) + +- Across all `13` Stage 5 runs in the window (`12` checkpoints + `todo/flow-timing-gate-judges-test-time.log`), + `stage5_calib_work` took a median of **`2.58 min`** (max `2.65 min` on `#278`), consuming **`0.58 h` (`~35 min`)** of + wall-clock work. +- Read-only profiling against `apps/holon-agentic-coder/flow-agent-defaults-self-doc`: + - `generate_calibration`: `8.87 s` + - `enforce_report_self_check`: `0.04 s` + - `promote_pending_candidates(dry_run=True)`: `0.45 s` + - Total Python/git calibration work: **`9.36 s`** + - `npx --yes prettier --check `: **timed out at `20.01 s`** (`npx --yes prettier --version` also timed out + after `>30 s`) + - Direct cached binary `~/.npm/_npx/b388654678d519d9/node_modules/.bin/prettier --check `: **`0.064 s`** + (`64 ms`) +- Because `_converge_report` runs both `--write` and `--check` (`calibration.py:1402-1405`), `npx` startup/resolution + accounts for **`~140 s` (`~91%`)** of Stage 5 calibration work on every single flow. + +## Proposed change + +1. Resolve a local/cached `prettier` binary first (e.g., repository `node_modules/.bin/prettier`, + `shutil.which("prettier")`, or `npx --offline prettier` / cached `_npx` binary matching the repository's + `.prettierrc.json` expectations) before falling back to `("npx", "--yes", "prettier")`, or skip `--check` when + `--write` succeeded on the exact file and verify via `--write` + single fast binary call. +2. Add a hermetic unit test in `tests/test_calibration_format.py` (or existing calibration formatting tests) covering + the direct binary preference and `npx` fallback. + +## Expected gain + +Cuts Stage 5 calibration work from `~2.58 min` (`155 s`) back to `~0.2 min` (`~10–12 s`), saving **`~2.3 min` per flow** +(`~30 min` across `13` flows in a 2.4-hour window). + +## Cost + +Small: single command-resolution helper in `calibration.py` + unit test, delivered via the Holon flow. + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0048` (dropped `@3.8.4` pin), Bean `0383` (Stage 5 timing & budget), Bean `0408` (local hygiene gate). + +## Audit evidence, 2026-11-25T04:02Z (self-improvement audit, fifth merge) + +- **`PR #308` (`workspace-survival-job-parallel`):** Stage 5 calibration work (`03:35:18Z–03:37:54Z`) took **`2.60 min` + (`156 s`)** (`calibrate` total `12.69 min` vs `10 min` budget), and Stage 2 in + `todo/flow-workspace-survival-job-parallel.log:45-46` also hit **two `30 s` `npx --yes prettier@3.8.4` timeouts** + (`60 s` wasted in Stage 2). + +## Audit evidence, 2026-11-25T05:07Z (self-improvement audit, fifth merge #290–#294) + +- **`PR #308` Round 1 re-calibration (`04:10:12Z..04:12:52Z`)** spent **`2.50 min`** (`150 s`, incl. `10 s` re-point), + and **`thomashan/dev-env#42` Stage 5 calibration (`04:29:23Z..04:31:59Z`)** spent **`2.60 min`** (`156 s`) on + calibration work before `final_head_ci`. + +## Audit evidence, 2026-11-25T05:41Z (self-improvement audit, fifth merge #295–#299) + +- **Stage 2 `formatting.py` (`apps/sandbox-executor/src/sandbox_executor/formatting.py:11,48,63`)**, still pinned to + `npx --yes prettier@3.8.4`, timed out twice after `30 s` (`60 s` wasted) in both newly launched flows: `0371` + (`todo/flow-ledger-fragments-and-promotion.log:45-46`) and `0438` + (`todo/flow-calibration-merge-adapted-file.log:45-46`). +- On `PR #309` (`0438`), those Stage 2 timeouts left + `plans/I-1795584436-calibration-merge-adapted-file/P-1795584464-CLA-CO5.5.md` unformatted, causing **`Test - Hygiene` + (`run 45554742211`, `make lint-md` using `prettier@3.10.1`) to immediately FAIL** at `05:37:23Z`, blocking `3/3` + `APPROVED (0/0/0)` reviewers at `05:40:16Z` and dispatching a resolver pass (`05:40:17Z`). `formatting.py` and + `calibration.py` should share one local/cached Prettier binary resolver aligned with CI's version. + +## Audit evidence, 2026-11-25T06:05Z (self-improvement audit, fifth merge #300–#304) + +- The downstream cost of Stage 2 Prettier timing out twice (`60 s`) on `PR #309` (`0438`) finished settling at + `06:01:51Z`: it added a `6.58 min` resolver pass, a `29 s` 4-push burst (`26eca98f` cancelled), `9.95 min` CI on + `4ded0b14`, and a `10.15 min` full Iter 2 re-review (`21.63 min` Stage 4 instead of `~4 min`). +- Stage 5 calibration work on `PR #309` (`05:57:50Z..06:00:26Z`) still spent **`2.60 min` (`156 s`)** running two host + `npx --yes prettier` calls (`calibration_diff` / report check) before `final_head_ci` settled at `06:01:45Z` + (`48.93 s` CI wait; `3.98 min` Stage 5 total). diff --git a/.beans/holon-agentic-coder-ref-metadata-0443--stage-4-pushes-review-ledger-rows-cancelling-ci.md b/.beans/holon-agentic-coder-ref-metadata-0443--stage-4-pushes-review-ledger-rows-cancelling-ci.md new file mode 100644 index 00000000..73e122f0 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0443--stage-4-pushes-review-ledger-rows-cancelling-ci.md @@ -0,0 +1,135 @@ +--- +# holon-agentic-coder-ref-metadata-0443 +title: "Stage 4 pushes review ledger rows seconds after resolver or conflict merge, cancelling CI" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - ci + - performance + - holon-agentic-coder +created_at: 2026-11-25T03:08:00Z +updated_at: 2026-11-25T06:05:00Z +--- + +## Problem + +In Stage 4 (`sandbox_executor/flow/review/loop.py` and `ledger_commit.py`), whenever the resolver container pushes a fix +or `conflict_gate.py` pushes a `Merge main` commit, the engine immediately runs `_commit_pending_ledger_rows` (`9–12 s` +later) and pushes `chore(review): record review ledger rows` as a separate GitHub push. Because GitHub Actions cancels +in-progress runs per PR branch, that follow-up push immediately cancels the 5 CI workflows triggered on the code/merge +head, wastes `Docker Build` runner time (`96–126 s`), and defeats `ci_bookkeeping_gate` (`PR #272`), forcing the +ledger-row commit itself to run the full `6–9 min` CI suite because the cancelled parent head never passed CI. + +## Evidence (2026-11-25T00:28Z–02:54Z fifth-merge audit) + +All `5` cancelled CI heads across `holon-agentic-coder` PRs in the window were caused by this `9–12 s` double-push race: + +- **`PR #305` (`git-refs-self-doc`):** `01:40:54Z` `4ea64923` (`fix(review)`) pushed $\rightarrow$ `01:41:03Z` (`+9 s`) + `10da1c03` (`chore(review): record review ledger rows (iteration 1)`) pushed; all `5` cancellable workflows on + `4ea64923` cancelled (`8–9 s`, `Docker Build` wasted `96 s`), forcing `10da1c03` to run full CI (`Unit: 438 s`, + `Stress: 290 s`). +- **`PR #306` (`github-pr-merge-self-doc`):** + - `02:07:06Z` `1a49bac5` (`fix(review)`) pushed $\rightarrow$ `02:07:15Z` (`+9 s`) `4b7c7498` (`chore(review)`) + pushed; `5` workflows on `1a49bac5` cancelled (`9–15 s`), forcing full CI on `4b7c7498` (`Unit: 441 s`, + `Stress: 430 s`). + - `02:15:13Z` `4ba9ecf7` (`Merge main`) pushed $\rightarrow$ `02:15:25Z` (`+12 s`) `69fae7f4` (`chore(review)`) + pushed; `5` workflows on `4ba9ecf7` cancelled (`13–51 s`, `Docker Build` wasted `104 s`), forcing Stage 5 + `merged_head_ci` to wait `456 s` (`7.6 min`) on `69fae7f4`. +- **`PR #296` (`split-cli-init-modules`):** + - `00:27:55Z` `b646d346` (`fix(review)`) pushed $\rightarrow$ `ac5d3c5e` (`chore(review)`) cancelled `b646d346` + (`8–9 s`) and ran full CI (`397 s`). + - `00:35:45Z` `59d41deb` (`Merge main`) pushed $\rightarrow$ `00:35:57Z` (`+12 s`) `c2f861c4` (`chore(review)`) + pushed; `5` workflows on `59d41deb` cancelled (`17–51 s`, `Docker Build` wasted `126 s`), forcing Stage 5 + `merged_head_ci` to wait `475 s` (`7.9 min`) on `c2f861c4`. + +Code locations: `apps/holon-agentic-coder/main/apps/sandbox-executor/src/sandbox_executor/flow/review/loop.py:329,857`, +`conflict_gate.py:112,182`, and `ledger_commit.py:135-155`. + +## Proposed change + +1. Eliminate the `9–12 s` double push: + - Have the host (not the resolver container, or deferring the container's push to the host) push once after the host + appends and commits iteration ledger rows on top of the resolver's commit, OR fold pending Stage 4 ledger rows into + the resolver/conflict-gate push before pushing to `origin`. + - At `conflict_gate` / `loop.py:857` (Stage 4 exit before Stage 5), avoid pushing a bare `chore(review)` commit + `12 s` after `Merge main` when Stage 5 is entering immediately (or push `Merge main` + final Stage 4 ledger rows + together in one push). +2. Add a hermetic Stage 4 test asserting that a resolver fix + iteration ledger rows (and conflict-gate merge + exit + ledger rows) result in a single `push_commit` call, not two sequential pushes. + +## Expected gain + +Eliminates `100%` of self-inflicted Stage 4 CI cancellations (`5` cancelled heads / `~500 s` of wasted `Docker Build` +runs in 2.4 h) and avoids invalidating `ci_bookkeeping_gate` on follow-up ledger commits. + +## Cost + +Medium: push batching in `flow/review/loop.py`, `ledger_commit.py`, `conflict_gate.py`, and resolver handoff, delivered +via the Holon flow. + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0383` (Stage 4/5 inline commits & one push per step), Bean `0394` (Rec. 6), Bean `0403` + (`ci_bookkeeping_gate`). + +## Audit evidence, 2026-11-25T04:02Z (self-improvement audit, fifth merge) + +- **`PR #308` (`workspace-survival-job-parallel`):** `3/3` code/merge pushes in `02:54Z–03:54:45Z` were cancelled + `9–16 s` later by follow-up `chore(review): record review ledger rows` pushes (`16` cancelled workflow runs in window; + `317 s` of `Docker Build` wasted), defeating `ci_bookkeeping_gate` on all `3` ledger commits: + - `03:16:12Z` `0b986f9b` (`fix(review)`) $\rightarrow$ `03:16:25Z` (`+13 s`) `8f533e24` (`chore(review)`); `5` + workflows cancelled (`9–23 s`, `Docker Build` `98 s`), forcing full CI on `8f533e24` (`Unit`: `542 s`, `Stress`: + `396 s`). + - Conflict gate **triple push in `20 s`**: `03:26:07Z` `5cb52b05` (`before conflict merge`) $\rightarrow$ `03:26:16Z` + (`+9 s`) `b14bd3dd` (`sync: merge target origin/main`) $\rightarrow$ `03:26:27Z` (`+11 s`) `24d23329` + (`chore(review)`); `5` workflows on `b14bd3dd` cancelled (`14–28 s`, `Docker Build` `111 s`), forcing + `merged_head_ci` to wait `8.75 min` (`525 s`) on `24d23329`. + - `03:51:41Z` `11721091` (`fix(review)`) $\rightarrow$ `03:51:57Z` (`+16 s`) `a27a4ce4` (`chore(review)`); `5` + workflows cancelled (`10–24 s`, `Docker Build` `108 s`). (`2b840055` `Test - Unit` was also cancelled at `371 s` + when `0b986f9b` arrived.) + +## Audit evidence, 2026-11-25T05:07Z (self-improvement audit, fifth merge #290–#294) + +- **`PR #308` (`workspace-survival-job-parallel`) hit two quadruple-push bursts in Stage 4:** + - `04:01:29Z..04:02:08Z` (`39 s`): `60964f80` $\rightarrow$ `03b6dbe7` $\rightarrow$ `b95c09b7` $\rightarrow$ + `3357edd2` (Round 1 Iter 2 ledger + nested Stage 5 rerun + consensus withdrawal; cancelled CI on `03b6dbe7` and + `b95c09b7`). + - `05:00:49Z..05:01:19Z` (`30 s`): `54321e50` $\rightarrow$ `aab5fe10` $\rightarrow$ `bd581a65` $\rightarrow$ + `37ecf4f7` (Round 2 Iter 2 resolver + ledger + target-sync `main` merge + ledger; cancelled CI on `bd581a65`; + earlier `3595c1f1` at `04:48:55Z` was also cancelled by follow-up `31fdc482`). + - Overall in-window `hac` CI (`03:54:45Z..05:05:00Z`): `15/17` (`88.2%`) PR heads were churn (`8` bookkeeping, `7` + `main`-merge), contributing to `23` cancelled workflow runs (`#290–#294` full lifetime: `43/47` = `91.5%` churn + heads, `29` bookkeeping + `14` `main`-merge across `459` check-runs). +- **`thomashan/dev-env#42` (`tmux-focus-events-on`):** Stage 5 `ef1fbd76` push (`04:31:59Z`) cancelled `b1dc27bb`'s + running `Unit Tests` and `Ubuntu Converge E2E` (`2/3` = `66.7%` of `#42` CI heads were bookkeeping churn). + +## Audit evidence, 2026-11-25T05:41Z (self-improvement audit, fifth merge #295–#299) + +- **`PR #308` hit a third Stage 4 quadruple-push burst in `29 s` (`05:16:12Z..05:16:41Z`):** `ebb688d6` (`fix(review)`, + doc-only) $\rightarrow$ `69c4188f` (`before target sync`) $\rightarrow$ `8857f506` (`sync: merge target origin/main`) + $\rightarrow$ `c960579d` (`chore(review)`); cancelled `5` workflows on `8857f506` (`7–12 s`, while `Docker Build` + `45552461815` still ran `108 s`), forcing `c960579d` to run full `7.57 min` CI. +- Across `#295–#299` full PR lifetimes, `5` code/merge heads (`cb34f2eb`, `01418f78`, `b646d346`, `59d41deb` on `#296`; + `68f4f9a6` on `#297`) were similarly cancelled by immediate follow-up `chore(review)` ledger commits. + +## Audit evidence, 2026-11-25T06:05Z (self-improvement audit, fifth merge #300–#304) + +- **`PR #309` (`0438`) reproduced the exact `29 s` quadruple-push Stage 4 pattern (`05:46:52Z..05:47:21Z`):** resolver + pushed `89eae143` (`fix(review)` formatting `P-1795584464-CLA-CO5.5.md`) $\rightarrow$ `88adfe30` + (`chore(review): ... before target sync` at `05:47:06Z`) $\rightarrow$ `26eca98f` (`sync: merge target main` at + `05:47:20Z`) $\rightarrow$ `4ded0b14` (`chore(review) iteration 1` at `05:47:21Z`). That burst immediately **cancelled + 5 workflows on `26eca98f` at `05:47:32Z` (`7 s`)**, let `Docker Build` (`45555994086`) burn **`148 s`** + (`05:47:25Z..05:49:53Z`) for nothing, and forced `4ded0b14` to run full **`9.95 min` CI** (`05:47:30Z..05:57:27Z`). + +## Audit evidence, 2026-11-26T03:50Z (fifth-merge audit) + +- Across `48` distinct `holon-agentic-coder` SHAs in `2026-11-25T22:49:00Z..2026-11-26T03:50:09Z`, **`26` SHAs + (`54.2%`)** were cancelled mid-CI (`24` of them `fix(review)` or `chore(calibration)` heads immediately superseded + `10–20 s` later by `chore(review)` / calibration ledger commits on `#308`, `#310`–`#314`). +- Combined with `0450`, cancelling the resolver CI head forced Stage 4 to fall back to `local_tests` on `9` review + iterations (`#310` iters `2–7`, `#311` iters `2–3`, `#312` iter `2`), while `Docker Build` still ran to `success` on + all `26/26` cancelled SHAs (`39.93 runner-min`, Bean `0475`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0444--stage-5-calibrate-sync-fetch-fails-without-retry.md b/.beans/holon-agentic-coder-ref-metadata-0444--stage-5-calibrate-sync-fetch-fails-without-retry.md new file mode 100644 index 00000000..827b9deb --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0444--stage-5-calibrate-sync-fetch-fails-without-retry.md @@ -0,0 +1,80 @@ +--- +# holon-agentic-coder-ref-metadata-0444 +title: "Stage 5 calibrate_sync._fetch_execution_branch fails on transient SSH error without retry" +status: completed +type: bug +priority: normal +tags: + - flow + - stage-5 + - reliability + - git + - holon-agentic-coder +created_at: 2026-11-25T03:08:00Z +updated_at: 2026-11-26T13:13:04Z +--- + +## Problem + +In Stage 5 (`sandbox_executor/flow/stages/calibrate.py:266`), `_prepare_execution_branch` calls +`calibrate_sync.sync_execution_ref` $\rightarrow$ `_fetch_execution_branch` (`calibrate_sync.py:43-50`) outside +`call_with_retries` (`calibrate.py:279`). Whenever `git fetch origin` hits a transient SSH/keychain/network failure +while `refs/remotes/origin/` already exists locally, Stage 5 immediately aborts with `CalibrationSyncError` +instead of retrying with short backoff. + +## Evidence (2026-11-25T00:28Z–02:54Z fifth-merge audit) + +- On `touch-set-self-doc` (`PR #298`, checkpoint + `apps/holon-agentic-coder/flow-touch-set-self-doc/.holon/flow/checkpoint-touch-set-self-doc.json`), Stage 5 failed + after `6 s` at `2026-11-25T00:30:27Z`: + ```text + Calibrate stage failed: could not fetch origin/I-1795565481-touch-set-self-doc/P-1795565501-ANA-G4N/E-1795565805-ANA-G4N/_ (host fetch of '...' through remote 'origin' failed: git@github.com: Permission denied (publickey). + fatal: Could not read from remote repository. + ``` +- Resumed `1.37 min` later (`00:31:52Z`) with no host or key changes and fetched/calibrated cleanly (`00:36:11Z`), + proving the failure was transient. + +## Proposed change + +1. Wrap `fetch_base` in `_fetch_execution_branch` (`calibrate_sync.py:43-50`, or `host_remote.fetch_base` for transient + SSH/network errors) with bounded retry + short backoff (e.g., 3 attempts over `~10–15 s`) before raising + `CalibrationSyncError`. +2. Add a hermetic unit test in `tests/flow/test_calibrate_sync.py` verifying that a transient `HostRemoteError` on the + first fetch attempt succeeds on retry without failing Stage 5. + +## Expected gain + +Prevents transient SSH/network fetch hiccups from halting Stage 5 and forcing a stop/resume cycle (`~1.5 min` wasted per +incident). + +## Cost + +Small: tiny retry wrapper in `calibrate_sync.py` + unit test, delivered via the Holon flow. + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0424` (Stage 4 transient DNS/Docker retries), Bean `0393` (preflight retry). + +## Flow + +In progress 2026-11-26: flow `fetch-execution-branch-retry` (intent +`todo/intent-0444-fetch-execution-branch-retry.json`, log `todo/flow-fetch-execution-branch-retry.log`). Scope: +`flow/calibrate_sync.py` (the bean's `stages/calibrate.py` path is stale), new `flow/calibrate_fetch_retry.py`, new test +file. + +## Resolution + +Delivered via [PR #340](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/340) and merged into `main` +(`72de702c`): + +- **Key Architectural Deliverables**: the execution-branch fetch in Stage 5 (`_fetch_execution_branch`, via the new + `flow/calibrate_fetch_retry.py`) makes three attempts with short backoff before raising `CalibrationSyncError`, so a + transient SSH or network failure no longer aborts calibration. +- **Verification & Tests**: hermetic retry test in `apps/sandbox-executor/tests/test_calibrate_fetch_retry.py`; a + transient fetch failure succeeds on a later attempt. +- **Holon Flow Traversal**: all 5 stages completed for slug `fetch-execution-branch-retry`; the flow worktree and its + `I-1795693496-fetch-execution-branch-retry/*` branches were removed after merge (post-PR-merge step 4). Four + uncommitted review-loop ledger rows in that worktree were saved to + `/private/tmp/claude-501/-Users-thomashan-git-holon-agentic-coder-ref-metadata/f956a41e-6830-4ee3-9257-8c114a4af5b9/scratchpad/fetch-execution-branch-retry-worktree-ledger.patch` + before removal. diff --git a/.beans/holon-agentic-coder-ref-metadata-0445--end-of-flow-sync-leaves-checkpoint-completed-during-reentry.md b/.beans/holon-agentic-coder-ref-metadata-0445--end-of-flow-sync-leaves-checkpoint-completed-during-reentry.md new file mode 100644 index 00000000..f2a6f81d --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0445--end-of-flow-sync-leaves-checkpoint-completed-during-reentry.md @@ -0,0 +1,70 @@ +--- +# holon-agentic-coder-ref-metadata-0445 +title: "End-of-flow sync leaves checkpoint stuck at completed during Stage 4/5 re-entry" +status: todo +type: bug +priority: high +tags: + - flow + - end-of-flow-sync + - checkpoint + - stage-4 + - stage-5 + - holon-agentic-coder +created_at: 2026-11-25T04:02:00Z +updated_at: 2026-11-25T04:02:00Z +--- + +## Problem + +When Stage 5 finishes cleanly, `PipelineEngine._run_stages` / `_handle_review_boundary` (`flow/pipeline.py:362-388`) +saves the checkpoint with `current_stage = "completed"` and `calibrate.status = "success"` before calling +`_finalize_approved_flow` $\rightarrow$ `finish_flow`. If `finish_flow` (`flow/end_of_flow_sync.py:160-173,199`) then +sees `CONFLICTING`/`DIRTY`, merges `origin/main`, and calls `_reenter_review_and_calibrate`, +`record(FlowStage.REVIEW, review)` runs only **after** `run_stage(FlowStage.REVIEW)` finishes. For the entire duration +of the re-entered Stage 4 (and Stage 5), the checkpoint on disk remains frozen at `current_stage: "completed"` with +stale Stage 5 `success` and frozen `context.logs`. + +## Evidence (`2026-11-25T02:54Z–03:54:45Z` fifth-merge audit) + +- On `holon-agentic-coder#308` (`workspace-survival-job-parallel`), Stage 5 exited and saved + `apps/holon-agentic-coder/flow-workspace-survival-job-parallel/.holon/flow/checkpoint-workspace-survival-job-parallel.json` + at `2026-11-25T03:39:19Z` (`current_stage: "completed"`, `90` entries in `context.logs`). +- At `03:39:20Z`, `End-of-flow sync round 1/3` detected `CONFLICTING/DIRTY` (ledger-only conflict after `#288` merged at + `03:35:55Z`), merged `558646ae` (`adaf72a8` at `03:39:23Z`), and re-entered Stage 4 from `03:39:28Z` through + `03:54:45Z+` (`15.3+ min` across `2` review iterations and `1` resolver pass in + `todo/flow-workspace-survival-job-parallel.log`). +- Throughout those `15.3+ min`, `checkpoint-workspace-survival-job-parallel.json` still reported + `current_stage: "completed"`, `calibrate.status: "success"`, and zero post-`03:39:19Z` log entries, making the live + Stage 4 run appear finished to `bean_progress.py` and any checkpoint reader. + +## Proposed change + +1. In `end_of_flow_sync._reenter_review_and_calibrate` (and/or `PipelineEngine._finalize_approved_flow`), save a + checkpoint marking the re-entered stage (`review` / `calibrate`) as active/in-progress before dispatching + `run_stage(...)`, and flush `context.logs` during re-entry. +2. Add a hermetic unit test in `tests/flow/test_end_of_flow_sync.py` verifying the checkpoint transitions out of + `completed` as soon as `finish_flow` re-enters Stage 4. + +## Expected gain + +Eliminates `15+ min` windows of false `completed` state in `checkpoint-*.json`, `bean_progress.py`, and resume safety +checks whenever end-of-flow target sync triggers Stage 4/5 re-entry. + +## Cost + +Small: checkpoint state transition before `run_stage` in `end_of_flow_sync.py` + unit test, delivered via the Holon +flow. + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0407` (mechanical `end_of_flow_sync` merges should carry approval without full Stage 4 re-entry), Bean + `0388` (harness `bean_progress.py` stale stage display), Bean `0412` (step timing and logging). + +## Audit evidence, 2026-11-25T05:07Z (self-improvement audit, fifth merge #290–#294) + +- **`PR #308` (`workspace-survival-job-parallel`):** `checkpoint-workspace-survival-job-parallel.json` remained frozen + at `current_stage: "completed"` (`calibrate.end_time: "2026-11-25T04:14:18Z"`) throughout the entire **`49.6+ min`** + Round 2 Stage 4 re-entry (`04:14:18Z..05:04:00Z+`, Iters 1–3, `27.02 min` + `4.47 min` resolver turns, `2` + `review_local` runs, live Iter 3). diff --git a/.beans/holon-agentic-coder-ref-metadata-0446--stage-3-admission-blocks-split-parent-plans-before-decomposing.md b/.beans/holon-agentic-coder-ref-metadata-0446--stage-3-admission-blocks-split-parent-plans-before-decomposing.md new file mode 100644 index 00000000..d82679ef --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0446--stage-3-admission-blocks-split-parent-plans-before-decomposing.md @@ -0,0 +1,66 @@ +--- +# holon-agentic-coder-ref-metadata-0446 +title: "Stage 3 admission blocks SPLIT parent plans on union touch set before decomposition" +status: todo +type: bug +priority: high +tags: + - flow + - stage-3 + - admission + - decomposition + - holon-agentic-coder +created_at: 2026-11-25T04:02:00Z +updated_at: 2026-11-25T05:45:00Z +--- + +## Problem + +In `ExecuteStage.admit_and_refresh_plan` (`flow/stages/execute.py:213-223`), when `_plan_budget_decision(context)` +returns `DECISION_DECOMPOSED` (`SPLIT`), Stage 3 still runs `admission_stage_failure(context, state.start_time)` against +the parent plan's union touch set before `_run_decomposed_plan` runs. A `SPLIT` parent never executes code directly — +each sequential child plans and runs its own Stage 3 admission on its narrow subset — so blocking on the parent's broad +union (especially when `intent.scope` includes a directory prefix such as `apps/sandbox-executor/tests/`) serializes the +entire decomposed flow behind unrelated PRs that touch any file under that prefix or belong only to later children. + +## Evidence (`2026-11-25T02:54Z–03:54:45Z` fifth-merge audit) + +- Bean `0407` (`no-unneeded-full-review`, `P-1795574132-ANA-G4N`) decided `SPLIT` into 4 sequential child intents + (`max child entropy 5.25`) at `2026-11-25T02:41:03Z`, with child 1 scoped to `flow/review/` (`gate_state.py`, + `approval_fingerprint.py`, etc.) and new `test_gate_state.py`. +- Because `admit_and_refresh_plan` checked the parent touch set (`apps/sandbox-executor/tests/` + `budgets.py`), Stage 3 + refused `0407` at `02:41:40Z` on **7** in-flight items (`#299`, `#296`, `#292`, `#290`, `#289`, `#287`, + `workspace-survival-job-parallel`), idling **`60.75 min`** across the `02:54:00Z–03:54:45Z` window (`73.08 min` total + since `02:41:40Z`). + +## Proposed change + +1. In `ExecuteStage.admit_and_refresh_plan` (`flow/stages/execute.py`), when `precheck.decision == DECISION_DECOMPOSED` + and `_sub_intent_depth_error(context) is None`, skip parent-level touch-set admission and delegate admission to each + child's own Stage 3 (while still refreshing the parent plan branch against `origin/` if needed). +2. Add a hermetic unit test in `tests/flow/stages/test_decomposition.py` verifying a `DECISION_DECOMPOSED` parent whose + union touch set overlaps an in-flight PR proceeds into child 1 rather than halting the parent at Stage 3. +3. In the harness, clarify in intent-authoring guidance that `scope` should list concrete file paths rather than broad + directory prefixes like `apps/sandbox-executor/tests/`. + +## Expected gain + +Eliminates false-positive Stage 3 blocks on decomposed multi-child flows (`60.75+ min` wait saved on `0407` in this +window alone) and prevents unrelated PRs in broad directories from stalling child 1. + +## Cost + +Small: guard in `flow/stages/execute.py` + unit test, delivered via the Holon flow (`holon-agentic-coder`). + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0348` (PR #226 actual PR files), Bean `0407` (`no-unneeded-full-review`), Bean `0395` (Stage 3 overlap + work). + +## Audit evidence, 2026-11-25T05:45Z (self-improvement audit, fifth merge #288 to #299) + +- 0407 is still refused at 05:41Z, about 180 min after 02:41:40Z. No wrapper is alive to relaunch it, so it stays + stopped until someone relaunches it by hand. +- Proposed change 3 (scope lists files) has no home in the harness today. The rule exists only in Claude Code's private + memory, so the Antigravity session that wrote the 0407 intent could not see it (Bean 0459). diff --git a/.beans/holon-agentic-coder-ref-metadata-0447--share-one-child-unit-run-or-split-jobs-for-workspace-survival.md b/.beans/holon-agentic-coder-ref-metadata-0447--share-one-child-unit-run-or-split-jobs-for-workspace-survival.md new file mode 100644 index 00000000..4984fd44 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0447--share-one-child-unit-run-or-split-jobs-for-workspace-survival.md @@ -0,0 +1,62 @@ +--- +# holon-agentic-coder-ref-metadata-0447 +title: "Run Workspace survival via one shared child unit pass or separate CI jobs" +status: todo +type: task +priority: normal +tags: + - ci + - pipeline + - stress + - performance + - holon-agentic-coder +created_at: 2026-11-25T04:02:00Z +updated_at: 2026-11-25T04:02:00Z +--- + +## Problem + +Running both `Workspace survival` stress tests concurrently inside the same 4-vCPU `ubuntu-latest` GitHub Actions job +(`.github/workflows/test-stress.yml`) saturates CPU instead of speeding up the pipeline: each `-n auto` child unit run +slows from `~180 s` (serial) to `~334 s` (concurrent), leaving the job at `364 s` (`399 s` total workflow run) vs +`365.5 s` `main` baseline. + +## Evidence (`2026-11-25T02:54Z–03:54:45Z` fifth-merge audit) + +- On `holon-agentic-coder#308` (`workspace-survival-job-parallel`, run `45540005200` on `24d23329`), `Test - Stress` + took `399 s` (`364 s` stress step) against a `365.5 s` `main` baseline. +- Reviewer 3 raised `R3-F1` (`important`) noting zero net CI wall-clock improvement; the Stage 4 resolver left `R3-F1` + `open` because per-module `--durations` across 276 modules showed no single dominant module (max 7%) and concurrent + child runs are 4-vCPU bound, requiring a design decision. +- Across the window, `Test - Stress` ran in `314–478 s` (`5.2–8.0 min`), setting or co-setting the critical path on + every full CI wait alongside `unit (macos-latest)` (`368–588 s`). + +## Proposed change + +Choose one of two designs in a focused follow-up flow: + +1. **One shared child unit pass:** execute the unit selection once under an isolated executor workspace + simulated + container `HOME`, verify both the workspace/git/`HEAD` survival guarantee and the `HOME` hermeticity guard from that + single run, and keep both negative controls (`head-moved` failure and deliberately non-hermetic canary trip). +2. **Two separate CI jobs:** split `test_workspace_survival_stress` and `test_sandbox_hermetic_guard` into two parallel + jobs in `.github/workflows/test-stress.yml` so each gets its own 4-vCPU runner (`~180 s` each). + +## Expected gain + +Cuts `Workspace survival` CI duration from `365–478 s` (`6.1–8.0 min`) to `~180–210 s` (`3.0–3.5 min`), saving +`~3–4 min` per full CI wait (`~6–8 min` per flow). + +## Cost + +Small: follow-up adjustment to `.github/workflows/test-stress.yml` and `apps/sandbox-executor/tests/stress_support.py`, +delivered via the Holon flow (`holon-agentic-coder`). + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`) after `PR #308` merges. +- Related: Bean `0405` (`workspace-survival-job-parallel`, slice 2), Bean `0400` (shorten the CI pipeline). + +## Evidence (audit 2026-11-26T10:50Z) + +After the unit-suite batches (#323, #325, #327) unit ubuntu fell from median 238 s to 171 s, but Workspace survival +stayed at 269 s (268 s before), so it is now the longest ubuntu job. See bean 0509. diff --git a/.beans/holon-agentic-coder-ref-metadata-0448--end-of-flow-sync-leaves-stale-calibrate-success-causing-nested-stage-5.md b/.beans/holon-agentic-coder-ref-metadata-0448--end-of-flow-sync-leaves-stale-calibrate-success-causing-nested-stage-5.md new file mode 100644 index 00000000..6b0632f1 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0448--end-of-flow-sync-leaves-stale-calibrate-success-causing-nested-stage-5.md @@ -0,0 +1,80 @@ +--- +# holon-agentic-coder-ref-metadata-0448 +title: + "end_of_flow_sync._reenter_review_and_calibrate leaves stale calibrate=SUCCESS, causing nested Stage 5 rerun and bogus + consensus withdrawal" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - stage-5 + - end-of-flow-sync + - calibration +created_at: 2026-11-25T05:07:00Z +updated_at: 2026-11-25T05:07:00Z +--- + +# `end_of_flow_sync._reenter_review_and_calibrate` leaves stale `calibrate=SUCCESS`, causing nested Stage 5 rerun and bogus consensus withdrawal + +## Summary + +When `end_of_flow_sync._reenter_review_and_calibrate` re-enters Stage 4 (`FlowStage.REVIEW`) after an end-of-flow target +merge, it leaves the prior Stage 5 `SUCCESS` result in `context.stage_results["calibrate"]` (and the prior `review` +result in `context.stage_results["review"]`). At the end of the re-entered Stage 4 loop (`run_review_loop`), +`review_calibration_freshness` sees `prior.status is StageStatus.SUCCESS`, immediately executes `run_calibrate_stage` +**inside Stage 4** before `record(FlowStage.REVIEW, review)`, and hits `stage5_merged_head_gate` comparing the new head +against the **stale prior** `review` entry — triggering a bogus `ACT-WITHDRAW` consensus withdrawal, a quadruple push +burst that cancels CI, and a redundant second full Stage 5 pass. + +## Evidence + +- `apps/sandbox-executor/src/sandbox_executor/flow/end_of_flow_sync.py:160-173`: `_reenter_review_and_calibrate` invokes + `run_stage(FlowStage.REVIEW)` then `record(FlowStage.REVIEW, review)` without clearing + `context.stage_results["calibrate"]` (`SUCCESS` from the completed prior Stage 5). +- `apps/sandbox-executor/src/sandbox_executor/flow/review/loop.py:773` & `calibrate_rerun.py:219-232`: + `review_calibration_freshness(context, pr_number)` checks `prior = context.stage_results.get("calibrate")` and runs + `run_calibrate_stage` inline inside Stage 4 before `record(FlowStage.REVIEW, review)` updates + `context.stage_results["review"]`. +- `apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py:119,130`: `stage5_merged_head_gate` reads the stale + prior `review` result in `context.stage_results["review"]` and detects a head mismatch against the newly pushed Stage + 4 iteration head. +- **`holon-agentic-coder#308` (`workspace-survival-job-parallel`, 2026-11-25T04:01Z–04:14Z):** + - At `04:01:25Z–04:02:13Z` (Round 1 Iter 2 after `end_of_flow_sync` Round 1), `review_calibration_freshness` triggered + a nested `Stage 5 rerun` (`0.25 min`, `04:01:58Z..04:02:13Z`) inside Stage 4. + - `stage5_merged_head_gate` issued a false consensus withdrawal (`ACT-WITHDRAW-1795579326-53dc30b3` at `04:02:08Z`) + against the earlier `8f533e24` head even though reviewers had just passed Round 1 Iter 2 (`04:01:22Z`), creating a + `4`-push burst (`60964f80` $\rightarrow$ `03b6dbe7` $\rightarrow$ `b95c09b7` $\rightarrow$ `3357edd2` in `39 s`) + that cancelled CI on `03b6dbe7` and `b95c09b7`. + - `_reenter_review_and_calibrate` then ran Stage 5 a **second time** (`04:02:13Z..04:14:18Z`, `12.08 min`: `7.97 min` + `merged_head_ci` wait on `3357edd2` + `2.50 min` calibration + `1.08 min` `final_head_ci` wait on `f727226d`). + +## Proposed Change + +1. In `_reenter_review_and_calibrate` (`end_of_flow_sync.py`), before calling `run_stage(FlowStage.REVIEW)`, clear stale + `context.stage_results.pop("calibrate", None)` (and supersede `context.stage_results["review"]` or mark calibration + invalidated) because `_reenter_review_and_calibrate` itself runs Stage 5 immediately after Stage 4 finishes. +2. Guard `review_calibration_freshness` (`calibrate_rerun.py`) so it does not run nested `run_calibrate_stage` when + called during an end-of-flow Stage 4/5 re-entry cycle (or only runs when Stage 4 is executed standalone after an + earlier Stage 5). +3. Add a unit test in `apps/sandbox-executor/tests/` covering `end_of_flow_sync._reenter_review_and_calibrate` to assert + `run_calibrate_stage` executes once after Stage 4 completes and `stage5_merged_head_gate` never withdraws the + just-completed Stage 4 consensus against an outdated pre-reentry review head. + +## Expected gain + +Eliminates false `ACT-WITHDRAW` withdrawals, quadruple push bursts cancelling CI, and redundant nested `Stage 5 rerun` + +double Stage 5 cycles (`12.08 min` in `PR #308` Round 1) on every `end_of_flow_sync` re-entry. + +## Cost + +Small: state cleanup + guard in `end_of_flow_sync.py` / `calibrate_rerun.py` plus unit tests, delivered via the Holon +flow (`holon-agentic-coder`). + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0407` (skip full Stage 4 re-entry on ledger-only `end_of_flow_sync` merges), Bean `0443` (push + batching), Bean `0445` (checkpoint status stale during re-entry). +- Audit source: `2026-11-25T05:07Z` fifth-merge self-improvement audit. diff --git a/.beans/holon-agentic-coder-ref-metadata-0449--stage-4-unchanged-streak-keys-on-raw-head-sha-and-ignores-open-findings.md b/.beans/holon-agentic-coder-ref-metadata-0449--stage-4-unchanged-streak-keys-on-raw-head-sha-and-ignores-open-findings.md new file mode 100644 index 00000000..99f4d1ee --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0449--stage-4-unchanged-streak-keys-on-raw-head-sha-and-ignores-open-findings.md @@ -0,0 +1,80 @@ +--- +# holon-agentic-coder-ref-metadata-0449 +title: + "Stage 4 unchanged_streak keys on raw head_sha and ignores open findings, letting target sync / doc-only commits loop + indefinitely" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - review-loop + - convergence +created_at: 2026-11-25T05:07:00Z +updated_at: 2026-11-25T05:41:00Z +--- + +# Stage 4 `unchanged_streak` keys on raw `head_sha` and ignores `open` findings, letting target sync / doc-only commits loop indefinitely + +## Summary + +Stage 4 convergence detection (`unchanged_streak` in `flow/review/loop.py:568-578`) requires +`current_sha == prev_head_sha` in addition to `current_sigs == prev_finding_sigs`. Whenever target-branch +synchronization merges `origin/main` or the resolver makes a bookkeeping/doc-only commit (such as writing a `FIND-CI` +section in `executions/E-*.md` with zero code diff), `head_sha` changes and resets `unchanged_streak` to zero — allowing +an unresolvable set of `open` reviewer findings to loop indefinitely through full reviewer ensembles, local test runs, +and resolver turns. + +## Evidence + +- `apps/sandbox-executor/src/sandbox_executor/flow/review/loop.py:568-578`: + - `current_sigs = frozenset(...)` and `current_sha = (resolved_target.head_sha if resolved_target else "") or ""`. + - `if current_sigs and current_sigs == prev_finding_sigs and current_sha == prev_head_sha: unchanged_streak += 1` + resets `unchanged_streak` on **any** `head_sha` bump, including `origin/main` target merges (`bd581a65`) and + resolver commits touching only `executions/E-*.md` (`3595c1f1`, `54321e50`) while leaving all reviewer findings + `open`. +- **`holon-agentic-coder#308` (`workspace-survival-job-parallel`, Round 2, 2026-11-25T04:14:18Z–05:04:00Z+, `49.6+ min` + and still live in Iter 3):** + - Reviewer findings `R1-F1`/`R2-F1`/`R3-F1` required maintainer intent re-scope beyond Stage 4's authority, so the + resolver left them `open` across both Round 2 Iter 1 (`04:21:54Z..04:48:55Z`, `27.02 min`) and Iter 2 + (`04:56:21Z..05:00:49Z`, `4.47 min`), changing only `executions/E-*.md` (`3595c1f1`, `54321e50`) and merging + `origin/main` (`bd581a65`). + - Because raw `head_sha` changed on those non-code commits, `unchanged_streak` failed to trip and dispatched Iter 3 at + `05:01:27Z` (`49.6+ min` spent on `3` iterations with zero code change on the PR). + +## Proposed Change + +1. Compute `unchanged_streak` against `(reviewer_finding_sigs, pr_own_code_diff_fingerprint)` rather than raw `head_sha` + (reusing the PR-own code diff fingerprint excl. `holon-knowledge/`, `.holon/`, and target-branch merges), so + `origin/main` merges and ledger/execution-markdown commits do **not** reset `unchanged_streak`. +2. Halt Stage 4 cleanly for human/maintainer escalation when consecutive iterations produce identical open reviewer + finding signatures with zero PR-own code diff change (or when the resolver returns with remaining actionable reviewer + findings left `open` and zero non-ledger/non-doc diff added). +3. Add unit tests covering `run_review_loop` convergence when `origin/main` merges or `executions/E-*.md`-only commits + advance `head_sha` while `R*-F*` findings stay `open`. + +## Expected gain + +Prevents `30–50+ min` stalled Stage 4 re-review loops (`49.6+ min` in `PR #308` Round 2 across 3 iterations) when +reviewer objections cannot be solved within Stage 4 scope or only ledger/`origin/main` commits occurred. + +## Cost + +Small: fingerprint-based streak comparison in `flow/review/loop.py` + unit test, delivered via the Holon flow +(`holon-agentic-coder`). + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0407` (ledger-only sync shouldn't re-enter Stage 4), Bean `0439` (resolver scope guard), Bean `0450` + (`review_local` `FIND-CI` churn feeding doc-only resolver commits). +- Audit source: `2026-11-25T05:07Z` fifth-merge self-improvement audit. + +## Audit evidence, 2026-11-25T05:41Z (self-improvement audit, fifth merge #295–#299) + +- **`holon-agentic-coder#308` Round 2 Iter 3 (`05:09:01Z..05:16:12Z`, `7.18 min`):** the resolver marked `R1-F1` + `"disposition": "applied"` (`ebb688d6`) while modifying **only `executions/E-1795573757-CLA-CO5.5.md`** (zero code or + workflow diff) and left `R2-F1` `"open"`. That doc-only commit plus target sync `8857f506` drove Stage 4 into **Iter 4 + (`05:16:46Z..05:21:18Z`)**, where Reviewer 3 reversed Iter 3 approval (`CHANGES_REQUESTED` `3/3`). Treating + `"applied"` with an `executions/*.md`-only change as non-code progress prevents this loop from repeating past Iter 3. diff --git a/.beans/holon-agentic-coder-ref-metadata-0450--stage-4-review-local-drops-output-excerpt-and-preempts-pending-ci.md b/.beans/holon-agentic-coder-ref-metadata-0450--stage-4-review-local-drops-output-excerpt-and-preempts-pending-ci.md new file mode 100644 index 00000000..9837a46b --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0450--stage-4-review-local-drops-output-excerpt-and-preempts-pending-ci.md @@ -0,0 +1,111 @@ +--- +# holon-agentic-coder-ref-metadata-0450 +title: + "Stage 4 review_local drops TestMeasurement.output_excerpt and preempts pending GitHub CI with slow host test runs" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - testing + - ci + - observability +created_at: 2026-11-25T05:07:00Z +updated_at: 2026-11-26T05:25:00Z +--- + +# Stage 4 `review_local` drops `TestMeasurement.output_excerpt` and preempts pending GitHub CI with slow host test runs + +## Summary + +When any reviewer objects in Stage 4 (`flow/review/loop.py:374-386`), the review loop probes GitHub CI once without +waiting for pending checks (`ci_status.get("pending", 0) > 0`). Because `_is_ci_head_passing` in +`head_test_evidence.choose_evidence` requires `pending == 0`, pending GitHub CI immediately forces +`TEST_SOURCE_REVIEW_LOCAL` (`uv run task test` on the host OS). When that host run fails, `local_tests.py:163-176` and +`review_report.py:126-137` discard `TestMeasurement.output_excerpt` and failing test node IDs — passing only +`"CI checks failed in iteration N"` + `"rate 0.99986996, failed=1"` to the resolver, forcing blind diagnosis across +`7,690` tests. + +## Evidence + +- `apps/sandbox-executor/src/sandbox_executor/flow/review/loop.py:374-386`: `if reviewer_objected:` performs a single + non-waiting CI lookup (`ci_status.get("pending", 0) > 0`), causing `head_test_evidence.choose_evidence` + (`pending == 0` required in `_is_ci_head_passing`) to fall back immediately to `TEST_SOURCE_REVIEW_LOCAL`, running + `uv run task test` on the host. +- `apps/sandbox-executor/src/sandbox_executor/flow/review/local_tests.py:163-176`: + `detail = outcome.measurement.run_error or f"rate {rate}, failed={failed}"` omits `outcome.measurement.output_excerpt` + from logs and `executions.jsonl`. +- `apps/sandbox-executor/src/sandbox_executor/review_report.py:126-137`: `ci_failure_finding` emits + `summary=f"CI checks failed in iteration {iteration}{names}."` without attaching `output_excerpt` or failing test + names. +- **`holon-agentic-coder#308` (`workspace-survival-job-parallel`, 2026-11-25T03:43Z–05:01Z):** + - Ran `3` host `review_local` suites (`~8.56 min` total: pre-window `03:43:39Z..03:46:26Z`; Round 2 Iter 1 + `04:19:05Z..04:21:54Z`, `2.82 min` on `1a6c1ab1`; Round 2 Iter 2 `04:53:29Z..04:56:21Z`, `2.87 min` on `31fdc482`). + - Both Round 2 host runs failed `1` macOS host test out of `7,690` (`7689/7690`, `rate 0.99986996`), an + environment-specific failure unseen in Linux Docker CI (`7692/7692` passing), while GitHub CI on the PR was still + running/pending. + - Because `FIND-CI` omitted which test failed and its traceback, the resolver spent **`27.02 min`** in Round 2 Iter 1 + (`04:21:54Z..04:48:55Z`) and **`4.47 min`** in Round 2 Iter 2 (`04:56:21Z..05:00:49Z`) probing and writing `FIND-CI` + diagnostics to `executions/E-*.md` (`3595c1f1`, `54321e50`) without resolving the host test or reviewer objections. + +## Proposed Change + +1. Preserve `outcome.measurement.output_excerpt` and parsed failing test node IDs/names in `local_tests.py` (logs + + `executions.jsonl`) and include a concise failure excerpt in `ci_failure_finding` (`review_report.py`) so the + resolver never gets a blind `"failed=1"` finding. +2. In `flow/review/loop.py:374`, when `reviewer_objected` and GitHub CI already has matching checks running + (`pending > 0`) on the reviewed head (and reviewers did not specifically pass on code), prefer waiting briefly for + the pending GitHub CI check status (or defer test verification when an objecting review will already trigger resolver + edits that supersede the head) instead of eagerly launching a `~2.9 min` host-OS `uv run task test` fallback. +3. Add unit tests verifying `local_tests.py` / `review_report.py` propagate `output_excerpt` into `FIND-CI` and + `loop.py` avoids redundant host runs while GitHub CI is pending. + +## Expected gain + +Saves `~2.8–2.9 min` per objected iteration on host test fallbacks, removes false macOS-host `1/7690` test blockers that +pass in Linux Docker CI, and eliminates multi-minute blind resolver diagnosis (`27.02 min` in `PR #308` Round 2 Iter 1). + +## Cost + +Small-to-medium: excerpt propagation in `local_tests.py` / `review_report.py` + pending-CI handling in `loop.py` with +unit tests, delivered via the Holon flow (`holon-agentic-coder`). + +## Notes + +- Target repo change through the Holon flow (`holon-agentic-coder`). +- Related: Bean `0412` (step timing and structured diagnostics), Bean `0449` (`FIND-CI` doc-only commits resetting + `unchanged_streak`). +- Audit source: `2026-11-25T05:07Z` fifth-merge self-improvement audit. + +## Audit evidence, 2026-11-25T05:41Z (self-improvement audit, fifth merge #295–#299) + +- **`holon-agentic-coder#308` Round 2 Iter 3 & Iter 4:** host `review_local` failed **`4/4` times** on `1` test + (`FIND-CI-003` at `05:09:01Z`, `2.82 min`, `1/7755`, `rate 0.99987105`; `FIND-CI-004` at `05:25:12Z`, `3.90 min`, + `1/7788`, `rate 0.99987160`) while Linux/macOS CI passed `7788/7788` and container `uv run task test` passed + `7757/7757`. +- Iter 3 resolver log (`todo/flow-workspace-survival-job-parallel.log:878`) identified the host-only failure as + `tests/test_ledger_append_only.py::test_repository_ledgers_survive_precheck_and_reconcile_byte_for_byte` (lines + `469-488` checksum live `REPO_LEDGER_DIR` before/after running, passing in isolation and CI but failing under host + `-n auto` `review_local`). +- In Iter 4, **GitHub CI on `c960579d` completed `11/11` green at `05:24:25Z`, `47 s` BEFORE host `review_local` + reported `failed=True` at `05:25:12Z`**, proving `review_local` does not even re-check GitHub CI completion before + emitting `FIND-CI` and dispatching a live resolver (`05:25:12Z..05:40:24Z+`). + +## Audit evidence, 2026-11-26T03:50Z (fifth-merge audit) + +- `todo/flow-ledger-fragments-and-promotion.log` (`2026-11-25T22:49Z..2026-11-26T03:30Z`): `review_local` emitted **`9` + more blind `CI checks failed in iteration N: local_tests` findings** (`#310` iters `2–7` = `6`, `#311` iters `2–3` = + `2`, `#312` iter `2` = `1`) with zero failing test node ID or traceback, after `0443` cancelled the prior head's CI. + In every case the resolver ran `uv run task test` (`7,934–8,012 passed, 7 skipped`) and found no failure, adding + `~2–5 min` churn per iteration. + +## Audit evidence, 2026-11-26 (flow time audit) + +Flow time audit (`todo/flow-time-audit-2026-11-26.md`), PRs #308 to #316: 16 host `review_local` runs, 2.1 to 3.9 min +each (41 min total, median 2.3 min per flow, p90 13.9). Every one on a claude-agent flow reported `failed=True` at rate +0.99987 (one host-only test, Bean 0469), while GitHub CI on the same head was green. Each became a +`FIND-CI ... local_tests` finding; the resolver dispositions read "no code change needed" or "not reproducible" (for +example #308 iterations 1 to 4, #310 iterations 2 to 7), so each run also cost part of a resolver turn. Fixing Bean 0469 +alone removes the false findings; this bean's point of waiting for pending CI instead of a host run removes the 2.3 min +per objecting iteration. diff --git a/.beans/holon-agentic-coder-ref-metadata-0451--dev-env-ci-lacks-bookkeeping-gate-and-runs-macos-unit-tests-serially.md b/.beans/holon-agentic-coder-ref-metadata-0451--dev-env-ci-lacks-bookkeeping-gate-and-runs-macos-unit-tests-serially.md new file mode 100644 index 00000000..3293674e --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0451--dev-env-ci-lacks-bookkeeping-gate-and-runs-macos-unit-tests-serially.md @@ -0,0 +1,73 @@ +--- +# holon-agentic-coder-ref-metadata-0451 +title: + "dev-env CI lacks ci_bookkeeping_gate and runs test-unit (macos-latest) serially, causing 15+ min Stage 5 overruns" +status: todo +type: feature +priority: high +tags: + - ci + - dev-env + - stage-5 + - pipeline + - performance +created_at: 2026-11-25T05:07:00Z +updated_at: 2026-11-25T05:07:00Z +--- + +# `dev-env` CI lacks `ci_bookkeeping_gate` and runs `test-unit (macos-latest)` serially, causing `15+ min` Stage 5 overruns + +## Summary + +`thomashan/dev-env` GitHub Actions workflows lack a bookkeeping-only path gate (`ci_bookkeeping_gate`, equivalent to +`holon-agentic-coder`'s `.github/actions/bookkeeping-gate/action.yml`) and run `test-unit.yml` +(`uv run --extra test pytest -v -l --tb=short -m "not network"`) serially without `pytest-xdist` +(`-n auto --dist worksteal`). As a result, every Stage 4/Stage 5 bookkeeping commit (`holon-knowledge/` / `executions/` +/ `plans/` / `intents/` / `.holon/` only) triggers the full matrix including a `14.4–15.1 min` serial `macos-latest` +unit run, pushing Stage 5 far over its `10 min` budget. + +## Evidence + +- `/Users/thomashan/git/dev-env/main/.github/workflows/test-unit.yml`: no `bookkeeping-gate` step; line 44 executes + `uv run --extra test pytest -v -l --tb=short -m "not network"` serially (no `-n auto --dist worksteal`). +- **`thomashan/dev-env#42` (`tmux-focus-events-on`, 2026-11-25T04:14Z–04:48Z):** + - Head `ef1fbd76` (Stage 5 calibration bookkeeping commit only, zero code changes) ran all `5` workflows (`15.45 min` + / `926.88 s` `final_head_ci` wait, `04:32:28Z..04:47:55Z`), driven by `test-unit (macos-latest)` running `203` tests + serially in `862.45 s` (`14.4 min`, vs `2.3 min` on Ubuntu). + - Total Stage 5 duration hit **`18.63 min`** (`04:29:19Z..04:48:00Z`, nearly `2x` the `10 min` budget), vs `0.28 min` + Stage 1 + `2.53 min` Stage 2 + `4.85 min` Stage 3. + - Earlier bookkeeping head `b1dc27bb` on `#42` also spent CI cycles until cancelled by `ef1fbd76` at `04:31:59Z`. +- **`thomashan/dev-env#41` (`tmux-shift-enter-extkeys`):** + - Bookkeeping head `d6fb465c` similarly waited `15.1 min` on serial macOS unit CI. + +## Proposed Change + +1. Add a shared bookkeeping-gate composite action (matching `holon-agentic-coder`'s + `.github/actions/bookkeeping-gate/action.yml`) to `thomashan/dev-env/.github/workflows/` (`test-unit.yml`, + `test-converge.yml`, `make.yml`, `test-hygiene.yml` as appropriate) so commits touching only `holon-knowledge/`, + `.holon/`, and `.md` docs skip heavy CI suites in `< 60 s` when prior code head passed or non-code files changed. +2. Add `pytest-xdist` (`-n auto --dist worksteal`) to `test-unit.yml` line 44 (verifying macOS test isolation / fixture + safety first) to cut `macos-latest` unit runtime from `14.4 min` down toward Ubuntu speed (`~2–4 min`). + +## Expected gain + +Cuts `dev-env` Stage 5 `final_head_ci` waits on bookkeeping-only heads from **`~15.5 min` to `~1 min`** (bringing +`dev-env` Stage 5 well under the `10 min` budget) and speeds up genuine code-head `macos-latest` unit runs +substantially. + +## Cost + +Small-to-medium: CI workflow action + `pytest-xdist` adoption in `thomashan/dev-env` (via a `dev-env` Holon flow; verify +macOS tests pass under `-n auto`). + +## Notes + +- Target repo change through the Holon flow (`thomashan/dev-env`). +- Reference implementation: `apps/holon-agentic-coder/main/.github/actions/bookkeeping-gate/action.yml`. +- Audit source: `2026-11-25T05:07Z` fifth-merge self-improvement audit. + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- `thomashan/dev-env#43` (`ubuntu-wsl-ghostty-terminfo`): `Unit Tests` (`macos-latest`) ran **`20.00 min`** on + `ce2ae608`, **`20.18 min`** again on Stage 5 bookkeeping commit `13844ea7`, and **`20.03 min`** on `main` push + `77a7910d`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0452--stage-5-kb-promotes-single-flow-stage-4-chatter.md b/.beans/holon-agentic-coder-ref-metadata-0452--stage-5-kb-promotes-single-flow-stage-4-chatter.md new file mode 100644 index 00000000..97936b84 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0452--stage-5-kb-promotes-single-flow-stage-4-chatter.md @@ -0,0 +1,91 @@ +--- +# holon-agentic-coder-ref-metadata-0452 +title: "Stage 5 KB promotion persists single-flow Stage 4 review chatter as permanent KB-failure entries" +status: completed +type: bug +priority: high +tags: + - flow + - stage-5 + - knowledge + - kb-bloat + - merge-conflicts + - holon-agentic-coder +created_at: 2026-11-25T05:41:00Z +updated_at: 2026-11-26T10:40:20Z +--- + +# Stage 5 KB promotion persists single-flow Stage 4 review chatter as permanent `KB-failure` entries + +## Summary + +Stage 5 calibration (`knowledge/wisdom.py:263-311`) promotes `action_signatures` whenever +`(success_count + failure_count) >= 2` and `failure_ladder_state in ("repeated", "proven-fail")`. Because `target` +embeds each flow's unique branch (`I-.../P-.../E-.../_`) and Stage 4 emits multiple `ACT-FIND` / `ACT-REV` ledger rows +per PR, normal intra-PR review iterations trip `min_trials = 2` within minutes and write dozens of per-flow review +findings permanently into `holon-knowledge/kb/failure_modes/KB-failure-*.json` as `"status": "active"` / `"veto"`. + +## Evidence + +- **Repository inspection on `holon-agentic-coder` `main` (`2026-11-25T05:35Z`):** + - `holon-knowledge/kb/failure_modes/` contains **`3,205` `KB-failure-*.json` files**. + - **`2,896 / 3,205` (`90.4%`)** carry `evidence.ledger_refs` (`ACT-*`) spanning `< 3,600 s` (`2,868` fall inside a + single 1-hour epoch bucket), proving they came from one flow's own run rather than repeated cross-flow failures. + - Across recent `holon-agentic-coder` PRs, Stage 5 committed **`21`** new `KB-failure-*.json` files in `PR #296` + (`split-cli-init-modules`), **`4`** in `PR #297` (`claude-auth-self-doc`), **`3`** in `PR #300` + (`decomposition-rule-self-doc`), and **`6`** staged on live `PR #308` (`workspace-survival-job-parallel`). + - Concrete samples on `main`: + - `KB-failure-03b08676.json` (`#296`): + `ledger_refs: ["ACT-FIND-1795564818-3a3c1d9f", "ACT-FIND-1795564661-45b31aab"]` (`157 s` apart in one PR), + `failure_count: 2`, + `payload.name: "Failure mode in I-1795523046-split-cli-init-modules/P-1795563158-ANA-G4N/E-1795563737-ANA-G4N/_"`. + - `KB-failure-39fb567e.json` and `KB-failure-a26f5682.json` (`#300`): `ACT-REV-*` / `REV-*` (`2–5 s` apart in one + PR), `failure_count: 3`, `"ladder_state": "proven-fail"`. +- **Root cause (`apps/sandbox-executor/src/sandbox_executor/knowledge/`):** + - `wisdom.py:278-296` queries `action_signatures` with `WHERE (success_count + failure_count) >= ?` (`min_trials=2`) + and persists `_promote_failure_candidate` (`wisdom.py:160-191`) regardless of origin or distinct intent count. + - `promotion.py:32-47` (`compute_context_fingerprint`) and `ledger_sync.py:33-40` (`_derive_context_fingerprint`) hash + raw flow/execution branch strings into `target`, so intra-flow reviewer/finding rows immediately self-collide into + permanent KB vetoes. + +## Proposed Change + +1. Exclude intra-flow Stage 4 review/finding rows (`ACT-REV`, `ACT-FIND`) from global `KB-failure-*.json` promotion — or + require failure evidence from **`>= 2` distinct intents** (`intent_id` / normalized non-flow `target`) before + promoting a failure mode or veto. +2. Add unit tests verifying multiple `ACT-FIND`/`ACT-REV` rows within one flow (`I-...`) do not produce a + `KB-failure-*.json` artifact, while recurring failures across separate flows still promote cleanly. +3. Follow up separately to prune/archive existing single-flow Stage 4 `KB-failure-*.json` clutter (`2,896+` files + checked on every CI `make lint-json` run). + +## Expected gain + +Stops every multi-reviewer / multi-iteration PR from committing `3–21` spurious `KB-failure-*.json` files into git, +shrinks `holon-knowledge/kb/failure_modes/` (`3,205` JSON files scanned by CI hygiene), removes `KB-failure-*.json` +add/add conflicts across parallel PRs, and restores signal to the failure-mode KB. + +## Cost + +Small-to-medium: promotion filter and target normalization in `knowledge/wisdom.py` / `knowledge/ledger_sync.py` + unit +tests, delivered via `holon flow` (`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`). +- Related: Bean `0371` (per-flow pending ledger fragments and KB conflict reduction). +- Audit source: `2026-11-25T05:41Z` fifth-merge self-improvement audit (`#295–#299`). + +## Resolution + +Delivered via [PR #331](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/331) and merged into `main` +(`310ea9f`): + +- **Key Architectural Deliverables**: Stage 5 promotion no longer writes a permanent `KB-failure` file for an action + signature whose trials all come from one flow's own Stage 4 review rows (`ACT-REV` / `ACT-FIND`). The predicate lives + in `knowledge/promotion_rules.py` so `knowledge/wisdom.py` does not grow. Repeated failures from separate flows or + from non-review actions still promote as before. +- **Verification & Tests**: `apps/sandbox-executor/tests/test_failure_promotion_review_chatter.py` covers single-flow + review chatter (no artifact) and cross-flow recurrence (still promoted). Module budgets were not touched. +- **Holon Flow Traversal**: Intent, plan, execute, review loop and calibration (calibrated branch and calibration report + `687e7da9`) completed. Follow-up: pruning the existing single-flow `KB-failure-*.json` clutter is tracked as + bean 0506. diff --git a/.beans/holon-agentic-coder-ref-metadata-0453--consolidate-duplicated-self-doc-test-scanners.md b/.beans/holon-agentic-coder-ref-metadata-0453--consolidate-duplicated-self-doc-test-scanners.md new file mode 100644 index 00000000..269aaec4 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0453--consolidate-duplicated-self-doc-test-scanners.md @@ -0,0 +1,81 @@ +--- +# holon-agentic-coder-ref-metadata-0453 +title: "Consolidate 19+ duplicated test_*_self_doc.py AST and allowlist scanners into one parameterized check" +status: completed +type: task +priority: normal +tags: + - tests + - code-quality + - hygiene + - self-doc + - holon-agentic-coder +created_at: 2026-11-25T05:41:00Z +updated_at: 2026-11-26T11:37:00Z +--- + +# Consolidate `19+` duplicated `test_*_self_doc.py` AST and allowlist scanners into one parameterized check + +## Summary + +Per-module self-documenting refactors under Bean `0153` each add a standalone `tests/test_*_self_doc.py` file (`79–154` +lines) that copy-pastes identical AST docstring collectors, `tokenize.generate_tokens` scanners, comment-allowlist +matchers, and 10+ parameterized `test_comment_allowlist_rules` test cases instead of reusing one shared helper and +parameterized test registry. + +## Evidence + +- **Cadence merges `#295–#299` and `#300` (`holon-agentic-coder`):** + - `PR #295` (`099025f8`) added `apps/sandbox-executor/tests/test_local_llm_self_doc.py` (`88` lines). + - `PR #297` (`0bd580ea`) added `apps/sandbox-executor/tests/test_claude_auth_self_doc.py` (`91` lines). + - `PR #298` (`5e08904f`) added `apps/sandbox-executor/tests/test_touch_set_self_doc.py` (`147` lines). + - `PR #300` (`efafa316`) added `apps/sandbox-executor/tests/test_decomposition_rule_self_doc.py` (`143` lines). +- **Scale across `main` and open `0153` PRs (`2026-11-25T05:35Z`):** + - `main` now carries **`19` `test_*_self_doc.py` files (`2,199` lines total)**; **`19/19`** define their own custom + AST/tokenize/allowlist helper functions (`_collect_docstrings`, `_is_allowlisted_comment`, etc.). + - `7` open `0153` PR worktrees (`#301–#307`) carry another `7` standalone files (`932` lines), bringing the pattern to + **`26` files (`3,131` lines)** if left fragmented. + - Duplicates logic against project code-quality rules and grows the unit test suite (`Bean 0405`) on every module + slice. + +## Proposed Change + +1. Once open `0153` PRs (`#301–#307`) land or drain (avoiding overlap conflicts), extract one shared `self_doc` + AST/tokenize/allowlist checker + unit tests covering allowlist edge cases once. +2. Replace the `19+` standalone `test_*_self_doc.py` copies with a single parameterized test module over the governed + module/package list (or unify into Bean `0153` Goal 4's global `task lint` self-doc gate). + +## Expected gain + +Deletes `~2,000–3,000` lines of duplicated test code and `~200+` redundant allowlist test invocations without losing +AST/comment enforcement on any module. + +## Cost + +Small refactor flow (`apps/sandbox-executor/tests/`) run after the active `0153` queue drains (`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`); wait until `#301–#307` merge/close so touch sets stay + disjoint. +- Related: Bean `0153` (self-documenting code & Goal 4 global check), Bean `0405` (clean up unnecessary unit tests). +- Audit source: `2026-11-25T05:41Z` fifth-merge self-improvement audit (`#295–#299`). + +## Progress + +- 2026-11-26: flow `consolidate-self-doc-tests` launched (claude-agent, claude-opus-5-5); log + `todo/flow-consolidate-self-doc-tests.log`. + +## Resolution + +Delivered via [PR #336](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/336) and merged into `main` +(`6d68e5dc`): + +- **Key Architectural Deliverables**: the 26 standalone `test_*_self_doc.py` files are replaced by one shared helper + `apps/sandbox-executor/tests/self_doc_scanner.py` (AST docstring collector, tokenize comment scanner, allowlist + matcher) and one data-driven test module `test_self_doc_modules.py` over the governed module list. No production code + changed. +- **Verification & Tests**: test-only change (+431 / -3,138 lines across the 26 removed files and the two new ones, + excluding flow ledger and plan files). Merged after CI and review. +- **Holon Flow Traversal**: flow `consolidate-self-doc-tests` (claude-agent, claude-opus-5-5) reached merge with its + plan and calibration artifacts in the merged diff. Install step skipped (test-only change). diff --git a/.beans/holon-agentic-coder-ref-metadata-0454--ci-bookkeeping-gate-runs-full-ci-on-main-merges.md b/.beans/holon-agentic-coder-ref-metadata-0454--ci-bookkeeping-gate-runs-full-ci-on-main-merges.md new file mode 100644 index 00000000..e1a26607 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0454--ci-bookkeeping-gate-runs-full-ci-on-main-merges.md @@ -0,0 +1,112 @@ +--- +# holon-agentic-coder-ref-metadata-0454 +title: "ci_bookkeeping_gate triggers full 7-workflow CI on mechanical Merge origin/main PR pushes" +status: completed +type: feature +priority: high +tags: + - ci + - pipeline + - performance + - merge-conflicts + - holon-agentic-coder +created_at: 2026-11-25T05:41:00Z +updated_at: 2026-11-26T21:05:09Z +--- + +# `ci_bookkeeping_gate` triggers full 7-workflow CI on mechanical `Merge origin/main` PR pushes + +## Summary + +`scripts/ci_bookkeeping_gate.py:114-148` uses `compare(client, base, head_sha)` (`2-dot` `before..head_sha` GitHub +compare), which sweeps in every file `origin/main` changed since the PR branched whenever a conflict-resolution or +target-sync commit merges `origin/main`. Every mechanical pre-merge `Merge origin/main` push therefore runs the full +`7`-workflow CI suite (`~7.1–9.1 min`) even when the PR's own non-bookkeeping diff vs `origin/main` is unchanged +(`pr_own_identical=True`) and `origin/main` already ran CI. + +## Evidence + +- **Cadence PRs `#295–#299` and queue merges (`2026-11-25T04:57Z–05:38Z`):** + - All `5` post-calibration `Merge remote-tracking branch 'origin/main'` pushes triggered full CI across `531–571` + `2-dot`-changed files (`238–248` non-bookkeeping) while `pr_own_identical=True`: + - `hac#295` (`f3caa65e`, `04:57:36Z..05:05:33Z`, `7.95 min`, merged early at `04:59:58Z` before `Unit`/`Stress` + finished). + - `hac#297` (`dfaf36cc`, `05:04:12Z..05:12:49Z`, **`8.62 min`**, merged at `05:09:36Z` while `Unit`/`Stress` ran). + - `hac#298` (`79e0ab33`, `05:11:05Z..05:18:09Z`, **`7.07 min`**, merged at `05:12:10Z` with `4/7` checks running). + - `hac#299` (`821656a1`, `05:13:57Z..05:22:03Z`, **`8.10 min`**). + - `hac#300` (`a4e23b9e`, `05:23:06Z..05:32:13Z`, **`9.12 min`**). + - Across `#295–#299` full lifetimes, `6/30` (`20%`) tested CI heads were `main_merge` heads (`27/30 = 90.0%` total + churn incl. `21` bookkeeping/conflict heads), and `8` open PRs (`#302–#308`) remain queued behind additional + `Merge origin/main` cycles (`cf7c77f6` on `#301` already ran at `05:32:56Z`). +- **Mechanism:** `apps/holon-agentic-coder/main/scripts/ci_bookkeeping_gate.py:114-148` inspects only `before..head_sha` + (`compare`), never checking whether `head_sha` is a merge with `origin/` whose resolved PR-own diff matches an + earlier green head. + +## Proposed Change + +1. First let Bean `0371` eliminate ledger-only `Merge origin/main` pushes across disjoint PRs (highest-leverage root + fix). +2. For remaining clean target merges (e.g., `end_of_flow_sync` or non-overlapping `origin/main` updates), evaluate a + safe fast-path in `ci_bookkeeping_gate.py` (always keeping `Test - Hygiene` active for merge markers / Prettier / + JSONL): + - Note correctness constraint: merging new `origin/main` code with existing PR code _can_ interact semantically + (callers/imports), so never skip blindly when both `origin/main..main` and PR code touch coupled symbols/tests; + safely skip expensive jobs (`Docker Build`, redundant matrix legs, or full tests) only when `origin/main` changes + since the prior base were limited to bookkeeping/docs/unrelated modules or after `origin/main` itself passed CI and + both sides' touched packages are disjoint. +3. Add unit tests in `tests/` covering `ci_bookkeeping_gate` behavior on merge commits (skipping only under safe + provenance conditions and running full CI whenever merge resolution edits code). + +## Expected gain + +Saves `~7–9 min` of runner compute and queue latency per mechanical `Merge origin/main` push across multi-PR queues (`8` +open PRs in current queue). + +## Cost + +Medium: merge-parent & disjoint-scope verification in `scripts/ci_bookkeeping_gate.py` / `ci_bookkeeping_api.py` + unit +tests via `holon flow` (`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`). +- Related: Bean `0371` (per-flow ledger fragments prevent most queue merges), Bean `0403` (`ci_bookkeeping_gate`), Bean + `0407` (approval survives target merge), Bean `0428` (3-dot PR-own diff in `ci_final_head.py`). +- Audit source: `2026-11-25T05:41Z` fifth-merge self-improvement audit (`#295–#299`). + +## Audit evidence, 2026-11-25T06:05Z (self-improvement audit, fifth merge #300–#304) + +- **Queue `Merge origin/main` CI runs (`05:23:09Z..05:56:20Z`):** `6` additional mechanical `Merge origin/main` pushes + on `#300–#305` triggered full `7`-workflow CI: + - `hac#300` (`a4e23b9e`, `05:23:09Z..05:32:13Z`, **`9.07 min`**) + - `hac#301` (`cf7c77f6`, `05:32:56Z..05:41:41Z`, **`8.75 min`**) + - `hac#302` (`df58b838`, `05:40:15Z..05:49:25Z`, **`9.17 min`**) + - `hac#303` (`f1247c9b`, `05:42:51Z..05:50:12Z`, **`7.35 min`**) + - `hac#304` (`cbd65bdf`, `05:45:57Z..05:54:27Z`, **`8.50 min`**) + - `hac#305` (`f2787749`, `05:48:47Z..05:56:20Z`, **`7.55 min`**) +- Meanwhile, all `5` merged PRs (`#300–#304`) were merged `55 s` to `8.18 min` before their PR-side `Merge origin/main` + CI finished (and PRs `#306–#308` remain `CONFLICTING/DIRTY` pending additional sync cycles). + +## Flow (2026-11-26) + +Running as flow ci-skip-clean-main-merge-pushes (intent todo/intent-0454-ci-skip-clean-main-merge-pushes.json, log +todo/flow-ci-skip-clean-main-merge-pushes.log). + +## Resolution + +Delivered via [PR #346](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/346) and merged into `main` +(`aa085c3`): + +- **Key Architectural Deliverables**: new `scripts/ci_merge_push_gate.py`, called from `decide()` in + `scripts/ci_bookkeeping_gate.py`. A synchronize push whose new head is a clean two-parent merge of the base into the + previous head skips the heavy jobs only on positive evidence (previous head green, merged-in base commit green on + `main`, merge result identical to git's, pull request files disjoint from base changes). Anything else, any API error + or any doubt runs the full job; the hygiene job always runs in full. `scripts/ci_bookkeeping_api.py` extended. Step 1 + of the plan (bean 0371, ledger-only merge pushes) is completed. +- **Verification & Tests**: hermetic `apps/sandbox-executor/tests/test_ci_merge_push_gate.py` plus wiring and gate test + updates. +- **Holon Flow Traversal**: flow `ci-skip-clean-main-merge-pushes` ran Intent -> Plan -> Execute -> Review -> + Calibration (calibration report included in the pull request). +- **Verification pending (live)**: the skip has not yet been observed on a live push. Watch the next `Merge origin/main` + push to an open pull request for the merge-push skip decision on the gate's output line, and confirm it skips only the + bookkeeping-clean case. diff --git a/.beans/holon-agentic-coder-ref-metadata-0455--post-pr-merge-rebuilds-coherence-and-skips-triage.md b/.beans/holon-agentic-coder-ref-metadata-0455--post-pr-merge-rebuilds-coherence-and-skips-triage.md new file mode 100644 index 00000000..8a30df76 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0455--post-pr-merge-rebuilds-coherence-and-skips-triage.md @@ -0,0 +1,80 @@ +--- +# holon-agentic-coder-ref-metadata-0455 +title: "post-pr-merge rebuilds holon-coherence on hac merges, collides on burst merges, and skips triage" +status: todo +type: bug +priority: high +tags: + - harness + - post-merge + - install-holon + - prioritise-beans + - reliability +created_at: 2026-11-25T05:41:00Z +updated_at: 2026-11-25T06:05:00Z +--- + +# `post-pr-merge` rebuilds `holon-coherence` on `hac` merges, collides on burst merges, and skips triage + +## Summary + +Three operational defects in `.agents/skills/post_pr_merge/SKILL.md` and +`.agents/skills/install_holon/scripts/install_holon.py` compound whenever target PRs merge in bursts: + +1. `post_pr_merge/SKILL.md:84` invokes `python3 .agents/skills/install_holon/scripts/install_holon.py` **without + `--holon-only`** for `holon-agentic-coder` merges (`install_holon.py:250-278`), unconditionally syncing and + rebuilding `holon-coherence:latest` + reinstalling `holon-coherence` even when `holon-coherence` (`#55`) has not + changed. (`install_holon.py:229` also sets `default=True` on `--all` inside a mutually-exclusive argument group.) +2. Concurrent `# - post-merge` subagents spawned during rapid bursts run overlapping builds (rebuilding the same + images per commit instead of once for latest `main`), contend on `.git/index.lock` / non-fast-forward harness pushes, + and repeatedly skip Step 5 (`prioritise_beans.py`). +3. Skipping Step 5 left the `139 KB` `.beans/bean-triage-prioritisation.md` matrix stale across an entire `3+` hour + merge wave. + +## Evidence (`2026-11-25T04:59Z–05:39Z` burst merges) + +- `7` `holon-agentic-coder` PRs merged in `39 min` (`#295` `04:59:58Z`, `#296` `05:01:49Z`, `#297` `05:09:36Z`, `#298` + `05:12:10Z`, `#299` `05:20:56Z`, `#300` `05:31:18Z`, `#301` `05:38:33Z`), while `holon-coherence` stayed unchanged at + `#55` (`2026-11-24T12:44:47Z`). +- Harness commit history shows `6aaf358` (`05:06:16Z`), `5a5dd84` (`05:10:35Z`), `ae07885` (`05:18:35Z`), and `261a130` + (`05:25:16Z`) updated beans without refreshing `.beans/bean-triage-prioritisation.md`, whose `mtime` remained + **`2026-11-25T02:29:34Z`** (`3.1+ h` stale across `7+` merges). +- Meanwhile concurrent `post-merge` and audit runs needed explicit `.git/index.lock` waits, `--no-ff` push/rebase + handling, and selective `git commit --only` instructions to avoid sweeping up peer working-tree changes. + +## Proposed Change + +1. Update `.agents/skills/post_pr_merge/SKILL.md:84` to pass `--holon-only` for `holon-agentic-coder` merges + (`install_coherence.py` already handles `holon-coherence` merges separately), and clean up `--all` default handling + in `.agents/skills/install_holon/scripts/install_holon.py:228-231` (or pass `--no-sync` since Step 1 already synced + `apps//main`). +2. Serialize or coalesce `install_holon` and Step 5 `prioritise_beans.py` across overlapping `post-pr-merge` invocations + (e.g., flock/marker on latest `origin/main` SHA so burst merges build images and regenerate + `.beans/bean-triage-prioritisation.md` once cleanly after catching up rather than N times or skipping Step 5 + indefinitely). +3. Standardize `post_pr_merge/SKILL.md` Step 6 commits to explicit `git commit --only ` instead of + `git add .beans/` when concurrent sessions share the harness worktree. + +## Expected gain + +Cuts unneeded `holon-coherence` Docker builds and CLI reinstalls from every `hac` merge, prevents burst build/git lock +contention, and keeps `.beans/bean-triage-prioritisation.md` accurate after burst merges. + +## Cost + +Small harness-only change in `.agents/skills/post_pr_merge/SKILL.md` and +`.agents/skills/install_holon/scripts/install_holon.py`. + +## Notes + +- Harness-only change. +- Related: Bean `0402` (running flows isolated from post-merge image rebuilds), Bean `0388` (stale inline triage + narrative in `prioritise_beans.py`). +- Audit source: `2026-11-25T05:41Z` fifth-merge self-improvement audit (`#295–#299`). + +## Audit evidence, 2026-11-25T06:05Z (self-improvement audit, fifth merge #300–#304) + +- Following burst merges `#300–#304` (`05:31:18Z..05:46:57Z`, `5` merges in `15.65 min`), `git log` shows + `.beans/bean-triage-prioritisation.md` has still not been updated since commit `0f0525f` (`2026-11-25T02:30:25Z`, + `3.5+ h` stale across `12` merges `#293–#304`), and `flow-no-unneeded-full-review` (`0407`) remains an active worktree + without completing triage/backfill parity. diff --git a/.beans/holon-agentic-coder-ref-metadata-0458--ready-pull-requests-are-hand-synced-before-each-me.md b/.beans/holon-agentic-coder-ref-metadata-0458--ready-pull-requests-are-hand-synced-before-each-me.md new file mode 100644 index 00000000..95e00b27 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0458--ready-pull-requests-are-hand-synced-before-each-me.md @@ -0,0 +1,75 @@ +--- +# holon-agentic-coder-ref-metadata-0458 +title: "Ready pull requests are hand-synced before each merge and merged before that pipeline ends" +status: todo +type: bug +priority: high +tags: + - harness + - pipeline + - merge + - churn +created_at: 2026-11-25T05:45:00Z +updated_at: 2026-11-25T05:45:00Z +--- + +## Problem + +When the flow has ended, nothing keeps a ready pull request mergeable. Each merge into `main` makes every other ready +pull request conflict on the ledgers (Bean 0371), so before each merge someone runs the `resolve-conflict` skill +(`git merge origin/main`), which pushes a main-merge head and restarts the full pipeline. The merge then often does not +wait for that pipeline. The end state that matters is a passing pipeline and a passing consensus on the merged head; +this sequence spends a full pipeline per merge and still merges heads whose pipeline has not finished. + +PR #283 (the flow resolves conflicts at every stage) does not help here: it acts only while a flow is running, and these +flows had finished hours earlier. + +## Evidence (self-improvement audit, 2026-11-25T05:45Z; scripts in `todo/self-improvement-audit-2026-11-25a/`) + +- Merge sweep #288 to #299, 03:35:55Z to 05:20:56Z: every PR got a `Merge remote-tracking branch 'origin/main'` commit + (the message `resolve-conflict` leaves; the engine writes `sync: merge target ...` or `(conflict gate)`) a median of + 5.5 min before its merge (longest 34.6 min, #292). The flows behind them had ended at 18:52Z to 00:45Z. 13 such + commits in all on #284 to #300 between 02:28Z and 05:23Z, after #283 had merged. +- 8 of the 12 (#289, #290, #293, #294, #295, #297, #298, #299) were merged before the pipeline on that final head had + finished (#293, #294, #298 merged 1.1 to 1.2 min after the sync). All later passed, so nothing broke this time, but + the merged head was not verified when it merged (`sweep.md`). +- Main-merge heads in the period: 28 of 78 PR heads, 409 runner-min (median 7.9 min wall), against 167 runner-min for + the 13 code heads (`period-churn.txt`). +- Ready PRs waited a median of 335.7 min (longest 523.4 min, #288) between last approval and merge; in that time every + merge to `main` made them conflict again. +- All 32 merged PRs from #268 to #299 show `mergedBy: thomashan`; the agents use the same account, so the log cannot + tell whether a merge into `main` came from the maintainer or from an agent session. The hard rule says only the + maintainer merges into `main`. + +## Proposed change + +1. Bean 0371 (ledger fragments) removes the conflicts. Until then the steps below make the merges cheap and verified. +2. Harness (`.agents/pr-merging.md`, `post-pr-merge`): after a merge, sync the other ready PRs in one batch, not one at + a time just before each merge. Ledger-only conflicts are resolved mechanically. Each PR is left with a green pipeline + on its final head, and the ready list shows which PRs are mergeable now. +3. Do not sync a PR that is already `MERGEABLE`; the main-push pipeline tests the merged result anyway. +4. When a PR has been synced, its merge waits for the pipeline on that head (`gh pr checks --watch`); the merge report + states the head SHA and its pipeline result. +5. Make merges attributable: an agent session that merges a PR (only PRs into branches other than `main`) says so in a + PR comment, so merges into `main` without one are the maintainer's. + +## Expected gain + +About 12 full pipelines per sweep of 12 (about 95 min of wall time, 230 runner-min). The serial gap between merges (6.6 +min median, set by the sync pipeline) drops to the time it takes to click merge. No merge of an unverified head. + +## Cost + +Small, harness only (`.agents/pr-merging.md`, `.agents/skills/post_pr_merge/`, `.agents/skills/resolve_conflict/`). + +## Notes + +- Related: Bean 0454 (written at the same time by the other session: skip the full pipeline on mechanical merge heads; + same sweep evidence, CI-side fix), Bean 0371 (ledger fragments, the structural fix), Bean 0423 (two sessions), Bean + 0398 (stacked start), Bean 0420 (PR merged while its flow runs). + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- `thomashan/dev-env#42` (`tmux-focus-events-on`): `Merge remote-tracking branch 'origin/main'` (`842a47cf`) was pushed + at `2026-11-26T03:45:52Z` and merged **`29 s` later** at `03:46:21Z`, long before `Unit Tests` (`15–20 min`) or + `Ubuntu Converge E2E` (`5–6 min`) completed. diff --git a/.beans/holon-agentic-coder-ref-metadata-0459--maintainer-rules-kept-only-in-one-session-s-privat.md b/.beans/holon-agentic-coder-ref-metadata-0459--maintainer-rules-kept-only-in-one-session-s-privat.md new file mode 100644 index 00000000..9a022c63 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0459--maintainer-rules-kept-only-in-one-session-s-privat.md @@ -0,0 +1,82 @@ +--- +# holon-agentic-coder-ref-metadata-0459 +title: "Maintainer rules kept only in one session's private memory never reach the other session" +status: completed +type: bug +priority: high +tags: + - harness + - instructions + - coordination + - antigravity +created_at: 2026-11-25T05:45:00Z +updated_at: 2026-11-25T06:05:00Z +--- + +## Problem + +The Claude Code session keeps 34 maintainer rules in its private auto-memory (`~/.claude/projects//memory/`). +The Antigravity session never reads that directory. Several of those rules have no counterpart in `AGENTS.md` or +`.agents/`, so the Antigravity session cannot follow them, and it did not. + +## Evidence (self-improvement audit, 2026-11-25T05:45Z) + +- **"Intent scope lists files"** (memory: never put whole directories in intent scope; a globbed touch set blocks every + flow). It is in no `.agents/` file, `AGENTS.md` or the `holon_flow` skill. The Antigravity intent for Bean 0407 + (`todo/intent-0407-no-unneeded-full-review.json`, 18 entries) lists `apps/sandbox-executor/tests/`. Stage 3 refused it + at 02:41:40Z on 7 in-flight PRs and flows, and it is still refused at 05:41Z (about 180 min). Bean 0446 fixes the + engine side; the rule itself is missing from the harness. +- **"Log a bean for every bug"**: no `.agents/` file says it. +- **"No human halt before merge"**: appears only in a script string of `prioritise_beans.py`. +- Bean 0411 already records that model ladders are written out in eight places; this is the same problem across + sessions: a rule that lives in one place the other session cannot see. + +## Proposed change + +1. Go through the 34 memory files. Move each one that states a rule for the workspace (not a personal preference of one + runtime) into its canonical `.agents/` file, following Bean 0411's one-canonical-place layout. In memory, keep only a + pointer. +2. Put the intent-authoring rules in one place in `.agents/holon-flow.md`, linked from the `holon_flow` skill: scope + lists files and never directories, no harness paths or bean ids in intent text, and slugs of at most 32 characters. +3. `run_holon_flow.py` refuses an intent whose `scope` entry is a directory, or ends in `/`, before Stage 1, so any + session gets the same check. + +## Expected gain + +The Antigravity session follows the same rules. On Bean 0407 alone that saves about 180 min of refused Stage 3 and a +relaunch. Each new rule is written once, in a place both sessions read. + +## Cost + +Small, harness only. Step 3 is a few lines in `.agents/skills/holon_flow/scripts/run_holon_flow.py`. + +## Notes + +- Related: Bean 0411 (contradicting instructions), Bean 0446 (SPLIT parent admission), Bean 0423 (two sessions). + +## Resolution + +Reviewed all 33 memory files. Added to the shared instructions (each attributed to the maintainer with its memory date): + +- `.agents/holon-flow.md` ("Intent Authoring and Running Rules"): scope lists files; no harness paths or bean ids in + intent text; 32-character slugs; never stop a running flow; no human halt before merge; diagnose failures at once; + rerun on end conflict. +- `.agents/coordination.md` (section 7): harness ops via skill subagents, escalated conflicts, subagent naming, main + thread delegates. +- `.agents/pr-merging.md`: post-merge via the post-pr-merge skill in a lowest-tier subagent. +- `.agents/workflows.md`: log a bean for every bug; beans live in the main checkout's `.beans/`. +- `.agents/engineering-rules.md` (rule 16): module budgets force a split. +- `.agents/skills/holon_flow/scripts/run_holon_flow.py`: refuses an intent whose scope has a directory entry (test in + `tests/test_flow_scope_files.py`). + +Not added: "resolve a conflict the moment it is found", "only success postings wait for the pipeline", "fail early" and +the ledger merge-order rule have no memory text, so they could not be checked. Note `.agents/engineering-rules.md` rule +14 says to interleave ledger rows chronologically, which conflicts with the stated "keep main's order, append only" +rule; needs the maintainer's wording. Bean 0411 still owns the cross-runner switching contradiction (holon-flow.md, +instructions.md, workflows.md say switch automatically; the skill and the memory say ask first). The AGENTS.md +Antigravity default already reads `gemini-4-neon` in the working tree. + +- Progress (2026-11-25): added "Flow principles (maintainer, 2026-11-24)" to `.agents/holon-flow.md`; rewrote the ledger + conflict rule (main's order kept, only the branch's rows appended) in engineering-rules, workflows, instructions and + the holon_flow, resolve_conflict and pr_review_loop skills; aligned runner switching with the skill (see Bean 0411). + Open: resolve_known.py and a prompt string in run_holon_flow.py still interleave; noted on Bean 0436. diff --git a/.beans/holon-agentic-coder-ref-metadata-0460--stage-4-resolver-runs-full-pytest-on-doc-only-fixes.md b/.beans/holon-agentic-coder-ref-metadata-0460--stage-4-resolver-runs-full-pytest-on-doc-only-fixes.md new file mode 100644 index 00000000..262a8358 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0460--stage-4-resolver-runs-full-pytest-on-doc-only-fixes.md @@ -0,0 +1,73 @@ +--- +# holon-agentic-coder-ref-metadata-0460 +title: "Stage 4 resolver runs full 7,800+ pytest suite twice and even on Markdown/bookkeeping-only fixes" +status: todo +type: feature +priority: high +tags: + - flow + - stage-4 + - resolver + - performance + - holon-agentic-coder +created_at: 2026-11-25T06:05:00Z +updated_at: 2026-11-25T06:05:00Z +--- + +# Stage 4 resolver runs full 7,800+ pytest suite twice and even on Markdown/bookkeeping-only fixes + +## Problem + +In `apps/holon-agentic-coder/main/apps/sandbox-executor/src/sandbox_executor/entrypoint/review_loop.py`, the Stage 4 +resolver incurs unnecessary full test runs on two paths: + +1. **Unconditional full test run on non-code diffs:** `_verify_before_push` (`review_loop.py:295-324`, line `315`) + always invokes `uv run task test` even when the resolver only edited Markdown/bookkeeping files (such as formatting a + plan file with Prettier, updating `executions/` or `plans/`, or fixing a docstring/YAML nit covered by + `lint`/`run_markdown_gate`). +2. **Duplicate execution of the full suite on code fixes:** `_build_resolver_prompt` (`review_loop.py:389, 397`) + instructs the resolver agent to run `uv run task lint` and `uv run task test` locally before marking findings + `applied`, after which `_verify_before_push` (`review_loop.py:306-315`) immediately re-runs `uv run task lint`, + `run_markdown_gate`, and the entire `uv run task test` suite again before committing and pushing. + +## Evidence (2026-11-25T06:05Z audit, #300-#304 & #309) + +- **`PR #309` (`0438`, `calibration-merge-adapted-file`):** After `3/3` reviewers `APPROVED (0/0/0)` at `05:40:16Z`, + Stage 4 blocked solely on unformatted Markdown + (`plans/I-1795584436-calibration-merge-adapted-file/P-1795584464-CLA-CO5.5.md`, `Test - Hygiene` run `45554742211` + failed at `05:37:27Z`). Dispatching the resolver (`05:40:17Z`) to format one `.md` file (`89eae143`) took + **`6.58 min`** before committing ledger rows at `05:47:06Z` + (`checkpoint-calibration-merge-adapted-file.json:878-888`), triggering `26eca98f` / `4ded0b14` (`9.95 min` CI) and a + `10.15 min` full Iter 2 re-review (`05:47:26Z..05:57:35Z`). +- **`PR #308` (`workspace-survival-job-parallel`):** Iter 3 doc-only fix (`ebb688d6`, `05:16:12Z`) likewise ran a + multi-minute resolver pass, and Iter 4 resolver (`05:25:12Z..06:02Z+`, container `d7a5f5ec82a1`) stayed live `37+ min` + inside `claude-opus-5-5` + pytest verification loops (related: Bean `0430`). + +## Proposed Change + +1. **Diff-scoped pre-push gate in `_verify_before_push` (`review_loop.py:295-324`):** Inspect + `git diff --name-only ..HEAD` plus working-tree changes; when every file modified by the resolver is + documentation/Markdown/bookkeeping (`*.md`, `plans/`, `executions/`, `holon-knowledge/`), run `run_markdown_gate` + (Prettier) and `uv run task lint-docs` (or fast doc/hygiene checks) and skip `uv run task test`. +2. **Avoid redundant back-to-back full test runs:** Either delegate final test verification exclusively to + `_verify_before_push` with targeted pytest guidance for the agent prompt (or reuse a clean verified-head marker + written when the resolver ran `uv run task test` without subsequent edits), so the full `uv run task test` suite runs + at most once per resolver turn on Python/workflow edits and zero times on doc-only edits. +3. Add unit tests covering `_verify_before_push` doc-only skipping vs Python/workflow full verification. + +## Expected Gain + +- Saves **`~3–6 min`** wall time on every doc/Markdown-only Stage 4 resolver pass (like `#309`'s `6.58 min` formatting + pass) and **`~2–3 min`** on every code resolver pass that currently runs `uv run task test` twice. +- Combines cleanly with Bean `0407` (skip unneeded full re-review when only hygiene/bookkeeping changed). + +## Cost + +Small: scoped diff check in `apps/sandbox-executor/src/sandbox_executor/entrypoint/review_loop.py` + unit tests via +`holon flow` (`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`). +- Related: Bean `0407` (skip full re-review when nothing reviewable changed), Bean `0430` (resolver turn budget & + test-loop watchdog), Bean `0442` (Stage 2/5 Prettier timeouts causing `#309` hygiene failure). diff --git a/.beans/holon-agentic-coder-ref-metadata-0461--main-push-ci-concurrency-cancels-intermediate-merges.md b/.beans/holon-agentic-coder-ref-metadata-0461--main-push-ci-concurrency-cancels-intermediate-merges.md new file mode 100644 index 00000000..b5b1f769 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0461--main-push-ci-concurrency-cancels-intermediate-merges.md @@ -0,0 +1,106 @@ +--- +# holon-agentic-coder-ref-metadata-0461 +title: "Main-push CI concurrency group silently cancels intermediate main commits during burst merges" +status: completed +type: bug +priority: high +tags: + - ci + - pipeline + - github-actions + - reliability + - holon-agentic-coder +created_at: 2026-11-25T06:05:00Z +updated_at: 2026-11-26T10:52:52Z +--- + +# Main-push CI concurrency group silently cancels intermediate main commits during burst merges + +## Problem + +Five `holon-agentic-coder` GitHub Actions workflows share the same `concurrency` stanza: + +- `.github/workflows/test-unit.yml:14-16` +- `.github/workflows/test-stress.yml:14-16` +- `.github/workflows/test-hygiene.yml:14-16` +- `.github/workflows/test-integration.yml:14-16` +- `.github/workflows/make.yml:14-16` + +Each declares: + +```yaml +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} +``` + +Because GitHub Actions allows at most **one active run and one pending run per concurrency group**, setting +`group: ${{ github.workflow }}-${{ github.ref }}` on `push` to `main` (instead of scoping to `github.sha` or omitting +`concurrency` for `push`, as `.github/workflows/docker-build.yml` does) silently cancels intermediate queued `main` runs +whenever 3 or more PRs merge while `Test - Unit` or `Test - Stress` (`8–11 min`) are running. Even with +`cancel-in-progress: false`, the newer `push` displaces the older pending `main` run in the 1-deep queue. + +## Evidence (2026-11-25T06:05Z audit, #301–#304 burst merges) + +During the `#301–#304` merge burst (`05:38:33Z..05:46:57Z`, 4 merges in `8.4 min` on `main`): + +- `ebcffd12` (`#301` merged `05:38:33Z`) held the active `Test - Unit` (`05:38:35Z..05:49:52Z`, `11.28 min`) and + `Test - Stress` (`05:38:35Z..05:47:27Z`, `8.87 min`) slots. +- `67bfb621` (`#302` merged `05:41:14Z`) queued behind it, then was displaced when `d281e437` (`#303` merged + `05:43:52Z`) arrived: **`Test - Unit` (`45555296940`) and `Test - Stress` (`45555296864`) finished + `completed/cancelled` at `05:43:54Z` (`2.63 min` queued)** without testing `#302` on `main`. +- `d281e437` (`#303` merged `05:43:52Z`) was in turn displaced when `bdb2d5f1` (`#304` merged `05:46:57Z`) arrived: + **`Test - Unit` (`45555590090`) and `Test - Stress` (`45555590188`) finished `completed/cancelled` at + `05:46:59Z..05:47:00Z` (`3.10–3.12 min` queued)** without testing `#303` on `main`. + +Combined with `#300–#304` all being merged `55 s` to `8.18 min` before their PR-side `Merge origin/main` CI checks +completed (`0458`), intermediate `main` commits `#302` and `#303` lost unit/stress verification on `main` as well. + +## Proposed Change + +1. In `.github/workflows/{test-unit,test-stress,test-hygiene,test-integration,make}.yml`, scope `concurrency.group` on + `push` to `main` so every `main` commit's CI is not evicted from a 1-pending queue — e.g.: + ```yaml + concurrency: + group: + ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || format('{0}-{1}', + github.ref, github.sha) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + ``` + (or verify `group: ...-${{ github.sha }}` when `push` vs `pull_request` `github.ref`). Confirm + `.github/workflows/docker-build.yml` parity and update `.github/workflows/README.md` / + `tests/test_workflow_triggers.py` if concurrency policy is tested. +2. Pair with maintainer merge wait (`0458`) so PR heads are verified before merge while `main` push history retains + intact check-runs when not explicitly superseded. + +## Expected Gain + +Eliminates silent `completed/cancelled` gaps on `main` commits during burst merge sweeps (`2/6` `main` commits in the +`#300–#304` window lost `Test - Unit` + `Test - Stress` provenance). + +## Cost + +Small: 5 YAML workflow concurrency expressions (`+` any workflow YAML unit test) via `holon flow` +(`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`). +- Related: Bean `0454` (`ci_bookkeeping_gate` on `Merge origin/main`), Bean `0458` (waiting for PR CI before merge). + +In progress 2026-11-26: flow main-push-ci-concurrency-per-sha (log todo/flow-main-push-ci-concurrency-per-sha.log). + +## Resolution + +Delivered via [PR #333](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/333) and merged into `main` +(`06137f5`): + +- **Key Architectural Deliverables**: the `concurrency` block of `test-unit.yml`, `test-stress.yml`, `test-hygiene.yml`, + `test-integration.yml` and `make.yml` now groups `pull_request` runs by workflow and head branch, and every other + event by workflow, ref and commit SHA, matching `docker-build.yml`. A `main` push is no longer evicted from the + one-deep pending queue by a later push. `cancel-in-progress` is unchanged (`pull_request` only). No job, step, + trigger, permission or environment variable changed. +- **Verification & Tests**: workflow-only change (5 files, +20/-5); no application code touched, so `install-holon` was + not needed. Final-head CI was green before merge. +- **Holon Flow Traversal**: all 5 stages completed (intent ok, plan ok, execute ok, review approved, calibrate ok with + the calibration report covering execution head `8bb210bd199f`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0462--epoch-second-stage-and-plan-ids-collide-across-concurrent-flows.md b/.beans/holon-agentic-coder-ref-metadata-0462--epoch-second-stage-and-plan-ids-collide-across-concurrent-flows.md new file mode 100644 index 00000000..f5678183 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0462--epoch-second-stage-and-plan-ids-collide-across-concurrent-flows.md @@ -0,0 +1,83 @@ +--- +# holon-agentic-coder-ref-metadata-0462 +title: "Epoch-second stage and plan IDs collide across concurrent flows" +status: in-progress +type: bug +priority: normal +tags: + - flow + - architecture + - ledgers + - concurrency + - holon-agentic-coder +created_at: 2026-11-25T06:05:00Z +updated_at: 2026-11-26T13:02:11Z +--- + +# Epoch-second stage and plan IDs collide across concurrent flows + +## Problem + +Multiple ID generators in `apps/sandbox-executor/src/sandbox_executor/` still derive IDs purely from `int(time.time())` +without a per-flow disambiguator (despite Bean `0278` fixing `build_review_id` and adding `build_stage_disambiguator` in +`ledger/rows.py:116-119`): + +1. **Intent ID / branch (`entrypoint/intent_creator.py:86`):** + `resolve_root_intent_branch(intent_data, slug_clean, int(time.time()), "", "")` embeds the same `I-` prefix + across two concurrent flows launched in the same second (`I-1795584436-ledger-fragments-and-promotion` and + `I-1795584436-calibration-merge-adapted-file`; earlier `#300` & `#302` shared `I-1795567884-*`). +2. **Plan ID (`entrypoint/planner.py:348`, `ledger/rows.py:122-131`):** `plan_seq = int(time.time())` builds + `P---` checked only against `taken_plan_ids` _within `intent_branch_prefix`_. Because two + concurrent flows with different slugs check disjoint branch prefixes, if Stage 1 finishes in the same second (both + take `~15-20 s` -> Stage 2 starts in the same second), they mint the exact same globally non-unique `plan_id` in + `holon-knowledge/ledger/plans.jsonl`. +3. **Review iteration and Stage 5 calibration IDs (`flow/review/loop.py:463`, `calibration.py:1316`):** `execution_id` + still uses bare `f"REV-ITR-{iteration}-{int(time.time())}"` and `f"CAL-{plan_id}-{int(time.time())}"` without hex + disambiguation, inheriting any `plan_id` collision or same-second completion across concurrent flows. + +## Evidence (2026-11-25T06:05Z audit, live & main ledger) + +- **`main` `holon-knowledge/ledger/plans.jsonl`:** contains **5 duplicate `plan_id` values** (`P-1795154100-CLA-CO5.5` + x2, `P-1795167432-CLA-CO5.5` x3, `P-1795184234-CLA-CO5.5` x2, `P-1795246947-CLA-CO5.5` x2, `P-1795567904-ANA-G4N` x2). + In particular, `#300` (`decomposition-rule-self-doc`, Stage 1 `00:51:32Z`, plan `00:54:24Z`) and `#302` + (`review-report-self-doc`, Stage 1 `00:51:32Z`, plan `00:54:26Z`) both minted `I-1795567884-*` and the identical + `plan_id` `P-1795567904-ANA-G4N`, merging duplicate `plan_id` rows into `main`. +- **Concurrent active flows (`0371` & `0438`/`#309` at `05:27:16Z`):** both started in the same second + (`todo/flow-ledger-fragments-and-promotion.log:14`, `checkpoint-calibration-merge-adapted-file.json:846`), both + received `I-1795584436-*`, and both Stage 2 planners minted the identical **`P-1795584464-CLA-CO5.5`** + (`todo/flow-ledger-fragments-and-promotion.log:57`, `checkpoint-calibration-merge-adapted-file.json:99`), so + `calibration_predicted` / `calibration` ledger lookups and `CAL-P-1795584464-CLA-CO5.5-...` labels collide. + +## Proposed Change + +1. Include a short disambiguator (reusing `build_stage_disambiguator` or short hash of `slug`/intent/worktree) in root + `intent_id` / `plan_id` (`build_plan_id`, keeping branch segment within `ensure_stage_segment_fits`), `execution_id` + (`REV-ITR-...` in `flow/review/loop.py:463`), and `CAL-...` (`calibration.py:1316`). +2. Add regression tests verifying two same-second calls with different slugs/branches produce globally distinct + `intent_id`, `plan_id`, `REV-ITR-*`, and `CAL-*` IDs while preserving branch-length limits and existing row schemas. + +## Expected Gain + +Eliminates duplicate `plan_id`, `CAL-...`, and `REV-ITR-...` identifiers across concurrent flows (`5` duplicate +`plan_id`s already on `main`, plus live `0371`/`0438` `P-1795584464-CLA-CO5.5` collision), preventing silent cross-flow +misattribution in calibration lookups and ledger queries once Bean `0371` lands. + +## Cost + +Small: reuse existing `build_stage_disambiguator` helper across 4 ID construction sites + unit tests via `holon flow` +(`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`). +- Related: Bean `0278` (completed for `build_review_id`), Bean `0371` (per-flow pending ledger fragments keyed by root + intent id). + +## Flow (2026-11-26) + +In progress via flow `plan-id-unique-across-flows` (claude-agent, claude-opus-5-5), narrowed to plan-id uniqueness; the +`REV-ITR-*` and `CAL-*` sites in `flow/review/loop.py` and `calibration.py` are left for a follow-up once those files +are free of live flows. + +Plan ids are now unique across flows: [PR #341](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/341) +merged into `main` (`91c2afe`, 2026-11-26). Bean stays in-progress for the `REV-ITR-*` and `CAL-*` id follow-up. diff --git a/.beans/holon-agentic-coder-ref-metadata-0463--stage-2-planner-emits-directory-touch-sets-from-file-intents.md b/.beans/holon-agentic-coder-ref-metadata-0463--stage-2-planner-emits-directory-touch-sets-from-file-intents.md new file mode 100644 index 00000000..5a7670cc --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0463--stage-2-planner-emits-directory-touch-sets-from-file-intents.md @@ -0,0 +1,78 @@ +--- +# holon-agentic-coder-ref-metadata-0463 +title: "Stage 2 planner collapses file-scoped intents into directory touch-set entries that broaden Stage 3 overlap" +status: todo +type: bug +priority: high +tags: + - flow + - stage-2 + - planner + - stage-3 + - admission + - holon-agentic-coder +created_at: 2026-11-25T06:05:00Z +updated_at: 2026-11-25T06:05:00Z +--- + +# Stage 2 planner collapses file-scoped intents into directory touch-set entries that broaden Stage 3 overlap + +## Problem + +Even when an input `intent.json` explicitly lists concrete file paths in `scope` (and zero directories), Stage 2 +(`planner.py` + `planner.template.md`) frequently collapses those files into a broad trailing-`/` directory entry in +`## Touch Set`: + +- `apps/holon-agentic-coder/main/holon-config/prompts/planner.template.md:109-113` explicitly invites directory globs + (`one backticked repository-relative path or glob per top-level bullet (a trailing '/' means a whole directory, '*' stays within one path segment and '**' spans directories)`). +- `apps/holon-agentic-coder/main/apps/sandbox-executor/src/sandbox_executor/entrypoint/planner.py:302-307` only prints + an stderr + `Warning: the touch set has folder or wildcard entries (...); they match every existing file below them at Stage 3 admission, so prefer module paths.` + after creating and committing the plan branch. + +At Stage 3 admission, any folder entry matches **every** existing file beneath that directory across all open PRs and +active flows, artificially magnifying admission blocking (distinct from Bean `0459`, which validates `intent.json` +`scope` before Stage 1, and Bean `0446`, which covers `SPLIT` parent admission before decomposition). + +## Evidence (2026-11-25T06:05Z audit, Bean 0371 flow) + +- **`0371` (`ledger-fragments-and-promotion`):** `todo/intent-0371-ledger-fragments-and-promotion.json:7-27` carefully + specified **19 concrete file paths** (`fragments.py`, `promote.py`, `rows.py`, `query.py`, `order.py`, `__init__.py`, + etc.) and **0 directories**. +- Despite this, the Stage 2 planner emitted `- apps/sandbox-executor/src/sandbox_executor/ledger/` on line `197` of + `plans/I-1795584436-ledger-fragments-and-promotion/P-1795584464-CLA-CO5.5.md`, triggering the non-fatal stderr warning + in `todo/flow-ledger-fragments-and-promotion.log:47` + (`Warning: the touch set has folder or wildcard entries (apps/sandbox-executor/src/sandbox_executor/ledger/); they match every existing file below them at Stage 3 admission, so prefer module paths.`) + and widening the plan's touch set across the entire `ledger/` package (`git_refs.py` overlap with `#305` came from the + broader module list, while any folder collapse blocks unrelated siblings under `ledger/` like `sync.py` or future + flows). + +## Proposed Change + +1. Update `holon-config/prompts/planner.template.md:109-113` to prohibit collapsing concrete paths into trailing-`/` + directories or wildcards (`*`, `**`) whenever concrete module/file paths exist (and explicitly when the intent + `scope` lists files). +2. In `apps/sandbox-executor/src/sandbox_executor/entrypoint/planner.py` (or touch-set validation helper), either: + - fail Stage 2 plan validation (`_fail_plan_attempt`, triggering a prompt retry/correction turn within Stage 2) when + `broad_entries(touch_set)` is non-empty for a concrete-file intent scope, OR + - cleanly disallow directory/glob wildcards unless explicitly justified and bounded, matching `0459`'s wrapper guard + on `intent.json` `scope`. +3. Add unit tests verifying Stage 2 rejects or expands collapsed directory touch-set entries produced from file-scoped + intents. + +## Expected Gain + +Prevents Stage 2 from silently undoing careful file-level touch scoping in `intent.json`, eliminating avoidable +false-positive Stage 3 overlap blocking across unrelated files inside shared packages (`sandbox_executor/flow/`, +`ledger/`, `calibration/`, `tests/`). + +## Cost + +Small: prompt rule + Stage 2 `broad_entries` enforcement/retry check in `entrypoint/planner.py` + unit tests via +`holon flow` (`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`). +- Related: Bean `0459` (wrapper rejects directory entries in `intent.json` `scope`), Bean `0446` (`SPLIT` parent plans + blocked before decomposition), Bean `0371`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0464--install-xterm-ghostty-terminfo-on-windows-linux.md b/.beans/holon-agentic-coder-ref-metadata-0464--install-xterm-ghostty-terminfo-on-windows-linux.md new file mode 100644 index 00000000..a54ed945 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0464--install-xterm-ghostty-terminfo-on-windows-linux.md @@ -0,0 +1,104 @@ +--- +# holon-agentic-coder-ref-metadata-0464 +title: "Install xterm-ghostty terminfo on Ubuntu WSL (Windows) and Linux hosts" +status: completed +type: feature +priority: normal +tags: + - dev-env + - windows + - wsl + - ubuntu + - linux + - ghostty + - tmux + - terminfo +parent: holon-agentic-coder-ref-metadata-0435 +created_at: 2026-11-25T22:35:00Z +updated_at: 2026-11-26T00:09:00Z +--- + +# Install `xterm-ghostty` terminfo on Ubuntu WSL (Windows) and Linux hosts + +## Problem + +When connecting over SSH from macOS running Ghostty (`TERM=xterm-ghostty`) into an **Ubuntu WSL** instance on a Windows +machine (rather than native Windows PowerShell/Win32), SSH forwards `TERM=xterm-ghostty` into the Ubuntu WSL session. +`dev-env` converges inside Ubuntu WSL (`devenv_system == 'Linux'`, `devenv_pkg_backend == 'apt'`, +`devenv_is_wsl == true`) and deliberately skips installing Ghostty on WSL (per `dev-env-ansible-wsl-skip` in +`ansible/roles/packages/tasks/main.yml`, `not (devenv_is_wsl | default(false) | bool)`), as well as on headless Linux +hosts where `devenv_install_gui_casks` is false. Consequently, the Ubuntu WSL terminfo database does not contain an +`xterm-ghostty` entry. + +Starting `tmux` (or other ncurses/TUI tools) inside the remote Ubuntu WSL instance then fails immediately before loading +`~/.tmux.conf`: + +```text +missing or unsuitable terminal: xterm-ghostty +``` + +## Proposed Change + +Through the Holon flow on `dev-env` (`git@github.com:thomashan/dev-env.git`): + +1. **Vendor the `xterm-ghostty` terminfo source**: + - Add the canonical plain-text `xterm-ghostty` terminfo definition (generated via `infocmp -x xterm-ghostty`) to the + repository at `ansible/roles/dotfiles/files/xterm-ghostty.terminfo`, outside the GNU Stow `$HOME` link tree so Stow + does not symlink raw terminfo text into `$HOME`. +2. **Compile `xterm-ghostty` into user terminfo via the `dotfiles` role**: + - Keep all provisioning inside the Linux/Ubuntu WSL `dotfiles` role (`ansible/roles/dotfiles/tasks/main.yml`), with + no native Windows changes (`winget.exe` or Windows Registry) required, so both `make converge` and `make dotfiles` + apply it on Ubuntu WSL and headless Linux regardless of `devenv_is_wsl` or `devenv_install_gui_casks`. + - Ensure `tic` / `infocmp` is available (`ncurses-bin` is standard on Ubuntu WSL and built into macOS; declare or + verify `ncurses-bin` cleanly on Debian/Ubuntu if absent). + - Add idempotent Ansible tasks in `ansible/roles/dotfiles/tasks/main.yml`: + - Probe `infocmp xterm-ghostty` (`changed_when: false`, `failed_when: false`, `check_mode: false`). + - When absent, compile the vendored source into `"{{ devenv_home }}/.terminfo"` via + `tic -x -o "{{ devenv_home }}/.terminfo" ` (without requiring root privileges), respecting + `ansible_check_mode`. + - Assert `infocmp xterm-ghostty` succeeds post-compile (when not in `ansible_check_mode`). +3. **Optional client-side Ghostty SSH fallback**: + - Evaluate adding `shell-integration-features = ssh-terminfo,ssh-env` to + `dotfiles/ghostty/.config/ghostty/config.ghostty` as a complementary fallback for ad-hoc SSH hosts that have not + run `dev-env`, while keeping host-side `~/.terminfo` compilation in `dev-env` as the primary guarantee for Ubuntu + WSL and Linux machines. +4. **Tests & Documentation**: + - Add hermetic pytest tests verifying: + - the vendored `xterm-ghostty` terminfo file compiles cleanly with `tic -x -o ` and + `TERMINFO= infocmp xterm-ghostty` succeeds, + - an isolated `tmux` check with `TERM=xterm-ghostty` and `TERMINFO=` starts cleanly without + `missing or unsuitable terminal`, + - the Ansible tasks in `ansible/roles/dotfiles/tasks/main.yml` are not gated out when `devenv_is_wsl: true` or + `devenv_install_gui_casks: false`, handle check mode cleanly, and pass `ansible-lint`. + - Extend Ubuntu E2E verification in `tests/test_converge_integration.py` to confirm `infocmp xterm-ghostty` succeeds + after converge on Ubuntu. + - Document `xterm-ghostty` terminfo provisioning for macOS Ghostty $\rightarrow$ Ubuntu WSL and Linux SSH sessions in + `README.md`. + +## Acceptance Criteria + +- Running `make converge` or `make dotfiles` inside Ubuntu WSL (`devenv_is_wsl: true`, `apt` backend) installs + `xterm-ghostty` into `~/.terminfo` idempotently without requiring Ghostty GUI installation or native Windows changes. +- `infocmp xterm-ghostty` exits `0` in the converged Ubuntu WSL instance (and Linux hosts). +- Starting `tmux` over SSH from macOS Ghostty (`TERM=xterm-ghostty`) into the Ubuntu WSL instance starts `tmux` and + loads `~/.tmux.conf` cleanly with no `missing or unsuitable terminal: xterm-ghostty` error. +- `uv run --extra test pytest -m "not network"`, `uv run --extra test ansible-lint ansible/site.yml`, + `npx prettier --check`, and Ubuntu E2E verification in `tests/test_converge_integration.py` pass. + +## Notes + +- Target repository: `dev-env` (`git@github.com:thomashan/dev-env.git`), delivered via `holon flow`. +- Active Holon flow slug: `ubuntu-wsl-ghostty-terminfo` (`antigravity-agent` / `gemini-4-neon`). +- Related beans: Bean `0344` (Ghostty installation and Stow config), Bean `0435` (`dev-env` improvements and + cross-platform fixes epic). + +## Resolution + +Successfully delivered via Pull Request [#43](https://github.com/thomashan/dev-env/pull/43) (merged +`2026-11-26T00:03:54Z`, commit `77a7910da0b192cb78a423ac18339c3c6193f9ac`). Key deliverables: + +- Vendored `ansible/roles/dotfiles/files/xterm-ghostty.terminfo` source definition. +- Idempotent Ansible compilation task in `ansible/roles/dotfiles/tasks/main.yml` targeting `~/.terminfo` via `tic -x`. +- Hermetic tests in `tests/test_ghostty_terminfo.py` and Ubuntu E2E checks in `tests/test_converge_integration.py`. +- Documentation updates in `README.md`. Verification: 7/7 CI checks green, 3/3 consensus approval, and Stage 5 + calibration EV (`96.05` predicted / `98.81` actual / `+2.76` delta). diff --git a/.beans/holon-agentic-coder-ref-metadata-0465--harness-work-sits-uncommitted-beans-and-instructions-untracked.md b/.beans/holon-agentic-coder-ref-metadata-0465--harness-work-sits-uncommitted-beans-and-instructions-untracked.md new file mode 100644 index 00000000..9efa6d57 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0465--harness-work-sits-uncommitted-beans-and-instructions-untracked.md @@ -0,0 +1,47 @@ +--- +# holon-agentic-coder-ref-metadata-0465 +title: "Harness beans, skills and the audit instruction sit uncommitted in the working tree" +status: todo +type: bug +priority: high +tags: + - harness + - git + - hygiene +created_at: 2026-11-25T22:49:00Z +updated_at: 2026-11-25T22:49:00Z +--- + +## Problem + +The harness branch carries 86 uncommitted paths: 49 modified tracked files (49 files, +1829/-315 lines, including 17 +under `.agents/`, skills and their tests) and 37 untracked paths. Of those, 30 are untracked beans (for example 0389 +to 0420) and `.agents/self-improvement-audit.md`, the file `AGENTS.md` names as the audit's rule, is itself untracked +(`git ls-files` returns nothing), as is `.agents/scripts/beans_to_issues.py`. A fresh clone or a second worktree does +not see them; one `git clean` or checkout loses them. Peer sessions also trip on the unstaged files (Bean 0440, the +pre-commit Prettier check). + +## Evidence (self-improvement audit, 2026-11-25T22:49Z) + +- `git status --short`: 49 `M`, 37 `??`; `git ls-files --others --exclude-standard .beans | wc -l` gives 30. +- Last commit touching `.beans/`: 2026-11-25T17:59:50+11:00; the beans written since by the audits and by sessions were + never committed. +- Related: Bean 0459 (rules kept only in one session's memory) is the same failure on another channel. + +## Proposed change + +- Commit each bean on creation: have the bean-writing step (and the audit) stage and commit only its own new files, + never with other paths. +- Session start reports the count of uncommitted harness paths and commits or names them before new work. +- Ask the maintainer to decide on the 49 modified files now; do not commit them from an audit. + +## Expected gain and cost + +No lost beans or rules, and a harness a second session can actually read. Cost: one small commit per bean and one check +at session start. + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- Still present at `2026-11-26T03:50Z`: `30+` untracked beans (`0389`–`0474`), untracked + `.agents/self-improvement-audit.md` and `.agents/scripts/beans_to_issues.py`, `48+` modified harness files, and a + stray zero-byte untracked root file `=2026-11-24T08:00:00Z`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0466--flow-aborts-when-docker-is-down-instead-of-waiting.md b/.beans/holon-agentic-coder-ref-metadata-0466--flow-aborts-when-docker-is-down-instead-of-waiting.md new file mode 100644 index 00000000..d5ea2a41 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0466--flow-aborts-when-docker-is-down-instead-of-waiting.md @@ -0,0 +1,39 @@ +--- +# holon-agentic-coder-ref-metadata-0466 +title: "A flow stage that needs Docker aborts the moment the daemon is down instead of waiting" +status: todo +type: bug +priority: normal +tags: + - flow + - preflight + - docker +created_at: 2026-11-25T22:49:00Z +updated_at: 2026-11-25T22:49:00Z +--- + +## Problem + +Stage 5 of `calibration-merge-adapted-file` entered CALIBRATE at 07:01:44Z, then at 07:01:45Z the wrapper printed +"Docker daemon is not running. Please start Docker." and the run ended. The same log shows the daemon running at line 4 +and line 310, so the daemon went away mid-run (an image rebuild or a restart; compare Bean 0402). The resume line says +"Pre-flight probe skipped: no remaining stage from 'calibrate' dispatches an agent runner", yet calibration still runs +containers, so the skip hides that Docker is needed. + +## Evidence (self-improvement audit, 2026-11-25T22:49Z) + +- `todo/flow-calibration-merge-adapted-file.log` lines 4, 310, 325 (PR #309, still open, `MERGEABLE`, approved head + waiting for CI). +- `todo/flow-workspace-survival-job-parallel.log` lines 1078 to 1090: the daemon was back 12 s after the failure there, + so the outage is short. +- Bean 0432 and the DNS bean cover resolver aborts; none covers the daemon check. + +## Proposed change + +- The Docker probe retries for a bounded time (for example 5 min at 15 s) before it fails the stage, and the probe runs + for any remaining stage that starts a container, calibrate included. +- A failure after the wait names the stage so the flow resumes from it without redoing finished work. + +## Expected gain and cost + +Removes a manual resume for a seconds-long outage. Cost: a small retry loop in the wrapper pre-flight. diff --git a/.beans/holon-agentic-coder-ref-metadata-0467--post-merge-record-commits-are-65-percent-of-harness-commits.md b/.beans/holon-agentic-coder-ref-metadata-0467--post-merge-record-commits-are-65-percent-of-harness-commits.md new file mode 100644 index 00000000..e6bb4317 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0467--post-merge-record-commits-are-65-percent-of-harness-commits.md @@ -0,0 +1,44 @@ +--- +# holon-agentic-coder-ref-metadata-0467 +title: "Per-merge record commits make up 60 of the last 92 harness commits" +status: todo +type: task +priority: normal +tags: + - harness + - churn + - post-merge +created_at: 2026-11-25T22:49:00Z +updated_at: 2026-11-25T22:49:00Z +--- + +## Problem + +Every merged pull request produces its own harness commit that appends one line to Bean 0153 ("docs(bean-0153): record +PR #NNN merged"), and the same for other post-merge bookkeeping. Since 2026-11-24T00:00Z the harness branch has 92 +commits, 60 of them matching `bean-0153` or `post-merge`. Bean 0153 is now 419 lines. Several commits record several PRs +at once (#302, #303, #304), others one PR (#305, #306, #307 as three commits within minutes), so the batching is +inconsistent. None of this affects the pipeline or the consensus of any target PR: it is churn that buries real harness +changes in history and (with Bean 0465) makes the squash at the end harder. + +## Evidence (self-improvement audit, 2026-11-25T22:49Z) + +- `git log --since=2026-11-24T00:00:00Z --oneline`: 92 commits, 60 bookkeeping. +- `b4e8b2f`, `82019d1`, `f549984`: three single-PR commits for #307, #306, #305. + +## Proposed change + +- Move the merged-PR record out of the bean body into a generated ledger (or the triage file) that the `post-pr-merge` + skill regenerates from `gh pr list`, so no per-merge edit of a bean is needed. +- If it stays in the bean, the skill batches all merges seen in one run into one commit, and the self-improvement + audit's merge count reads the same generated source. + +## Expected gain and cost + +About two thirds fewer harness commits and a stable, derived merge count for the audit. Cost: one change to the +`post-pr-merge` skill and a one-off conversion of the existing lines. + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- All `5` of the last `5` commits on the harness branch (`757bbf0`, `53cc14f`, `e5b1de8`, `0b1d299`, `c7cafb8`) are + `docs(post-merge)` commits (`100%` in this window). diff --git a/.beans/holon-agentic-coder-ref-metadata-0468--stage-3-overlap-refusal-exits-instead-of-waiting.md b/.beans/holon-agentic-coder-ref-metadata-0468--stage-3-overlap-refusal-exits-instead-of-waiting.md new file mode 100644 index 00000000..7c235714 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0468--stage-3-overlap-refusal-exits-instead-of-waiting.md @@ -0,0 +1,54 @@ +--- +# holon-agentic-coder-ref-metadata-0468 +title: "run_holon_flow.py exits on a Stage 3 overlap refusal instead of waiting it out" +status: todo +type: bug +priority: high +tags: + - flow + - stage-3 + - admission + - holon-agentic-coder +created_at: 2026-11-25T23:05:00Z +updated_at: 2026-11-25T23:05:00Z +--- + +## Problem + +Flow `macos-unit-only-when-relevant` (Bean 0400, claude-agent / claude-opus-5-5) finished Stage 2 and was refused at +Stage 3 admission: +`Stage 3 refused: the touch set overlaps local flow on branch I-1795584436-ledger-fragments-and-promotion/P-1795584464-CLA-CO5.5/_ ... on .github/workflows/README.md; finish or merge that flow first, or rerun with --allow-overlap.` +The wrapper then logged `Holon flow exited with non-zero code 1.` and exited 1. The Stage 3 overlap wait +(`wait_for_overlapping_prs` / the local-flow re-check in `run_holon_flow.py`) never ran: the process ended within +seconds of the refusal, with no `Waiting for overlapping pull request` or re-check line. + +## Expected + +Per SKILL.md, "Stage 3 overlap refusals are waited out": the wrapper polls the overlapping flow (or pull request) and +resumes from the checkpoint, without `--allow-overlap` and without stopping. + +## Evidence + +- Log `todo/flow-macos-unit-only-when-relevant.log` held only the final `Holon flow exited` line (see Bean 0385), so the + refusal text was not visible there. +- Checkpoint `.holon/flow/checkpoint-macos-unit-only-when-relevant.json` in + `apps/holon-agentic-coder/flow-macos-unit-only-when-relevant` records `admission.state: blocked` with the local-flow + blocker above. +- The overlapping flow `intent-0371-ledger-fragments-and-promotion` was still running and had no pull request yet, so + the local-flow branch (sleep, then re-run admission) was the one that should have run. + +## Notes + +- Not confirmed which condition failed (the `or rerun with --allow-overlap` text match on the captured output, or the + `is_overlap_refusal` check); the captured output needs to be printed before the branch decides. +- Related: Bean 0395 (work during an overlap wait), Bean 0385 (flow log empty until the run ends), Bean 0422 + (allow-overlap sticky across resumes). +- The overlap itself is real: the intent scope names `.github/workflows/README.md`, which the ledger-fragments flow also + touches. The flow was run with the same touch set, so no `--allow-overlap` was used. + +## Update, 2026-11-26 + +The same macos-unit-only-when-relevant run later resumed from its checkpoint on its own and completed Stage 3 to Stage 5 +(PR #315), after PR #310 merged. So the overlap wait does resume in at least this case. The first exit (2026-11-25 +23:03Z) is still unexplained; the flow log holds only the final line (Bean 0385). Keep this open for investigation of +why the wrapper exited at the first refusal. diff --git a/.beans/holon-agentic-coder-ref-metadata-0469--conflict-gate-test-reaches-real-launcher-on-macos-with-docker.md b/.beans/holon-agentic-coder-ref-metadata-0469--conflict-gate-test-reaches-real-launcher-on-macos-with-docker.md new file mode 100644 index 00000000..5fa76008 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0469--conflict-gate-test-reaches-real-launcher-on-macos-with-docker.md @@ -0,0 +1,78 @@ +--- +# holon-agentic-coder-ref-metadata-0469 +title: "test_conflict_gate code-conflict test reaches the real launcher and exits on macOS when docker is on PATH" +status: completed +type: bug +priority: normal +tags: + - tests + - hermetic + - macos +created_at: 2026-11-25T23:10:00Z +updated_at: 2026-11-26T22:35:00Z +--- + +## Problem + +`apps/sandbox-executor/tests/flow/review/test_conflict_gate.py::test_a_code_conflict_still_aborts_with_a_fingerprinted_approval` +fails on a clean checkout of origin/main (a144e65c) on a developer Mac that has `docker` on PATH, so local +`uv run pytest` is red on main. The two stress tests that re-run the suite in a child (`test_sandbox_hermetic_guard.py` +canary and `test_workspace_survival_stress.py`) fail only as a consequence. + +## Cause (confirmed) + +The test merges main into a conflicting branch, so `sync_with_target` calls the conflict resolver role. The chain is +`conflict_resolver_role._dispatch` -> `dispatch_role_agent` -> `containers.run_docker_container` -> `mounts()` -> +`launcher/mounts.py::_antigravity_mounts`. The default agent is `antigravity-agent` and the autouse fixture +`isolated_claude_home` sets HOME to an empty tmp dir, so `~/.holon/sessions/antigravity` is missing. On darwin without +HOLON_AGENT_KEY, `_abort_missing_macos_antigravity_session` calls `sys.exit(1)`. `_dispatch` only catches `Exception`, +and `SystemExit` is a `BaseException`, so it kills the test. The test never mocks the dispatch/launcher. + +Why CI is green: with docker absent from PATH (what CI macos-latest effectively provides) the launch aborts earlier, +before `mounts()`. Verified locally: the same test with `PATH=:/usr/bin:/bin` passes; with the normal PATH it +fails, with or without GITHUB_TOKEN, CI=true, or GITHUB_ACTIONS=true. The failure is not tied to the real ~/.holon +session dir (it exists on this Mac but the fixture hides it), only to docker being installed. Ubuntu is unaffected +because the abort is darwin-only. + +## Introduced by + +Latent since PR #280 (131c3b42, 2026-11-25, launcher refactor that moved the macOS abort into mounts.py; the abort +itself dates from #229/#241). The test is from PR #283 (ce2c4c7a, resolver tiers), which made the gate reach the +dispatch. Neither PR's CI caught it because CI runners lack docker. Main's latest Test - Unit run (45716718961, +a144e65c) is green on ubuntu and macos. + +## Evidence + +- Detached worktree of origin/main a144e65c: 1 failed, 25 passed in that file; SystemExit at mounts.py:84. +- CI log: that test PASSED on both unit (macos-latest) and unit (ubuntu-latest). + +## Proposed fix + +1. In the test (or an autouse conftest fixture), monkeypatch the role dispatch (`conflict_resolver_role._dispatch_role`) + or `containers.run_docker_container` so no unit test reaches the real launcher; assert it is not called for the + code-conflict path unless the test expects it. +2. Make `_dispatch` catch `SystemExit` too (`except (Exception, SystemExit)`) so a launcher abort becomes an + `agent_failed` verdict instead of killing the flow. +3. Add a hermetic guard that fails fast if a test spawns docker or reaches `run_docker_container` unmocked. + +## Flow + +Launched 2026-11-27 as flow-conflict-gate-launcher-abort (claude-agent, claude-opus-5-5); intent +todo/intent-0469-conflict-gate-launcher-abort.json. Scope: flow/conflict_resolver_role.py plus its two tests; the +conftest guard from proposed fix 3 is left out. + +## Resolution + +Delivered via [PR #355](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/355) and merged into `main` +(`c5435c1e`): + +- **Key Architectural Deliverables**: the conflict resolver role dispatch treats a `SystemExit` from the container + launcher as an `agent_failed` verdict (same as any other exception), so a launcher abort no longer kills the flow. The + code-conflict test replaces the role dispatch with a stub, so it never reaches the real launcher on a macOS host with + docker on PATH. +- **Verification & Tests**: `test_conflict_gate.py` and `test_conflict_resolver_role.py` updated; passes on a macOS host + with docker on PATH and an empty home directory. +- **Scope left out**: the conftest guard from proposed fix 3 (hermetic guard that fails fast on unmocked + `run_docker_container`) was not delivered here; it is left for the conftest split, bean 0540. +- **Holon Flow Traversal**: flow `conflict-gate-launcher-abort` (intent, plan, execute, review, calibrate) completed; + the PR was merged by the maintainer. diff --git a/.beans/holon-agentic-coder-ref-metadata-0470--warp-shift-enter-inside-tmux.md b/.beans/holon-agentic-coder-ref-metadata-0470--warp-shift-enter-inside-tmux.md new file mode 100644 index 00000000..d47fe975 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0470--warp-shift-enter-inside-tmux.md @@ -0,0 +1,89 @@ +--- +# holon-agentic-coder-ref-metadata-0470 +title: "Fix Warp Shift+Enter swallowed by tmux C-j binding" +status: completed +type: bug +priority: normal +tags: + - dev-env + - macos + - warp + - tmux + - wsl +parent: holon-agentic-coder-ref-metadata-0435 +created_at: 2026-11-25T23:19:00Z +updated_at: 2026-11-26T05:53:00Z +--- + +# Fix Warp `Shift+Enter` swallowed by `tmux` `C-j` binding + +## Problem + +Empirically verified on macOS Warp $\rightarrow$ SSH $\rightarrow$ Ubuntu WSL `tmux 3.8` (with `extended-keys always`, +`extended-keys-format csi-u`, and `terminal-features 'xterm*:extkeys'`): + +1. Outside `tmux` with Kitty keyboard protocol (`\e[>1u`), Warp sends CSI-u `\x1b[13;2u` (`1b 5b 31 33 3b 32 75`) on + `Shift+Enter`. +2. Outside `tmux` with `modifyOtherKeys=2` (`\e[>4;2m`, which is what `tmux 3.8` sends to the outer terminal), Warp + sends `0x0a` (`\n`, ASCII Line Feed) on `Shift+Enter`, while `Alt+Enter` sends `\x1b\r` (`1b 0d`). +3. Because `0x0a` is identical to `Ctrl-J` (`C-j`), `dotfiles/tmux/.tmux.conf` intercepts it via + `bind-key -n C-j if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'` (`vim-tmux-navigator`), swallowing + `Shift+Enter` completely (0 bytes reach the pane). +4. Ghostty is **not** affected: macOS Ghostty works natively with `Shift+Enter` inside `tmux 3.8` once `xterm-ghostty` + terminfo is present (Bean `0464`). + +## Investigation Findings (Warp Key Mapping) + +- Warp does **not** support custom keybindings that send arbitrary raw text or escape sequences (such as `\x1b\r` or + `\x1b[13;2u`) via `~/.warp/keybindings.yaml` or `~/.warp/settings.toml`. Warp's keybinding file only maps keys to + built-in internal Warp UI actions. +- Therefore, unlike Ghostty, a `dev-env` Stow dotfile for Warp cannot remap `Shift+Enter` to `\x1b\r` inside Warp + itself. + +## Approved Design + +1. **`dotfiles/tmux/.tmux.conf`**: + - Define `is_vim_or_agent` matching `vim`/`nvim`/`view`/`diff` and coding-agent TUIs (`claude`, `codex`, `agy`, + `antigravity`, `opencode`, `pi`, `node`). + - Update `bind-key -n C-j` to: + ```tmux + bind-key -n C-j if-shell -F '#{pane_at_bottom}' 'send-keys C-j' "if-shell \"$is_vim_or_agent\" 'send-keys C-j' 'select-pane -D'" + ``` + so single/bottom panes forward `0x0a` (`C-j`, Warp's `Shift+Enter` under `modifyOtherKeys=2`) with zero subprocess + overhead, top split panes running Neovim or coding-agent TUIs also forward `0x0a`, and top split panes running + plain shells retain `select-pane -D`. +2. **`tests/test_manifest.py`**: + - Update the `bind-key -n C-j` assertion for the new `is_vim_or_agent` + `#{pane_at_bottom}` directive while + preserving `is_vim` checks for `C-h`/`C-k`/`C-l` and `copy-mode-vi C-j`. +3. **`tests/test_tmux_shift_enter.py`**: + - Expand with a universal Warp + Ghostty real-`tmux` PTY matrix covering `Shift+Enter` (Ghostty `\x1b[13;2u` / + `\x1b[27;2;13~` and Warp `\x0a` / `\x1b[13;2u`), `Alt+Enter` (`\x1b\r` and `\x1b[13;3u`), and plain `Enter` (`\r`). + - Add a vertical split-pane PTY test proving `C-j` switches down from a plain top shell pane while forwarding `\x0a` + when the top pane runs a coding-agent process (e.g. `claude`). + +## Notes + +- Target repository: `dev-env` (`git@github.com:thomashan/dev-env.git`), delivered via `holon flow`. +- Active Holon flow slug: `warp-shift-enter-tmux-cj` (`antigravity-agent` / `gemini-4-neon`). +- Earlier Ghostty flow (`ghostty-shift-enter-esc-cr`) was stopped and cleaned up on 2026-11-26 after verifying Ghostty + works natively and the `0x0a` / `C-j` behaviour was Warp-specific. +- Related beans: Bean `0344`, Bean `0435`, Bean `0464`. + +## Resolution + +Delivered via [PR #45](https://github.com/thomashan/dev-env/pull/45) and merged into `main` (`6a50860`, +`2026-11-26T05:49:19Z`): + +- **Key Deliverables**: + - `dotfiles/tmux/.tmux.conf`: added `is_vim_or_agent` matching Vim/Neovim and coding-agent TUIs and updated + `bind-key -n C-j` to forward `C-j` (`0x0a`, Warp `Shift+Enter` under `modifyOtherKeys=2`) when `#{pane_at_bottom}` + is set or the active pane runs Vim/an agent TUI, while preserving `select-pane -D` for plain top split panes. + - `tests/test_manifest.py`: updated `bind-key -n C-j` manifest assertions for `#{pane_at_bottom}` and + `is_vim_or_agent`, while keeping `is_vim` assertions intact for `C-h`/`C-k`/`C-l` and `copy-mode-vi C-j`. + - `tests/test_tmux_shift_enter.py`: expanded the real-`tmux` PTY matrix covering Warp and Ghostty (`Shift+Enter`, + `Alt+Enter`, plain `Enter`) plus vertical split-pane tests verifying `C-j` pane navigation vs forwarding `\x0a` to + coding-agent processes. +- **Verification & Reviews**: 7/7 GitHub Actions CI checks green; 3/3 Stage 4 consensus review approval. +- **Holon Flow Traversal**: Completed all 5 stages (Intent $\rightarrow$ Plan $\rightarrow$ Execute $\rightarrow$ Review + Loop $\rightarrow$ Calibration); Stage 5 calibration EV: `96.46` predicted / `99.30` actual / `+2.84` delta (`0.00` + bug EV drag). diff --git a/.beans/holon-agentic-coder-ref-metadata-0471--resolver-argv-exposes-claude-oauth-token.md b/.beans/holon-agentic-coder-ref-metadata-0471--resolver-argv-exposes-claude-oauth-token.md new file mode 100644 index 00000000..b2d66f95 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0471--resolver-argv-exposes-claude-oauth-token.md @@ -0,0 +1,60 @@ +--- +# holon-agentic-coder-ref-metadata-0471 +title: "Resolver container argv carries the Claude OAuth token, visible to every local user via ps and docker top" +status: completed +type: bug +priority: high +tags: + - security + - flow + - stage-4 + - claude-agent +created_at: 2026-11-25T23:35:26Z +updated_at: 2026-11-26T12:10:00Z +--- + +## Problem + +During the Stage 4 resolver turn of `workspace-survival-job-parallel` (claude-agent, claude-opus-5-5), the in-container +`claude` process is started with its settings JSON on the command line (`--settings {"env": {...}}`). That JSON carries +`CLAUDE_CODE_OAUTH_TOKEN` in plain text, so the long-lived OAuth token appears in the argv of the process for the whole +turn. Any local user can read it with `ps` or `docker top `. The token is also echoed into agent tool output +when anyone lists processes, so it must be treated as exposed. + +## Fix direction + +- Pass the token through the container environment (`docker run -e`, or an env-file that is removed after start), never + through argv or a settings string on the command line. +- Keep the `HOLON_ECHO_PAD` padding, but do not place the secret in the padded argument. +- Add a test that the review and resolver argv never contain the token value. +- Rotate the exposed token once the fix lands. + +## Notes + +- Observed 2026-11-26 (local time) by `docker top` on a live resolver container for bean 0405. +- Related: 0432 (resolver turn failures), bean "claude-agent OAuth route" memory note (token via HOLON_AGENT_SETTINGS). + +## Flow + +In progress 2026-11-26: flow settings-token-off-argv (claude-agent, claude-opus-5-5) moves inline settings JSON carrying +the token into a private temp file so it leaves argv. + +PR #338 open 2026-11-26: 3/3 approved (4 iterations), calibrated, MERGEABLE/CLEAN, 11 checks green; awaiting maintainer +merge. Rotate the exposed token after merge. + +## Resolution + +Delivered via [PR #338](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/338) and merged into `main` +(`5440e923`): + +- **Key Architectural Deliverables**: `attribution_off_settings` (`agent_attribution.py`) and the claude runner + (`agent_runner.py`) write any settings with a non-empty `env` block, inline or from file, to a private mode-600 temp + file (`mkstemp`, removed at exit). `--settings` now receives a path, so `CLAUDE_CODE_OAUTH_TOKEN` is in no process + argument vector. +- **Verification & Tests**: `tests/test_agent_attribution.py`, `tests/test_agent_runner.py` assert the fake token is + absent from every argv element and that the file is mode 600 with the merged settings. +- **Holon Flow Traversal**: flow `settings-token-off-argv` completed all 5 stages (review 3/3 approved). +- **Scope note**: the flow also changed `preflight.py`, `preflight_secret_args.py` and `test_preflight.py`, outside its + intent scope (same pattern as beans 0502 and 0508). +- **ACTION FOR THE MAINTAINER**: rotate the Claude OAuth token now that the fix is merged. The token seen in + `docker top` output on 2026-11-26 must be treated as exposed until rotated. diff --git a/.beans/holon-agentic-coder-ref-metadata-0472--flow-runner-allows-duplicate-runs-and-leaves-children-alive.md b/.beans/holon-agentic-coder-ref-metadata-0472--flow-runner-allows-duplicate-runs-and-leaves-children-alive.md new file mode 100644 index 00000000..0b7ac7e7 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0472--flow-runner-allows-duplicate-runs-and-leaves-children-alive.md @@ -0,0 +1,65 @@ +--- +# holon-agentic-coder-ref-metadata-0472 +title: "Flow runner does not refuse a second run on the same intent and does not reap its children after a halt" +status: in-progress +type: bug +priority: high +tags: + - flow + - harness + - stage-4 +created_at: 2026-11-25T23:35:26Z +updated_at: 2026-11-25T23:35:26Z +--- + +## Problem + +Observed on intent 0405 (`workspace-survival-job-parallel`, resume from `review`, PR #308): + +1. Several `run_holon_flow.py --from-stage review` invocations for the same intent and the same `flow-` worktree + ran at once. Nothing refused the second or third run or took a lock on the intent, checkpoint, or worktree. Each run + launched its own Stage 4 resolver container with the worktree mounted read-write, so the runs wrote into the same + tree while the target-sync check ran. +2. After a run printed "Holon flow exited with non-zero code 1" and "Pipeline halted", its `holon flow` process stayed + alive for more than seven minutes at 0% CPU, and its `docker run` client and resolver container kept running. The + wrapper's exit did not stop or reap the children. +3. The resulting "target sync blocked: the worktree has uncommitted tracked changes" failure on `flow_start` (the same + symptom as 0432) came from these racing writers, not from a dead resolver turn. Once the duplicates were stopped the + tree was clean at the same HEAD and a single run proceeded. + +## Fix direction + +- Take an advisory lock per intent slug and worktree (for example a lock file under the worktree's `.holon/flow/`), and + refuse a second `--from-stage` or fresh run with a message naming the live pid. +- On a halted run, terminate the `holon flow` child process group and the `docker run` clients it started, and let + `docker stop` reach the containers that mount the worktree. +- Make the `flow_start` dirty-tree check ignore a tree whose writers are the current run's own containers, or wait for + them, rather than failing the stage. + +## Notes + +- The duplicates were started by the harness agent, not by a flow bug alone. The runner should still refuse them. +- Related: 0432 (dead resolver edits block target sync), 0443, 0449. + +## Audit evidence (2026-11-26T03:50Z, fifth-merge audit) + +- `thomashan/dev-env#43` (`ubuntu-wsl-ghostty-terminfo`) contains **4 separate plan commits** from **2 distinct intent + IDs** (`I-1795646837-ubuntu-wsl-ghostty-terminfo` and `I-1795646845-ubuntu-wsl-ghostty-terminfo`, created 8 s apart at + `22:47Z`–`22:58Z`: `P-1795646862-ANA-G4N`, `P-1795646869-ANA-G4N`, `P-1795647050-ANA-G4A`, `P-1795647322-ANA-G3.8F`) + committed into the same PR branch (`dev-env#43`), leaving orphan plan files on `main` when merged. + +## Progress (2026-11-26) + +- in-progress: flow `single-runner-per-checkpoint` (intent `todo/intent-0390-single-runner-per-checkpoint.json`, log + `todo/flow-single-runner-per-checkpoint.log`), covering this bean and 0472 (same defect). Stage 3 overlap refusals are + parked, not waited out. +- parked 2026-11-26: blocked by flow `tests-fewer-git-stage-pipeline` (I-1795684868, worktree + flow-tests-fewer-git-stage-pipeline) on apps/sandbox-executor/tests/flow/conftest.py; Stage 3 admission refused the + plan's touch set. Checkpoint kept at + apps/holon-agentic-coder/flow-single-runner-per-checkpoint/.holon/flow/checkpoint-single-runner-per-checkpoint.json + (stage execute); resume with --checkpoint only once that flow merges or releases conftest.py. +- resumed 2026-11-26 10:55Z from checkpoint (stage execute, `--checkpoint`, claude-agent / claude-opus-5-5): PR #332 + (the earlier blocker) has merged, but Stage 3 admission refused again on a touch-set overlap with open PR #334 + (`I-1795665991-no-unneeded-full-review`, flow worktree `flow-no-unneeded-full-review`) on + `apps/sandbox-executor/tests/flow/conftest.py`. Parked again; checkpoint kept (stage execute), no runner live. Resume + with `--checkpoint` once PR #334 merges or releases conftest.py. diff --git a/.beans/holon-agentic-coder-ref-metadata-0473--flow-push-rejected-after-child-pr-merge.md b/.beans/holon-agentic-coder-ref-metadata-0473--flow-push-rejected-after-child-pr-merge.md new file mode 100644 index 00000000..0f8cde67 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0473--flow-push-rejected-after-child-pr-merge.md @@ -0,0 +1,40 @@ +--- +# holon-agentic-coder-ref-metadata-0473 +title: + "Flow push of a parent branch is rejected after a child PR merges into it (stale local parent, no fetch before push)" +status: todo +type: bug +priority: high +tags: + - flow + - ledger-fragments-and-promotion +created_at: 2026-11-26T00:40:14Z +updated_at: 2026-11-26T00:40:14Z +--- + +## Problem + +Flow ledger-fragments-and-promotion (bean 0371) split into 4 sub-intents. Sub-intent 1 ran through review and +calibration and its PR #310 merged into the parent branch +`I-1795584436-ledger-fragments-and-promotion/P-1795584464-CLA-CO5.5/_` at 2026-11-26T00:38:28Z. Seven seconds later the +flow's sync commit (789cbfab, merging origin/main into the parent) was pushed from a local parent ref that did not +contain the merge commit ba5e090d. The push was rejected ("fetch first"), and Stage 3 failed at sub-intent 2/4 with +"target sync ... was blocked". The message names the ledgers, which is misleading: the failure is a non-fast-forward +push race on the parent ref. + +## Expected + +After a child PR merges into the parent branch, the flow fetches the parent ref and integrates it (a plain merge, never +a force push) before the target sync and push. + +## Evidence + +- PR #310 baseRefName is the parent branch, mergedAt 2026-11-26T00:38:28Z, merge commit ba5e090d. +- Local sync commit 789cbfab (11:38:35 +11) is not a descendant of ba5e090d. +- Checkpoint: current_stage execute, completed_stages intent and plan; wrapper log in + todo/flow-ledger-fragments-and-promotion.log. + +## Acceptance + +- The flow fetches and merges the remote parent head before pushing after a child merge. +- A rejected non-fast-forward push on a flow branch is retried after a fetch-and-merge, never forced. diff --git a/.beans/holon-agentic-coder-ref-metadata-0474--flow-integration-rejects-append-only-ledger-merge.md b/.beans/holon-agentic-coder-ref-metadata-0474--flow-integration-rejects-append-only-ledger-merge.md new file mode 100644 index 00000000..11cfe2ef --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0474--flow-integration-rejects-append-only-ledger-merge.md @@ -0,0 +1,39 @@ +--- +# holon-agentic-coder-ref-metadata-0474 +title: + "Flow integration of a plan branch into its execution branch refuses an append-only executions.jsonl merge as 'not a + pure ledger append'" +status: todo +type: bug +priority: high +tags: + - flow + - ledger + - ledger-fragments-and-promotion +created_at: 2026-11-26T03:36:30Z +updated_at: 2026-11-26T03:36:30Z +--- + +## Problem + +After all 4 sub-intents of flow ledger-fragments-and-promotion (bean 0371) merged into the plan branch +`I-1795584436-ledger-fragments-and-promotion/P-1795584464-CLA-CO5.5/_` (PRs #310-#313), Stage 3 failed with "integrating +... into .../E-1795647346-CLA-CO5.5/_ failed: merging ... conflicts in holon-knowledge/ledger/executions.jsonl (outside +holon-knowledge/ledger/*.jsonl or not a pure ledger append)". + +Both sides were append-only relative to their merge base (48b4ab08): the execution branch added 138 rows and the plan +branch added 288 rows, with zero deletions on either side. The conflict was the usual append-append at end of file. The +gate judged it not a pure append, so the flow halted instead of applying the ledger rule (main's rows in order, then +this branch's own rows). + +## Evidence + +- `git diff --numstat E` -> 138 added, 0 deleted; `git diff --numstat origin/P` -> 288 added, 0 deleted. +- Resolved mechanically with `resolve_known.py`: 10646 base rows + 138 own rows = 10784, every row present; committed as + f22ac491 and pushed fast-forward (6dd14494..f22ac491). +- Wrapper log: todo/flow-ledger-fragments-and-promotion.log, entry 2026-11-26T03:30:33Z. + +## Expected + +An append-only ledger conflict (both sides only add lines, no deletions) is settled by the ledger rule, for every merge +direction (plan into execution branch, and execution into plan branch), not refused as a judgement call. diff --git a/.beans/holon-agentic-coder-ref-metadata-0475--docker-build-workflow-lacks-concurrency-group-on-pull-requests.md b/.beans/holon-agentic-coder-ref-metadata-0475--docker-build-workflow-lacks-concurrency-group-on-pull-requests.md new file mode 100644 index 00000000..7bee9520 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0475--docker-build-workflow-lacks-concurrency-group-on-pull-requests.md @@ -0,0 +1,93 @@ +--- +# holon-agentic-coder-ref-metadata-0475 +title: "Docker Build workflow lacks a concurrency group and completes on every cancelled PR head" +status: completed +type: bug +priority: high +tags: + - ci + - pipeline + - github-actions + - performance + - holon-agentic-coder +created_at: 2026-11-26T03:50:00Z +updated_at: 2026-11-26T10:12:00Z +--- + +# Docker Build workflow lacks a concurrency group and completes on every cancelled PR head + +## Problem + +Five of the six core `holon-agentic-coder` CI workflows (`.github/workflows/test-unit.yml`, `test-stress.yml`, +`test-hygiene.yml`, `test-integration.yml`, `make.yml`) declare a `concurrency` stanza with +`cancel-in-progress: ${{ github.event_name == 'pull_request' }}`. `.github/workflows/docker-build.yml` declares no +`concurrency` block at all. + +Whenever a Stage 4 resolver commit or target-sync merge is superseded 10–20 s later by a `chore(review)` ledger push +(Bean `0443`) or another push on a pull request branch, the five test/lint workflows cancel the superseded head +immediately, whereas `Docker Build` runs to completion (`success`) on the stale SHA, burning Ubuntu runner minutes on a +head that can never merge. + +## Evidence (2026-11-26T03:50Z fifth-merge audit, 5 h window `2026-11-25T22:49:00Z..2026-11-26T03:50:09Z`) + +- Across `48` distinct `holon-agentic-coder` SHAs in the window (`298` workflow runs total), **`26` SHAs** had their + five test/lint workflows cancelled as superseded (`median 1.82 min` wall). +- **`Docker Build` ran to `success` on all `26` of those `26` cancelled SHAs** (`median 1.78 min`, `max 2.23 min`), + wasting **`2,396.0 s` (`39.93 runner-min`)** on commits already superseded (e.g., `PR #310` `e8fc7e43`, `0a9cbc98`, + `02c1d8e7`, `8dc91384`, `366ade8c`, `e311727d`, `ac5d2056`; `PR #311` `bac5dd73`, `feafb760`, `40c9d4ad`; `PR #312` + `f04266bf`, `4c8d25a5`; `PR #313` `937eef73`, `0c8fa6c7`; `PR #314` `6248e983`; `PR #308` `55df1efb`, `5a813110`). + +## Proposed Change + +1. Add a `concurrency` block to `.github/workflows/docker-build.yml` that cancels superseded `pull_request` heads while + keeping every `push` to `main` commit distinct (avoiding Bean `0461`'s `main`-push eviction bug): + ```yaml + concurrency: + group: + ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || format('{0}-{1}', + github.ref, github.sha) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + ``` +2. Update `.github/workflows/README.md` or workflow trigger tests if concurrency coverage requires it. + +## Expected Gain + +Eliminates `~40 runner-minutes` per 5-hour window (`26` cancelled heads in this window) and removes unnecessary +`Docker Build` queue contention on GitHub-hosted runners. + +## Cost + +Small: 4-line `concurrency` block in `.github/workflows/docker-build.yml` (+ test/doc check) via `holon flow` +(`holon-agentic-coder`). + +## Notes + +- Target repo change through `holon flow` (`holon-agentic-coder`). +- Related: Bean `0461` (`main`-push concurrency across the other 5 workflows), Bean `0443` (Stage 4 double-push race). + +## Progress + +- 2026-11-26: in-progress. Flow `flow-docker-build-concurrency-group` launched from + `todo/intent-0475-docker-build-concurrency-group.json` (claude-agent, claude-opus-5-5); scope is + `.github/workflows/docker-build.yml` only, disjoint from the live flows. + +## Resolution + +Delivered via [PR #329](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/329) and merged into `main` +(`883a5d6`): + +- **Key Architectural Deliverables**: top-level `concurrency` block added to `.github/workflows/docker-build.yml`. Pull + request runs group by workflow and head branch and cancel in progress; push and `workflow_dispatch` runs group by + workflow, ref and SHA and are never cancelled (main-push eviction avoided, per bean 0461). The diff touches that one + workflow file only. +- **Verification & Tests**: affected tests, lint, prettier and the full suite passed in the flow's execution record. + Live cancellation was not observable at merge time, so it is verified by construction, not by a live run. +- **Holon Flow Traversal**: intent, plan, execution and calibration artifacts were all committed for + `I-1795685858-docker-build-concurrency-group`. The bean's optional README or trigger-test update was not needed. +- **Post-merge**: flow worktree and its `I-1795685858-docker-build-concurrency-group` branches removed locally and on + origin. No install-holon run was needed (workflow-only change). +- 2026-11-26 10:10Z: flow `flow-docker-build-concurrency-group` completed. PR #329 (`.github/workflows/docker-build.yml` + only) was approved 3/3 at review, calibration report included (EV 37.57, final head CI success) and the PR reached + MERGEABLE/CLEAN. The maintainer (thomashan) merged PR #329 at 09:54Z while the flow was in calibration. Post-merge + closure (bean to completed, worktree and branch prune) is pending via the post-pr-merge skill. +- Bug logged: bean 0504 (run log stays empty while the flow runs). diff --git a/.beans/holon-agentic-coder-ref-metadata-0476--local-flow-overlap-polling-relaunches-every-minute-and-bloats-checkpoints.md b/.beans/holon-agentic-coder-ref-metadata-0476--local-flow-overlap-polling-relaunches-every-minute-and-bloats-checkpoints.md new file mode 100644 index 00000000..5e73c4b2 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0476--local-flow-overlap-polling-relaunches-every-minute-and-bloats-checkpoints.md @@ -0,0 +1,78 @@ +--- +# holon-agentic-coder-ref-metadata-0476 +title: "Local-flow overlap polling relaunches holon flow every minute, logs false clear, and bloats checkpoint logs" +status: todo +type: bug +priority: high +tags: + - flow + - stage-3 + - admission + - harness + - checkpoint +created_at: 2026-11-26T03:50:00Z +updated_at: 2026-11-26T03:50:00Z +--- + +# Local-flow overlap polling relaunches `holon flow` every minute, logs false clear, and bloats checkpoint logs + +## Problem + +When Stage 3 refuses admission due to a **local flow** that has not opened a pull request yet (`numbers == []`), +`.agents/skills/holon_flow/scripts/run_holon_flow.py:678-693` sleeps `60 s`, unconditionally logs +`INFO: Overlap cleared; resuming Stage 3 (admission is checked again).`, and spawns a full `holon flow --checkpoint` +subprocess. + +This causes three compounding problems: + +1. **False log signal & process churn:** While a multi-hour decomposed parent flow runs locally, the waiting wrapper + re-launches `holon flow` (plus pre-flight, git fetch, and Stage 3 admission) every `60 s` — printing + `Overlap cleared` hundreds of times when nothing cleared. +2. **Unbounded checkpoint log bloat:** Each failed `holon flow --checkpoint` run appends its refusal lines into + `checkpoint["context"]["logs"]` and re-writes the checkpoint JSON without deduplication or cap, inflating the + checkpoint file to hundreds of kilobytes. +3. **Late PR transition:** Even while the blocking flow opens sequential sub-intent PRs, the wrapper keeps hitting the + 60 s local-flow re-launch loop until the blocker finally opens its parent PR. + +## Evidence (2026-11-26T03:50Z fifth-merge audit) + +- **`macos-unit-only-when-relevant` (`0400`, `todo/flow-macos-unit-only-when-relevant.log`):** + - Refused at `2026-11-25T23:02:33Z` on local flow `I-1795584436-ledger-fragments-and-promotion/...` + (`.github/workflows/README.md`). + - Re-launched `holon flow --checkpoint` **`200+` times** across **`274.7+ min`** (`23:02:33Z..03:37:15Z+`; `400` + refusal lines already flushed by `03:01:05Z`, `median 0.083 min` / `5 s` per failed launch, `max 0.133 min` / `8 s`, + totalling **`~16–20 min`** of pure process/git/checkpoint overhead), printing + `INFO: Overlap cleared; resuming Stage 3` on every single minute. + - `apps/holon-agentic-coder/flow-macos-unit-only-when-relevant/.holon/flow/checkpoint-macos-unit-only-when-relevant.json` + bloated to **`298,110` bytes**, with `context["logs"]` containing **`1,752` lines (`274,923` bytes = `92.2%`** of + the file). +- **`ledger-fragments-and-promotion` (`0371`):** + - `checkpoint-ledger-fragments-and-promotion.json` similarly accumulated **`126,217` bytes** in `context["logs"]` + (`79.1%` of `159,481` bytes) across resumes. + +## Proposed Change + +1. **Harness (`run_holon_flow.py`):** + - When `numbers` is empty (local-flow blocker), never log `"Overlap cleared"`; log + `"Re-checking local-flow Stage 3 admission..."` instead. + - Check the blocking local worktree's checkpoint / branch state directly in Python (or back off the poll interval, + e.g. `60 s -> 120 s -> 300 s`, and also watch `gh pr list` for the blocking slug) before spawning a full + `holon flow --checkpoint` subprocess. +2. **Engine (`holon-agentic-coder` checkpoint writer via `holon flow`):** + - Cap or deduplicate repeated identical Stage 3 overlap-refusal lines in `context["logs"]` (e.g., keep a bounded tail + or collapse consecutive refusal entries) so checkpoint JSON files stay small across long overlap waits or retries. + +## Expected Gain + +Eliminates `200+` redundant `holon flow` process launches (`~16–20 min` CPU/git/IO churn over a 4.5 h wait), removes +misleading `"Overlap cleared"` log spam, and prevents `275 KB+` checkpoint JSON bloat. + +## Cost + +Small in harness (`.agents/skills/holon_flow/scripts/run_holon_flow.py` + `tests/`) and small in `holon-agentic-coder` +(checkpoint `context.logs` bounding via `holon flow`). + +## Notes + +- Related: Bean `0468` (wrapper previously exited on overlap), Bean `0385` (buffered log hid final `36+ min` of + `flow-macos-unit-only-when-relevant.log`), Bean `0412` (log overlap wait as one wait, not refused runs). diff --git a/.beans/holon-agentic-coder-ref-metadata-0477--wrapper-relaunches-fresh-instead-of-checkpoint-after-overlap-exit.md b/.beans/holon-agentic-coder-ref-metadata-0477--wrapper-relaunches-fresh-instead-of-checkpoint-after-overlap-exit.md new file mode 100644 index 00000000..3225eda6 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0477--wrapper-relaunches-fresh-instead-of-checkpoint-after-overlap-exit.md @@ -0,0 +1,54 @@ +--- +# holon-agentic-coder-ref-metadata-0477 +title: "Overlap-exit relaunch without --checkpoint restarts split-calibration-package from intent four times" +status: todo +type: bug +priority: high +tags: + - flow + - stage-3 + - admission + - checkpoint + - harness +created_at: 2026-11-26T05:15:00Z +updated_at: 2026-11-26T05:15:00Z +--- + +# Overlap-exit relaunch without --checkpoint restarts the flow from intent + +## Problem + +Bean 0197 (slug `split-calibration-package`) was launched with +`run_holon_flow.py --target-worktree apps/holon-agentic-coder/main --agent claude-agent --model claude-opus-5-5`. +Each relaunch after a Stage 3 overlap exit (local flow `no-unneeded-full-review`, touching calibration.py) and each +relaunch after a planner failure ran intent and plan again from scratch instead of resuming from +`.holon/flow/checkpoint-split-calibration-package.json`. The holon child command line carried no `--checkpoint`. + +Evidence (local intent branches, all pushed to origin, all cut from origin/main): + +- `I-1795665972-split-calibration-package` (plan P-1795665995) +- `I-1795666365-split-calibration-package` (plan P-1795666397) +- `I-1795668981-split-calibration-package` (plan P-1795669003; planner refused: + `mounted workspace ... has uncommitted changes`, caused by untracked `plans/I-1795668981-split-calibration-package/`) +- `I-1795669744-split-calibration-package` (plan P-1795669767, current run) + +Each fresh start also appended another intent row to the flow branch's ledger, so the eventual PR would carry duplicate +intent rows. + +## Expected + +After an overlap exit or a resumable failure, the wrapper relaunches with +`--checkpoint /.holon/flow/checkpoint-.json` and resumes at the stage recorded there (for Stage 3 +admission, `execute`). It never restarts from intent while a checkpoint exists. + +## Related + +- Bean 0468 (wrapper exits on a Stage 3 overlap instead of waiting). Still open. This bean is the resume half. +- Bean 0476 (overlap polling relaunches every minute). +- Untracked `plans/I-*/` left in the flow worktree by the intent stage blocks the planner's clean-workspace check. + Logged as a separate observation in the same run. + +## Workaround in use + +Hand-relaunch with `--checkpoint` (same intent, worktree, agent, model) after the overlapping flow's PR merges or +closes. Do not relaunch without it. diff --git a/.beans/holon-agentic-coder-ref-metadata-0478--reviewers-wait-for-ci-inside-their-own-turn-althou.md b/.beans/holon-agentic-coder-ref-metadata-0478--reviewers-wait-for-ci-inside-their-own-turn-althou.md new file mode 100644 index 00000000..cefab7cd --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0478--reviewers-wait-for-ci-inside-their-own-turn-althou.md @@ -0,0 +1,61 @@ +--- +# holon-agentic-coder-ref-metadata-0478 +title: "Reviewers wait for CI inside their own turn although the engine already gates on CI" +status: todo +type: bug +priority: normal +tags: + - flow + - stage-4 + - review + - ci + - holon-agentic-coder +created_at: 2026-11-26T05:25:00Z +updated_at: 2026-11-26T05:25:00Z +--- + +## Problem + +The reviewer prompt makes each of the three reviewers verify CI before approving: +`holon-config/prompts/review_loop.template.md:19` ("every CI check passes (`gh pr checks` or the local test suite"). The +engine already owns that gate after the reviewers return (`flow/review/loop.py:388-410`: registration wait, then +`settle_pending_ci`). So on every approving iteration the three reviewer sessions sit in their turn until the pipeline +on the head finishes. + +## Evidence + +Evidence: flow time audit of 2026-11-26 (git-ignored `todo/flow-time-audit-2026-11-26.md`, scripts and data in +`todo/flow-time-audit-2026-11-26/`), sample PRs #296 to #316 of holon-agentic-coder. + +- On all 11 approving iterations in the sample the ensemble container returned 2 to 30 s after the last CI job on the + reviewed head finished (for example #311 01:59:49 vs CI end 01:59:32; #313 03:28:22 vs 03:28:15; #314 03:58:33 vs + 03:58:31; #309 05:57:32 vs 05:57:26; #316 04:55:56 vs CI end on its head). +- Approving iterations take 6.5 to 10.3 min; blocked iterations of the same flows take 2.8 to 4.8 min (median 3.9 min). + The difference (median 5.8 min per flow, 58 min over 9 flows) is three agent sessions idling on CI. +- The engine's own CI wait right after them settles in 1 to 3 s, because the reviewers already waited. +- In #308 four blocked iterations carried a reviewer "CI role CHANGES" vote while CI was still pending or the host test + run (`review_local`) had failed, so the reviewer-side CI check also produces blockers on CI noise the engine gate + already handles. + +## Proposed change + +1. Reviewers judge the diff only: drop the CI clause from the reviewer approval rule and the CI role from the reviewer + verdict; the engine's post-review CI gate stays the single CI authority (it already withdraws consensus on a red + head). +2. Pass the current CI state to reviewers as information only (a failing check's log excerpt is still useful context). +3. Optionally start Stage 5 preparation (calibration report generation) while the engine waits on the final head's CI. + +## Expected gain + +About 5.8 min x 3 agent sessions (about 17 agent-minutes) per flow, fewer quota stops (limit waits are flow time), and +no blocked iterations from a reviewer's CI vote. Wall time per flow changes little (the CI gate still bounds the +approving iteration) unless point 3 is done. + +## Cost + +Small: prompt change and verdict parsing in the review container; tests for the verdict. + +## Notes + +- Related: Bean 0407 (review rerun only when the reviewable diff changes), Bean 0400 (shorter pipeline sets the + approving iteration), Bean 0450 (`review_local` host runs). diff --git a/.beans/holon-agentic-coder-ref-metadata-0479--parent-pull-request-of-a-decomposed-plan-is-re-rev.md b/.beans/holon-agentic-coder-ref-metadata-0479--parent-pull-request-of-a-decomposed-plan-is-re-rev.md new file mode 100644 index 00000000..45779ab3 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0479--parent-pull-request-of-a-decomposed-plan-is-re-rev.md @@ -0,0 +1,57 @@ +--- +# holon-agentic-coder-ref-metadata-0479 +title: "Parent pull request of a decomposed plan is re-reviewed in full after every child was approved" +status: todo +type: feature +priority: normal +tags: + - flow + - stage-4 + - review + - decomposition + - holon-agentic-coder +created_at: 2026-11-26T05:25:00Z +updated_at: 2026-11-26T05:25:00Z +--- + +## Problem + +When a plan is decomposed, each child flow is reviewed, approved and merged into the parent plan branch. The parent's +own pull request into `main` then runs a full three-reviewer review of the union of all children's changes, which +reviewers have already approved child by child. + +## Evidence + +Evidence: flow time audit of 2026-11-26 (git-ignored `todo/flow-time-audit-2026-11-26.md`, scripts and data in +`todo/flow-time-audit-2026-11-26/`), sample PRs #296 to #316 of holon-agentic-coder. + +- Bean 0371 (`ledger-fragments-and-promotion`): children #310, #311, #312, #313 (76, 117, 41 and 23 files) were each + approved; parent #314 changed 218 files, of which 209 were already in a child PR. Only 2 code files were new to the + parent (`flow/conflict_classes_resolve.py` and its test, the integration fix), plus knowledge-base records and the + parent plan and calibration report. +- Parent review: 2026-11-26 03:36:58 PR created, iteration 1 (reviewers 4.5 min, host `review_local` 2.3 min, resolver + 4.5 min), iteration 2 approving (9.9 min, CI-bound): 21.7 min, plus a pipeline on the 218-file diff. +- Iteration 1 did raise three Important findings, so an integration pass has value; the cost is re-reading the + already-approved child diffs with three reviewers. + +## Proposed change + +1. The parent review is scoped to what no child review covered: the integration delta (the parent head against the merge + of the approved child heads), the parent plan and calibration report, and cross-child consistency. +2. Children's approvals are recorded on the parent (fingerprints of their own diffs, as Bean 0407 keys approvals), and a + parent diff equal to the union of approved child diffs plus bookkeeping needs one reviewer, not three. +3. Keep the full pipeline on the parent head (the CI gate is unchanged). + +## Expected gain + +About 10 to 15 min per decomposed flow (one scoped iteration instead of a full one, and fewer findings to resolve), +growing with the number of children. + +## Cost + +Medium: approval carry-over from children to parent in the review loop; tests with a decomposed fixture. + +## Notes + +- Related: Bean 0407 (approval keyed to the reviewable diff; its first child is PR #316), Bean 0446 (admission of split + parents), Bean 0474 (parent integration rejects append-only ledger merge, 5.5 min lost in the same parent run). diff --git a/.beans/holon-agentic-coder-ref-metadata-0480--a-network-outage-at-pre-flight-ends-the-flow-wrapp.md b/.beans/holon-agentic-coder-ref-metadata-0480--a-network-outage-at-pre-flight-ends-the-flow-wrapp.md new file mode 100644 index 00000000..cb6c9c57 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0480--a-network-outage-at-pre-flight-ends-the-flow-wrapp.md @@ -0,0 +1,100 @@ +--- +# holon-agentic-coder-ref-metadata-0480 +title: "A network outage at pre-flight ends the flow wrapper and the flow idles until someone relaunches it" +status: in-progress +type: bug +priority: high +tags: + - flow + - harness + - preflight + - resilience + - holon-agentic-coder +created_at: 2026-11-26T05:25:00Z +updated_at: 2026-11-26T08:49:00Z +--- + +## Problem + +The wrapper (`.agents/skills/holon_flow/scripts/run_holon_flow.py`) runs the engine pre-flight probe before every +relaunch, including every relaunch of the Stage 3 overlap poll. The probe retries a transient UNKNOWN only +`DEFAULT_MAX_ATTEMPTS = 3` times with a 2 s pause (`sandbox_executor/preflight.py:26-30,417-435`), so a network outage +of more than about three minutes ends the wrapper with exit 1. Nothing relaunches it: the flow sits idle until a person +or a later session notices. + +## Evidence + +Evidence: flow time audit of 2026-11-26 (git-ignored `todo/flow-time-audit-2026-11-26.md`, scripts and data in +`todo/flow-time-audit-2026-11-26/`), sample PRs #296 to #316 of holon-agentic-coder. + +- 2026-11-25 about 06:24Z (DNS outage): `ledger-fragments-and-promotion` (Bean 0371) was polling a Stage 3 overlap; the + relaunch printed "Pre-flight probe ... returned transient UNKNOWN on attempt 1/3 ... 2/3 ... UNKNOWN; The probe did + not finish within 60s" and exited. Next relaunch: 22:52:42Z, **16.5 h** later. +- The same outage failed the `workspace-survival-job-parallel` resolver at 06:29:51Z ("API Error: Can't reach the API + server ... ENOTFOUND", Bean 0424's class); its resume came at 23:11:31Z (**16.7 h**). The + `calibration-merge-adapted-file` resync at 07:01:44Z then hit "Docker daemon is not running" (Bean 0466's class) and + idled to 22:47:59Z. +- Idle after failures with no auto-resume is 2178 of 3260 measured flow-minutes in the sample (67 %): the time between a + failure and a manual relaunch (this outage, plus 3 h on PR #308 after a `gh pr diff` HTTP 406 discovery failure, Bean + 0433). + +## Proposed change + +1. The wrapper classifies a pre-flight UNKNOWN whose cause is connectivity (DNS failure, connection refused or reset, + probe timeout with no reply) as transient and waits with backoff (for example 30 s doubling to 5 min, up to 60 min), + re-probing, before it gives up. The overlap poll does not re-run the model probe at all when the previous launch + passed it less than an hour ago. +2. When it does give up, the wrapper exits with a distinct code that the flow supervisor (Bean 0396) treats as "relaunch + from checkpoint later", not as a terminal failure, and the log says so with a timestamp. +3. Same policy for the engine's role-container failures (Bean 0424) and the Docker probe (Bean 0466), so one outage + window is handled identically at every point of the flow. + +## Expected gain + +Turns a multi-hour idle after any outage into the outage's own length plus one backoff step. In this sample: about 16 h +on each of three flows. + +## Cost + +Small in the wrapper and `preflight.py` (classification and backoff loop); the supervisor hook depends on Bean 0396. + +## Notes + +- Not a duplicate of Bean 0393 (completed: 3 quick retries and the slow-exit OK case) or Bean 0466 (Docker probe only). +- One-off trigger (the outage), structural cost (no wait-and-resume). + +## Progress + +- 2026-11-26: in-progress. Flow `flow-preflight-outage-wait-resume` (intent + `todo/intent-0480-preflight-outage-wait-resume.json`, slug `preflight-outage-wait-resume`), pre-flight scope only + (wait and resume in `sandbox_executor/cli/preflight.py` via a new `preflight_outage.py`). Wrapper-side and stage-level + parts are not in this flow. +- 2026-11-26 07:10Z: flow `flow-preflight-outage-wait-resume` (intent slug `preflight-outage-wait-resume`) completed + Stages 1 to 5 with exit 0. PR #320, head 2ea483bb, consensus APPROVED 3/3 at review iteration 2 (iteration 1 + CHANGES_REQUESTED, fixed by the resolver), calibration report in the PR diff (EV 65.24), MERGEABLE/CLEAN. Human merge + pending. Scope: `cli/preflight.py`, new `preflight_outage.py`, new test file. The resolver also added a public + `is_model_error` to `sandbox_executor/preflight.py` (+4 lines, 548 to 552), outside the intent scope; it will trip the + frozen override once the module-budget PR lands, so rebase or adjust before merging that one. Still open after this + PR: the wrapper side (distinct exit code for a relaunch-later outcome, skipping the model probe in the overlap poll) + and stage-level outages (Bean 0424 territory). +- 2026-11-26 08:49Z: PR #320 merged into `main` (`0cd63e0`, 08:46:12Z). `install-holon` rebuilt the images and + reinstalled `holon` and `holon-coherence`. Flow worktree, its branches and `origin` branches removed. + +## Resolution + +Partly delivered via [PR #320](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/320), merged into `main` +(`0cd63e0`): + +- **Pre-flight outage wait** (`sandbox_executor/cli/preflight.py`, new `preflight_outage.py`): a pre-flight UNKNOWN + caused by DNS, connection refused or reset, network unreachable, Docker daemon or probe timeout is re-run with backoff + (30 s doubling to a 300 s cap, giving up after 3600 s cumulative). Auth, quota, expired-key, not-logged-in, + model-name, missing-CLI and unsupported-runner results never wait. A public `is_model_error` was added to + `sandbox_executor/preflight.py`. +- **Verification**: hermetic `test_preflight_outage.py`. Flow `flow-preflight-outage-wait-resume` completed Stages 1 to + 5 (consensus APPROVED 3/3 at review iteration 2). + +Still open (bean stays `in-progress`): + +- Wrapper side: `run_holon_flow.py` exits with a distinct "relaunch from checkpoint later" code when the wait gives up, + and the Stage 3 overlap poll skips the model probe when the previous launch passed it under an hour ago. +- Stage-level outages (Bean 0424 territory). diff --git a/.beans/holon-agentic-coder-ref-metadata-0481--a-flow-whose-intent-scope-overlaps-a-flow-in-fligh.md b/.beans/holon-agentic-coder-ref-metadata-0481--a-flow-whose-intent-scope-overlaps-a-flow-in-fligh.md new file mode 100644 index 00000000..2b645959 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0481--a-flow-whose-intent-scope-overlaps-a-flow-in-fligh.md @@ -0,0 +1,60 @@ +--- +# holon-agentic-coder-ref-metadata-0481 +title: + "A flow whose intent scope overlaps a flow in flight is launched anyway and holds a concurrency slot while it waits" +status: todo +type: feature +priority: high +tags: + - flow + - harness + - coordination + - admission + - holon-agentic-coder +created_at: 2026-11-26T05:25:00Z +updated_at: 2026-11-26T05:25:00Z +--- + +## Problem + +The harness backfills up to four concurrent flows (`.agents/coordination.md`, 4-flow cap, "honouring ... disjoint touch +sets (`run_holon_flow.py` waits out Stage 3 overlaps automatically)"). In practice disjointness is only checked by the +engine at Stage 3, after intent and plan have run, so a bean whose scope overlaps a flow in flight is started, plans, +and then occupies one of the four slots for hours while a disjoint ready bean waits. + +## Evidence + +Evidence: flow time audit of 2026-11-26 (git-ignored `todo/flow-time-audit-2026-11-26.md`, scripts and data in +`todo/flow-time-audit-2026-11-26/`), sample PRs #296 to #316 of holon-agentic-coder. + +- `macos-unit-only-when-relevant` (PR #315) planned at 2026-11-25 22:57-23:02Z, then waited at Stage 3 from 23:02:29Z to + 04:02:54Z (**300 min**, about 217 refused relaunches) behind the local flow `ledger-fragments-and-promotion`, mostly + on `.github/workflows/README.md` (one stretch on `tests/test_ci_bookkeeping_wiring.py`). +- Live on 2026-11-26: `flow-references-github-issues` and `split-calibration-package` both wait at Stage 3 behind the + local flow `no-unneeded-full-review` (calibration.py, flow/context.py); the first has waited 56+ min so far, the + second restarted from intent four times (Bean 0477). +- Admission and overlap waits are 343 of 3260 measured flow-minutes in the sample (p90 per flow 52 min, worst 300 min). + +## Proposed change + +1. Before launching a bean, the harness compares the intent's `scope` files with the touch sets of the flows in flight + (their plan files and checkpoints) and with the files of open flow PRs; an overlapping bean is not launched while a + disjoint ready bean exists. +2. A flow that is refused at Stage 3 releases its slot: it is parked (checkpoint kept, no wrapper process) and + relaunched from its checkpoint when the blocker merges; the freed slot backfills with the next disjoint bean. +3. The triage matrix shows parked flows and what blocks them. + +## Expected gain + +The 4 slots stay busy with work that can progress; in this sample about 5 h of one slot (PR #315) and about 1 h each of +two slots now. Does not shorten an individual flow; raises throughput. + +## Cost + +Small to medium in `run_holon_flow.py` and the backfill step of `post-pr-merge`/coordination rules. + +## Notes + +- Related: Bean 0395 (do useful work during the overlap wait), Bean 0410 (generated README files as conflict magnets: + the #315 wait was mostly on one), Bean 0463 (directory touch sets widen overlap), Bean 0476 (overlap poll relaunches + every minute), Bean 0477 (relaunch after overlap exit restarts from intent), Bean 0423 (shared flow registry). diff --git a/.beans/holon-agentic-coder-ref-metadata-0482--estimate-a-performance-changes-saving-from-history-be.md b/.beans/holon-agentic-coder-ref-metadata-0482--estimate-a-performance-changes-saving-from-history-be.md new file mode 100644 index 00000000..62396c1a --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0482--estimate-a-performance-changes-saving-from-history-be.md @@ -0,0 +1,42 @@ +--- +# holon-agentic-coder-ref-metadata-0482 +title: "Estimate a performance change's saving from history before launching its flow" +status: todo +type: task +priority: high +tags: + - harness + - flow + - performance + - process +created_at: 2026-11-26T05:30:00Z +updated_at: 2026-11-26T05:30:00Z +--- + +## Problem + +The first macOS-relevance gate flow (PR #315, closed 2026-11-26) ran about 6 h end to end and passed review and +calibration, but its own replay showed its neutral-list rule would have skipped the macOS leg on 0 of 74 merged PRs +(#241 to #314). It saves nothing on code PRs. The coordinator's intent left the form of the rule to the flow, so the +flow built a gate that could not pay off. The replacement flow is `macos-unit-sensitive-paths-only` (Bean 0400). + +## Proposed rule + +Add to the intent guidance in `.agents/holon-flow.md` and to the `holon_flow` skill: an intent whose goal is speed or +cost must + +- state the measured baseline and an expected saving computed from historical data (replay over recent merged PRs or CI + runs) before launch; +- have that measurement done by a cheap read-only subagent, not by the flow itself; +- include re-measuring the result in its acceptance criteria; +- fix the design choices that decide whether any saving exists (for example which paths skip a CI leg) instead of + leaving them to the flow. + +## Acceptance + +- The rule is in `.agents/holon-flow.md` and the `holon_flow` skill, short and token-cheap. +- A launch of a speed or cost intent without a baseline and expected saving is refused by the skill's checklist. + +## Notes + +- Evidence: PR #315 (closed), Bean 0400, flow time audit 2026-11-26 (`todo/flow-time-audit-2026-11-26.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0483--measure-runner-and-model-wall-time-on-comparable-fl.md b/.beans/holon-agentic-coder-ref-metadata-0483--measure-runner-and-model-wall-time-on-comparable-fl.md new file mode 100644 index 00000000..43b00808 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0483--measure-runner-and-model-wall-time-on-comparable-fl.md @@ -0,0 +1,32 @@ +--- +# holon-agentic-coder-ref-metadata-0483 +title: "Measure runner and model wall time on comparable flows to choose the default" +status: todo +type: task +priority: normal +tags: + - flow + - runners + - performance +created_at: 2026-11-26T05:30:00Z +updated_at: 2026-11-26T05:30:00Z +--- + +## Problem + +The flow time audit of 2026-11-26 cannot say which runner or model is fastest. claude-agent/opus flows #308 to #316 have +a median of 46 min active (p90 102). antigravity/gemini self-doc flows #296 to #307 have a median of 23.7 min. That is +not comparable work (different intent sizes and kinds), so there is no conclusion yet. + +## Proposal + +- Run a paired comparison: same-size intents, or the same intent run twice in dry-run, one per runner/model. +- Report wall time per stage and per role (planner, executor, reviewer, resolver). +- Record agent and model per turn in the ledger so the comparison can be read from data later. Bean 0412 covers the + related timing and token gaps in `executions.jsonl`. + +## Notes + +- Open contradiction on the default runner: Bean 0411 item 3 (`AGENTS.md` says `antigravity-agent` with `gemini-4-neon`; + recent practice is `claude-agent`). Linked, deliberately not resolved here. +- Source: `todo/flow-time-audit-2026-11-26.md` and its data directory. diff --git a/.beans/holon-agentic-coder-ref-metadata-0484--an-untracked-plans-i-directory-from-an-earlier-att.md b/.beans/holon-agentic-coder-ref-metadata-0484--an-untracked-plans-i-directory-from-an-earlier-att.md new file mode 100644 index 00000000..124b8acf --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0484--an-untracked-plans-i-directory-from-an-earlier-att.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0484 +title: "An untracked plans/I-*/ directory from an earlier attempt makes the planner refuse the workspace as uncommitted" +status: completed +type: bug +priority: normal +tags: + - flow + - planner + - worktree +created_at: 2026-11-26T06:00:00Z +updated_at: 2026-11-26T12:10:00Z +--- + +## Problem + +An aborted flow attempt can leave an untracked `plans/I--/` directory in the flow worktree. The planner then +treats the mounted workspace as uncommitted and refuses to plan, so a later attempt for the same intent fails for a +reason it did not cause. + +## Evidence + +- Flow `split-calibration-package`, run for intent `I-1795668981-split-calibration-package`, failed at the plan stage + (2026-11-26). +- Cause: the untracked `plans/I-1795668981-split-calibration-package/` directory left in the flow worktree made the + mounted workspace count as uncommitted. +- Cleanup for the three abandoned duplicate attempts (`I-1795665972`, `I-1795666365`, `I-1795668981`) removed their + remote intent and plan branches. No leftover untracked plan directory for them remained in the flow worktree. + +## Proposal + +Pick one, or both: + +- The wrapper or engine removes or ignores its own untracked plan artefacts from an aborted attempt before the planner's + cleanliness check runs. +- The cleanliness check ignores untracked paths owned by the flow (for example `plans//` for the intent being + run), so only foreign uncommitted changes block planning. + +## Notes + +- Related: bean 0360 (resume after interrupted plan stage creates duplicate plan branch) and bean 0374 (sidecar scratch + files committed to execution branch) touch the same abort and resume paths. +- Do not delete any `plans/I-*/` directory by hand. Verify it is untracked and from an aborted attempt first. + +- In progress (2026-11-26): flow `planner-ignores-aborted-plan-dir` (claude-agent, claude-opus-5-5); scope + `entrypoint/execution_workspace.py` plus a new test file. + +## Resolution + +Delivered via [PR #339](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/339) and merged into `main` +(`8ef1bfba`): + +- **Key Architectural Deliverables**: `validate_mounted_workspace` (`entrypoint/execution_workspace.py`) no longer + counts untracked files under the engine-owned `plans/I-*/` directory as uncommitted changes. Every other uncommitted + change is still refused with the same message. +- **Verification & Tests**: `tests/test_execution_workspace_untracked_plans.py`. +- **Holon Flow Traversal**: flow `planner-ignores-aborted-plan-dir` completed all 5 stages. Its worktree and `I-*` + branches were removed locally and on origin. diff --git a/.beans/holon-agentic-coder-ref-metadata-0485--flow-module-budget-intent-does-not-authorise-ci-hygiene-gate.md b/.beans/holon-agentic-coder-ref-metadata-0485--flow-module-budget-intent-does-not-authorise-ci-hygiene-gate.md new file mode 100644 index 00000000..147b4185 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0485--flow-module-budget-intent-does-not-authorise-ci-hygiene-gate.md @@ -0,0 +1,42 @@ +--- +# holon-agentic-coder-ref-metadata-0485 +title: "A flow's module_budget_change intent field does not clear the CI hygiene budget gate" +status: todo +type: bug +priority: high +tags: + - hygiene + - module-budget + - flow + - holon-agentic-coder +created_at: 2026-11-26T06:10:00Z +updated_at: 2026-11-26T06:10:00Z +--- + +## Problem + +Flow `module-line-budget-all-packages` (bean 0380, holon-agentic-coder half) carries the `module_budget_change` intent +field. The flow authorised the change to `holon-config/hygiene/module_budgets.json` and its PR (#317) passes the unit, +build, integration and analysis checks. The `hygiene (ubuntu-latest)` job still fails at "Check module budgets" with +"differs from the merge-base copy", because `scripts/module_budget_freeze.py` in CI only accepts the change when the +`module-budget-change` pull request label is set (or `HOLON_ALLOW_MODULE_BUDGET_CHANGE=1`). The intent field is not +carried to the CI job. + +## Expected + +Either the flow applies the CI authorisation (label or env) for an intent that carries `module_budget_change`, or the +flow stops with a clear "needs the module-budget-change label" notice before Stage 5, rather than leaving a PR whose +required check is red. The maintainer decides whether the label is added by hand. + +## Notes + +- Found while driving PR #317 (2026-11-26). The label was not applied by the agent: the label is the maintainer's + CI-side authorisation channel. + +## Correction (coordinator, 2026-11-26) + +The claim that CI does not read the label is wrong: `test-hygiene.yml` on `main` already passes the +`module-budget-change` label to `scripts/check_module_budgets.py` (see Bean 0486 resolution). What remains true and is +this bean's scope: the Stage 4 review loop has no input path for a maintainer decision (no PR comment or label is read), +so a decision such as "use a 400-line default" can only reach a running flow by stopping it and resuming with an amended +intent. diff --git a/.beans/holon-agentic-coder-ref-metadata-0486--ci-frozen-budget-check-fails-authorised-budget-change.md b/.beans/holon-agentic-coder-ref-metadata-0486--ci-frozen-budget-check-fails-authorised-budget-change.md new file mode 100644 index 00000000..8e677214 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0486--ci-frozen-budget-check-fails-authorised-budget-change.md @@ -0,0 +1,44 @@ +--- +# holon-agentic-coder-ref-metadata-0486 +title: "CI's frozen budget-config check fails an authorised module budget change, so its flow loops in review" +status: completed +type: bug +priority: high +tags: + - hygiene + - module-budget + - ci + - flow + - holon-agentic-coder +created_at: 2026-11-26T06:15:00Z +updated_at: 2026-11-26T06:15:00Z +--- + +## Problem + +PR #317 (bean 0380, flow `module-line-budget-all-packages`) changes `holon-config/hygiene/module_budgets.json` under the +maintainer's authorisation, carried in the intent's `module_budget_change` field. The flow's own guards honour that +field, but CI's `hygiene (ubuntu-latest)` step "Check module budgets" compares the file byte-for-byte with the merge +base and has no way to see the authorisation. It failed on all four PR heads (runs 45763358922, 45764785555, +45765449520, 45766269700), and the review loop reached iteration 8 because the resolver cannot make CI green without +weakening the guard or reverting the authorised change. + +## Proposed fix + +Give CI a verifiable signal for an authorised budget change, decided by the maintainer. Options: a PR label only the +maintainer applies; the check reading the PR's intent row (`module_budget_change`) from the ledger; or a signed commit +trailer. The review loop should also classify a failure the resolver must not fix as a halt-and-report, not another +iteration (see Bean 0407, Bean 0409). + +## Notes + +- Found 2026-11-26 while checking why #317 was on review iteration 8. + +## Resolution (2026-11-26) + +Not a code gap. `main` already wires the label: `.github/workflows/test-hygiene.yml` sets `MODULE_BUDGET_CHANGE_LABEL` +from the `module-budget-change` label and exports `HOLON_ALLOW_MODULE_BUDGET_CHANGE=1`. The label did not exist in the +repository and was not on #317. The coordinator created it and the maintainer's decision applied it on 2026-11-26. The +next hygiene run reported the change as a notice and failed only on two new modules over the 200-line default +(`scripts/macos_relevance.py`, `scripts/macos_relevance_rules.py`), which the 400-line default (Bean 0489, applied in +#317) resolves. Open follow-up: the flow's review loop has no channel for maintainer decisions (see Bean 0485 notes). diff --git a/.beans/holon-agentic-coder-ref-metadata-0487--overlap-wait-is-silent-in-the-flow-log.md b/.beans/holon-agentic-coder-ref-metadata-0487--overlap-wait-is-silent-in-the-flow-log.md new file mode 100644 index 00000000..5bdfaf32 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0487--overlap-wait-is-silent-in-the-flow-log.md @@ -0,0 +1,28 @@ +--- +title: "Overlap wait is silent in the flow log: the wrapper prints only 'exited with non-zero code 1' while it waits" +status: todo +type: bug +priority: normal +tags: + - harness + - holon-flow + - logging +created_at: 2026-11-26T06:16:00Z +updated_at: 2026-11-26T06:16:00Z +--- + +## Problem + +When Stage 3 admission is refused on a touch-set overlap, `scripts/run_holon_flow.py` waits for the overlapping pull +requests (poll every 60 s). During that wait the flow log `todo/flow-.log` holds only the line +`Holon flow exited with non-zero code 1.` and nothing that says the wrapper is waiting, which pull request it waits on, +or when it will re-check. The only evidence is the checkpoint's `admission` block and the live wrapper process. + +Seen on `macos-unit-sensitive-paths-only` (2026-11-26): refused against PR #315, log silent from 05:06Z to 06:13Z (wait +released when #315 closed, flow resumed at 16:13 local). + +## Goal + +- Log each overlap refusal (the overlapping PR numbers and files) and each poll result (state of each PR) to the flow + log, so the log shows the wait. +- Keep the wait behaviour unchanged. diff --git a/.beans/holon-agentic-coder-ref-metadata-0488--bean-progress-lists-a-non-flow-worktree-as-a-bean-row.md b/.beans/holon-agentic-coder-ref-metadata-0488--bean-progress-lists-a-non-flow-worktree-as-a-bean-row.md new file mode 100644 index 00000000..83df4db3 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0488--bean-progress-lists-a-non-flow-worktree-as-a-bean-row.md @@ -0,0 +1,22 @@ +--- +# holon-agentic-coder-ref-metadata-0488 +title: "bean-progress lists a non-flow worktree as a bean row" +status: todo +type: bug +priority: low +tags: + - harness + - bean-progress +created_at: 2026-11-26T06:20:00Z +updated_at: 2026-11-26T06:20:00Z +--- + +## Problem + +On 2026-11-26 `bean_progress.py` showed a row `— | HAC | audit test suite | Not started` for the temporary read-only +worktree `apps/holon-agentic-coder/audit-test-suite` (a detached checkout made by an audit subagent, not a flow). The +row has no bean id and its "last activity" is the newest commit on `main`. + +## Fix + +Only treat `flow-*` worktrees (or worktrees with a flow checkpoint) as in-flight flows; ignore other worktrees. diff --git a/.beans/holon-agentic-coder-ref-metadata-0489--module-budget-default-400-stepping-down-by-50-to-250.md b/.beans/holon-agentic-coder-ref-metadata-0489--module-budget-default-400-stepping-down-by-50-to-250.md new file mode 100644 index 00000000..c50d42ce --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0489--module-budget-default-400-stepping-down-by-50-to-250.md @@ -0,0 +1,147 @@ +--- +# holon-agentic-coder-ref-metadata-0489 +title: "Module line budget: default 400 for now, then step down by 50 per pull request to 250, decomposing at each step" +status: in-progress +type: task +priority: high +tags: + - hygiene + - module-budget + - architecture + - refactoring + - holon-agentic-coder +created_at: 2026-11-26T06:30:00Z +updated_at: 2026-11-26T21:05:09Z +blocked_by: + - "0380" +--- + +## Instruction (maintainer, 2026-11-26) + +"Bump up the budget to 400 for now. There will be multiple PRs that will decrease the budget by 50. Each time the budget +is hit you will make a change to decompose the files, until the budget of 250 is achieved." + +This is the maintainer's explicit authorisation to change `holon-config/hygiene/module_budgets.json` for this schedule +only; each flow's intent carries it in the `module_budget_change` field, and each pull request needs the +`module-budget-change` label (applied by the maintainer) for CI to accept the change (Bean 0486). + +## Plan + +One pull request per step, each a separate holon flow, in order: + +| Step | Default budget | Work in the pull request | +| :--- | -------------: | :------------------------------------------------------------------------------------- | +| 1 | 400 | Raise the default from 200 to 400; drop every override at or below 400 (now redundant) | +| 2 | 350 | Lower the default to 350; decompose every module between 351 and 400 lines | +| 3 | 300 | Lower the default to 300; decompose every module between 301 and 350 lines | +| 4 | 250 | Lower the default to 250; decompose every module between 251 and 300 lines (target) | + +- A step that would touch too many modules for one flow is split into several flows (decomposition first, then the + budget change), each with a file-level scope. +- Decomposition is move-only where possible (like the `flow/` and `cli/` splits), keeps public imports working, and puts + no logic in `__init__.py` (Bean 0379). +- Every step re-measures: module count over the new default before and after, and the largest remaining modules. +- Overrides only ratchet down at every step; none is ever raised or added. + +## Open question for the maintainer + +Modules far over 400 (for example `calibration.py` about 1,600 lines, `review_ensemble.py` about 990, `env_registry.py` +about 930, `turns.py` about 890) keep frozen ratchet-down overrides from Bean 0380. Should each step also bring them +under the new default, or do they stay on their overrides and get their own decomposition beans (for example Bean 0197 +for `calibration.py`)? Default assumed here: they stay on overrides and are handled by their own beans. + +## Dependencies + +- Starts after Bean 0380 (PR #317: discovery-based coverage, overrides frozen at current size) merges, since step 1 + edits the configuration that pull request introduces, and after Bean 0486 (CI honours the label). +- Related: Bean 0340 (revisit the 200-line default), Bean 0197 (split `calibration.py`). + +## Flow + +in-progress 2026-11-26T08:31:01Z: holon flow `module-budget-default-400` (step 1, default 400), runner claude-agent / +claude-opus-5-5, log `todo/flow-module-budget-default-400.log`, intent `todo/intent-0489-module-budget-default-400.json` +(scope adds docs/architecture.md, which states the 200-line default). + +PR #326 opened by flow `module-budget-default-400` (2026-11-26T08:42:18Z). Needs the maintainer's `module-budget-change` +label for CI hygiene to accept the budget change; not applied by the agent. + +flow `module-budget-default-400` completed 2026-11-26T09:51:05Z: PR #326 (head 532f3834, base main), MERGEABLE/CLEAN, +label `module-budget-change` applied by the maintainer (not by the agent), review consensus APPROVED on iteration 8 +(iterations 1-7 blocked on the label, same as bean 0497), calibration included (EV predicted 64.59 in state file). +Overrides 61 -> 24: 37 removed (all at or below 400), 24 kept (all above 400, unchanged). Next step's decomposition set: +5 modules at 351-400 (knowledge/wisdom.py 353, budgets.py 359, flow/git_refs.py 380, scripts/pre_commit_check.py 381, +cli/commands/flow.py 398). Scope note: the flow also edited holon-config/prompts/planner.template.md (stale "default +200" text), outside the intent scope. Status stays in-progress until the maintainer merges. + +Step 1 merged: PR #326 merged into `main` (`67f6ea89`, 2026-11-26T09:51:19Z). Default raised 200 to 400; overrides 61 to +24 (37 removed, all at or below 400; the 24 kept are all above 400 and unchanged). The flow also edited +`holon-config/prompts/planner.template.md` (stale "default 200" wording), outside the intent scope. Post-merge: +`install-holon` rebuilt all images and reinstalled `holon` and `holon-coherence`; the flow worktree and the intent's +branches were removed. + +Step 2 set (default 350, decompose the modules between 351 and 400): `knowledge/wisdom.py` 353, +`sandbox_executor/budgets.py` 359, `flow/git_refs.py` 380, `scripts/pre_commit_check.py` 381, `cli/commands/flow.py` 398 +lines on `main` (measured 2026-11-26; the flow's own count matches). + +2026-11-26T09:55:25Z: in-progress, holon flow `module-budget-default-350` (step 2, default 350), runner claude-agent / +claude-opus-5-5, log `todo/flow-module-budget-default-350.log`, intent `todo/intent-0489-module-budget-default-350.json` +(scope adds the new split modules). + +2026-11-26T10:01:04Z: parked: Stage 3 admission refused (touch set overlaps local flow `no-unneeded-full-review`, branch +I-1795665991-no-unneeded-full-review, on apps/sandbox-executor/src/sandbox_executor/budgets.py); flow +`module-budget-default-350` kept its worktree `flow-module-budget-default-350` and checkpoint; resume from checkpoint +(--checkpoint, never relaunch without it) once that flow merges or releases budgets.py. + +- 2026-11-26T12:10Z: PR #335 merged to `main` (`f0d6c56d`). + `apps/sandbox-executor/src/sandbox_executor/flow/github/ci_final_head.py` is now 368 lines (wc -l on `main`), above + the step-2 default of 350. Add it to the step-2 split set (`module-budget-default-350`, parked; resume from + checkpoint). The step-2 set on `main` is then: `knowledge/wisdom.py` 353, `sandbox_executor/budgets.py` 359, + `flow/git_refs.py` 380, `cli/commands/flow.py` 398, `flow/github/ci_final_head.py` 368. + +## Flow log (2026-11-27, parked) + +- Retired the stale attempt (worktree `flow-module-budget-default-350`, local and remote + `I-1795686809-module-budget-default-350/*` branches; no PR, nothing unique beyond its plan). +- Launched a fresh step-2 flow from `todo/intent-0489-module-budget-default-350.json` (six modules, plus + `ci_final_head_seams.py` and `ci_final_head_rerun.py` for `ci_final_head.py`; `module_budget_change` kept). Intent and + plan stages passed (plan EV 36.6). +- Stage 3 refused on a touch-set overlap with flow `I-1795665991-no-unneeded-full-review` on `budgets.py`. Run stopped + with `--no-wait-on-overlap`; `--allow-overlap` not used. Parked: + `parked 2026-11-27: blocked by flow no-unneeded-full-review (PR #334, merged 2026-11-26) on budgets.py`. +- The blocker has since merged, but the flow worktree and its checkpoint no longer exist (I-/P- branches also gone; the + intent and plan commits survive as unreferenced objects). Resuming needs a maintainer or coordinator decision on a + fresh launch without a checkpoint. +- No PR yet, so the `module-budget-change` label has not been requested. Bug logged as bean 0519. + +- 2026-11-26T20:59:26Z: resumed: holon flow `module-budget-default-350` (step 2, default 350) from checkpoint (execute + stage), runner claude-agent / claude-opus-5-5. Blocker PR #342 merged (57a8aa38, 2026-11-26T20:58:42Z). + Module-budget-change label: required for CI on the PR; noted here, not applied by the agent. +- 2026-11-26T21:00:28Z: parked: Stage 3 admission refused on overlap with PR #349 (branch + I-1795704651-kb-wisdom-deterministic-files) on apps/sandbox-executor/src/sandbox_executor/knowledge/wisdom.py. + Worktree flow-module-budget-default-350 and checkpoint kept; resume from checkpoint (--checkpoint, never relaunch + without it) once PR #349 merges or releases wisdom.py. + +## Note (coordinator, 2026-11-26 21:05Z) + +After PR #347 split `calibration.py` into the `calibration/` package, `holon-config/hygiene/module_budgets.json` still +carries an override `calibration.py: 1608` for a file that no longer exists. Removing a dead override is a budget-file +change, so it belongs to this bean's authorised schedule: drop it in the next budget step (step 2 if its plan can take +it, otherwise step 3), and have the budget check flag overrides whose file is gone. + +- 2026-11-26T21:04Z: resumed: holon flow `module-budget-default-350` (step 2, default 350) from checkpoint (execute + stage), runner claude-agent / claude-opus-5-5, log `todo/flow-module-budget-default-350.log`. Blocker PR #349 merged + (2c865160, 2026-11-26T21:03:27Z); PR #346 merged (aa085c38). Module-budget-change label: required for CI on the PR; + noted here, not applied by the agent. Worktree was behind main (3e83fadc vs 2c865160); the flow engine owns any sync. +- 2026-11-26T21:05Z: parked again: Stage 3 admission refused on overlap with local flow `single-runner-per-checkpoint` + (branch I-1795685390-single-runner-per-checkpoint/P-1795704471-CLA-CO5.5/_, worktree + flow-single-runner-per-checkpoint, still running) on apps/sandbox-executor/src/sandbox_executor/flow/lazy_exports.py. + Worktree flow-module-budget-default-350 and checkpoint kept; resume from checkpoint (--checkpoint, never relaunch + without it) once that flow merges or releases lazy_exports.py. Also: wisdom.py overlap with #349 cleared (PR #349 + merged 2026-11-26T21:03:27Z). + +## Note (post-merge of PR #346, 2026-11-26T21:05:09Z) + +PR #346 (merged `aa085c3`) takes `scripts/ci_bookkeeping_api.py` to 383 lines (`wc -l` on `main`), above the step-2 +default of 350. The parked step-2 plan was made before #346 and does not cover it. When step 2 resumes, its review loop +will hit a hygiene failure on that file. The fix is to split it (move-only), not an override. Add it to the step-2 split +set. diff --git a/.beans/holon-agentic-coder-ref-metadata-0490--holon-flow-resume-silently-ignores-an-amended-intent-file.md b/.beans/holon-agentic-coder-ref-metadata-0490--holon-flow-resume-silently-ignores-an-amended-intent-file.md new file mode 100644 index 00000000..33460338 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0490--holon-flow-resume-silently-ignores-an-amended-intent-file.md @@ -0,0 +1,29 @@ +--- +# holon-agentic-coder-ref-metadata-0490 +title: "holon flow resume with --checkpoint silently ignores an amended intent file" +status: todo +type: bug +priority: high +tags: + - holon-flow + - engine + - resume + - holon-agentic-coder +created_at: 2026-11-26T06:35:00Z +updated_at: 2026-11-26T06:35:00Z +--- + +## Problem + +`holon flow --checkpoint ` (cli/commands/flow.py, `_resolve_checkpoint_and_intent`) loads the +checkpoint context and sets `intent_data = {}`: the intent file argument is ignored without a warning or an error. A +maintainer amendment to the goal (bean 0380: default 200 -> 400, 2026-11-26) therefore cannot reach a resumed flow. The +plan (Stage 2) and execution (Stage 3) branches, the intents ledger row and the checkpoint's `intent_data` all keep the +old goal, and `--from-stage plan|execute` reuses the checkpointed branches rather than amending them. + +## Wanted + +One supported path to amend a flow's intent: either refuse an intent file that differs from the checkpoint's +`intent_data` with a clear message, or (preferred) `--amend-intent` that records the amended intent as a new append-only +ledger row, updates the checkpoint, and re-runs plan and execute on the SAME PR branch lineage so Stage 4 re-reviews. +Until then an amended intent needs a fresh flow, which opens a new PR. diff --git a/.beans/holon-agentic-coder-ref-metadata-0491--subset-test-run-loses-flow-repos-fixture.md b/.beans/holon-agentic-coder-ref-metadata-0491--subset-test-run-loses-flow-repos-fixture.md new file mode 100644 index 00000000..e6652264 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0491--subset-test-run-loses-flow-repos-fixture.md @@ -0,0 +1,51 @@ +--- +# holon-agentic-coder-ref-metadata-0491 +title: "Running a subset of unit test files loses the flow_repos fixture" +status: todo +type: bug +priority: normal +tags: + - tests + - holon-agentic-coder +created_at: 2026-11-26T07:10:00Z +updated_at: 2026-11-26T13:41:00Z +--- + +## Problem + +Found in the test suite audit of 2026-11-26 (main `412bed21`). Running the 20 files listed in +`todo/test-suite-audit-2026-11-26/serial-top20-files.txt` together (serially with `-p no:xdist` or with `-n 6`) gives +`fixture 'flow_repos' not found` for 48 tests (`tests/flow/stages/test_children.py`, `test_plan_decision.py`, +`test_plan_resume_adopts_branch.py`, `test_integration.py` and `tests/flow/test_git_refs.py`) and 5 failures in +`tests/flow/review/test_conflict_gate.py` and `tests/flow/test_pipeline.py`. Each file alone passes, and so does the +full unit selection. Logs: `todo/test-suite-audit-2026-11-26/serial-top20-rerun.log`, `gitphase-run.log`. + +## Why it matters + +Flows that re-measure only their in-scope files (every test-speed intent) hit false failures, and the order dependence +it reveals (bean 0386) can hide a real one. + +## Further evidence (PR #332, bean 0511, scrapped as a duplicate) + +Batch 2 of bean 0405 (flow `tests-fewer-git-stage-pipeline`) hit the same defect with a different file set: when +`apps/sandbox-executor/tests/flow/stages/test_replan_request.py` is listed after a parent-directory file that follows +other `stages/` files (for example `stages/test_children.py flow/test_git_refs.py stages/test_replan_request.py`), its +eight cases error with "fixture 'no_origin_reconcile' not found", serially and under xdist. Listing the `stages/` files +contiguously, or a full-directory run, passes. The same order dependence (a fixture visible only to some argument +orders) points to conftest discovery as the cause, so the fix should cover both fixtures. + +## Next step + +Bisect the file list to the pair that triggers it (conftest discovery order or a module that imports a test module and +shadows `tests.flow`), then fix it in the Holon flow. + +## Flow + +Launched 2026-11-26 as flow `flow-fixtures-any-test-file` (claude-agent, claude-opus-5-5), worktree +`flow-flow-fixtures-any-test-file`, log `todo/flow-flow-fixtures-any-test-file.log`. Intent scope: the three conftest +files plus one new regression test. The slug was truncated to 32 characters (Bean 0426). + +**Parked 2026-11-26T13:39Z:** Stage 3 refused the flow: the touch set overlaps the waiting +`single-runner-per-checkpoint` flow on `apps/sandbox-executor/tests/conftest.py`. Intent kept as +`todo/intent-0491-flow-fixtures-any-test-file-subset.json`; relaunch (checkpoint resume) once that flow merges. See Bean +0519 for the vanishing worktree after a refusal. diff --git a/.beans/holon-agentic-coder-ref-metadata-0492--flow-edits-outside-intent-scope-and-review-passes-it.md b/.beans/holon-agentic-coder-ref-metadata-0492--flow-edits-outside-intent-scope-and-review-passes-it.md new file mode 100644 index 00000000..df9a5d9c --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0492--flow-edits-outside-intent-scope-and-review-passes-it.md @@ -0,0 +1,33 @@ +--- +# holon-agentic-coder-ref-metadata-0492 +title: "A flow edited a file outside its intent scope and the review passed it" +status: todo +type: bug +priority: normal +tags: + - flow + - scope + - holon-agentic-coder +created_at: 2026-11-26T07:12:00Z +updated_at: 2026-11-26T07:12:00Z +--- + +## Problem + +The flow for intent `timing-gate-runner-variance` (PR #321 on holon-agentic-coder) declared four files in its intent +scope. Its pull request also changed `apps/sandbox-executor/src/sandbox_executor/flow/github/ci_failure_detail.py`, +which is not in the scope. The change itself is reasonable (it recognises the bare `Timing gate` step name used by the +Workspace survival job), but the flow edited the file without it being declared, Stage 3 and Stage 4 did not stop it, +and the approval covered it. Found 2026-11-26 while verifying PR #321 after its flow completed. + +## Why it matters + +Intent scope is what admission uses to decide overlaps with other flows in flight. An undeclared file in a pull request +can overlap a flow that was admitted on the declared scope, so the admission decision no longer holds for the PR as +written. + +## Next step + +Find where the execute-stage touch set is checked against the intent scope (and why the review did not reject the extra +path), then make an edit outside the declared scope fail Stage 3 or Stage 4 unless the plan declares it. Check whether +PR #321 should be re-scoped or the file added to the intent scope before the maintainer merges. diff --git a/.beans/holon-agentic-coder-ref-metadata-0493--approved-pr-goes-stale-when-main-tightens-budgets.md b/.beans/holon-agentic-coder-ref-metadata-0493--approved-pr-goes-stale-when-main-tightens-budgets.md new file mode 100644 index 00000000..5a382003 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0493--approved-pr-goes-stale-when-main-tightens-budgets.md @@ -0,0 +1,37 @@ +--- +# holon-agentic-coder-ref-metadata-0493 +title: "An approved PR shows CLEAN but breaks main's hygiene after a budget-tightening merge" +status: todo +type: bug +priority: high +tags: + - flow + - ci + - module-budget + - holon-agentic-coder +created_at: 2026-11-26T07:55:00Z +updated_at: 2026-11-26T07:55:00Z +--- + +## Problem + +PR #317 (merged 2026-11-26 07:50Z) froze module line budgets on every package. Two PRs that were already approved, +calibrated and `MERGEABLE`/`CLEAN` with green CI would have turned `main`'s hygiene check red if merged: #320 grows +`sandbox_executor/preflight.py` to 552 lines (frozen at 548) and #321 makes `flow/github/ci_final_head.py` 328 lines +(frozen at 299). GitHub reported both as clean because there was no textual conflict, and their CI had run against the +old base. Nothing in the flow or the harness flagged them; the coordinator first called #321 ready without checking. + +## Proposed fix + +- After any merge that changes `holon-config/hygiene/module_budgets.json` (or any lint/hygiene configuration), every + open flow PR is re-checked against the new `main`: run the budget check on the PR head merged with `main`, and re-run + the flow from review for each PR that fails. +- The `post-pr-merge` skill lists open PRs that the merge makes stale and resyncs them. +- Long term: CI requires the PR branch to be up to date with `main` for hygiene, or runs a merge-queue style check. + +- 2026-11-26T12:10Z: after #335, #337, #338, #339 merged, re-checked open PRs #334, #340, #341 and the parked flow + worktrees against `main` (merge-tree and budget limits): no conflicts; no source module over its limit. #334 adds test + modules over 400 lines (tests are not budgeted). +- 2026-11-26T13:35Z: after #345 merged, re-checked open PRs #342, #344, #346 and the live and parked flow worktrees + against `main` (`git merge-tree`, budget file touch): all clean merges; none changes + `holon-config/hygiene/module_budgets.json`, and no budget file changed on `main` since #326. No budget impact. diff --git a/.beans/holon-agentic-coder-ref-metadata-0494--approval-withdrawn-on-stale-fingerprint-then-re-reported.md b/.beans/holon-agentic-coder-ref-metadata-0494--approval-withdrawn-on-stale-fingerprint-then-re-reported.md new file mode 100644 index 00000000..45d44d51 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0494--approval-withdrawn-on-stale-fingerprint-then-re-reported.md @@ -0,0 +1,34 @@ +--- +# holon-agentic-coder-ref-metadata-0494 +title: "A fresh iteration-4 approval was withdrawn at the merged-head gate on a stale fingerprint and then re-reported" +status: todo +type: bug +priority: normal +tags: + - flow + - review + - holon-agentic-coder +created_at: 2026-11-26T08:30:00Z +updated_at: 2026-11-26T08:30:00Z +--- + +## Problem + +Flow for intent `timing-gate-runner-variance` (PR #321) re-ran from `--from-stage review` on head f79e57f7 (main merged +in). The review loop reached 3/3 approval at iteration 4 on head f2f0b8da, but the approval was posted through the +fallback review-comment path (HTTP 422 on self-approval), so its approval fingerprint was not refreshed. Stage 5's +merged-head gate then compared it with the fingerprint recorded for the older approval on 8cd7d557 and withdrew it: +"PR-own change changed since approval". The only later commits were ledger, KB and calibration files. The wrapper then +printed "Stage 4 approved (0/0/0)" four seconds later without a fresh review. + +## Why it matters + +The gate withdrew a valid approval, and the re-approval that followed came without evidence that the withdrawal was +resolved. The state is correct only because the PR-own diff after f2f0b8da is ledger/KB/calibration only, which was +checked by hand. A future run could take either path with no clear record of which approval covers the head. + +## Next step + +Record the approval fingerprint when a review is approved through the fallback comment path, and make the wrapper log +which approval (iteration, head, fingerprint) covers the final head. Check that a withdrawal followed by an immediate +approval does not reuse verdicts from before the withdrawal. diff --git a/.beans/holon-agentic-coder-ref-metadata-0495--flow-resume-log-silent-and-calibrate-budget-counts-ci-wait.md b/.beans/holon-agentic-coder-ref-metadata-0495--flow-resume-log-silent-and-calibrate-budget-counts-ci-wait.md new file mode 100644 index 00000000..48067b49 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0495--flow-resume-log-silent-and-calibrate-budget-counts-ci-wait.md @@ -0,0 +1,32 @@ +--- +# holon-agentic-coder-ref-metadata-0495 +title: "Resumed flow wrote no progress to its log, and Stage 5 overran its budget by counting the CI wait" +status: todo +type: bug +priority: normal +tags: + - flow + - logs + - holon-agentic-coder +created_at: 2026-11-26T08:30:00Z +updated_at: 2026-11-26T08:30:00Z +--- + +## Problem + +While resuming PR #320 (preflight-outage-wait-resume) from `--from-stage review` with a checkpoint, two things were +observed. Both were seen once; the cause of the first is not confirmed. + +1. The resumed `run_holon_flow.py` process, launched with `>> todo/flow-.log 2>&1`, wrote nothing to that log for + about 35 minutes while review and calibration ran (file size and mtime unchanged). Progress was only visible in the + flow worktree's commits and the background task output. Likely cause: the wrapper's stdout is block-buffered + (PYTHONUNBUFFERED is set only for the `holon flow` child), but this is unverified. +2. Stage 5 logged `WARNING: Stage 'calibrate' ran 13.9 min against its 10 min budget; keeping its 'success' result.` + Roughly 13 of those minutes were the Stage 4 CI wait (about 780 s) performed inside calibration, so the budget figure + counts a wait the stage does not own. + +## Next step + +Confirm whether the wrapper's stdout is flushed (run with and without PYTHONUNBUFFERED=1 and compare the log). Decide +whether the calibrate budget should exclude the CI wait, and log that wait as its own stage line. Found 2026-11-26 while +resuming PR #320. diff --git a/.beans/holon-agentic-coder-ref-metadata-0496--run-holon-flow-log-stays-empty-until-flow-exits.md b/.beans/holon-agentic-coder-ref-metadata-0496--run-holon-flow-log-stays-empty-until-flow-exits.md new file mode 100644 index 00000000..e09bd057 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0496--run-holon-flow-log-stays-empty-until-flow-exits.md @@ -0,0 +1,37 @@ +--- +# holon-agentic-coder-ref-metadata-0496 +title: "run_holon_flow.py writes nothing to its log file until the flow exits" +status: scrapped +type: bug +priority: normal +tags: + - flow + - harness + - logs +created_at: 2026-11-26T08:29:54Z +updated_at: 2026-11-26T08:29:54Z +--- + +## Problem + +Launched `scripts/run_holon_flow.py` for intent `tests-fewer-git-worktree-exec` with stdout and stderr redirected to +`todo/flow-tests-fewer-git-worktree-exec.log`. The file stayed at 0 bytes for the whole run (about 1 h 15 min, through +Stage 2 to Stage 5). Its contents appeared only when the process exited. Progress could only be followed through the +flow worktree's checkpoint file and git log, so a stall could not be seen from the log. + +## Why it matters + +The log is the first place a stall, a quota wait or an overlap refusal shows up. An empty log for the whole run hides +those states from whoever is monitoring, and the parked-flow rule depends on seeing the refusal promptly. + +## Next step + +Check whether the wrapper's output is block-buffered when redirected to a file (PYTHONUNBUFFERED is set only for the +flow process, not for the wrapper), and make the wrapper flush each stage line as it prints. Add a test that a stage +transition reaches the log file before the flow exits. + +Found 2026-11-26 while running the batch 3 flow (bean 0405). + +## Scrapped (coordinator, 2026-11-26) + +Duplicate of Bean 0385 (flow log file stays empty until the run ends). Its evidence is folded into 0385. diff --git a/.beans/holon-agentic-coder-ref-metadata-0497--review-loop-reruns-the-ensemble-on-a-ci-failure-the-resolver-says-is-not-fixable-in-code.md b/.beans/holon-agentic-coder-ref-metadata-0497--review-loop-reruns-the-ensemble-on-a-ci-failure-the-resolver-says-is-not-fixable-in-code.md new file mode 100644 index 00000000..9806d835 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0497--review-loop-reruns-the-ensemble-on-a-ci-failure-the-resolver-says-is-not-fixable-in-code.md @@ -0,0 +1,60 @@ +--- +# holon-agentic-coder-ref-metadata-0497 +title: "Review loop re-runs the full ensemble 9 times on a CI failure the resolver reported as not fixable in code" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - review + - resolver + - churn +created_at: 2026-11-26T08:55:00Z +updated_at: 2026-11-26T08:55:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26 (fifth merge). Flow `module-line-budget-all-packages` (PR #317, +`todo/flow-module-line-budget-all-packages.log`): iterations 1 to 9 (05:16:53Z to 06:22:10Z, 65 min of a 112 min review +loop, 12 iterations in all) each ran 3 reviewers (about 3.7 min), a resolver turn, a ledger commit and a push. From +iteration 1 the resolver's own finding evidence said the same thing every time: the hygiene job fails only because the +frozen budget file differs from the merge base and the PR lacks the maintainer label; "no code fix exists". Its finding +`recommendation` stayed the boilerplate "Run linters and tests locally, apply fixes, and commit the changes", and +disposition stayed `open`. Every ledger-row push restarted the pipeline (PR #317: 100 workflow runs, 14 failures, 16 +cancelled, 70 successes). Iteration 9 also found a second, fixable cause (branch behind main, missing the #319 scripts) +that no earlier iteration acted on. The end state (pipeline passes, consensus passes) was reached only once an +authorisation was supplied at iteration 10. + +Related: 0485/0486 (the cause), 0409 (resolver pass that changed nothing), 0407 (scoped re-review). This bean is the +loop-level guard none of them states: they remove one cause; the loop would repeat for the next unfixable cause. + +## Proposed change + +- The resolver result carries a `blocked_on` field (`authorisation`, `external`, `behind-main`, `none`) in place of the + generic recommendation. +- When the previous iteration's resolver pushed no code change and the failing check set and evidence are unchanged, the + loop does not start the ensemble. It waits on the cheap condition (label present, env set, main merged) at a fixed + poll, with a cap of 2 repeats, then reports the stuck cause in the flow log. +- `behind-main` is handled by the engine (merge origin/main, push once) before the next review, not left to a reviewer + note. + +## Expected gain and cost + +About 8 iterations x 10.8 min (audit of 2026-11-26 blocked-iteration cost) = about 85 min and 8 pipeline restarts on +that flow, plus roughly 24 reviewer-agent turns. Cost: one result field, one loop guard, tests; no change to approval +semantics. + +## Recurrence (2026-11-26, flow module-budget-default-400, PR #326) + +Three reviewers APPROVED with 0 open findings on each of 7 iterations; the consensus stayed CHANGES_REQUESTED and the +loop hit its 7/7 cap because `hygiene (ubuntu-latest)` stayed red: the `module-budget-change` label, which only the +maintainer applies, was not set. Same class as bean 0486. + +## Recurrence (audit 2026-11-26T10:50Z) + +#326: 9 review iterations; iterations 2 to 8 (7 iterations, about 55 min, 08:55Z to 09:50Z) had 3/3 APPROVED with 0 +findings while the container verdict stayed CHANGES_REQUESTED because `hygiene (ubuntu-latest)` was red on every head. 7 +of the 20 review iterations across the six flows were this churn; #325 and #331 each also lost an iteration to +`local_tests` CI failures. diff --git a/.beans/holon-agentic-coder-ref-metadata-0498--live-tree-budget-unit-test-duplicates-the-hygiene-gate-and-fails-every-open-pr-after-a-budget-merge.md b/.beans/holon-agentic-coder-ref-metadata-0498--live-tree-budget-unit-test-duplicates-the-hygiene-gate-and-fails-every-open-pr-after-a-budget-merge.md new file mode 100644 index 00000000..df743543 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0498--live-tree-budget-unit-test-duplicates-the-hygiene-gate-and-fails-every-open-pr-after-a-budget-merge.md @@ -0,0 +1,44 @@ +--- +# holon-agentic-coder-ref-metadata-0498 +title: + "A unit test measures the live tree against the live budget file, so it duplicates the hygiene gate in three jobs and + fails every open PR after a budget merge" +status: todo +type: bug +priority: high +tags: + - tests + - ci + - module-budgets + - holon-agentic-coder +created_at: 2026-11-26T08:55:00Z +updated_at: 2026-11-26T08:55:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26. PR #317 merged at 07:50:13Z (discovery-based budgets for all packages). Within 1 to +13 min the pipelines of the open PRs #320, #321 and #323 failed in `Test - Unit`, `Test - Stress` and `Test - Hygiene` +at 07:50:57Z, 07:52:52Z and 07:52:54Z. For #320 and #321 the unit failure is +`apps/sandbox-executor/tests/flow/test_module_budgets.py::test_the_live_configuration_passes_against_the_real_tree` +(`assert 1 == 0`) on ubuntu and macOS, so a check the hygiene job already runs (`scripts/check_module_budgets.py`) fails +again inside the unit selection, which runs in unit ubuntu, unit macOS and the Workspace survival child. #320 and #321 +were re-approved at 08:13Z and 08:12Z after their approvals at 07:05Z and 07:06Z, so one merge cost them about 1 h of +rework each (see 0493/0494 for the approval side). + +## Problem + +A unit test that reads the repository's real tree and real configuration is not a unit test: its result depends on every +other open change, and it repeats a gate that already exists. Any module that grows by a line on a branch, or any main +merge that tightens a limit, fails 3 jobs (about 3 + 6 + 5 min of runner time) for one cause. + +## Proposed change + +Run the budget script against a synthetic tree in the unit test (keep that), and drop the real-tree case from the unit +selection; hygiene remains the one gate on the real tree. Add a rule to the test standards: a unit test never asserts a +property of the live checkout. + +## Expected gain and cost + +Removes 3 duplicate failing jobs per budget-tightening merge per open PR (here 3 PRs, 9 jobs). Cost: one test deleted or +rewritten; no coverage lost because hygiene runs the same script on every PR. diff --git a/.beans/holon-agentic-coder-ref-metadata-0499--calibration-report-records-ci-run-count-review-iterations-and-which-were-churn.md b/.beans/holon-agentic-coder-ref-metadata-0499--calibration-report-records-ci-run-count-review-iterations-and-which-were-churn.md new file mode 100644 index 00000000..36cca0f2 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0499--calibration-report-records-ci-run-count-review-iterations-and-which-were-churn.md @@ -0,0 +1,35 @@ +--- +# holon-agentic-coder-ref-metadata-0499 +title: "Calibration report records, per flow, CI runs, review iterations and how many were churn" +status: todo +type: task +priority: normal +tags: + - flow + - stage-5 + - calibration + - measurement +created_at: 2026-11-26T08:55:00Z +updated_at: 2026-11-26T08:55:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26. The audit rules require, per flow, the number of pipeline runs and review iterations +needed to reach both passes, and how many were caused by churn rather than a defect. No flow records it. This audit had +to rebuild it from `gh run list` and the flow logs: PR #317 100 runs and 12 iterations, #320 66 runs and 2 approvals, +#321 66 and 2, #323 31 and 1, #319 42 and 1, #314 30 and 1. The distinction between churn and defect (ledger-only push, +main moved, unfixable-by-code finding, nit-only iteration) is visible to the engine at the time and lost afterwards. +Related: 0412 (step timing), 0443 (cancelled runs), 0495 (Stage 5 budget). + +## Proposed change + +At Stage 5 write to the calibration report (and the executions ledger row) a small table: workflow runs by conclusion +(success, failure, cancelled), review iterations, and for each blocked iteration a reason class from a fixed list +(defect, nit-only, ci-authorisation, ci-flake, main-moved, no-new-head, other). Counting uses data the loop already +holds; nothing new is fetched except one `gh run list` call. + +## Expected gain and cost + +Makes the next audit's churn count a read instead of a reconstruction, and lets a future gate warn when churn exceeds a +threshold. Cost: about 100 lines plus a test; no effect on the critical path. diff --git a/.beans/holon-agentic-coder-ref-metadata-0500--bean-progress-shows-one-row-per-bean-hiding-parallel-flows.md b/.beans/holon-agentic-coder-ref-metadata-0500--bean-progress-shows-one-row-per-bean-hiding-parallel-flows.md new file mode 100644 index 00000000..dc7be0d3 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0500--bean-progress-shows-one-row-per-bean-hiding-parallel-flows.md @@ -0,0 +1,39 @@ +--- +# holon-agentic-coder-ref-metadata-0500 +title: "bean-progress shows one row per bean, hiding parallel flows and their PRs" +status: completed +type: bug +priority: normal +tags: + - harness + - bean-progress +created_at: 2026-11-26T09:20:00Z +updated_at: 2026-11-26T09:30:00Z +--- + +## Problem + +On 2026-11-26 bean 0405 had three flows running at once (test batches `tests-constant-time-tmp-dirs`, +`tests-cpu-bound-redaction-ledger`, `tests-fewer-git-worktree-exec`), each with its own PR (#325, #327, #323). +`bean_progress.py` showed one row for 0405 with one PR and listed the others only as "stale attempt" in the notes, so +the coordinator rebuilt the table by hand instead of returning the skill's output verbatim. Related stale rows the same +day: merged beans whose post-merge had not run yet showed "Stage 5 (Calibrated)" or "Not started" (0404, 0419, 0480), +and a decomposed flow showed "Stage 2 (Plan)" for its next child after earlier children merged into its plan branch. + +## Fix + +- One row per live flow (slug), grouped under its bean; a bean with no live flow keeps one row. +- Do not label a concurrent flow of the same bean as a "stale attempt" when its runner is live. +- Show a merged PR as merged (from `gh`) even before the post-merge skill updates the bean. +- For decomposed flows, show "child N of M" and the children's PRs. +- Related: Bean 0388 (stale halted stage), Bean 0488 (non-flow worktree row). + +## Resolution + +Implemented in `.agents/skills/bean_progress/` (2026-11-26, maintainer instruction). One row per live flow or PR of a +bean (same Bean # repeated, adjacent, notes prefixed with the flow slug); dead attempts without runner or PR still fold +into a `stale attempt` note. Merged PRs (read via `gh pr list --state merged|closed`) show `Merged — post-merge pending` +(beans with no flow are matched by bean number); closed-PR flows with a dead runner show `PR closed — dead worktree`. +Only `flow-*` or checkpoint-bearing worktrees count as flows (bean 0488). Decomposed flows show +`Stage N (child X of M: slug)` with the active and merged child PR numbers. SKILL.md documents the multi-row rule, split +flows and a Stale rows section; table columns unchanged. Hermetic tests added in `tests/test_bean_progress.py`. diff --git a/.beans/holon-agentic-coder-ref-metadata-0501--holon-flow-wrapper-log-stays-empty-until-exit.md b/.beans/holon-agentic-coder-ref-metadata-0501--holon-flow-wrapper-log-stays-empty-until-exit.md new file mode 100644 index 00000000..a72635a7 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0501--holon-flow-wrapper-log-stays-empty-until-exit.md @@ -0,0 +1,38 @@ +--- +# holon-agentic-coder-ref-metadata-0501 +title: "holon flow wrapper log stays empty until the flow exits" +status: scrapped +type: bug +priority: normal +tags: + - harness + - holon-flow +created_at: 2026-11-26T09:21:00Z +updated_at: 2026-11-26T09:21:00Z +--- + +## Problem + +Found while driving `tests-constant-time-tmp-dirs` (2026-11-26) with `scripts/run_holon_flow.py` launched in the +background with `> todo/flow-.log 2>&1`. The log file stayed at 0 bytes for the whole run (about 2 h 10 min, +through Stages 3, 4 and 5), while the flow process and its Docker containers were alive and the checkpoint advanced. The +text only appeared after the flow exited. + +## Why it matters + +The driving subagent can only follow progress through the checkpoint and `git log` in the flow worktree. A stalled +stage, a refusal or a limit wait is invisible in the log while it happens. Monitoring also cannot tell a hung wrapper +from a healthy one. + +## Next step + +Second occurrence 2026-11-26 (batch 5, `tests-cpu-bound-redaction-ledger`): the log stayed at 0 bytes through a +33-minute execute stage and the --from-stage calibrate rerun appended nothing until it ended. Same cause. + +Find where the wrapper's output is buffered (the wrapper's own stdout is not flushed, or the flow's output is captured +and written at the end) and flush each stage transition and `holon flow` line as it happens. Check with a short +background run that the log grows during Stage 3. + +## Scrapped (coordinator, 2026-11-26) + +Duplicate of Bean 0385 (flow log file stays empty until the run ends). Its evidence is folded into 0385. diff --git a/.beans/holon-agentic-coder-ref-metadata-0502--flow-plan-touch-set-adds-files-outside-intent-scope.md b/.beans/holon-agentic-coder-ref-metadata-0502--flow-plan-touch-set-adds-files-outside-intent-scope.md new file mode 100644 index 00000000..520d1669 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0502--flow-plan-touch-set-adds-files-outside-intent-scope.md @@ -0,0 +1,44 @@ +--- +# holon-agentic-coder-ref-metadata-0502 +title: "Planner touch set adds files outside the intent scope and blocks admission on a sibling flow" +status: todo +type: bug +priority: normal +tags: + - holon-flow + - harness + - admission +created_at: 2026-11-26T09:37:00Z +updated_at: 2026-11-26T21:05:39Z +--- + +## Problem + +Flow `single-runner-per-checkpoint` (intent 0390 backfill) was refused at Stage 3 admission on +`apps/sandbox-executor/tests/flow/conftest.py`, which is not in its intent scope. The refusal names the sibling flow +`tests-fewer-git-stage-pipeline` (I-1795684868) as the overlap. The plan (P-1795685415) introduced the file into the +touch set, so the overlap came from the plan, not from the declared scope. + +## Asks + +- Decide whether the plan may widen the touch set beyond the intent scope; if not, reject the plan rather than admit it. +- If it may, report the added files in the refusal so the coordinator can see the cause. + +## Notes + +- Flow parked with its checkpoint kept; resumed only from the checkpoint once the sibling flow releases the file. + +## Evidence (audit 2026-11-26T10:50Z) + +Of PRs #325 to #331, #326 (`planner.template.md`), #327 (10 files, plan returned to Stage 2 at 08:28Z) and #330 +(`flow/review/loop.py`) changed files outside the intent scope and were approved. See bean 0508 for the intent-side fix. + +## Evidence (folded from bean 0541, 2026-11-26) + +- Flow `admission-remote-in-flight` (bean 0519): intent scope named six files; the Stage 2 plan's `## Touch Set` listed + fourteen, including new `flow/in_flight_liveness.py`, `tests/flow/remote_flow_fixtures.py` and `docs/touch_set.md`. + Nothing compared plan against scope; Stage 3 admission refused on open PR #342 over `flow/lazy_exports.py`, which the + intent never named, and parked the flow. +- Acceptance from 0541 still applies: a plan touch set with a file outside the intent scope is refused at Stage 2 with + the extra files named; a subset passes unchanged. +- Log: `todo/flow-admission-remote-in-flight.log` (refusal 2026-11-26T14:28:21Z). diff --git a/.beans/holon-agentic-coder-ref-metadata-0503--review-approves-flow-pr-with-unmet-acceptance-criteria.md b/.beans/holon-agentic-coder-ref-metadata-0503--review-approves-flow-pr-with-unmet-acceptance-criteria.md new file mode 100644 index 00000000..1ddbb5fd --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0503--review-approves-flow-pr-with-unmet-acceptance-criteria.md @@ -0,0 +1,37 @@ +--- +# holon-agentic-coder-ref-metadata-0503 +title: "Review loop approves a flow PR whose measured acceptance criteria are not met" +status: todo +type: bug +priority: high +tags: + - tests + - flow + - holon-agentic-coder +created_at: 2026-11-26T09:45:00Z +updated_at: 2026-11-26T09:45:00Z +--- + +## Problem + +Flow `tests-cpu-bound-redaction-ledger` (PR #327 on holon-agentic-coder, merged by the maintainer 2026-11-26 09:38:33Z) +reached 3/3 consensus approval, calibration and a clean merge while its own execution notes state two acceptance misses +in the intent: + +- The summed time of the files in scope fell 27.8 percent (median 68.16 s to 49.24 s), not the required 35 percent. +- The whole unit selection still shows `9 failed` (all in `test_stress_support.py`, called out of scope in the notes) in + every run of both arms, while the intent requires the selection to pass. + +Neither criterion gates Stage 4 or Stage 5; the wrapper reported "completed successfully" and the review loop recorded +"Consensus approval reached". + +## Why it matters + +The intent's measurable criteria are the reason the flow was launched. A PR that misses them can merge under a green +"approved" banner, and the calibration then records a result the intent said was a failure. + +## Next step + +Make the review ensemble (or the wrapper's terminal gate) check each intent `acceptance_criteria` item that the +execution notes report as not met, and withhold consensus or report it as a blocker. Keep `apps/sandbox-executor` +test-only flows as the regression case. diff --git a/.beans/holon-agentic-coder-ref-metadata-0504--run-holon-flow-log-stays-empty-while-running.md b/.beans/holon-agentic-coder-ref-metadata-0504--run-holon-flow-log-stays-empty-while-running.md new file mode 100644 index 00000000..c80a712c --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0504--run-holon-flow-log-stays-empty-while-running.md @@ -0,0 +1,42 @@ +--- +title: "run_holon_flow.py log file stays empty while the flow runs when stdout is redirected" +status: scrapped +type: bug +priority: normal +tags: + - harness + - holon-flow + - observability +created_at: 2026-11-26T10:12:00Z +updated_at: 2026-11-26T10:12:00Z +--- + +# run_holon_flow.py log file stays empty while the flow runs when stdout is redirected + +## Problem + +Bean 0475 (flow `flow-docker-build-concurrency-group`) was launched with +`run_holon_flow.py ... > todo/flow-docker-build-concurrency-group.log 2>&1`. For the whole run (about 20 minutes, +through intent, plan, execute, review and calibrate) the log file stayed at 0 bytes. The complete summary appeared only +when the process exited. The checkpoint and `.subagent` state were written correctly, so the flow itself was running. + +The wrapper does not set `PYTHONUNBUFFERED` for itself and does not flush its own prints (grep of +`.agents/skills/holon_flow/scripts/run_holon_flow.py` for `PYTHONUNBUFFERED`, `flush` and `-u` returns nothing), so +Python block-buffers stdout when it is redirected to a file. Monitoring a live flow through its log is therefore blind +until the end. + +## Proposed Change + +1. Have `run_holon_flow.py` write its progress lines with `flush=True` or re-exec under `python3 -u`, so a redirected + log shows stage transitions while the flow runs. +2. Add a short note to the holon_flow skill that the redirected log fills only as stages finish until this is fixed, and + that the checkpoint and `.subagent/flow__state.json` are the live signals. + +## Notes + +- Found while driving `flow-docker-build-concurrency-group` (PR #329, merged by the maintainer on 2026-11-26). +- Not yet confirmed as the only cause: the `holon flow` child may also buffer its own output. + +## Scrapped (coordinator, 2026-11-26) + +Duplicate of Bean 0385 (flow log file stays empty until the run ends). Its evidence is folded into 0385. diff --git a/.beans/holon-agentic-coder-ref-metadata-0505--child-prs-of-a-decomposed-plan-run-ci-against-a-stale-base.md b/.beans/holon-agentic-coder-ref-metadata-0505--child-prs-of-a-decomposed-plan-run-ci-against-a-stale-base.md new file mode 100644 index 00000000..81841189 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0505--child-prs-of-a-decomposed-plan-run-ci-against-a-stale-base.md @@ -0,0 +1,32 @@ +--- +# holon-agentic-coder-ref-metadata-0505 +title: "Child PRs of a decomposed plan run CI against the plan branch's stale copy of main" +status: todo +type: bug +priority: high +tags: + - flow + - decomposition + - ci + - module-budget + - holon-agentic-coder +created_at: 2026-11-26T10:30:00Z +updated_at: 2026-11-26T10:30:00Z +--- + +## Problem + +The flow `no-unneeded-full-review` (decomposed into five children, PRs #316, #318, #322, #324, #328 into its plan +branch) cut its plan branch before #317 and #326 changed `holon-config/hygiene/module_budgets.json` on `main`. Child PR +#328's head (1e221bed) has `entrypoint/review_loop.py` 927, `env_registry.py` 954 and `flow/__init__.py` 562 lines, over +`main`'s frozen overrides (913, 931, 522), yet its hygiene check passes because the plan branch still carries the old +budget file. The children's CI therefore validates against a stale base, the budget growth accumulates across children +unnoticed, and the breach surfaces only when the parent PR into `main` syncs, after hours of work. + +## Proposed fix + +- Before each child starts and before each child PR's CI gate, merge `origin/main` into the plan branch (mechanical + sync; ledger/KB conflicts resolved as today), so children run CI against current `main` config. +- At minimum, run the budget check of the child head merged with `origin/main` in the child's CI gate and raise it as a + finding. +- Related: Bean 0493 (approved PR goes stale when main tightens budgets), Bean 0479 (parent PR re-reviewed in full). diff --git a/.beans/holon-agentic-coder-ref-metadata-0506--prune-single-flow-kb-failure-clutter.md b/.beans/holon-agentic-coder-ref-metadata-0506--prune-single-flow-kb-failure-clutter.md new file mode 100644 index 00000000..5a224263 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0506--prune-single-flow-kb-failure-clutter.md @@ -0,0 +1,33 @@ +--- +# holon-agentic-coder-ref-metadata-0506 +title: "Prune the existing single-flow Stage 4 KB-failure clutter from holon-knowledge" +status: in-progress +type: task +priority: medium +tags: + - knowledge + - kb-bloat + - holon-agentic-coder +created_at: 2026-11-26T10:40:20Z +updated_at: 2026-11-26T10:40:20Z +--- + +Flow: prune-single-flow-kb-failures (todo/flow-prune-single-flow-kb-failures.log). Parked at Stage 4 on bean 0516 +(review prompt too long for a 2,923-path deletion PR). + +## Problem + +Bean 0452 / PR #331 stops new single-flow Stage 4 review chatter from being promoted to `KB-failure-*.json`, but the +files already committed to `holon-knowledge/kb/failure_modes/` remain. About 2,900 of roughly 3,200 files span under one +hour and came from one flow's own review rows, and CI `make lint-json` scans every one of them. + +## Proposed fix + +- Identify the files whose `evidence.ledger_refs` are all `ACT-REV` / `ACT-FIND` from a single flow (same `I-...` root). +- Archive or delete them in one mechanical pass, keeping any file backed by `>= 2` distinct intents. +- Confirm `make lint-json` and the knowledge index still build; route the change through `holon flow` (sole change + path). + +parked 2026-11-26 21:03Z: Stage 4 review failed again with "Prompt is too long" on resume (see bean 0516). Checkpoint +kept at review in `flow-prune-single-flow-kb-failures`; PR #344 open, MERGEABLE/CLEAN at the time of the check. Resume +from checkpoint once the review prompt no longer inlines the bulk deletion. diff --git a/.beans/holon-agentic-coder-ref-metadata-0507--install-holon-pull-races-on-shared-fetch-head.md b/.beans/holon-agentic-coder-ref-metadata-0507--install-holon-pull-races-on-shared-fetch-head.md new file mode 100644 index 00000000..a9017ed3 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0507--install-holon-pull-races-on-shared-fetch-head.md @@ -0,0 +1,42 @@ +--- +# holon-agentic-coder-ref-metadata-0507 +title: "install-holon fails its main-worktree pull when a concurrent fetch rewrites the shared FETCH_HEAD" +status: todo +type: bug +priority: medium +tags: + - harness + - install + - post-merge + - holon-agentic-coder +created_at: 2026-11-26T10:40:20Z +updated_at: 2026-11-26T21:05:39Z +--- + +## Problem + +Running `install_holon.py` after PR #331 merged (2026-11-26) failed at its sync step with exit 128: +`git pull --ff-only origin main` printed `Cannot fast-forward to multiple branches`. The main worktree was already +fast-forwarded to `origin/main` by the same run. A retry of the same pull succeeded, and the second install run +completed all images and both CLIs. + +`FETCH_HEAD` is shared by every worktree of the repository and had accumulated about 180 lines from live flows' fetches, +which points to a concurrent fetch from a running flow rewriting it mid-pull. + +## Proposed fix + +- In `install_holon` / `install_coherence` sync, retry the fetch-and-pull once on this exit, or use + `git merge --ff-only origin/main` after `git fetch origin main` (no `FETCH_HEAD` dependency on the pull's merge + candidates). +- Consider trimming `FETCH_HEAD` or running the pull with `--no-write-fetch-head` where supported. + +## Evidence (folded from bean 0542, 2026-11-26) + +- PR #342 merged (`57a8aa38`); the first `install_holon.py` run failed in `sync_git_worktree` at + `git pull --ff-only origin main` with "There are no candidates for merging among the refs that you just fetched", + although the main worktree was already at `origin/main` and clean. A manual pull printed "Already up to date"; a + second run completed all builds and CLI installs. +- Cause still unconfirmed; both symptoms look like the shared `FETCH_HEAD` race above. Fix candidates are the same: + retry once, or `git fetch origin main` then `git merge --ff-only origin/main`. +- Post-merge install for PR #348 (2026-11-26) ran clean on the first attempt, after the other install (#346) had + finished. diff --git a/.beans/holon-agentic-coder-ref-metadata-0508--intent-scope-is-hand-guessed-3-of-6-flows-changed.md b/.beans/holon-agentic-coder-ref-metadata-0508--intent-scope-is-hand-guessed-3-of-6-flows-changed.md new file mode 100644 index 00000000..c736b193 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0508--intent-scope-is-hand-guessed-3-of-6-flows-changed.md @@ -0,0 +1,72 @@ +--- +# holon-agentic-coder-ref-metadata-0508 +title: "Intent scope is hand-guessed: 3 of 6 flows changed files they did not list" +status: completed +type: task +priority: high +tags: + - flow + - intent + - scope + - holon-agentic-coder +created_at: 2026-11-26T10:50:00Z +updated_at: 2026-11-26T21:05:39Z +--- + +## Flow + +In progress: flow intent-scope-check (claude-agent, claude-opus-5-5), log todo/flow-intent-scope-check.log, launched +2026-11-26T14:22Z; ships the check as a separate `holon intent-check` command. + +## Problem + +Self-improvement audit 2026-11-26T10:50Z. Comparing each intent's `scope` with the merged PR's files: + +| PR | Listed but unchanged | Changed but unlisted (non-bookkeeping) | +| :-- | :--------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- | +| 326 | `scripts/check_module_budgets.py` | `holon-config/prompts/planner.template.md` | +| 327 | `test_executor_agent_output_redaction.py`, `test_merge.py` | 10 files: `doctor_replay.py`, `fast_home.py`, `ledger_parity_rows.py`, `make_dry_run.py`, 3 new tests, ... | +| 330 | none | `flow/review/loop.py` | +| 331 | `tests/test_wisdom.py` | none | + +#325 and #329 matched exactly. On #327 the executor's edit outside the touch set returned the plan to Stage 2 at +`08:28:01Z`; the re-plan plus a second admission cost about 33 min (Stage 2 at `07:56`, Stage 3 end at `09:03`, against +18 to 24 min for a clean Stage 3 elsewhere). The flows with unlisted files passed review (beans 0492, 0502 cover the +engine side). + +## Proposed fix + +- A pre-launch intent check (`holon intent check `, read-only) that proposes companion files for the listed + scope from the import graph (modules imported by listed tests, tests importing listed modules) and from co-change in + `git log`, and warns about listed files that do not exist or that no acceptance criterion needs. +- Intent authors run it before launch; the intent instructions say so. + +## Expected gain + +Avoids a Stage 3 to Stage 2 round trip (about 33 min on #327) and the unlisted-file findings; 3 of 6 flows today. Cost: +a small read-only command. + +## Update 2026-11-26T12:20Z (audit) + +Seven more flows (#332, #333, #335 to #339), scope against the PR files (non-bookkeeping): #333, #336, #339 match +exactly; #332 changed 4 unlisted files (`hermetic_repos.py`, `stage_templates.py`, `sync_boundary_repos.py`, +`test_stage_templates.py`) and left 2 listed unchanged; #335 added `test_calibrate_final_head_ci.py`; #337 added +`test_ci_bookkeeping_chain.py`; #338 added `preflight.py`, `preflight_secret_args.py`, `test_preflight.py`. All passed +review. Combined with the table above: 7 of 13 flows escaped scope (54 %). The decomposed 0407 flow lost about 67 min of +discarded Stage 3 turns plus about 12 min of re-plan in 4 of its 5 children (child 1 15.6 min, child 2 11.8, child 3 +26.0, child 5 13.3; escapes were `flow/__init__.py` re-exports, an app README and a fixture), the same pattern bean 0414 +measured. Priority stays high; this is the cheapest fix at the source and should be picked before 0414 (engine side). +The most common escapes are companion files (package re-export, README, fixture, a test that exercises the changed +module), which the proposed `holon intent check` can list deterministically. + +## Notes + +Related: 0492, 0502, 0414, 0481 (engine-side touch-set handling). + +## Resolution + +Delivered via [PR #348](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/348) and merged into `main` +(`46a1185`): `holon intent-check [--target-worktree] [--json]` reports missing companion files +(scope-graph imports and co-change), proposes companions, and warns about listed files no acceptance criterion names. +Trial on intent 0540 ran clean. Pre-launch step added to `.agents/skills/holon_flow/SKILL.md`. Import-graph and +co-change heuristics only; the planner's touch set (beans 0502 and 0541) is a separate check. diff --git a/.beans/holon-agentic-coder-ref-metadata-0509--verify-a-performance-flow-ci-saving-on-main-after.md b/.beans/holon-agentic-coder-ref-metadata-0509--verify-a-performance-flow-ci-saving-on-main-after.md new file mode 100644 index 00000000..c63336c4 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0509--verify-a-performance-flow-ci-saving-on-main-after.md @@ -0,0 +1,43 @@ +--- +# holon-agentic-coder-ref-metadata-0509 +title: "Verify a performance flow CI saving on main after it merges and record it" +status: todo +type: task +priority: high +tags: + - flow + - ci + - measurement + - calibration + - holon-agentic-coder +created_at: 2026-11-26T10:50:00Z +updated_at: 2026-11-26T10:50:00Z +--- + +## Problem + +Self-improvement audit 2026-11-26T10:50Z. Today's test batches (#323, #325, #327; unit-only refactors) were asked to cut +CI time, but nothing measures the result after merge. Job times on `main` pushes (seconds, from `gh run view` jobs): + +| Job | Before (pushes 22:51Z to 08:46Z, n=6) | After (pushes 08:47Z to 09:54Z, n=5) | Change | +| :-------------------------- | :------------------------------------ | :----------------------------------- | :---------- | +| unit (macos-latest) | 478 to 647, median 560 | 347 to 575, median 445 | about -20 % | +| unit (ubuntu-latest) | 159 to 260, median 238 | 153 to 230, median 171 | about -28 % | +| Workspace survival (ubuntu) | 204 to 341, median 268 | 251 to 326, median 269 | **0 %** | + +The 40 percent targets of the test intents were not met on macOS, survival did not move at all and is now the longest +ubuntu job (it re-runs the whole unit selection, bean 0447), and the run-to-run spread on macOS (347 to 575 after) is as +large as the saving. No flow, calibration report or bean records this comparison, so the next batch is planned from +impressions. + +## Proposed fix + +- A post-merge step (in the `post-pr-merge` skill) for any bean tagged performance: read the three job medians for the + five `main` pushes before and after the merge, write the table into the bean's Resolution, and open a follow-up bean + when the target is missed. +- Raise bean 0447 (survival shares the unit run) to high: it is the one job the batches did not touch. + +## Expected gain + +Stops spending flows on changes with no measured effect; points the next batch at survival (about 270 s) and macOS +variance. Cost: one read-only script and a skill step. Related: 0482 (estimate before launch), 0499, 0447, 0400. diff --git a/.beans/holon-agentic-coder-ref-metadata-0510--main-push-ci-re-runs-every-workflow-for-merges-who.md b/.beans/holon-agentic-coder-ref-metadata-0510--main-push-ci-re-runs-every-workflow-for-merges-who.md new file mode 100644 index 00000000..9a0d5537 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0510--main-push-ci-re-runs-every-workflow-for-merges-who.md @@ -0,0 +1,53 @@ +--- +# holon-agentic-coder-ref-metadata-0510 +title: "Main-push CI re-runs every workflow for merges whose tree the PR head already tested" +status: completed +type: task +priority: medium +tags: + - ci + - pipeline + - holon-agentic-coder +created_at: 2026-11-26T10:50:00Z +updated_at: 2026-11-26T12:10:00Z +--- + +## Problem + +Self-improvement audit 2026-11-26T10:50Z. Every merge to `main` runs all seven workflows again. Merges between `09:25Z` +and `10:39Z` ran macOS unit (445 s), ubuntu unit (about 165 s), Workspace survival (about 270 s), integration and stress +each, about 17 runner-minutes of tests per merge, with 0 failures on the main pushes. #329 changed only +`.github/workflows/docker-build.yml` and still ran the full unit suite on two OSes and survival (`09:54Z`: ubuntu 153 s, +macOS 445 s, survival 278 s). The PR heads had already passed the same jobs: 0 failed unit runs on 44 heads of #325, +#326, #327, #329, #330 and #331. + +## Proposed fix + +- On `push` to `main`, skip the test jobs when the pushed tree equals the tree of the PR head that passed (squash merge + of an up-to-date branch), and always run them when `main` moved since the last green head (compare + `git rev-parse ^{tree}`). +- Cheaper alternative: path filters so workflow-only, docs-only and ledger-only merges run hygiene only (extends 0454). + +## Expected gain + +Up to about 17 runner-minutes and the macOS timing-gate flake exposure per merge; no effect on the PR gate. Risk: an +interaction between two merges is only caught on the next PR, so keep one scheduled full run per day. Related: 0403, +0454, 0461, 0400. + +- In progress (2026-11-26): flow main-push-ci-skip-tested-tree (claude-agent, claude-opus-5-5), log + todo/flow-main-push-ci-skip-tested-tree.log. + +## Resolution + +Delivered via [PR #337](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/337) and merged into `main` +(`762642ab`): + +- **Key Architectural Deliverables**: on `push` to `main`, the unit and Workspace survival jobs skip their expensive + steps when the pushed tree equals the merged PR head's tree and the same job already succeeded on that head (new + `scripts/ci_main_push_gate.py`, rule `main-push-tested-tree`). Every other case runs the full job. The unit and stress + workflows gain a daily scheduled run. No write permission was added. +- **Verification & Tests**: `tests/test_ci_main_push_gate.py`, `tests/test_ci_bookkeeping_chain.py`, + `tests/test_ci_bookkeeping_wiring.py`. +- **Holon Flow Traversal**: flow `main-push-ci-skip-tested-tree` completed all 5 stages. +- **Watch**: on the first main pushes, confirm that the tree-already-tested skip appears for a squash merge of an + up-to-date head, and that a push after `main` moved still runs the full jobs. diff --git a/.beans/holon-agentic-coder-ref-metadata-0511--stage-tests-fixture-not-found-when-stages-files-are-listed-out-of-order.md b/.beans/holon-agentic-coder-ref-metadata-0511--stage-tests-fixture-not-found-when-stages-files-are-listed-out-of-order.md new file mode 100644 index 00000000..30b8191d --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0511--stage-tests-fixture-not-found-when-stages-files-are-listed-out-of-order.md @@ -0,0 +1,33 @@ +--- +# holon-agentic-coder-ref-metadata-0511 +title: "Stage test files error with fixture 'no_origin_reconcile' not found when pytest arguments are out of order" +status: scrapped +type: bug +priority: normal +tags: + - tests + - flow + - holon-agentic-coder +created_at: 2026-11-26T10:55:00Z +updated_at: 2026-11-26T10:57:00Z +--- + +## Problem + +Found by the batch 2 flow for `tests-fewer-git-stage-pipeline` (flow PR #332, execution notes). When +`apps/sandbox-executor/tests/flow/stages/test_replan_request.py` is listed on the pytest command line after a +parent-directory file that itself follows other `stages/` files (for example +`stages/test_children.py flow/test_git_refs.py stages/test_replan_request.py`), its eight cases error with "fixture +'no_origin_reconcile' not found", serially and under xdist. Listing the `stages/` files contiguously, or a +full-directory run, passes. + +## Goal + +Make the fixture visible to every `stages/` test regardless of argument order (for example by moving it to +`stages/conftest.py` or `flow/conftest.py` at the right scope), or add a test that fails on the out-of-order invocation +so it cannot regress silently. + +## Resolution + +Scrapped 2026-11-26: duplicate of bean 0491 (same family: a subset or ordered pytest run loses a fixture). The evidence +was added to bean 0491. diff --git a/.beans/holon-agentic-coder-ref-metadata-0512--push-pr-merge-events-to-auto-trigger-post-merge.md b/.beans/holon-agentic-coder-ref-metadata-0512--push-pr-merge-events-to-auto-trigger-post-merge.md new file mode 100644 index 00000000..0f35fb5f --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0512--push-pr-merge-events-to-auto-trigger-post-merge.md @@ -0,0 +1,101 @@ +--- +# holon-agentic-coder-ref-metadata-0512 +title: "Push PR-merged events to wake the agent and automatically run post-pr-merge" +status: todo +type: feature +priority: high +tags: + - harness + - github + - webhook + - post-pr-merge + - automation + - ntfy +created_at: 2026-11-26T10:55:00Z +updated_at: 2026-11-26T10:55:00Z +--- + +# Push PR-merged events to wake the agent and automatically run `post-pr-merge` + +## Problem + +Every time the maintainer merges a ready Pull Request on GitHub (`holon-agentic-coder`, `holon-coherence`, or +`dev-env`), the agent remains unaware until the maintainer manually pastes ` has been merged` into the chat +session. Only then does the agent trigger `post-pr-merge` (trunk sync, CLI/image rebuild, bean closure, worktree/branch +cleanup, triage refresh, audit count, and next-bean backfill). + +Existing pieces do not close this loop: + +- Bean `0182` built `.agents/scripts/event_watcher.py` and `.agents/scripts/wait_for.py`, but the watcher is not kept + running, relies on polling, and explicitly stops short of dispatching `post-pr-merge`. +- Bean `0352` designs `gh webhook forward` as a general wait-source abstraction for CI/review waits, but does not wire + an automatic post-merge push trigger into active agent sessions or a persistent host dispatcher across all managed + repositories (including `dev-env`). + +## Proposed Change + +Build an end-to-end **PR-merged push $\rightarrow$ automatic `post-pr-merge`** pipeline across all managed repositories +(`Holon-Agentic-Coder/holon-agentic-coder`, `Holon-Agentic-Coder/holon-coherence`, and `thomashan/dev-env`): + +1. **Push Ingress (GitHub $\rightarrow$ Host, Zero-Poll Primary)**: + - Support a pluggable push listener with two push transports (plus ETag polling fallback when offline/unconfigured): + - **Option A — `gh webhook forward` / `gh event listen`** (reusing Bean `0352`'s source interface): stream + `pull_request` (`closed` + `merged`) events directly to a local listener with zero repo workflow changes + (switches to `gh event listen` automatically once GitHub enables Event Streams on the account). + - **Option B — GitHub Actions `pull_request` (`closed` + `merged == true`) $\rightarrow$ private `ntfy.sh` SSE + stream**: a tiny workflow in each managed repository publishes a minimal hint (`repo` + `pr` number only, zero + secrets or code) to a dedicated private `ntfy` topic, and the host subscribes over Server-Sent Events + (`GET //json`, zero polling, zero GitHub API rate limit, works behind NAT without `admin:repo_hook`). + - Treat every push message strictly as an **untrusted hint**: before acting, always verify live state via + `gh pr view --repo / --json state,mergedAt,mergeCommit,baseRefName` and confirm + `state == "MERGED"` and `baseRefName == "main"`. +2. **Agent Wakeup & Automatic `post-pr-merge` Dispatch**: + - **In-session reactive wakeup (zero tokens while waiting)**: when a `holon-flow` reaches Stage 5 + approval/calibration and reports "awaiting human merge", automatically start a lightweight background merge-wait + task subscribed to the push stream for `#` (costing zero model tokens while idle). The moment the PR + merges on GitHub, the background task exits `0` with verified `{repo, pr, merge_commit, merged_at}`, reactively + waking the session to spawn `# - post-merge` via the `post-pr-merge` skill. + - **Persistent host dispatcher (when no session is waiting)**: run a lightweight macOS `launchd` LaunchAgent + (mirroring `.agents/skills/run_247/scripts/com.holon.limit-watch.plist`) listening to the push stream so merges + performed while no interactive chat is open still trigger `post-pr-merge` (for example by creating a lowest-tier + Antigravity conversation via `ConversationService/CreateConversation` or invoking a deterministic post-merge + runner), then sending a single completion `ntfy` once post-merge finishes. +3. **Idempotency, Concurrency & Guardrails**: + - Maintain an atomic lock and handled-merge ledger (e.g. `.subagent/handled_merges.json` keyed by + `/#@`) so in-session reactive waiters, parallel sessions, and the persistent daemon + never double-run `post-pr-merge` for the same PR (addressing burst-merge races noted in Bean `0455`). + - Strict repository allowlist (`holon-agentic-coder`, `holon-coherence`, `dev-env`) and `baseRefName == "main"` + filter (sub-intent PRs into plan branches never trigger `main` post-merge). + - Only act on PRs tracked by a flow worktree, state file, or bean; ignore foreign/untracked PRs. + - Human-only merge boundary stays absolute: the push pipeline reacts strictly _after_ human merge and never merges, + approves, or pushes to `main`. + - Redact all tokens and never log or commit `ntfy` topics or webhook secrets. +4. **Tests & Documentation**: + - Add hermetic pytest coverage in `tests/` (faked push stream + faked `gh` CLI) verifying: + - a `pr_merged` push hint triggers live `gh pr view` verification and fires `post-pr-merge` dispatch once, + - spoofed or unmerged hints (`state != "MERGED"` or `baseRefName != "main"`) are rejected, + - duplicate deliveries or simultaneous in-session + daemon triggers are deduplicated by the atomic handled-merge + lock, + - disconnected push streams reconnect with backoff and fall back cleanly to ETag polling. + - Document setup, start/stop, and guardrails in `.agents/pr-merging.md` and `.agents/skills/post_pr_merge/SKILL.md`. + +## Acceptance Criteria + +- Merging an approved PR into `main` on `holon-agentic-coder`, `holon-coherence`, or `dev-env` automatically notifies + the agent via push (within seconds, zero polling tokens) and runs the `post-pr-merge` lifecycle without the maintainer + typing a manual merge message. +- Verified live against GitHub before acting; duplicate or non-`main` merge events are ignored idempotently. +- Works both when an interactive session is open (reactive background wakeup) and when no session is open (persistent + host dispatcher). +- Hermetic pytest suite passes via `uv run pytest`, and all touched harness markdown passes Prettier. + +## Notes + +- Primary work lives in the harness (`.agents/` and `tests/`); if Option B (`ntfy` workflow) is selected, each target + repository's GitHub Actions workflow change goes through `holon flow`. +- Related beans: Bean `0182` (persistent polling event watcher & `wait_for.py`), Bean `0352` (`gh webhook forward` push + primitive), Bean `0455` (`post-pr-merge` burst-merge safety), Bean `0396` (session-surviving flow runs). + +## Resolution + +Pending. diff --git a/.beans/holon-agentic-coder-ref-metadata-0513--stage-5-restore-fails-on-pending-ledger-rows-and-withdraws-approval.md b/.beans/holon-agentic-coder-ref-metadata-0513--stage-5-restore-fails-on-pending-ledger-rows-and-withdraws-approval.md new file mode 100644 index 00000000..877fa4de --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0513--stage-5-restore-fails-on-pending-ledger-rows-and-withdraws-approval.md @@ -0,0 +1,53 @@ +--- +# holon-agentic-coder-ref-metadata-0513 +title: + "Stage 5 restore of the starting branch fails on pending ledger rows and withdraws a fresh approval on a + bookkeeping-only head" +status: todo +type: bug +priority: normal +tags: + - flow + - review + - calibration + - holon-agentic-coder +created_at: 2026-11-26T11:46:00Z +updated_at: 2026-11-26T11:46:00Z +--- + +## Evidence + +Flow no-unneeded-full-review, parent PR into main (intent-level execution branch +`I-1795665991-no-unneeded-full-review/P-1795666015-CLA-CO5.5/E-1795666317-CLA-CO5.5/_`), Stage 4 approved 3/3 at head +c9fc1fc, then Stage 5 ran: + +- `Merged-head CI gate: head 6dd0020e ... not covered by the approval of c9fc1fc: PR-own change changed since approval`. + The fingerprint moved from pf1:c7206394 to pf1:695a123f, on a head whose only change was ledger rows. +- `Warning: could not restore starting branch ... Your local changes to the following files would be overwritten by checkout: holon-knowledge/ledger/pending/executions/I-1795665991-no-unneeded-full-review.jsonl. Aborting`. +- `Consensus withdrawn` and `restarting Stage 4 at iteration 1 (restart 1 of 3)`, so a fresh 3/3 approval was + re-reviewed in full. + +Two defects: + +1. The checkout back to the starting branch in Stage 5 is not preceded by committing or clearing the pending ledger + file, so the restore aborts and leaves the worktree on the wrong ref with uncommitted ledger rows carried over. +2. Bookkeeping ledger rows written after approval change the PR-own fingerprint, so the approval is withdrawn for a + change that is not reviewable. This is the same class as bean 0494 and goal 1 of bean 0407. + +## Cost (audit 2026-11-26T12:20Z) + +The decomposed 0407 flow (04:06Z to at least 11:43Z, PR #334) per child, from `todo/flow-no-unneeded-full-review.log`: +child 1 04:12 to 04:58 (46 min; 1 Stage 3 escape 15.6 min; 2 review iterations), child 2 04:59 to 06:22 (84; escape +11.8; 4 iterations, review 57 min), child 3 06:23 to 07:43 (80; escape 26.0; 4 iterations, 38 min), child 4 07:44 to +09:15 (91; 6 iterations, 62 min), child 5 09:15 to 10:42 (87; escape 13.3; 5 iterations, 64 min), parent 10:43 to 11:29 +(4 iterations, 46 min) then the withdrawn approval restarted Stage 4 at 11:29:45Z and iteration 2 was still blocked at +11:42Z. Review loops were about 284 of the first 7.4 h (21 child iterations plus 4 parent), Stage 3 discards about 80 +min with re-plans, and this withdrawal restarted a full review for a ledger-only head. Step times for pre-flight, pushes +and merge-ins are not measured (0412). + +## Goal + +- Stage 5 always commits or stashes its own ledger rows before switching branches, and fails loudly if restore is needed + and not possible. +- The approval fingerprint excludes ledger and pending bookkeeping paths, so an approval survives ledger-only commits + (see bean 0407, goal 1). diff --git a/.beans/holon-agentic-coder-ref-metadata-0514--main-push-gate-skips-nothing-when-merges-arrive-in-a-burst.md b/.beans/holon-agentic-coder-ref-metadata-0514--main-push-gate-skips-nothing-when-merges-arrive-in-a-burst.md new file mode 100644 index 00000000..59ff18ba --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0514--main-push-gate-skips-nothing-when-merges-arrive-in-a-burst.md @@ -0,0 +1,57 @@ +--- +# holon-agentic-coder-ref-metadata-0514 +title: "Main-push tree gate skips nothing when merges arrive back to back; coalesce a burst to the newest tip" +status: in-progress +type: task +priority: normal +tags: + - ci + - pipeline + - holon-agentic-coder +created_at: 2026-11-26T12:20:00Z +updated_at: 2026-11-26T12:20:00Z +--- + +## Flow + +In progress: flow `main-push-superseded-skip` (intent `todo/intent-0514-main-push-superseded-skip.json`, claude-agent +claude-opus-5-5), 2026-11-27. + +## Evidence + +Self-improvement audit 2026-11-26T12:20Z, question (1). + +- #333 (per-SHA concurrency, merged 10:51Z): in order. No cancelled run on `main` after it; the last cancellations are + `903aafe` (08:47Z) and five on 11-25. Every main push since ran unit, survival, integration and stress to success (9 + pushes, 0 failures). +- #337 (skip tested tree, merged 12:06Z): one main push has run since it landed, `5440e92` (#338). The gate logged + `decision=RUN rule=main-push-tree-mismatch detail=pushed tree 2c7c301d0741, head tree 6bee257e74e8`, so survival (207 + s) and both unit legs ran in full. `762642a` (#337 itself) has no run at all because GitHub fires one push event for + the two commits merged together. +- Cause: #339, #335, #338 and #337 merged at 12:04:42, 12:05:00 and 12:06:00 (twice). Each PR head had been tested on + the base it was cut from; once the previous merge lands, the pushed tree can never equal the head tree. Three full CI + sets started in 2 minutes (`f0d6c56`, `8ef1bfb`, `5440e92`): macOS unit 292 s, 425 s and still running, survival 291, + 269 and 207 s, ubuntu unit 156, 122 and 162 s, about 25 runner-minutes for trees that are each a superset of the + previous one. + +So the gate helps for an isolated merge and does nothing for a burst, which is how the maintainer merges (4 PRs in 80 s +here). + +## Proposed fix + +- A push whose commit is no longer the tip of `main` when the job starts (`git ls-remote origin main`) records a skip + with rule `main-push-superseded` and relies on the newest tip's run, which tests a superset tree. Only the tip of a + burst runs the full suite. +- Keep the daily scheduled full run. If the tip run fails, the failing merge is found by the existing per-PR green heads + plus a bisect job, which this bean does not build. +- Log the rule and the skipped/ran count per day in the workflow summary so the saving is measured (relates to 0509). + +## Expected gain + +A burst of N merges costs one run instead of N: about 17 runner-minutes saved per extra merge (0510 figures). Cost: +attribution of a red tip to one of N merges needs a bisect; mitigated because PR heads were already green. + +## Notes + +Related: 0510 (completed, the exact-tree rule), 0461 (per-SHA concurrency, deliberately keeps every push), 0403, 0454. +The 0461 reason (never evict a pending push) is kept by skipping, not cancelling. diff --git a/.beans/holon-agentic-coder-ref-metadata-0515--ledger-reorder-pr-will-conflict-with-every-main-merge-and-resolvers-undo-it.md b/.beans/holon-agentic-coder-ref-metadata-0515--ledger-reorder-pr-will-conflict-with-every-main-merge-and-resolvers-undo-it.md new file mode 100644 index 00000000..5f48a89f --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0515--ledger-reorder-pr-will-conflict-with-every-main-merge-and-resolvers-undo-it.md @@ -0,0 +1,48 @@ +--- +# holon-agentic-coder-ref-metadata-0515 +title: "Ledger reorder (0436) conflicts with every merge to main and the resolvers keep main order, silently undoing it" +status: todo +type: bug +priority: high +tags: + - ledger + - flow + - conflicts + - holon-agentic-coder +created_at: 2026-11-26T12:20:00Z +updated_at: 2026-11-26T12:20:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26T12:20Z, question (4). Bean 0436's flow `ledgers-sorted-chronologically` started at +12:04Z (Stage 3 admitted at 12:11:26Z, "overlaps no flow in flight", 5 other flows in flight: ci-final-head, +fetch-execution-branch-retry, no-unneeded-full-review, plan-id-unique, settings-token-off-argv). + +- The change rewrites every row of the three canonical ledgers. Every merge to `main` appends to + `holon-knowledge/ledger/executions.jsonl` (#339, #338, #337 each changed it in the last 2 minutes), so the reorder PR + conflicts on its first merge-in after any other PR lands; with the maintainer's merge cadence (4 merges in 80 s at + 12:04Z) it will conflict several times during review. +- Stage 3 admission excludes engine-owned ledger paths, so no other flow waits for it and it waits for none. +- The resolvers (`resolve_known.py`, `flow/ledger_reconcile.py`) now keep main's file byte for byte and append the + branch's new rows. Applied to the reorder PR that discards the reordering and leaves a PR that looks resolved but + changes nothing, and the review passes an empty or partial normalisation. A flow-owned reorder is also not rerun by + any step after a conflict. + +## Proposed fix + +- Make normalisation re-runnable: the reorder PR carries the script (goal 1 of 0436) and the conflict step for that one + PR re-runs it on the merged ledgers instead of keeping main's text; a hygiene check (goal 2) fails the PR if a ledger + is out of order at the final head. +- Do not start the flow while other PRs are about to merge; land it when no PR is open (goal 3 of 0436 says so, but + nothing enforces it). The main agent holds the other pickers until it merges, or merges it first in a burst. +- Add a final-head check that "rows(main) subset-of rows(PR) and the file is sorted" so a silent undo fails Stage 4. + +## Expected gain + +Avoids a review loop that approves an undone sort, and repeated conflict rounds (each about 5 to 15 min, plus a full +re-review under 0513). Cost: one re-run hook in the conflict step and one check. + +## Notes + +Related: 0436, 0371, 0513, 0494. Do not edit 0436's scope; this bean only adds the landing risk. diff --git a/.beans/holon-agentic-coder-ref-metadata-0516--review-prompt-too-long-on-mass-deletion-pr.md b/.beans/holon-agentic-coder-ref-metadata-0516--review-prompt-too-long-on-mass-deletion-pr.md new file mode 100644 index 00000000..86d92143 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0516--review-prompt-too-long-on-mass-deletion-pr.md @@ -0,0 +1,66 @@ +--- +# holon-agentic-coder-ref-metadata-0516 +title: "Review ensemble fails with 'Prompt is too long' on a pull request that deletes thousands of files" +status: completed +type: bug +priority: high +tags: + - flow + - review + - prompt-size +created_at: 2026-11-26T12:45:00Z +updated_at: 2026-11-26T22:33:03Z +--- + +## Problem + +The flow for bean 0506 (prune-single-flow-kb-failures) executed in 4.4 min and changed 2,923 paths (a script, a test and +about 2,900 deleted `KB-failure-*.json` files). Stage 4 iteration 1 then failed in 1.2 min: all three reviewers +(claude-agent / claude-opus-5-5) exited with code 1, "Prompt is too long". A retry would fail the same way, so the flow +stopped at review (checkpoint kept in the flow-prune-single-flow-kb-failures worktree, PR created). + +## Proposed change + +- The review request lists a deleted or bulk-mechanical path set as a count plus a sample instead of inlining each path + and its diff, and caps the diff section by size before it builds the prompt. +- Until then a mechanical deletion of this size is split into PRs of at most a few hundred paths, or the pruning script + is run by the flow without committing its output. + +## Update 2026-11-26 21:01Z: resumed after PR #334 still fails + +- Resumed PR #344 from checkpoint (`--from-stage review`) after merging origin/main (merge 375dca35, pushed). Review + iteration 2 ran in `full` mode ("last reviewed head unknown", since iteration 1 recorded no reviewed head), so the + reviewers were still given the whole diff, including the mass deletion. The #334 own-diff keying did not help. +- Error, all three reviewers (claude-agent / claude-opus-5-5), 21:01Z, within seconds of dispatch: "Reviewer agent + command failed with code 1 (stop reason: other). Runner output (redacted): Prompt is too long". +- Reviewer diff at that point (`git diff origin/main...HEAD`): 2,928 files changed, 1,020 insertions, 88,221 deletions, + 3.96 MB of patch text; 2,921 of the paths are deleted `holon-knowledge/kb/failure_modes/KB-failure-*.json`. +- Retry not done. Flow stopped at review; this flow's processes killed; checkpoint kept at stage review; worktree at + 375dca35 with an uncommitted flow-written `holon-knowledge/ledger/pending/executions/I-1795696249-*.jsonl` change. + +## Progress 2026-11-27 + +in-progress: holon flow `flow-review-prompt-mass-deletion` (intent `todo/intent-0516-review-prompt-mass-deletion.json`, +log `todo/flow-review-prompt-mass-deletion.log`, claude-agent / claude-opus-5-5). The fix bounds the reviewers' diff in +`review_request.py` and `delta_review_request.py`: bulk deletions and generated files are summarised by count and +sample, and the inlined diff is capped at 400000 bytes with omitted sections listed by directory. Bean 0506 stays parked +until this lands, then resumes from its checkpoint. + +Update 2026-11-27: flow `flow-review-prompt-mass-deletion` completed through Stage 5. PR #352 (head 15f6c660) is OPEN, +MERGEABLE/CLEAN, all CI checks green; Stage 4 consensus 3/3 APPROVED at iteration 1 (no review failures); calibration +report included in the PR diff (EV predicted 41.95, actual 60.70). Left in-progress until the maintainer merges PR #352. +Bean 0506 can resume from its checkpoint after that merge. + +## Resolution + +Delivered via [PR #352](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/352) and merged into `main` +(`2e28d79e`): + +- **Key Architectural Deliverables**: `bound_review_diff` in `review_request.py` runs before any reviewer prompt is + built, for both the full review and the own-diff delta review (`delta_review_request.py`). Deletions in a directory + with 25 or more deleted files and generated files (`*.lock`, `package-lock.json`, `*.min.js`, `*.map`) are summarised + by count and a five-path sample; other sections are inlined in git order until 400000 bytes, and the rest are listed + by parent directory. A diff needing none of these rules is returned byte-identical. +- **Verification & Tests**: `test_review_request_bulk_diff.py` added; Stage 4 consensus 3/3 APPROVED at iteration 1. +- **Holon Flow Traversal**: Stages 1 to 5 completed in `flow-review-prompt-mass-deletion` (intent, plan, execute, review + loop, calibration) with no review failures. diff --git a/.beans/holon-agentic-coder-ref-metadata-0517--concurrent-flows-add-the-same-kb-wisdom-file-add-add-conflict.md b/.beans/holon-agentic-coder-ref-metadata-0517--concurrent-flows-add-the-same-kb-wisdom-file-add-add-conflict.md new file mode 100644 index 00000000..c2a8331a --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0517--concurrent-flows-add-the-same-kb-wisdom-file-add-add-conflict.md @@ -0,0 +1,60 @@ +--- +# holon-agentic-coder-ref-metadata-0517 +title: "Concurrent flows add the same knowledge-base or wisdom file, so their PRs conflict add/add" +status: completed +type: bug +priority: normal +tags: + - flow + - knowledge-base + - merge-conflicts + - holon-agentic-coder +created_at: 2026-11-26T12:40:00Z +updated_at: 2026-11-26T21:06:00Z +--- + +## Problem + +Ledger rows no longer conflict (per-flow fragments, PR #314), and Bean 0244 (completed) made KB/WB facts append-only +records, yet Stage 5 promotion still writes shared knowledge-base and wisdom files whose names are content hashes. Two +flows that promote the same heuristic or pattern add the same path with different content: on 2026-11-26 open PRs #340 +and #341 both add `holon-knowledge/wisdom/heuristics/WB-heuristic-84a6ddeb.json` (add/add conflict), and earlier #308 +and main both added `holon-knowledge/kb/patterns/KB-pattern-dd1ab35f.json` (resolved by keeping the later `updated_ts`). +Whichever PR merges second needs a conflict pass, a push and a CI cycle. + +## Proposed fix + +- Write promoted KB/wisdom entries as per-flow fragments merged on main, as the ledgers now do; or +- give `resolve_known.py` a deterministic rule for add/add on KB/WB JSON (union of evidence, later `updated_ts` wins) so + the conflict is settled mechanically without a subagent. +- Related: Bean 0244 (KB/WB facts append-only, completed), Bean 0371 (ledger fragments), Bean 0506 (KB-failure clutter). + +## Audit evidence (2026-11-26T13:40Z) + +- Frequency: three of the five merges in the window (#341 at 12:58Z, #340 at 13:04Z, #343 at 13:04Z, with #345 clean) + add or rewrite `holon-knowledge/wisdom/heuristics/WB-heuristic-84a6ddeb.json`, five minutes apart, so each of the last + two conflicted with the one before (add/add). 661 `holon-knowledge/kb|wisdom` json path touches in 59 main commits + since 11-25. +- Cause is not hash collision: the file is the "Universal heuristic: main" wisdom entry whose payload carries run + counters (`total_executions` 23, Wilson bound 0.857). Every flow's Stage 5 promotion rewrites it with a different + counter, so any two concurrent PRs conflict. The real fix is to stop writing counter-bearing KB/WB files in the flow + PR: derive them on `main` in the existing Promote Ledger workflow, as the ledgers now are. The `resolve_known.py` rule + is only the fallback. +- Cost per conflict: a resolver pass, a push, a CI cycle and a rerun, see bean 0522 (about 12 to 26 min plus a full + review). + +## Resolution + +Delivered via [PR #349](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/349) and merged into `main` +(`2c86516`): + +- **Key Architectural Deliverables**: new `knowledge/stable_envelope.py` builds promoted KB and WB files from the id and + context only (no wall clock, no execution counters, no counter-bearing advisory text) and writes them + exclusive-create, so an existing file is never rewritten. `persist_kb_fact` and `persist_wb_rule` route through it. + Run counters stay in the action index and ledgers. Legacy files on `main` remain readable by `load_index`. +- **Verification & Tests**: byte-independence tests against a shifting clock and counters, a never-rewrite test, and a + legacy-read test in `test_wisdom.py`; guardrail run of 558 tests passed. +- **Holon Flow Traversal**: intent, plan, execution, review and calibration completed + (`executions/E-1795704929-CLA-CO5.5.md`, calibration commit `30136ba4` on the flow branch). + +The `resolve_known.py` fallback in the proposed fix was not needed. diff --git a/.beans/holon-agentic-coder-ref-metadata-0518--review-loop-sets-shared-repo-git-identity.md b/.beans/holon-agentic-coder-ref-metadata-0518--review-loop-sets-shared-repo-git-identity.md new file mode 100644 index 00000000..4c4b6d62 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0518--review-loop-sets-shared-repo-git-identity.md @@ -0,0 +1,66 @@ +--- +# holon-agentic-coder-ref-metadata-0518 +title: + "Review loop writes its git identity into the shared repository config, so host-side commits are authored by the agent" +status: in-progress +type: bug +priority: high +tags: + - flow + - git + - review-loop + - holon-agentic-coder +created_at: 2026-11-26T13:06:00Z +updated_at: 2026-11-26T21:06:00Z +--- + +## Problem + +On 2026-11-26 the bare repository config shared by every worktree of holon-agentic-coder +(`apps/holon-agentic-coder/.git/config`) holds `user.name = Holon Review Loop Agent` and +`user.email = review-loop-agent@holon-agentic-coder.com`. The Stage 4 review loop runs `git config` on the mounted +worktree, and because worktrees share one config file, the identity leaks to every worktree on the host. A conflict +resolution merge made on the host for PR #340 (`da5880ad`) was authored as "Holon Review Loop Agent" instead of the +maintainer. Any harness subagent or the maintainer committing in a holon-agentic-coder worktree now does the same. The +global identity (`~/.gitconfig`) is unaffected. + +## Status + +Delivered via [PR #350](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/350) and merged into `main` +(`cc1f256`, 2026-11-26T21:04:13Z): the review loop sets its identity per command and never writes the shared repository +config. Flow `review-loop-git-identity-env` (intent todo/intent-0518-review-loop-git-identity-env.json, log +todo/flow-review-loop-git-identity-env.log) cleaned up after the merge. + +Remaining step (bean stays in-progress, awaiting maintainer go-ahead): remove `user.name` and `user.email` (Holon Review +Loop Agent) from the shared `apps/holon-agentic-coder/.git/config`. Not done by the agent; check first that no flow +depends on them. install-holon was rerun after the merge. + +## Proposed fix + +- The review loop (and any container role) sets identity per command (`git -c user.name=... -c user.email=...` or + `GIT_AUTHOR_*`/`GIT_COMMITTER_*` env), or with `git config --worktree` after enabling `extensions.worktreeConfig`, + never in the shared repository config. +- One-off: remove the two keys from the shared config once no flow depends on them (check first that flows still set + their own identity). +- Related: earlier hits on git identity: , 0019, 0118, 0131, 0213. + +## Audit evidence (2026-11-26T13:40Z) + +- Duration: not new. The host repository already holds commits whose author and committer are `Holon Review Loop Agent` + made on the host (timezone +11:00): 210 of 738 such commits, the first `10da7fe5` + (`Merge remote-tracking branch 'origin/main'`) on 2026-11-20, then every day since (229 commits on 11-20, 157 on + 11-21, 142 on 11-23, 71 on 11-26). 77 flow logs show `git config --global user.name Holon Review Loop Agent` run by + the container. `.git/config` was last rewritten at 00:25 today, so it is live. +- What it affected: every host-side sync and merge commit of a flow (`sync: merge target origin/main at ...`, + `Merge remote-tracking branch`, `chore(review): record review ledger rows`) is attributed to the agent, as are harness + conflict merges made in a flow worktree (#340, `da5880ad`). The maintainer's global identity is still in + `~/.gitconfig` but the repository setting wins. Audit trail by author is unusable for the whole period. +- The log line says `--global`, so the container's HOME (or a mounted config) resolves to the shared repository config. + Fix the cause (do not mount or point HOME at a file inside the repository) and not only the symptom. + +## Shared config cleared (2026-11-26 21:08Z) + +The maintainer removed `user.name`/`user.email` (Holon Review Loop Agent) from `apps/holon-agentic-coder/.git/config`; +`git config --get user.name` now resolves to the global identity. Flows 0216 and 0390 were started before PR #350's +reinstall and may still write the keys back during their review stage: re-check the shared config after both finish, +then close this bean. diff --git a/.beans/holon-agentic-coder-ref-metadata-0519--flow-worktree-and-checkpoint-vanish-after-stage-3-overlap-refusal.md b/.beans/holon-agentic-coder-ref-metadata-0519--flow-worktree-and-checkpoint-vanish-after-stage-3-overlap-refusal.md new file mode 100644 index 00000000..8927b1f2 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0519--flow-worktree-and-checkpoint-vanish-after-stage-3-overlap-refusal.md @@ -0,0 +1,97 @@ +--- +# holon-agentic-coder-ref-metadata-0519 +title: "Flow worktree, checkpoint and intent/plan branches vanish after a Stage 3 overlap refusal" +status: in-progress +type: bug +priority: high +tags: + - flow + - checkpoint + - holon-agentic-coder +created_at: 2026-11-27T00:10:00+11:00 +updated_at: 2026-11-26T14:23:25.786Z +--- + +## Problem + +On 2026-11-26 the flow `module-budget-default-350` (bean 0489) ran intent and plan, then Stage 3 refused on a touch-set +overlap with `I-1795665991-no-unneeded-full-review` (run with `--no-wait-on-overlap`, so it stopped as designed). +Afterwards the flow worktree `apps/holon-agentic-coder/flow-module-budget-default-350` was gone, with its +`.holon/flow/checkpoint-module-budget-default-350.json`, and the local `I-1795686809-module-budget-default-350/*` +branches were gone too. The intent and plan commits (5ac9ddd9, ac3712c8) survive only as unreferenced objects. The +overlapping flow's worktree (`flow-no-unneeded-full-review`) was also absent when checked, though its PR #334 merged +only later. + +Parking a refused flow (per the holon-flow skill) depends on keeping the worktree, branches and checkpoint. Nothing in +the harness or the wrapper printed a removal, so the cause is not confirmed; a concurrent cleanup run (for example a +clean-branches or post-merge pass) is one candidate, and the flow engine's own failure path is another. + +## Expected + +A refused Stage 3 leaves the worktree, the I-/P- branches and the checkpoint in place, so the flow resumes with +`--checkpoint` once the blocker merges. + +## Acceptance + +- Identify what removed the worktree and branches (check the holon CLI failure path and the clean-branches / post-merge + skills for `worktree remove` or `branch -D` of `I-*` refs). +- A test or wrapper guard that refuses to delete a parked flow's worktree or checkpoint. + +## Diagnosis (maintainer, 2026-11-26) + +The Stage 3 overlap check is not checking against the remote each time: it read a stale local branch. When the fresh +`module-budget-default-350` flow was admitted (about 13:05Z), PR #334 (`I-1795665991-no-unneeded-full-review`) had +already merged at 13:01:37Z and its remote branches were being deleted, but the local +`I-1795665991-no-unneeded-full-review*` branches (33 of them, removed by the #334 post-merge run a few minutes later) +and their remote-tracking refs were still in the shared repository, so admission counted a merged flow as in flight and +refused on `budgets.py`. + +## Fix (admission) + +- Before every admission check, `git fetch --prune origin` so deleted remote branches drop out, and judge "in flight" + from the remote: an `I-*` branch counts only if it still exists on origin **and** (its PR is open, or a live runner + holds its worktree). A local branch or worktree alone, or a branch whose PR is merged or closed, never blocks. +- Log, with the refusal, how the blocker was found (ref name, local or remote, PR number and state), so a stale match is + visible at once. +- Add a test: a merged PR whose local branch still exists does not block admission. + +## Still open + +Why the refused flow's own worktree, checkpoint and branches disappeared is not explained by the above. Candidates: the +wrapper's cleanup on an early Stage 3 exit, or a concurrent post-merge run's stale-plan sweep (a plan-only worktree with +no PR matches that rule). Check both. + +Second case, same day: the worktree `flow-agent-runner-spec-per-agent` (PR #343, merged 13:04:41Z) disappeared while a +review re-run was still live in it (its log ends +`cannot change to .../flow-agent-runner-spec-per-agent: No such file or directory`); the #343 post-merge run found it +already gone before its own cleanup step. So something other than the post-merge cleanup step removes flow worktrees: +find every `git worktree remove`/`rm -rf` path in the wrapper, the engine and the harness skills, and make each one +refuse while a runner holds the worktree. + +## Audit evidence (2026-11-26T13:40Z) + +- Today `apps/holon-agentic-coder/flow-module-budget-default-350` exists with its checkpoint and the `I-1795698612-*` + branches, parked at 13:18:56Z on PR #342 (a live refusal, not the stale-ref case). So the original disappearance was + followed by a relaunch that recreated them, or it was transient. +- Candidate for the still-open question: a post-merge pass running while a rerun is alive removes the worktree under it. + #340 and #343 had reruns started 21 s and 33 s before they merged (bean 0522). + +## Progress + +- in-progress 2026-11-26: admission part (remote-aware in-flight check, fetch --prune before each Stage 3 check, refusal + names how each blocker was found) launched as flow `admission-remote-in-flight` (intent + todo/intent-0519-admission-remote-in-flight.json, worktree apps/holon-agentic-coder/flow-admission-remote-in-flight, + claude-agent / claude-opus-5-5). Bean 0520 (trial merge) not implemented. +- parked 2026-11-26: flow `admission-remote-in-flight` (plan I-1795703012 / P-1795703035, checkpoint kept in the flow + worktree) refused at Stage 3 admission: the touch set overlaps open PR #342 (branch + I-1795694671-ledgers-sorted-chronologically, the flow in its PR) on + apps/sandbox-executor/src/sandbox_executor/flow/lazy_exports.py. Resume from checkpoint (--checkpoint) once #342 + merges or releases that file. Note: the plan's touch set lists 14 files, nine of them outside the intent scope (incl. + lazy_exports.py); logged as bean 0541. + +- resumed 2026-11-26 from checkpoint (claude-agent / claude-opus-5-5, --no-wait-on-overlap): PR #342 merged 20:58:42Z, + but Stage 3 refused again on a touch-set overlap with the parked flow `module-budget-default-350` (branch + I-1795698612-module-budget-default-350/P-1795698637-CLA-CO5.5/_, blocked since 13:18:56Z on #342) on + apps/sandbox-executor/src/sandbox_executor/flow/lazy_exports.py. parked 2026-11-26 20:59Z: blocked by parked flow + module-budget-default-350 on lazy_exports.py; resume from checkpoint once that flow's worktree releases the file (its + blocker #342 has merged, so it needs its own resume or its stale waiting state cleared). diff --git a/.beans/holon-agentic-coder-ref-metadata-0520--stage-3-admission-blocks-on-shared-paths-not-on-real-merge-conflicts.md b/.beans/holon-agentic-coder-ref-metadata-0520--stage-3-admission-blocks-on-shared-paths-not-on-real-merge-conflicts.md new file mode 100644 index 00000000..07ac4acd --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0520--stage-3-admission-blocks-on-shared-paths-not-on-real-merge-conflicts.md @@ -0,0 +1,62 @@ +--- +# holon-agentic-coder-ref-metadata-0520 +title: "Stage 3 admission blocks on shared file paths, not on a real merge conflict; one open PR parks several flows" +status: todo +type: feature +priority: high +tags: + - flow + - admission + - coordination + - holon-agentic-coder +created_at: 2026-11-26T13:40:00Z +updated_at: 2026-11-26T13:40:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26T13:40Z, question (1). + +- `module-budget-default-350` (bean 0489) was refused at 13:18:56Z because its touch set overlaps open PR #342 + (`ledgers-sorted-chronologically`, 34 files, open since 12:19Z, 79 min) on `flow/lazy_exports.py` and + `docs/architecture.md`. Both are registry or prose hubs where two flows usually add different lines. +- `single-runner-per-checkpoint` (beans 0390/0472) was parked three times on 11-26: 09:35Z behind + `tests-fewer-git-stage-pipeline` on `tests/flow/conftest.py`, 10:56Z behind PR #334 on the same `conftest.py`, and + 13:04Z behind the older waiting flow `split-calibration-package`, which is itself parked. Each refusal ends the run + and needs a manual relaunch with `--checkpoint` (bean 0476 stopped the polling). +- Admission compares path sets, so one wide PR (#342 touches the three ledgers, 4 flow modules, 3 docs) blocks every + flow that shares even one hub path, whether or not the edits could conflict. Beans 0481 (pre-launch check), 0337 + (waiting flows block each other, completed), 0410 (hand-edited conflict magnets) and 0519 (stale refs) do not change + this. + +## Proposed change + +1. Replace "paths overlap" with a trial merge: for each overlapping flow or open PR, run `git merge-tree --write-tree` + of the candidate execution base against that PR head (after `git fetch --prune`). Refuse only on a real conflict; log + the conflicting hunks. Overlap on a path that merges clean is admitted and logged. +2. Keep the path-set check as the cheap pre-filter and as the answer when the trial merge cannot run. +3. Let the planner shrink the touch set: split hub edits (`lazy_exports.py`, `docs/architecture.md`, `conftest.py`) into + a final small step or out of the plan when the intent does not need them (relates to 0502, 0508). +4. A small PR should not wait on a wide one: when the blocker is an open PR older than the candidate, report its age and + size in the refusal so the maintainer can order merges (merge #342 first, or split it). + +## Expected gain + +Admission and overlap waits were 343 of 3260 flow-minutes in the 11-26 time audit (worst 300 min). A trial merge turns +the hub-file refusals (3 of the 4 refusals above) into admissions. Cost: one `merge-tree` per candidate, no worktree. + +## Notes + +Related: 0481, 0519, 0410, 0502, 0508, 0151. The `conftest.py` split in the question is already the shape of 0410; this +bean makes the engine stop needing it first. + +## Design gap (2026-11-26, found before launch) + +At Stage 3 admission the candidate flow has a plan but no code, so a `git merge-tree` of its base against an in-flight +PR head cannot show whether its future edits conflict; it only shows whether the in-flight PR still applies to main. A +real trial merge is possible only once the executor's commits exist, i.e. at PR time. Options for the maintainer: (a) +optimistic admission: admit despite shared paths (keep refusing only for declared exclusive files such as budget +config), run the trial merge at PR time against `origin/main` and every open flow PR head, and send real conflicts to +the conflict resolver; (b) keep path-based admission but narrow it (shared docs, conftest and registries excluded or +split, see Bean 0540). The admission fix that is implementable now (judge in-flight from the remote, ignore stale local +refs) was launched separately under Bean 0519. diff --git a/.beans/holon-agentic-coder-ref-metadata-0521--main-push-gate-runs-in-full-when-the-pr-head-job-is-still-running.md b/.beans/holon-agentic-coder-ref-metadata-0521--main-push-gate-runs-in-full-when-the-pr-head-job-is-still-running.md new file mode 100644 index 00000000..cfff3dc9 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0521--main-push-gate-runs-in-full-when-the-pr-head-job-is-still-running.md @@ -0,0 +1,43 @@ +--- +# holon-agentic-coder-ref-metadata-0521 +title: "Main-push gate runs the full suite when the merged PR head job is still running; wait for it instead" +status: todo +type: task +priority: normal +tags: + - ci + - pipeline + - holon-agentic-coder +created_at: 2026-11-26T13:40:00Z +updated_at: 2026-11-26T13:40:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26T13:40Z, question (5). + +- #333 (per-SHA concurrency): in order, no cancelled main run since 10:51Z; every main push in the window ran to + completion. +- #337 (tested-tree skip): works for an isolated merge. #345 (`1567b6b`, 13:32Z) logged + `decision=SKIP rule=main-push-tested-tree detail=#345 head d5e31a2d3849` on both unit legs, the run took 19 s. +- It did not skip #334 (`20687d4`), #340 (`72de702`) and #343 (`f1e18bc`): all three logged + `decision=RUN rule=main-push-head-job-not-finished` (`in_progress in run 2176`, `in_progress in run 2181`, + `queued in run 2184`). The PR was merged while its head's unit job was still running, so the gate fell back to the + full suite: unit 8.6 min (macOS) on `72de702`, 5.9 min on `f1e18bc`, survival and stress as well, about 17 + runner-minutes each. +- 0514 (burst coalescing) covers back-to-back merges; this is the single-merge case where the head run is simply not + finished yet. Of the 5 merges in this audit window, 1 skipped and 4 ran full. + +## Proposed change + +- When the head job is queued or in progress, the gate polls it (up to the head job's own timeout, say 15 min, 30 s + interval) and decides on its result: success on an equal tree skips, failure or cancel runs. Only a missing head run + runs at once. +- Better: run the gate step first so a waiting main job holds no macOS runner while it polls (the check is a few API + calls). + +## Expected gain + +Up to 17 runner-minutes on each merge made before the head CI finishes (3 of 5 here). Cost: a job that waits instead of +runs; worst case it waits as long as the full suite would have taken. Keep the daily scheduled full run. Related: 0514, +0510 (completed), 0461. diff --git a/.beans/holon-agentic-coder-ref-metadata-0522--post-conflict-rerun-restarts-a-full-review-and-outlives-the-merge.md b/.beans/holon-agentic-coder-ref-metadata-0522--post-conflict-rerun-restarts-a-full-review-and-outlives-the-merge.md new file mode 100644 index 00000000..e02c9588 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0522--post-conflict-rerun-restarts-a-full-review-and-outlives-the-merge.md @@ -0,0 +1,51 @@ +--- +# holon-agentic-coder-ref-metadata-0522 +title: + "A rerun after a post-approval conflict restarts a full review from the review stage and keeps running after the PR + merges" +status: todo +type: bug +priority: high +tags: + - flow + - stage-4 + - merge-conflicts + - holon-agentic-coder +created_at: 2026-11-26T13:40:00Z +updated_at: 2026-11-26T13:40:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26T13:40Z, question (2). Logs: `todo/flow-fetch-execution-branch-retry.log`, +`todo/flow-agent-runner-spec-per-agent.log`. + +- #340 and #343 both finished with approval and calibration, `PR #340 Mergeable: MERGEABLE, State: CLEAN` (12:29Z) and + `PR #343 ... CLEAN` (12:44Z). #341 merged at 12:58Z and added the same `WB-heuristic-84a6ddeb.json`, so both PRs + turned conflicting (bean 0517). The conflict was settled by hand and a rerun was launched with `--from-stage review`: + #340 at 13:04:02Z, #343 at 13:04:08Z. +- Each rerun started a full ensemble iteration, `Review mode at iteration 3: full (last reviewed head unknown)`, even + though the approval had been carried over by PR-own fingerprint earlier in the same log + (`approval carried over ... fingerprint pf1:dd4d979e`). The only change on the head was a merge of main. +- The maintainer's merge queue merged #340 at 13:04:23Z and #343 at 13:04:41Z, 21 s and 33 s after the reruns began. + Neither log has an end line after `git config --global user.name Holon Review Loop Agent`: the review containers and + `holon flow` processes were left running against merged PRs, then post-merge removed the worktrees under them (this + fits the vanishing worktrees of bean 0519 and the open bean 0420). +- The right restart stage was `calibrate` or nothing: the review had already approved and the merge added no PR-owned + change. `review` re-spends 3 reviewers (about 12 to 26 min and the same tokens as iteration 1) for no gain; the gate + that ends the flow is the pipeline and the consensus, and both were already passed. + +## Proposed change + +1. After a conflict resolution at the merge boundary, compute the PR-own fingerprint; if equal to the approved one, + resume at `calibrate` (or just re-check CI on the new head), never at `review`. The wrapper prints the stage it + picked and why. +2. Before any rerun and every minute while it runs, read the PR state and the merge queue; if the PR is merged or + queued, stop the rerun, reap its `holon flow` and `docker run` children (0472), and leave the worktree alone until + they are gone. +3. The delta review needs the last reviewed head; persist it in the checkpoint so a resume is not "unknown". + +## Expected gain + +Per post-approval conflict: one full review iteration (12 to 26 min, 3 reviewer calls) and one orphaned process set. +Frequency: 2 of 5 merges in the window (3 of 5 conflicted, see 0517). Related: 0420, 0472, 0519, 0517, 0497, 0513. diff --git a/.beans/holon-agentic-coder-ref-metadata-0523--parked-flow-is-resumed-by-hand-when-its-blocker-merges.md b/.beans/holon-agentic-coder-ref-metadata-0523--parked-flow-is-resumed-by-hand-when-its-blocker-merges.md new file mode 100644 index 00000000..521292fe --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0523--parked-flow-is-resumed-by-hand-when-its-blocker-merges.md @@ -0,0 +1,41 @@ +--- +# holon-agentic-coder-ref-metadata-0523 +title: + "A flow parked at Stage 3 is resumed by hand when its blocker merges; record the blocker and resume on its state + change" +status: todo +type: feature +priority: normal +tags: + - flow + - coordination + - parked + - holon-agentic-coder +created_at: 2026-11-26T13:40:00Z +updated_at: 2026-11-26T13:40:00Z +--- + +## Evidence + +Self-improvement audit 2026-11-26T13:40Z, question (1). + +- `module-budget-default-350` was refused at 13:18:56Z on PR #342 and exited (`Pipeline halted`, checkpoint kept, + worktree present). `single-runner-per-checkpoint` has been parked since 09:35Z, relaunched twice by hand and refused + again each time (10:56Z, 13:04Z). Nothing connects a parked flow to the event that frees it; the harness agent has to + notice the merge, rerun `run_holon_flow.py --checkpoint` and often finds a different blocker. +- The wrapper already prints `gh event listen --resource --event ...state.changed.v1` hints; `gh event listen` + exits on the first event, which fits a one-shot resume. + +## Proposed change + +- On a Stage 3 refusal the wrapper writes `todo/parked/.json` with the blocker (PR number or branch), the + checkpoint path and the resume command, then exits. +- A small watcher (extends the merge-event hook of bean 0512) runs `gh event listen` on each blocker PR, and on merge or + close relaunches the flow with `--checkpoint`, after the same `git fetch --prune` admission re-check of 0519. If the + new refusal names another blocker, it updates the record and waits again. It honours the 4-flow cap. +- Parked flows are listed by `bean_progress` with their blocker. + +## Expected gain + +Removes the idle time between a blocker merging and a human relaunching (not measured; bean 0412 would record it) and +the repeated manual probes. Related: 0512, 0519, 0520, 0481, 0394. diff --git a/.beans/holon-agentic-coder-ref-metadata-0524--coherence-fix-ca-key-perms-and-web-password-leaks.md b/.beans/holon-agentic-coder-ref-metadata-0524--coherence-fix-ca-key-perms-and-web-password-leaks.md new file mode 100644 index 00000000..36ac750f --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0524--coherence-fix-ca-key-perms-and-web-password-leaks.md @@ -0,0 +1,55 @@ +--- +# holon-agentic-coder-ref-metadata-0524 +title: "Fix world-writable Root CA key permissions, web password leaks, and unscrubbed cache" +status: todo +type: bug +priority: critical +tags: + - holon-coherence + - security + - ca + - secrets +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +`holon-coherence` generates its X.509 Root CA cleanly with `0o700`/`0o600` permissions in `ca_generator.py`, but +container startup immediately negates that hardening by enabling world-writable mount permissions (`0o777` directories +and `0o666` private key files), passing `HOLON_COHERENCE_WEB_PASSWORD` on container command lines and query strings, and +persisting unscrubbed LLM payloads inside the world-writable cache directory. + +## Evidence + +- `src/holon_coherence/commands/start.py:263`: passes `world_accessible_mounts=True`. +- `src/holon_coherence/container/lifecycle.py:39-40,309-320,423-424`: `chmod 0o777` on `~/.holon/proxy-ca`, `cache`, and + `logs`, and `chmod 0o666` on `holon-root-ca.key` and `mitmproxy-ca.pem`, overriding + `src/holon_coherence/ca_generator.py:12-26,67-89,162-189`. +- `src/holon_coherence/container/lifecycle.py:341-342,498-499`: exposes `HOLON_COHERENCE_WEB_PASSWORD` in + `docker run -e` and `--set web_password=...` process argv. +- `src/holon_coherence/commands/endpoints.py:34`: leaks auth token in `?token=` query string. +- `src/holon_coherence/hybrid_cache.py:299-325`: `HybridCacheStore` writes unscrubbed LLM payloads into the `0o777` + cache directory. + +## Proposed Change + +1. Remove `0o777`/`0o666` world-writable mount permissions (`world_accessible_mounts=True`); use proper container + UID/GID mapping or read-only cert-only mounts while keeping Root CA private keys strictly `0o600` inside `0o700` + directories. +2. Pass `web_password` via a `0o600` mounted file or temp env-file instead of `docker run -e` / CLI argv, and replace + `?token=` URL query output with non-URL token delivery or header auth. +3. Scrub sensitive tokens/headers before persisting to `HybridCacheStore` and enforce `0o700`/`0o600` permissions on + cache and log directories. + +## Acceptance Criteria + +- Starting the proxy container never sets `0o777` on `~/.holon/*` directories or `0o666` on `holon-root-ca.key` or + `mitmproxy-ca.pem`. +- `HOLON_COHERENCE_WEB_PASSWORD` never appears in `docker run` arguments, mitmproxy `--set` argv, or endpoint URLs. +- Regression tests assert restrictive directory/key permissions (`0o700`/`0o600`) and scrubbed cache storage. + +## Notes + +- Target repository: `holon-coherence` (evaluated at `HEAD 18084f3`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0525--coherence-harden-dashboard-and-mode-control-api.md b/.beans/holon-agentic-coder-ref-metadata-0525--coherence-harden-dashboard-and-mode-control-api.md new file mode 100644 index 00000000..54499238 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0525--coherence-harden-dashboard-and-mode-control-api.md @@ -0,0 +1,49 @@ +--- +# holon-agentic-coder-ref-metadata-0525 +title: "Harden /holon/* dashboard Host validation, /holon/api/mode auth, CORS, and wire_log_dir" +status: todo +type: bug +priority: critical +tags: + - holon-coherence + - security + - proxy +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +The proxy's local dashboard and mode-control endpoint intercept `/holon/*` paths regardless of the request `Host` +header, expose an unauthenticated control endpoint with wildcard CORS that accepts arbitrary `wire_log_dir` filesystem +paths, and ignore runtime mode overrides in `GET /holon/api/mode` when `HOLON_PASSIVE_MONITORING=1` is set. + +## Evidence + +- `src/holon_coherence/proxy/steps/serve_dashboard.py:16-93`: + - Matches `path_clean` without checking `Host` header, allowing any upstream domain serving `/holon/*` (or browser + CSRF) to hit the local control plane. + - Line 24: sets `Access-Control-Allow-Origin: *`. + - Line 39: exposes unauthenticated `POST /holon/api/mode` accepting an arbitrary unvalidated `wire_log_dir` path. + - Line 59: `GET /holon/api/mode` ignores runtime overrides when `HOLON_PASSIVE_MONITORING=1`. + +## Proposed Change + +1. Restrict `/holon/*` interception in `serve_dashboard.py` to explicit loopback/holon `Host` headers (e.g., + `localhost`, `127.0.0.1`, `[::1]`, or an explicit internal dashboard host). +2. Require bearer/web-token authentication on `POST /holon/api/mode` and drop `Access-Control-Allow-Origin: *`. +3. Reject arbitrary `wire_log_dir` paths or confine them strictly inside an allowed configured base directory via + `Path.resolve()` containment checks. +4. Fix `GET /holon/api/mode` to report active runtime overrides consistently with `POST /holon/api/mode`. + +## Acceptance Criteria + +- Requests for `/holon/*` targeting external `Host` headers pass through upstream untouched. +- Unauthenticated or cross-origin `POST /holon/api/mode` requests return `401`/`403`, and path traversal / out-of-bounds + `wire_log_dir` values return `400`. +- `GET /holon/api/mode` returns the effective runtime mode even when `HOLON_PASSIVE_MONITORING=1`. + +## Notes + +- Target repository: `holon-coherence` (evaluated at `HEAD 18084f3`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0526--coherence-fix-sse-chunk-buffering-and-wire-tests.md b/.beans/holon-agentic-coder-ref-metadata-0526--coherence-fix-sse-chunk-buffering-and-wire-tests.md new file mode 100644 index 00000000..f874c682 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0526--coherence-fix-sse-chunk-buffering-and-wire-tests.md @@ -0,0 +1,57 @@ +--- +# holon-agentic-coder-ref-metadata-0526 +title: "Fix SSE chunk fragmentation bugs and add real mitmproxy tflow wire-level tests" +status: todo +type: bug +priority: high +tags: + - holon-coherence + - sse + - proxy + - testing +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Streaming SSE handlers split raw TCP byte chunks without carrying incomplete lines or multi-byte UTF-8 sequences across +chunk boundaries, silently corrupting or dropping fragmented events. Because the test suite contains zero tests built on +real `mitmproxy.http.HTTPFlow` (`tflow`) or a local HTTP server, these wire-level bugs went undetected, while +integration tests still hit external hosts and mix legacy `unittest.TestCase`. + +## Evidence + +- `src/holon_coherence/providers/translation.py:426-442`: splits TCP chunks on `\n` with no incomplete-line carry + buffer, silently dropping JSON events split across chunks. +- `src/holon_coherence/proxy/steps/sse_tap.py:41-47`: decodes raw byte chunks without an incremental UTF-8 decoder and + contains a dead self-assignment at line 47. +- Zero tests in `tests/` construct real `mitmproxy.http.HTTPFlow` (`mitmproxy.test.tflow`) or exercise a local + `HTTPServer` despite `mitmproxy==12.2.3` in dev dependencies. +- `tests/test_docker_integration.py:31`: makes live HTTP calls to `http://example.com`. +- `tests/test_coherence.py` and `tests/test_docker_integration.py`: use legacy `unittest.TestCase`. +- `src/holon_coherence/rag_indexer.py:23`: references `".beans"`, bypassed `tests/test_repo_hygiene.py:41` (`\.beans/` + regex). + +## Proposed Change + +1. Add an incomplete-line carry buffer in `providers/translation.py` and use `codecs.getincrementaldecoder("utf-8")` in + `proxy/steps/sse_tap.py` (removing the dead self-assignment at line 47). +2. Add real `mitmproxy.test.tflow` and local `HTTPServer` wire tests covering fragmented SSE JSON lines, split + multi-byte UTF-8 characters, Host-header routing, and dashboard isolation. +3. Replace the live `http://example.com` call in `tests/test_docker_integration.py` with a local test server and migrate + remaining `unittest.TestCase` classes to pure pytest. +4. Remove `".beans"` from `rag_indexer.py:23` and tighten `tests/test_repo_hygiene.py` so bare `.beans` references are + caught. + +## Acceptance Criteria + +- Fragmented SSE JSON lines and split multi-byte UTF-8 code points across arbitrary chunk boundaries translate and tap + with zero dropped events or decode errors. +- Wire tests using `mitmproxy.test.tflow` / local `HTTPServer` pass offline with `uv run pytest`. +- Zero `unittest.TestCase` subclasses and zero harness-path `.beans` references remain in `holon-coherence`. + +## Notes + +- Target repository: `holon-coherence` (evaluated at `HEAD 18084f3`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0527--coherence-unify-provider-detection-and-cycles.md b/.beans/holon-agentic-coder-ref-metadata-0527--coherence-unify-provider-detection-and-cycles.md new file mode 100644 index 00000000..c863b76c --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0527--coherence-unify-provider-detection-and-cycles.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0527 +title: "Unify provider detection, make ProviderFormat extensible, and break import cycles" +status: todo +type: task +priority: high +tags: + - holon-coherence + - architecture + - extensibility + - refactor +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Provider detection logic is duplicated and already diverges between the proxy addon and the provider registry. Extending +`holon-coherence` with a new LLM provider requires editing closed `Literal` types and hardcoded provider branches across +multiple modules, while circular imports connect `parsers/` ↔ `providers/` and `commands/docker_ops.py` ↔ +`commands/endpoints.py`. + +## Evidence + +- `src/holon_coherence/proxy/addon.py:82-126` (`detect_provider`) vs `src/holon_coherence/providers/__init__.py:69-115`: + disagree on `"claude"` model and `"system"`-vs-`"messages"` detection precedence. +- `src/holon_coherence/providers/base.py:10`: closed `ProviderName = Literal["anthropic", "openai", "gemini"]`; + `ProviderFormat` lacks a `matches(url, payload)` seam; concrete providers nominally inherit from `Protocol`. +- `src/holon_coherence/parsers/sse.py:44-57`: hardcoded `KNOWN_PROVIDERS` omits `ollama`/`vllm`. +- `src/holon_coherence/proxy/routing.py:78-86`, `src/holon_coherence/proxy/steps/clean_payload.py:54-58`: branch on + provider name strings; `src/holon_coherence/hybrid_cache.py:173-175` ignores its `provider` parameter. +- Import cycles: `parsers/tokens.py:84` and `parsers/sse.py:58,64` deferred-import `providers.get_provider`; + `commands/docker_ops.py:24-25,122` ↔ `commands/endpoints.py:6-10`; sibling imports from `providers/anthropic.py` in + `providers/openai.py:11` and `providers/gemini.py:11`. +- Duplicate `in_container` helper in `src/holon_coherence/host_local.py:218-219` and + `src/holon_coherence/container/lifecycle.py:153-154`. + +## Proposed Change + +1. Move shared message/turn helpers (`merge_consecutive_roles`, etc.) into a leaf `providers/_common.py` module and use + structural `Protocol` typing instead of inheriting from `ProviderFormat`. +2. Add a `matches(url, payload)` (and capability/header hooks) seam to `ProviderFormat` so `detect_provider` delegates + to a single registry-ordered lookup and `KNOWN_PROVIDERS` is derived dynamically from the registry (covering + `ollama`/`vllm`). +3. Break both import cycles (`parsers/` ↔ `providers/` and `commands/docker_ops.py` ↔ `commands/endpoints.py`) and add + an acyclic-import boundary test. +4. Consolidate `in_container` into a single shared helper. + +## Acceptance Criteria + +- Exactly one provider-detection code path exists across `proxy/addon.py` and `providers/`. +- Zero circular imports remain between `parsers/`, `providers/`, and `commands/` (verified by an automated import test). +- Registering a new provider via `register_provider()` requires no core `Literal` or string `if/elif` edits. + +## Notes + +- Target repository: `holon-coherence` (evaluated at `HEAD 18084f3`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0528--coherence-cut-hot-path-copies-and-dry-drift.md b/.beans/holon-agentic-coder-ref-metadata-0528--coherence-cut-hot-path-copies-and-dry-drift.md new file mode 100644 index 00000000..296fa346 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0528--coherence-cut-hot-path-copies-and-dry-drift.md @@ -0,0 +1,60 @@ +--- +# holon-agentic-coder-ref-metadata-0528 +title: "Eliminate request hot-path deepcopies, duplicate parsers, metric drift, and ab_test leaks" +status: todo +type: task +priority: normal +tags: + - holon-coherence + - performance + - clean-code + - refactor +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +The proxy request/response hot path executes redundant `copy.deepcopy` calls, duplicate token parsing, and triple +payload normalization per cache write, while duplicated SSE/text/metrics helpers cause subtle drift (including +inconsistent streaming vs. non-streaming `finish_reason` mapping) and `ab_test.py` leaks temporary directories and +passes host paths into containers. + +## Evidence + +- Up to 4× `copy.deepcopy` per request across `src/holon_coherence/proxy/steps/clean_payload.py:17`, + `src/holon_coherence/payload_cleaner.py:52`, and `src/holon_coherence/providers/anthropic.py:44,68,96,106`; 2× token + parsing per response; 3× `normalize_payload` per `HybridCacheStore.put()`. +- `src/holon_coherence/hybrid_cache.py:76-79,248-255`: unused SQLite index `idx_prompt_cache_provider_system_created`. +- 3× copy-pasted `_iter_sse_chunks` (`providers/anthropic.py:408`, `providers/openai.py:26`, `providers/gemini.py:25`) + and 2× `_extract_item_text` (`anthropic.py:485`, `openai.py:228`). +- Divergent `CumulativeMetrics` (`src/holon_coherence/proxy/metrics.py`) vs `OfflineMetricsAccumulator` + (`src/holon_coherence/metrics/aggregation.py`) and duplicate `if ttft is not None and ttft > 0:` condition at + `proxy/metrics.py:87-91`. +- `src/holon_coherence/commands/ab_test.py:89-118`: leaks `mkdtemp` directory and passes host path into container + execution. +- `src/holon_coherence/providers/translation.py:380-382` vs `252-255`: streaming and non-streaming paths produce + inconsistent `finish_reason` values. +- `pyproject.toml:25`: unused `cryptography==48.0.1` runtime dependency. + +## Proposed Change + +1. Copy the request payload at most once at the step boundary, parse response tokens once, and normalize payloads once + on cache `put()`. +2. Drop the unused `idx_prompt_cache_provider_system_created` SQLite index in `hybrid_cache.py`. +3. Extract shared `_iter_sse_chunks`, `_extract_item_text`, and live/offline metrics accumulation helpers; remove the + duplicate `ttft` branch in `proxy/metrics.py`; align streaming vs. non-streaming `finish_reason`. +4. Fix `commands/ab_test.py` temp-dir lifecycle (`tempfile.TemporaryDirectory`) and container mount paths, and remove + unused `cryptography==48.0.1` from `pyproject.toml`. + +## Acceptance Criteria + +- Hot-path proxy pipeline performs at most one defensive copy per mutated request and one token parse per response. +- Streaming and non-streaming translation yield matching `finish_reason` values for equivalent stop states. +- Live and offline metrics accumulators share core aggregation logic and `commands/ab_test.py` leaves no leaked + `mkdtemp` directories. + +## Notes + +- Target repository: `holon-coherence` (evaluated at `HEAD 18084f3`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0529--coherence-centralize-settings-wire-log-docker.md b/.beans/holon-agentic-coder-ref-metadata-0529--coherence-centralize-settings-wire-log-docker.md new file mode 100644 index 00000000..fb022001 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0529--coherence-centralize-settings-wire-log-docker.md @@ -0,0 +1,57 @@ +--- +# holon-agentic-coder-ref-metadata-0529 +title: "Centralize typed CoherenceSettings, bound wire-log queues, and align Docker/wheel packaging" +status: todo +type: task +priority: normal +tags: + - holon-coherence + - config + - resilience + - packaging +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Environment configuration is read ad hoc with `os.getenv()` across 12+ modules and frozen at import time in several +modules, wire-log futures/files grow without bounds, CA generation errors are silently swallowed, and Dockerfile asset +resolution and dependency installation diverge from `uv.lock` and wheel packaging. + +## Evidence + +- Scattered `os.getenv()` across 12+ modules with inconsistent bool/port parsing and import-time freezes in + `src/holon_coherence/wire_log.py:41`, `src/holon_coherence/mitm_addon.py:87`, and + `src/holon_coherence/web_token.py:23`. +- `src/holon_coherence/wire_log.py:137-140`: unbounded `_pending_wire_log_futures` queue, plus 2× duplicated disk + storage (`turn_*.json` + `transactions.jsonl`) with no rotation. +- Silent exception suppression around CA setup: `src/holon_coherence/container/lifecycle.py:419-421` + (`suppress(Exception)` on `generate_root_ca`) and `src/holon_coherence/ca_generator.py:144-153` (`OSError` on + `_sync_mitmproxy_ca`). +- Fragile 4-level `__file__` traversal to find `Dockerfile` (`src/holon_coherence/commands/docker_ops.py:56`, + `src/holon_coherence/container/image.py:22`), breaking under non-editable wheel installs. +- `Dockerfile` uses `pip` (ignoring `uv.lock`), leaves base image digest unpinned, lacks `HEALTHCHECK`, and + `.dockerignore` is incomplete. + +## Proposed Change + +1. Introduce a frozen, typed `CoherenceSettings.from_env()` configuration object with uniform bool/int/path parsing and + eliminate import-time env freezes. +2. Bound `_pending_wire_log_futures` (with backpressure or drop counter), remove duplicate `turn_*.json` / + `transactions.jsonl` write overhead where redundant, and add size/age rotation. +3. Replace silent CA `suppress(Exception)`/`OSError` catches with explicit logging or propagated startup errors. +4. Resolve container/Dockerfile assets via `importlib.resources` (with editable checkout fallback), align `Dockerfile` + with `uv.lock`, pin the base digest, add a `HEALTHCHECK`, and complete `.dockerignore`. + +## Acceptance Criteria + +- All environment variables are parsed through `CoherenceSettings.from_env()` with unit-tested bool/port defaults. +- Wire-log futures queue and disk usage are bounded and rotatable; CA setup failures are logged loudly or surfaced. +- `holon-coherence` can locate Docker/build assets cleanly when installed as a wheel, and `Dockerfile` locks + dependencies against `uv.lock`. + +## Notes + +- Target repository: `holon-coherence` (evaluated at `HEAD 18084f3`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0530--coherence-type-checking-shims-and-self-doc-prune.md b/.beans/holon-agentic-coder-ref-metadata-0530--coherence-type-checking-shims-and-self-doc-prune.md new file mode 100644 index 00000000..e42def87 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0530--coherence-type-checking-shims-and-self-doc-prune.md @@ -0,0 +1,59 @@ +--- +# holon-agentic-coder-ref-metadata-0530 +title: "Add static type checker to CI, prune redundant self-doc tests, legacy shims, and root clutter" +status: todo +type: task +priority: normal +tags: + - holon-coherence + - typing + - clean-code + - hygiene +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Despite 98.3% return type annotations, CI runs no static type checker (`mypy`/`pyright`). Meanwhile, 9 redundant +per-module `*_self_doc.py` test files duplicate `test_repo_self_doc.py`, legacy compatibility barrels and per-request +`sys.modules` probes add maintenance overhead, unused experimental modules with unclosed SQLite connections sit at the +package root, and misleading names mask metric/parity semantics. + +## Evidence + +- No `mypy` or `pyright` step in `.github/workflows/`. +- 9 redundant hardcoded `*_self_doc.py` files (922 LOC) duplicating `tests/test_repo_self_doc.py`. +- `src/holon_coherence/proxy/steps/_compat.py:25-67` probes `sys.modules["holon_coherence.mitm_addon"]` on every + request; oversized re-export barrels in `cli.py:7-162`, `commands/__init__.py`, `mitm_addon.py`, `proxy/__init__.py`, + and 10 legacy Anthropic wrappers in `payload_cleaner.py:10-17,77-137`. +- Unused experimental modules at package root: `openbrain_memory.py` (unclosed SQLite connections at lines `21,48,81`), + `rag_indexer.py`, `ringer_orchestrator.py`. +- `src/holon_coherence/proxy/dashboard.py:6-383`: 378-line inline HTML/CSS/JS string literal. +- Overstated parity names `_check_semantic_parity` / `"100% Structural Equivalence"` + (`ab_testing/evaluation.py:185,307-326`) that only inspect non-empty messages and final role; triple rate aliases + (`*_tps`, `*_throughput_tps`, `*_speed_tps`) in `proxy/metrics.py:135-142`; dual CLI arg parsing (`cli.py:187-222` vs + `commands/agents.py:390-454`). + +## Proposed Change + +1. Add `mypy` or `pyright` to CI and resolve any surfaced type errors. +2. Delete the 9 redundant `*_self_doc.py` test files while keeping `tests/test_repo_self_doc.py` authoritative. +3. Migrate callers off legacy re-export shims/`_compat.py` and retire `proxy/steps/_compat.py` and `payload_cleaner.py` + legacy wrappers. +4. Move experimental modules (`openbrain_memory.py`, `rag_indexer.py`, `ringer_orchestrator.py`) into + `holon_coherence/experimental/` (or delete if obsolete) and wrap SQLite usage in context managers. +5. Extract `proxy/dashboard.py`'s inline HTML/CSS/JS to a static asset file, rename `_check_semantic_parity` / + `"100% Structural Equivalence"` to reflect structural validation accurately, consolidate duplicate TPS field aliases, + and unify CLI argument parsing. + +## Acceptance Criteria + +- CI runs `mypy` or `pyright` with zero errors on `src/` and `tests/`. +- Zero redundant `*_self_doc.py` files remain; `_compat.py` per-request probing is removed. +- Package root contains only active core modules and `dashboard.py` loads its HTML asset cleanly. + +## Notes + +- Target repository: `holon-coherence` (evaluated at `HEAD 18084f3`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0531--hac-break-layer-cycles-and-decompose-hotspots.md b/.beans/holon-agentic-coder-ref-metadata-0531--hac-break-layer-cycles-and-decompose-hotspots.md new file mode 100644 index 00000000..ac515371 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0531--hac-break-layer-cycles-and-decompose-hotspots.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0531 +title: "Break flow/entrypoint and ledger/knowledge import cycles and decompose ExecutionRun, planner, turns" +status: todo +type: task +priority: high +tags: + - holon-agentic-coder + - architecture + - complexity + - refactor +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Bidirectional import cycles link `flow` ↔ `entrypoint` (11 imports each way) and `ledger` ↔ `knowledge`, while +`FlowContext.__post_init__` triggers proxy-resolution side effects during dataclass instantiation and `ExecutionRun`, +`entrypoint/planner.py:main`, and `turns.py:run_turn` carry extreme state/complexity counts. + +## Evidence + +- Bidirectional `flow` ↔ `entrypoint` cycle (11 imports in each direction, e.g. + `apps/sandbox-executor/src/sandbox_executor/entrypoint/review_loop.py:51-56`, `flow/review/loop.py:16`, + `flow/stages/execute.py:20`). +- `ledger` ↔ `knowledge` cycle (`ledger/rows.py:324` imports `CredentialRedactor` from `knowledge.records`). +- `review_target.py:12,127,159,186,223`: deferred private imports from `flow`. +- `flow/github/token_scopes.py:7`: imports from `launcher.mounts`. +- `flow/context.py:189-194`: `FlowContext.__post_init__` calls side-effecting `coherence.resolve_flow_proxy_choice()`. +- `entrypoint/executor/run.py:89-141`: 5-mixin god object `ExecutionRun` holding 42 mutable attributes. +- Complexity hotspots outside `run_review_loop` (Bean `0192`) and `calibration.py` (Bean `0197`): + `entrypoint/planner.py:329` (`main`, CC=50, 321 lines) and `turns.py:543` (`run_turn`, CC=49, 189 lines, 18 + parameters). + +## Proposed Change + +1. Extract shared contracts, redaction interfaces, and review-target models into leaf modules to break `flow` ↔ + `entrypoint`, `ledger` ↔ `knowledge`, `flow/github` → `launcher`, and `review_target` → `flow._*` cycles, guarded by + an automated import-layer test. +2. Move `coherence.resolve_flow_proxy_choice()` out of `FlowContext.__post_init__` into an explicit factory/builder. +3. Replace `ExecutionRun`'s 5-mixin inheritance with composed collaborators, and decompose `entrypoint/planner.py:main` + and `turns.py:run_turn` using typed config/request parameter objects. + +## Acceptance Criteria + +- Automated import-layer test verifies zero circular dependencies across `flow`, `entrypoint`, `ledger`, `knowledge`, + `launcher`, and `runners`. +- `FlowContext(...)` construction is pure (zero proxy/network/subprocess side effects). +- `planner.py:main`, `turns.py:run_turn`, and `ExecutionRun` meet Ruff complexity limits without bloated parameter lists + or 5-mixin state bags. + +## Notes + +- Target repository: `holon-agentic-coder` (evaluated at `HEAD f1e18bcd`). +- Related existing beans: Bean `0192` (`run_review_loop`/`run_review_stage`), Bean `0197` (`calibration.py`), Bean + `0152`/`0489` (module budgets). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0532--hac-harden-container-limits-and-secret-perms.md b/.beans/holon-agentic-coder-ref-metadata-0532--hac-harden-container-limits-and-secret-perms.md new file mode 100644 index 00000000..cb490cda --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0532--hac-harden-container-limits-and-secret-perms.md @@ -0,0 +1,67 @@ +--- +# holon-agentic-coder-ref-metadata-0532 +title: "Add Docker resource limits, read-only intent mount, 0o600 secret permissions, and Dockerfile pinning" +status: in-progress +type: task +priority: high +tags: + - holon-agentic-coder + - security + - docker + - secrets +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +While `.git` worktree host-hardening is strong, spawned role containers lack resource limits (`--memory`, `--cpus`, +`--pids-limit`), mount `/tmp/intent.json` writable, rely on `--add-host` for metadata IP blocking (which does not stop +direct IP requests), unpack secret bundles with process umask instead of `0o600`, write `local_llm` configs with +`0o777`/`0o644`, omit `--` terminators in `git.py`, and pipe an unpinned `install.sh` to `bash` in `Dockerfile`. + +## Evidence + +- Role container `docker run` assembly omits `--memory`, `--cpus`, `--pids-limit`, and `--read-only`. +- `apps/sandbox-executor/src/sandbox_executor/launcher/mounts.py:14-19`: `--add-host 169.254.169.254:127.0.0.1` only + overrides hostname lookup, not direct IP HTTP requests to link-local metadata endpoints. +- `launcher/containers.py:194`: mounts `/tmp/intent.json` read-write inside the container. +- `local_llm.py:54-55,626-638`: sets `0o777` directory and `0o644` `models.json` permissions. +- `agent_runner.py:348-354`: unpacks secret bundles under default umask rather than `0o600` and logs unredacted + exception errors. +- `git.py:105-200`: omits `--` option/path terminators before user/branch/path arguments. +- `Dockerfile:93`: pipes unpinned, unverified `install.sh` directly to `bash`. + +## Proposed Change + +1. Configure default Docker `--memory`, `--cpus`, and `--pids-limit` flags (and `--read-only` rootfs with scoped tmpfs + where compatible), and change `/tmp/intent.json` mount to `:ro`. +2. Enforce `0o700`/`0o600` permissions on unpacked secret bundles and `local_llm.py` config files, and pass error + messages around secret handling through `redaction.py`. +3. Add `--` terminators in `git.py` subprocess calls, implement/enforce network-level metadata CIDR + (`169.254.169.254/32`) blocking where Docker network rules allow, and pin + SHA256-verify the installer script in + `Dockerfile`. + +## Acceptance Criteria + +- Container launch tests assert `--memory`, `--cpus`, `--pids-limit`, and `/tmp/intent.json:ro` in generated Docker + args. +- Unpacked secret files and `local_llm` configs are created with `0o600`/`0o700` and failures never emit unredacted + secrets. +- `Dockerfile` verifies a pinned version and SHA256 checksum rather than piping unverified remote `install.sh`. + +## Notes + +- Target repository: `holon-agentic-coder` (evaluated at `HEAD f1e18bcd`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). + +## Flow (2026-11-27) + +flow slug secret-bundle-private-files (claude-agent, claude-opus-5-5) covers only the secret bundle part of item 2 +(0o600 files, 0o700 directories, redacted warning in agent_runner.py). Left open: container resource limits and +read-only intent mount (touch launcher/containers.py, parked with 0390), local_llm modes (the container user needs +them), git.py terminators (tests assert exact git args), Dockerfile pin (needs a vendor checksum). + +parked 2026-11-27: Stage 4 halted before push (pre-push tests test_flow_repo_templates history and +test_executor_run_salvage fail on the review-loop identity leak); PR #356 open. Resume from checkpoint (--checkpoint, +--from-stage review) once the review identity fix merges. diff --git a/.beans/holon-agentic-coder-ref-metadata-0533--hac-add-type-checker-and-consolidate-dry-drift.md b/.beans/holon-agentic-coder-ref-metadata-0533--hac-add-type-checker-and-consolidate-dry-drift.md new file mode 100644 index 00000000..4428da6d --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0533--hac-add-type-checker-and-consolidate-dry-drift.md @@ -0,0 +1,55 @@ +--- +# holon-agentic-coder-ref-metadata-0533 +title: "Add mypy/pyright to CI, unify agent-ID and numstat helpers, and drive runtime env from env_registry" +status: todo +type: task +priority: high +tags: + - holon-agentic-coder + - typing + - clean-code + - dry +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +99.5% of functions carry return annotations, yet CI runs no static type checker (`mypy`/`pyright`). Core +normalization/parsing logic (agent IDs, runner metadata, `git diff --numstat`) is duplicated across 4–5 sites, runtime +code does not consume `env_registry.py` (causing real documentation/behavior drift like `HOLON_AGENT_EFFORT`), and +legacy `os.environ` mutations plus dead shims remain. + +## Evidence + +- No `mypy`/`pyright` check in `.github/workflows/`. +- 4 separate agent-ID normalizers: `agent_defaults.py:328` (`normalise_agent_id`), `local_llm.py:92` + (`normalize_agent_id`), `agent_runner.py:682`, `entrypoint/role_dispatcher.sh:14-18`. +- Duplicate runner metadata between `agent_defaults.py` and `runners/*.py`. +- 5 separate `git diff --numstat` parsers (including literal tab parsing at `flow/stages/review.py:139`). +- `env_registry.py:4-5,55` and `config_env_keys.py:10` document `HOLON_AGENT_EFFORT` for Claude, whereas only + `AntigravityAgentRunner` reads it (`agent_runner.py:517`). +- Process-global `os.environ` mutations in `cli/main.py:47` and `agent_runner.py:336,436`. +- Dead legacy artifacts: `_support_legacy_repo_dir` monkey-patch decorator (`flow/context.py:120-132`) and unreachable + `sys.version_info >= (3, 12)` check (`agent_runner.py:81-84`). + +## Proposed Change + +1. Wire `mypy` or `pyright` into CI across `sandbox_executor` and fix surfaced type mismatches. +2. Unify agent-ID normalization into one shared helper (consumed by Python and shell/dispatcher wrappers) and + consolidate `git diff --numstat` parsing into `git.py`. +3. Generate or validate runtime env lookups directly from `env_registry.py` (fixing `HOLON_AGENT_EFFORT` alignment) and + pass scoped `env` mappings instead of mutating process-global `os.environ`. +4. Delete `_support_legacy_repo_dir` and the dead `sys.version_info >= (3, 12)` guard. + +## Acceptance Criteria + +- CI executes `mypy` or `pyright` cleanly on every PR. +- Single canonical helper exists for agent-ID normalization and `git diff --numstat` parsing. +- `HOLON_AGENT_EFFORT` docs and runner behavior agree, verified via `test_environment_reference.py`. + +## Notes + +- Target repository: `holon-agentic-coder` (evaluated at `HEAD f1e18bcd`). +- Coordinate env consolidation with Bean `0223`. +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0534--hac-fix-silent-excepts-library-exits-adapters.md b/.beans/holon-agentic-coder-ref-metadata-0534--hac-fix-silent-excepts-library-exits-adapters.md new file mode 100644 index 00000000..42279243 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0534--hac-fix-silent-excepts-library-exits-adapters.md @@ -0,0 +1,49 @@ +--- +# holon-agentic-coder-ref-metadata-0534 +title: "Eliminate silent except-pass catches, library sys.exit calls, and GitHub/Git adapter error gaps" +status: todo +type: bug +priority: normal +tags: + - holon-agentic-coder + - resilience + - error-handling +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Three `except Exception: pass` blocks silently swallow failures (including temporary credential cleanup), library +modules call `sys.exit(1)` instead of raising domain exceptions, `GitHubAdapter` bypasses `parse_gh_json` and drops +`self.proxy_env` in `gh()`, and `git.py` raises untyped `RuntimeError` exceptions. + +## Evidence + +- Silent `except Exception: pass` at `apps/sandbox-executor/src/sandbox_executor/launcher/containers.py:211` (temp + credential cleanup), `agent_runner.py:433`, and `flow/pipeline.py:430` (among 133 broad `except Exception` blocks). +- `sys.exit(1)` inside library modules: `agent_runner.py:380,686` and `launcher/mounts.py:84`. +- `flow/github/adapter.py:91` calls raw `json.loads` rather than `parse_gh_json`; `GitHubAdapter.gh()` at lines + `114-116` omits `self.proxy_env`. +- `git.py:43`: raises generic `RuntimeError` instead of a structured `GitCommandError`. + +## Proposed Change + +1. Replace the 3 silent `except Exception: pass` blocks with narrowed exception types and explicit warning/cleanup + logging (and triage/narrow the highest-risk remaining broad `except Exception` catches). +2. Replace `sys.exit(1)` in `agent_runner.py` and `launcher/mounts.py` with typed exceptions handled at the CLI + entrypoint boundary. +3. Update `flow/github/adapter.py:91` to use `parse_gh_json` and pass `self.proxy_env` through `GitHubAdapter.gh()`. +4. Introduce a typed `GitCommandError` in `git.py` carrying `returncode`, `cmd`, and `stderr`. + +## Acceptance Criteria + +- Zero silent `except Exception: pass` blocks remain in `src/sandbox_executor/`. +- No library module calls `sys.exit(...)` outside CLI/script entrypoints. +- `GitHubAdapter.gh()` respects `proxy_env` and surfaces malformed `gh` JSON via `parse_gh_json`; `git.py` raises + `GitCommandError`. + +## Notes + +- Target repository: `holon-agentic-coder` (evaluated at `HEAD f1e18bcd`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0535--hac-unify-runner-spec-git-forge-stage-registry.md b/.beans/holon-agentic-coder-ref-metadata-0535--hac-unify-runner-spec-git-forge-stage-registry.md new file mode 100644 index 00000000..7174dec0 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0535--hac-unify-runner-spec-git-forge-stage-registry.md @@ -0,0 +1,49 @@ +--- +# holon-agentic-coder-ref-metadata-0535 +title: "Make RunnerSpec single-source runner registration and add GitForge Protocol + stage registry" +status: todo +type: task +priority: normal +tags: + - holon-agentic-coder + - extensibility + - architecture +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Adding a new coding-agent runner still requires coordinated edits across ~8 files spanning Python, shell, and Docker +configs. Meanwhile, GitHub CLI (`gh`) calls are hardcoded with no forge `Protocol`, `flow/pipeline.py` dispatches stages +via hardcoded `if/elif`, only 2 `Protocol` classes exist across 341 modules, and `subprocess` is imported directly in 50 +modules. + +## Evidence + +- Adding a runner spans `agent_runner.py`, `agent_defaults.py`, `launcher/mounts.py`, `entrypoint/role_dispatcher.sh`, + `Dockerfile`, `docker-bake.hcl`, `env_registry.py`, and docs despite `runners/spec.py` (`RunnerSpec`). +- `flow/pipeline.py:176-199`: hardcoded `if/elif` stage dispatch. +- Only 2 `Protocol` definitions across 341 source files; no `GitForge` `Protocol` decoupling PR/CI operations from `gh` + JSON; `subprocess` imported directly in 50 modules. + +## Proposed Change + +1. Make `RunnerSpec` (`runners/spec.py`) the single source of truth driving `agent_defaults.py`, `launcher/mounts.py`, + and generated/manifested role-dispatcher runner metadata. +2. Define a `GitForge` `Protocol` implemented by `GitHubAdapter` so stage code depends on the protocol rather than `gh` + subprocess internals. +3. Replace the `if/elif` stage dispatch in `flow/pipeline.py:176-199` with a declarative stage registry mapping stage + enum/keys to handlers. + +## Acceptance Criteria + +- Runner mounts, defaults, and model-discovery hooks read from `RunnerSpec` without duplicating per-runner tables in + `agent_defaults.py`. +- Pipeline stage dispatch uses a registry table and PR/CI consumers type against `GitForge`. + +## Notes + +- Target repository: `holon-agentic-coder` (evaluated at `HEAD f1e18bcd`). +- Related: Bean `0270` (dynamic model discovery). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0536--hac-structured-logging-and-bounded-checkpoints.md b/.beans/holon-agentic-coder-ref-metadata-0536--hac-structured-logging-and-bounded-checkpoints.md new file mode 100644 index 00000000..7d57638f --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0536--hac-structured-logging-and-bounded-checkpoints.md @@ -0,0 +1,48 @@ +--- +# holon-agentic-coder-ref-metadata-0536 +title: "Unify structured logging, bound checkpoint context.logs, and remove FlowCheckpoint dual-writes" +status: todo +type: task +priority: normal +tags: + - holon-agentic-coder + - observability + - logging +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Flow execution emits unstructured plain-text logs with mixed `print()` and `logging` calls, appends unbounded +`context.logs` arrays directly inside persisted `FlowCheckpoint` JSON snapshots, and maintains dual-write redundancy in +`FlowCheckpoint.to_dict()`. + +## Evidence + +- Mixed `print()` and unstructured `logging` across stage/CLI execution paths. +- Unbounded `context.logs` persisted inside checkpoint JSON files (slowing atomic checkpoint + serialization/deserialization on long or restarted flows). +- `apps/sandbox-executor/src/sandbox_executor/flow/checkpoint.py:124-128`: `FlowCheckpoint.to_dict()` duplicates + `admission` fields alongside legacy aliases such as `repo_dir`. + +## Proposed Change + +1. Introduce structured log event helpers (supporting JSON or key=value line format) and route execution progress + through `logging` rather than ad-hoc `print()`. +2. Bound `context.logs` inside `FlowCheckpoint` (e.g., tail ring buffer of recent entries) while writing full logs to + the dedicated flow log file. +3. Deprecate and remove dual-write `admission` / `repo_dir` redundancy from `FlowCheckpoint.to_dict()` while preserving + read compatibility for existing checkpoints. + +## Acceptance Criteria + +- Checkpoint JSON size stays bounded regardless of flow iteration count or restart count. +- `FlowCheckpoint.to_dict()` emits a single canonical schema without duplicate `admission` / `repo_dir` fields, while + `from_dict()` still loads older checkpoints cleanly. + +## Notes + +- Target repository: `holon-agentic-coder` (evaluated at `HEAD f1e18bcd`). +- Coordinate with Bean `0412` / `0476` / `0495` on flow log streaming. +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0537--hac-retire-compat-shims-stale-budgets-why-policy.md b/.beans/holon-agentic-coder-ref-metadata-0537--hac-retire-compat-shims-stale-budgets-why-policy.md new file mode 100644 index 00000000..cc040f25 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0537--hac-retire-compat-shims-stale-budgets-why-policy.md @@ -0,0 +1,57 @@ +--- +# holon-agentic-coder-ref-metadata-0537 +title: "Retire legacy re-export shims, stale budget overrides, conftest allowlist, and allow # WHY comments" +status: todo +type: task +priority: normal +tags: + - holon-agentic-coder + - hygiene + - clean-code + - testing +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Over 834 lines of compatibility re-export shims expose `_`-private internals, 9 stale module-budget overrides and an +empty `token_reduction/` directory clutter the tree, `tests/conftest.py` carries a brittle hardcoded test-name allowlist +amid heavy white-box patching, and zero-comment enforcement in `tests/test_self_doc_modules.py` strips crucial "why" +explanations from subtle safety/platform invariants. + +## Evidence + +- 834 lines of compatibility shims exposing `_`-private symbols: `cli/__init__.py` (350L), `ledger/__init__.py` (167L), + and `flow/lazy_exports*.py` (317L). +- 9 stale overrides in `holon-config/hygiene/module_budgets.json` (e.g. `flow/__init__.py` at 38L vs 522L cap) and + orphaned empty `token_reduction/` directory. +- `tests/conftest.py:369-393`: hardcoded `_FEATURE_WORKTREE_CWD_TESTS` allowlist; 4 global autouse stubs + (`lines 408-442`), 2,677 `monkeypatch`/`mock.patch` sites, and 84 private `_` imports across tests. +- `tests/test_self_doc_modules.py` (with stale `BASELINE_LINE_CEILINGS` at `line 190`) bans all inline comments, erasing + critical rationale for non-obvious invariants (`local_llm.py:54-55` `0o777`, `git.py:71-72` `TypeError` retry, + `ledger/lock.py:21` errno `45`, `git_flow.py:34-69` `.git` sentinels). + +## Proposed Change + +1. Update internal/test imports to reference canonical modules, delete the 834L compatibility shims and empty + `token_reduction/` directory, and remove the 9 stale `module_budgets.json` overrides (coordinating with Bean `0489`). +2. Replace `_FEATURE_WORKTREE_CWD_TESTS` in `tests/conftest.py` with an explicit `@pytest.mark.allow_worktree_cwd` + marker and shift new tests from `_`-private monkeypatching to adapter/contract seams. +3. Extend `tests/test_self_doc_modules.py` to explicitly permit `# WHY:` invariant comments on non-obvious + platform/security constraints, refresh `BASELINE_LINE_CEILINGS`, and restore concise `# WHY:` annotations to the + subtle invariants above. + +## Acceptance Criteria + +- Compatibility re-export shims and orphaned `token_reduction/` directory are removed; zero stale `module_budgets.json` + caps remain above current+margin. +- `tests/conftest.py` contains no hardcoded test-function name allowlist. +- `test_self_doc_modules.py` permits `# WHY:` comments while continuing to reject redundant narrating comments. + +## Notes + +- Target repository: `holon-agentic-coder` (evaluated at `HEAD f1e18bcd`). +- Related existing beans: Bean `0379` (`__init__.py` logic), Bean `0405` (test cleanup), Bean `0489` (module budget + step-down), Bean `0153` (self-doc). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0538--hac-add-architecture-audit-kb-entries.md b/.beans/holon-agentic-coder-ref-metadata-0538--hac-add-architecture-audit-kb-entries.md new file mode 100644 index 00000000..5eac4527 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0538--hac-add-architecture-audit-kb-entries.md @@ -0,0 +1,306 @@ +--- +# holon-agentic-coder-ref-metadata-0538 +title: "Add 2026-11 architecture audit patterns and failure modes to holon-agentic-coder KB" +status: todo +type: task +priority: normal +tags: + - holon-agentic-coder + - knowledge-base + - architecture + - audit +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Key architectural patterns and systemic failure modes uncovered during the 2026-11 review of `holon-agentic-coder` +(`HEAD f1e18bcd`) are not yet persisted inside `holon-knowledge/kb/` where Stage 2 planners and Stage 4 reviewers can +consult them. Under the Sole Change Path rule, target repository KB entries must land via `holon flow`. + +## Proposed Change + +Run `holon flow` targeting `holon-agentic-coder` to add the 7 curated, target-native KB JSON files below to +`holon-knowledge/kb/patterns/` and `holon-knowledge/kb/failure_modes/`. All payloads conform to +`docs/knowledgebase_schema.md` and contain zero harness references. + +### 1. `holon-knowledge/kb/patterns/KB-pattern-worktree-git-hardening.json` + +```json +{ + "kb_id": "KB-pattern-worktree-git-hardening", + "kb_type": "pattern", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 1, + "failure_count": 0 + }, + "tags": ["security", "git", "worktree", "docker", "secrets"], + "human_approved": true, + "payload": { + "name": "Host .git Worktree Metadata Hardening & 0o600 Temp Env-Files", + "description": "Isolate containerised role execution from host git hook/config tampering by rejecting extensions.worktreeConfig=true, mounting .git/{hooks,config,modules} read-only with inert sentinels, checking POSIX ACLs, and passing secrets exclusively via 0o600 temp env-files in 0o700 dirs.", + "modules": [ + "apps/sandbox-executor/src/sandbox_executor/git_flow.py", + "apps/sandbox-executor/src/sandbox_executor/launcher/env_files.py", + "apps/sandbox-executor/src/sandbox_executor/redaction.py" + ], + "known_pitfalls": [ + "Always pair --add-host metadata overrides with network-level blocks if direct IP egress is undesirable", + "Avoid overwriting secret mounts with writable tmpfs or process-umask file copies" + ] + } +} +``` + +### 2. `holon-knowledge/kb/patterns/KB-pattern-hermetic-pytest-conftest.json` + +```json +{ + "kb_id": "KB-pattern-hermetic-pytest-conftest", + "kb_type": "pattern", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 1, + "failure_count": 0 + }, + "tags": ["testing", "pytest", "hermeticity", "isolation"], + "human_approved": true, + "payload": { + "name": "Suite-Wide Hermetic pytest Guards in conftest.py", + "description": "Enforce global git identity isolation, credential/keychain scrubbing, active-checkout ledger mutation detection, GitHub CLI write guards, and socket/network guards inside tests/conftest.py alongside automated environment-reference and repository-hygiene drift suites.", + "modules": [ + "apps/sandbox-executor/tests/conftest.py", + "apps/sandbox-executor/tests/test_environment_reference.py", + "apps/sandbox-executor/tests/test_repository_hygiene.py" + ], + "known_pitfalls": [ + "Avoid hardcoded test-function name allowlists; use explicit pytest markers", + "Prefer adapter/contract test seams over monkeypatching private _-prefixed symbols" + ] + } +} +``` + +### 3. `holon-knowledge/kb/patterns/KB-pattern-three-ledger-fragment-routing.json` + +```json +{ + "kb_id": "KB-pattern-three-ledger-fragment-routing", + "kb_type": "pattern", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 1, + "failure_count": 0 + }, + "tags": ["ledger", "provenance", "concurrency", "resilience"], + "human_approved": true, + "payload": { + "name": "Append-Only 3-Ledger Fragment Routing & Prefix Verification", + "description": "Preserve provenance without cross-flow merge conflicts by routing concurrent flow writes to per-intent pending fragments under holon-knowledge/ledger/pending/, enforcing LedgerLock advisory locking with fsync and prefix-rewrite verification, and promoting fragments idempotently on main.", + "modules": [ + "apps/sandbox-executor/src/sandbox_executor/ledger/route.py", + "apps/sandbox-executor/src/sandbox_executor/ledger/fragments.py", + "apps/sandbox-executor/src/sandbox_executor/ledger/promote.py", + "apps/sandbox-executor/src/sandbox_executor/ledger/lock.py" + ], + "known_pitfalls": ["Keep runtime metadata paths relative to target-native holon-knowledge/ only"] + } +} +``` + +### 4. `holon-knowledge/kb/failure_modes/KB-failure-bidirectional-flow-entrypoint-cycle.json` + +```json +{ + "kb_id": "KB-failure-bidirectional-flow-entrypoint-cycle", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["architecture", "import-cycle", "layer-boundary"], + "human_approved": true, + "payload": { + "name": "Bidirectional flow <-> entrypoint and ledger <-> knowledge Import Cycles", + "description": "Mutually importing flow and entrypoint (11 edges each way) or ledger and knowledge (via redaction imports), paired with deferred private imports from flow in review_target.py and side-effecting resolve_flow_proxy_choice() in FlowContext.__post_init__, tangles host orchestration and in-container execution layers.", + "symptoms": [ + "Deferred function-local imports required to avoid ImportError at startup", + "Dataclass construction triggers external proxy/network lookup", + "Unit tests require heavy monkeypatching across internal private module boundaries" + ], + "root_causes": [ + "Shared domain contracts, target models, and redactors live inside higher orchestration packages instead of leaf modules", + "Configuration side effects executed inside __post_init__" + ], + "mitigations": [ + { + "strategy": "Invert dependencies via leaf contract modules and explicit factories", + "description": "Extract shared contracts/redaction interfaces into leaf packages, construct FlowContext via an explicit factory, and enforce acyclic layer direction with an import test.", + "cost": "Medium refactor", + "effectiveness": 0.95 + } + ] + } +} +``` + +### 5. `holon-knowledge/kb/failure_modes/KB-failure-monolithic-review-loop-complexity.json` + +```json +{ + "kb_id": "KB-failure-monolithic-review-loop-complexity", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["complexity", "maintainability", "review-loop"], + "human_approved": true, + "payload": { + "name": "Extreme Cyclomatic Complexity & God Object Growth in Orchestration Loops", + "description": "Unbounded stateful loops accumulate 17-18 parameters, ~25 locals, and cyclomatic complexity up to 205-210 (flow/review/loop.py:run_review_loop), alongside CC~50 functions (entrypoint/planner.py:main, turns.py:run_turn, flow/stages/review.py) and 5-mixin bags like ExecutionRun.", + "symptoms": [ + "Single functions exceed 300-750 lines and Ruff C901 limits via inline suppressions", + "Merge conflicts converge repeatedly on oversized loop/calibration modules", + "High cognitive load and fragile white-box mocking in unit tests" + ], + "root_causes": [ + "Inline state mutation across multi-stage retries, CI waits, consensus evaluation, and resolution without a dedicated step object", + "Adding new flags/options directly to function signatures instead of typed request/context objects" + ], + "mitigations": [ + { + "strategy": "Decompose into stateful coordinator + pure decision functions", + "description": "Replace monolithic loops and multi-mixin inheritance with a focused coordinator holding named step methods and pure functional verdict transitions.", + "cost": "High initially, lowers long-term churn", + "effectiveness": 0.9 + } + ] + } +} +``` + +### 6. `holon-knowledge/kb/failure_modes/KB-failure-env-registry-runtime-drift.json` + +```json +{ + "kb_id": "KB-failure-env-registry-runtime-drift", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["config", "dry", "documentation", "resilience"], + "human_approved": true, + "payload": { + "name": "Declarative Env Registry Drift & Duplicated Normalization Helpers", + "description": "When env_registry.py documents keys separately from runtime parsing, consumer behavior diverges silently (e.g. HOLON_AGENT_EFFORT documented for Claude while only read by AntigravityAgentRunner). Parallel agent-ID normalizers (4 copies), git diff --numstat parsers (5 copies), and silent except Exception: pass blocks compound maintenance drift.", + "symptoms": [ + "Environment reference tables disagree with actual runner consumption", + "Subtle behavioral divergence across duplicated ID normalizers or diff parsers", + "Cleanup errors or credential unlink failures vanish under except Exception: pass" + ], + "root_causes": [ + "Registry acts as documentation metadata rather than the single runtime source of truth", + "Utility parsing written inline across stages instead of centralized in git.py / agent_defaults.py" + ], + "mitigations": [ + { + "strategy": "Single-source env definitions and shared helpers", + "description": "Have runtime config resolution read directly from env_registry.py definitions, consolidate ID/numstat helpers, and forbid silent except Exception: pass blocks.", + "cost": "Low", + "effectiveness": 0.95 + } + ] + } +} +``` + +### 7. `holon-knowledge/kb/failure_modes/KB-failure-container-resource-and-secret-perm-gaps.json` + +```json +{ + "kb_id": "KB-failure-container-resource-and-secret-perm-gaps", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["security", "docker", "secrets", "supply-chain"], + "human_approved": true, + "payload": { + "name": "Missing Container Resource Limits, Permissive Secret Unpacking, & Unpinned Installers", + "description": "Strong .git mount hardening is weakened when role containers launch without --memory/--cpus/--pids-limit/--read-only, mount /tmp/intent.json writable, rely only on --add-host against direct metadata IPs, unpack secret bundles without explicit 0o600 permissions (or log unredacted errors), or curl | bash unpinned installers in Dockerfile.", + "symptoms": [ + "Runaway agent subprocesses can exhaust host memory or PIDs", + "Secret bundle files inherit permissive umask or broad local_llm directory modes (0o777/0o644)" + ], + "root_causes": [ + "Container flags omitted resource quotas and read-only intent mount qualifier", + "File creation helpers omitted explicit os.chmod(0o600/0o700) and redaction wrapping" + ], + "mitigations": [ + { + "strategy": "Enforce Docker quotas, 0o600 permissions, and checksum-pinned builds", + "description": "Pass --memory/--cpus/--pids-limit and :ro mounts, explicitly set 0o600/0o700 on secrets and local_llm configs, add -- terminators in git commands, and verify SHA256 checksums for Dockerfile downloads.", + "cost": "Low", + "effectiveness": 0.95 + } + ] + } +} +``` + +## Acceptance Criteria + +- All 7 `KB-*.json` files above are committed under `holon-knowledge/kb/{patterns,failure_modes}/` via `holon flow` + targeting `holon-agentic-coder`. +- `sandbox_executor.knowledge.wisdom.load_index()` loads every entry cleanly with zero schema/JSON errors and zero + harness path leaks. + +## Notes + +- Target repository: `holon-agentic-coder` (must execute via `holon flow`; never hand-edit + `apps/holon-agentic-coder/main`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0539--coherence-add-architecture-audit-kb-entries.md b/.beans/holon-agentic-coder-ref-metadata-0539--coherence-add-architecture-audit-kb-entries.md new file mode 100644 index 00000000..e3846a40 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0539--coherence-add-architecture-audit-kb-entries.md @@ -0,0 +1,305 @@ +--- +# holon-agentic-coder-ref-metadata-0539 +title: "Add 2026-11 architecture audit patterns and failure modes to holon-coherence KB" +status: todo +type: task +priority: normal +tags: + - holon-coherence + - knowledge-base + - architecture + - audit +created_at: 2026-11-26T13:35:00Z +updated_at: 2026-11-26T13:35:00Z +--- + +## Problem + +Key architectural patterns and critical failure modes identified during the 2026-11 review of `holon-coherence` +(`HEAD 18084f3`) should be codified inside `holon-coherence/holon-knowledge/kb/` so future flows reuse clean pipeline +patterns and avoid security/SSE regressions. Under the Sole Change Path rule, these KB files must land via `holon flow`. + +## Proposed Change + +Run `holon flow` targeting `holon-coherence` to add the 7 curated, target-native KB JSON files below to +`holon-knowledge/kb/patterns/` and `holon-knowledge/kb/failure_modes/`. All payloads conform to +`knowledgebase_schema.md` and contain zero harness references. + +### 1. `holon-knowledge/kb/patterns/KB-pattern-declarative-proxy-step-pipeline.json` + +```json +{ + "kb_id": "KB-pattern-declarative-proxy-step-pipeline", + "kb_type": "pattern", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 1, + "failure_count": 0 + }, + "tags": ["proxy", "architecture", "pipeline", "modularity"], + "human_approved": true, + "payload": { + "name": "Declarative Fail-Open StepSpec Proxy Pipeline", + "description": "Keep MitmproxyAddon.request/response under 30 lines by composing small (33-146L), single-purpose StepSpec modules operating over typed RequestContext/ResponseContext objects with explicit Outcome.CONTINUE/HALT control flow and run_guarded fail-open isolation.", + "modules": [ + "src/holon_coherence/proxy/steps/base.py", + "src/holon_coherence/proxy/steps/__init__.py", + "src/holon_coherence/proxy/addon.py" + ], + "known_pitfalls": [ + "Retire legacy sys.modules compat probes (_compat.py) promptly so step execution stays side-effect free", + "Copy payload once at the entry boundary rather than calling deepcopy inside multiple sequential steps" + ] + } +} +``` + +### 2. `holon-knowledge/kb/patterns/KB-pattern-locked-complexity-and-self-doc-hygiene.json` + +```json +{ + "kb_id": "KB-pattern-locked-complexity-and-self-doc-hygiene", + "kb_type": "pattern", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 1, + "failure_count": 0 + }, + "tags": ["complexity", "hygiene", "self-documenting", "testing"], + "human_approved": true, + "payload": { + "name": "Locked Complexity Baseline Ratchet & Dynamic Self-Doc Verification", + "description": "Enforce a 200-line default module budget, lock inline complexity # noqa counts with an automated ratchet test (test_complexity_baseline.py), and dynamically enforce self-documenting symbol naming across every source module (test_repo_self_doc.py).", + "modules": [ + "holon-config/hygiene/module_budgets.json", + "tests/test_complexity_baseline.py", + "tests/test_module_budgets.py", + "tests/test_repo_self_doc.py" + ], + "known_pitfalls": [ + "Remove per-module *_self_doc.py duplicates once covered globally by test_repo_self_doc.py", + "Pair complexity gates with static type checking (mypy/pyright) in CI" + ] + } +} +``` + +### 3. `holon-knowledge/kb/patterns/KB-pattern-honest-unmeasured-wire-telemetry.json` + +```json +{ + "kb_id": "KB-pattern-honest-unmeasured-wire-telemetry", + "kb_type": "pattern", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 1, + "failure_count": 0 + }, + "tags": ["telemetry", "metrics", "security", "redaction"], + "human_approved": true, + "payload": { + "name": "Provider-Agnostic X-Holon-* Telemetry with Honest Unmeasured Labels & Recursive Scrubbing", + "description": "Emit uniform X-Holon-* wire telemetry headers across providers, explicitly report 'unmeasured' for non-streaming or sub-50ms decode timings rather than synthetic estimates, and scrub 16+ sensitive headers, query parameters, token regexes, and recursive JSON bodies before persisting wire logs.", + "modules": [ + "src/holon_coherence/proxy/steps/record_metrics.py", + "src/holon_coherence/metrics_math.py", + "src/holon_coherence/proxy/timing.py", + "src/holon_coherence/proxy/scrubbing.py" + ], + "known_pitfalls": [ + "Bound async wire-log pending queues and rotate transactions/turn logs to cap disk growth", + "Ensure HybridCacheStore entries undergo the same scrubbing/permission hygiene as wire logs" + ] + } +} +``` + +### 4. `holon-knowledge/kb/failure_modes/KB-failure-world-writable-ca-mount-permissions.json` + +```json +{ + "kb_id": "KB-failure-world-writable-ca-mount-permissions", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["security", "ca", "permissions", "secrets", "docker"], + "human_approved": true, + "payload": { + "name": "Container Startup Overwrites CA Private Key Permissions to 0o666 / 0o777", + "description": "Passing world_accessible_mounts=True from commands/start.py into container/lifecycle.py chmods ~/.holon/{proxy-ca,cache,logs} to 0o777 and holon-root-ca.key / mitmproxy-ca.pem to 0o666, completely nullifying ca_generator.py's 0o700/0o600 hardening. Paired with passing HOLON_COHERENCE_WEB_PASSWORD on docker/mitmproxy argv and ?token= URLs plus unscrubbed payloads in 0o777 cache.", + "symptoms": [ + "MITM Root CA private key is world-readable and world-writable on host", + "Web UI password visible in process table (ps) and terminal URL logs" + ], + "root_causes": [ + "Broad chmod 0o777/0o666 workaround for container UID mismatch instead of UID/GID mapping or read-only cert mounts", + "Passing secret values via CLI flags and URL query parameters" + ], + "mitigations": [ + { + "strategy": "Enforce strict 0o700/0o600 permissions and file-based secret passing", + "description": "Remove world_accessible_mounts=True, align container UID/GID or use separate cert-only mounts keeping private keys 0o600, pass web_password via 0o600 env/config files, and scrub cached payloads.", + "cost": "Low", + "effectiveness": 0.99 + } + ] + } +} +``` + +### 5. `holon-knowledge/kb/failure_modes/KB-failure-unauthenticated-hostless-proxy-control.json` + +```json +{ + "kb_id": "KB-failure-unauthenticated-hostless-proxy-control", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["security", "proxy", "dashboard", "csrf"], + "human_approved": true, + "payload": { + "name": "Host-Less /holon/* Dashboard Hijack & Unauthenticated /holon/api/mode", + "description": "proxy/steps/serve_dashboard.py intercepts any request matching path_clean under /holon/* without validating Host, sets Access-Control-Allow-Origin: *, and accepts unauthenticated POST /holon/api/mode payloads with an unvalidated wire_log_dir path (while GET /holon/api/mode ignores runtime overrides when HOLON_PASSIVE_MONITORING=1).", + "symptoms": [ + "External websites or proxied traffic under /holon/* collide with the local control plane", + "Any local process or cross-origin page can switch proxy mode or redirect wire logs to arbitrary host paths" + ], + "root_causes": [ + "Route matcher checks path without explicit loopback/holon Host allowlist", + "State-mutating control endpoint lacks token auth, CORS restriction, and path containment validation" + ], + "mitigations": [ + { + "strategy": "Validate Host header, authenticate POST /holon/api/mode, and confine wire_log_dir", + "description": "Only intercept explicit localhost/holon Host headers, require web-token authentication on mode mutations, drop wildcard CORS, and confine wire_log_dir via Path.resolve() containment.", + "cost": "Low", + "effectiveness": 0.98 + } + ] + } +} +``` + +### 6. `holon-knowledge/kb/failure_modes/KB-failure-unbuffered-sse-chunks-without-wire-tests.json` + +```json +{ + "kb_id": "KB-failure-unbuffered-sse-chunks-without-wire-tests", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["sse", "streaming", "testing", "mitmproxy"], + "human_approved": true, + "payload": { + "name": "Unbuffered SSE Chunk Splitting Masked by Duck-Typed Fake Proxy Tests", + "description": "providers/translation.py splits streaming TCP chunks on newline without a carry buffer for partial lines, and proxy/steps/sse_tap.py decodes raw byte chunks without an incremental UTF-8 decoder. Unit tests relied solely on duck-typed fake flow objects with zero mitmproxy.test.tflow or HTTPServer wire tests, letting chunk-boundary corruption go untested.", + "symptoms": [ + "JSON SSE events split across TCP packets are silently dropped during translation", + "Multi-byte UTF-8 characters split across chunks raise or corrupt tap output" + ], + "root_causes": [ + "Per-chunk stateless .split('\\n') and .decode('utf-8') instead of persistent line buffer and incremental UTF-8 decoder", + "Absence of real mitmproxy tflow and chunked HTTPServer wire tests" + ], + "mitigations": [ + { + "strategy": "Add incremental line + UTF-8 buffering and wire-level chunk-split tests", + "description": "Carry partial SSE lines between chunks, use codecs.getincrementaldecoder('utf-8'), and add real mitmproxy.test.tflow + local HTTPServer tests splitting mid-JSON and mid-rune.", + "cost": "Low", + "effectiveness": 0.95 + } + ] + } +} +``` + +### 7. `holon-knowledge/kb/failure_modes/KB-failure-hot-path-deepcopy-and-provider-drift.json` + +```json +{ + "kb_id": "KB-failure-hot-path-deepcopy-and-provider-drift", + "kb_type": "failure_mode", + "version": "1.0", + "created_ts": "2026-11-26T13:35:00Z", + "updated_ts": "2026-11-26T13:35:00Z", + "created_by": "architecture-audit-2026-11", + "status": "active", + "evidence": { + "ledger_refs": ["architecture-audit-2026-11-26"], + "success_count": 0, + "failure_count": 1 + }, + "tags": ["performance", "dry", "providers", "extensibility"], + "human_approved": true, + "payload": { + "name": "Hot-Path Deepcopy Multiplication & Divergent Provider Detection Logic", + "description": "Each proxied LLM request undergoes up to 4x copy.deepcopy calls, 2x response token parses, and 3x cache payload normalizations while proxy/addon.py:detect_provider and providers/__init__.py disagree on claude/system-vs-messages precedence and closed ProviderName Literals block extensible provider registration.", + "symptoms": [ + "Added proxy latency on large multi-turn context payloads", + "Routing vs token-cleaning steps can classify edge payloads to different providers" + ], + "root_causes": [ + "Independent helper functions performing defensive deep copies and re-parsing instead of sharing normalized context per flow", + "Duplicate detect_provider implementations instead of ProviderFormat.matches(url, payload)" + ], + "mitigations": [ + { + "strategy": "Single boundary copy + registry-driven ProviderFormat.matches()", + "description": "Copy mutated payloads at most once per request, parse response tokens once, and consolidate provider classification into a registry-backed ProviderFormat.matches() seam.", + "cost": "Medium", + "effectiveness": 0.9 + } + ] + } +} +``` + +## Acceptance Criteria + +- All 7 `KB-*.json` files above are committed under `holon-knowledge/kb/{patterns,failure_modes}/` via `holon flow` + targeting `holon-coherence`. +- All JSON files pass schema validation and contain zero harness path references. + +## Notes + +- Target repository: `holon-coherence` (must execute via `holon flow`; never hand-edit `apps/holon-coherence/main`). +- Source: 2026-11 ecosystem architecture & source-code review (`docs/ecosystem-audit-report-2026-11.md`). diff --git a/.beans/holon-agentic-coder-ref-metadata-0540--split-conftest-each-test-module-owns-its-setup.md b/.beans/holon-agentic-coder-ref-metadata-0540--split-conftest-each-test-module-owns-its-setup.md new file mode 100644 index 00000000..fa3c1d07 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0540--split-conftest-each-test-module-owns-its-setup.md @@ -0,0 +1,146 @@ +--- +# holon-agentic-coder-ref-metadata-0540 +title: "Split conftest.py: each test module owns its setup" +status: todo +type: task +priority: high +tags: + - tests + - holon-agentic-coder + - architecture + - merge-conflicts + - hermetic +created_at: 2026-11-26T14:00:00Z +updated_at: 2026-11-26T14:00:00Z +blocked_by: + - "0197" +--- + +## Instruction (maintainer, 2026-11-26) + +"we need to split conftest.py. the design for this is all test should isolate as much set up as possible so different +tests don't rely on the same conftest.py" + +## Problem + +`apps/sandbox-executor/tests/conftest.py` (442 lines, 20 fixtures, 18 autouse) and `tests/flow/conftest.py` (139 lines, +6 fixtures, 3 autouse) are touch-set magnets: any flow that changes a fixture lists a conftest, so flows block each +other at Stage 3 admission (0390 parked twice on `tests/flow/conftest.py`, behind 0405 batch 2 and 0197; bean 0520 +records the pattern). Every autouse fixture also runs for every one of the 8,878 unit tests though few need it, and +fixtures that live in a directory conftest are the cause of the subset-run failures in 0491 (and 0511, scrapped into +it). + +## Measurements (origin/main f1e18bcd, detached worktree, removed afterwards) + +Three conftest files, 594 lines: `tests/conftest.py` 442, `tests/flow/conftest.py` 139, +`tests/flow/stages/conftest.py` 13. 318 test files; 8,909 collected, 8,878 unit tests run after the stress and +integration marks and bean 0469's host-only test are deselected. + +Who needs each autouse fixture: "ablation" = the fixture removed from the closure of every test, files with at least one +failure; "called" = files in which a recording wrapper saw the stub invoked in a full run. Both on the 318 files. + +| Fixture (autouse unless noted) | Files that need it | Evidence | +| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -----------------------------------------: | :------------------------------------------------------------------- | +| `stub_stage3_admission` | 19 | called; 60 tests fail without it | +| `stub_executor_test_measurement` | 10 | called; 1 test fails without it | +| `stub_review_local_test_measurement` | 10 | called; 0 fail (real run of the test task is the cost) | +| `stub_review_workspace_head` | 20 | called; 54 tests fail without it | +| `_listed_feature_worktree_cwd` + table | 5 files, 6 table entries | 1 test fails on a detached checkout; the table names tests by string | +| `_sandboxed_clean_reviewers` (flow) | 13 | ablation; 93 tests fail | +| `_no_real_prettier` (flow): npx fake | 2 | called | +| `_no_real_prettier` (flow): mergeability probe | 12 | called | +| `_knowledge_index_without_disk_wait` (flow) | 33 | called (performance only) | +| `fake_keychain` | 11 | ablation; 143 tests fail | +| `isolated_env_file_dir` | 5 | ablation; 227 tests fail (218 in test_preflight.py) | +| `isolated_layered_config` | 2 fail, 27 call `cli.main` or `config_env` | ablation; the rest leak silently | +| `flow_repos` / `_flow_repos_template` (not autouse) | 24 | fixture parameter | +| `stage_start` (not autouse) | 6 | fixture parameter | +| `no_origin_reconcile` (stages conftest, not autouse) | 3 | fixture parameter | +| `feature_worktree_cwd` (not autouse) | 1 direct + 5 via the table | | +| Guards: `hermetic_git_config`, `no_ambient_credentials`, `isolated_claude_home`, `_isolate_agent_defaults`, `checkout_*` x3, `holon_dir_session_guard`, `gh_write_guard` (14 fail without it), `network_guard_fixture` | all (universal) | removing the three checkout guards fails nothing by design | + +Result by category: + +- Used by one file: none. Fewest users: `no_origin_reconcile` 3 files, the npx fake 2, `stage_start` 6. +- Used by one directory: every flow fixture (all 103 flow files get three autouse wrappers; 37 flow files need any of + them). The four root stubs reach 48 files (28 inside `flow/`). +- Autouse paid by all but needed by few: all four root stubs, the table-driven cwd fixture, `fake_keychain`, + `isolated_env_file_dir`, and the three flow autouse fixtures. +- Genuinely universal: the guards in the last row of the table (about 10 fixtures, roughly 190 lines once their long + bodies move to a helper). +- Global-state couplings: `hermetic_git_config` and `isolated_layered_config` write `os.environ` directly (undone by + hand, not by monkeypatch); `_listed_feature_worktree_cwd` matches tests by path and class-name strings; + `pytest_configure` replaces numbered temp dirs for the session; `gh_write_guard` and `network_guard_fixture` chain on + `subprocess.Popen` (the second depends on the first); `_no_real_prettier` replaces `subprocess.run` for every flow + test; the session fixture `_flow_repos_template` is visible only below `tests/flow` in a conftest. +- Test-time effect: per-test cost of all autouse setup is about 1 ms (suite audit of 2026-11-26), so moving seven stubs + saves a few CPU seconds across 8,878 tests (well under a second of wall time on 18 workers, about 2 s on the two CI + workers). Baseline on this host: 91.6 s wall, 8,878 passed, `-n auto`; a later run under four live flows took 158 s, + so local wall times cannot resolve this and the acceptance check is "no slower". The point of the split is conflicts + and isolation, not speed. +- A subset run with the module-level import design needs no conftest discovery, so 0491's failure disappears for the + moved fixtures. `pytest_plugins` in a test module was tested and rejected: the plugin (autouse fixtures too) applies + to every module collected after it, so order matters (reproduced with two files in both orders). +- Module budgets: they cover `apps/*/src/` and `scripts/` only (default 400, stepping to 250 by 0489); tests and + conftests are not budgeted. The new helper modules stay under 200 lines each (rule 15). Budget file frozen. + +Open pull requests and live or parked flows touching a conftest.py today: none of the four open PRs (#342, #344, #345, +#346) and none of the nine flow worktrees has a conftest.py in its diff against origin/main. Parked 0390 lists +`tests/flow/conftest.py` in its planned touch set. Test files in the batches below that are also in someone's diff now: +#342 and flow `ledgers-sorted-chronologically` (`flow/review/test_conflict_gate.py`, `test_ledger_append_only.py`; +batches 3 and 6), flow `split-calibration-package` (`flow/test_calibrate_nested_refs.py`, `flow/test_dispatch.py`, +`test_calibration.py`; batches 4 and 7), #345 (`test_partial_salvage.py`; batch 7). + +## Design + +1. Each test module owns its setup. Shared setup is a plain install function plus a non-autouse fixture in a small + helper module (`tests/flow/support/` for flow setup, `tests/support/` for the rest), imported by name into the module + that needs it and applied with `pytestmark = pytest.mark.usefixtures(...)`. +2. `pytest_plugins` is not used in test modules (global, order-dependent, autouse leaks). +3. `tests/conftest.py` keeps only universal safety guards (hermetic git config, ambient credentials, claude home, agent + defaults, layered config, the checkout guards, gh write guard, network guard), with long bodies in + `tests/support/guards.py`, under 200 lines. `tests/flow/conftest.py` and `tests/flow/stages/conftest.py` are deleted. +4. No autouse fixture unless every test needs it; a new fixture goes in the test module or an imported helper. +5. During the series each conftest keeps a thin autouse wrapper per fixture that calls the same install function, so + unmigrated modules work and the series can merge step by step; the last user's step removes the wrapper. +6. `isolated_layered_config` stays a guard for now (27 modules call `cli.main` or `config_env`; only 2 fail without it + but the rest would leak env silently). `fake_keychain` moves to its 11 users and a guard in the conftest refuses + `security`/`secret-tool` for any test that did not apply it. +7. Rule recorded in `.agents/engineering-rules.md` (rule 17) and the PR review prompt. + +## Batches (sequential; each ≤ ~15 files, files-only scope, disjoint; one flow at a time) + +| Step | Intent | Files | +| ---: | :---------------------------------- | :------------------------------- | +| 1 | `intent-0540-conftest-split-1.json` | 3 test files, 3 conftest, 5 new | +| 2 | `intent-0540-conftest-split-2.json` | 11 test files | +| 3 | `intent-0540-conftest-split-3.json` | 11 test files | +| 4 | `intent-0540-conftest-split-4.json` | 10 test files | +| 5 | `intent-0540-conftest-split-5.json` | 11 test files, 1 conftest | +| 6 | `intent-0540-conftest-split-6.json` | 10 test files | +| 7 | `intent-0540-conftest-split-7.json` | 12 test files | +| 8 | `intent-0540-conftest-split-8.json` | 13 test files, 1 conftest, 1 new | +| 9 | `intent-0540-conftest-split-9.json` | 0 test files, 1 conftest, 2 new | + +Expected effect on line counts (estimates): `tests/flow/conftest.py` 139 to under 60 after step 1 and deleted in step 5; +`tests/flow/stages/conftest.py` deleted in step 1; `tests/conftest.py` 442 to about 410 after step 1, about 385 after +step 8, under 200 after step 9. The first step takes the fewest-user fixtures (`no_origin_reconcile`, 3 users) out and +relocates the rest of `tests/flow/conftest.py`; no flow fixture has a single user (see the table), so "single user" is +read as "fewest users". + +## Dependencies and coordination + +- Run after flow `split-calibration-package` (0197) merges (it touches `flow/test_calibrate_nested_refs.py`, + `flow/test_dispatch.py`, `test_calibration.py`, and its planner may list `tests/flow/conftest.py`). +- Coordinate with parked 0390: both list `tests/flow/conftest.py`. Either 0390 runs first, or its intent drops the + conftest from its scope (a new fixture goes into the module under test) and step 1 runs after it. +- Steps 3 and 6 wait for #342 (flow `ledgers-sorted-chronologically`); step 7 waits for #345. +- Overlaps 0537 item 2 (the `_FEATURE_WORKTREE_CWD_TESTS` allowlist): step 7 and 9 do it with in-place marks; 0537 drops + that item. Fixes 0491 for every moved fixture (close it when step 5 merges). Uses 0469's deselect until that is fixed. +- The knowledge pattern about conftest guards (0538) stays true for the guards that remain; update it after step 9. + +## Notes + +- Measurement scripts and the ablation plugin were throwaway files in the detached worktree; raw counts are in this + bean. +- Intents: `todo/intent-0540-conftest-split-1.json` to `-9.json` (git-ignored, never name harness paths). diff --git a/.beans/holon-agentic-coder-ref-metadata-0541--planner-touch-set-exceeds-intent-scope.md b/.beans/holon-agentic-coder-ref-metadata-0541--planner-touch-set-exceeds-intent-scope.md new file mode 100644 index 00000000..d93a71f1 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0541--planner-touch-set-exceeds-intent-scope.md @@ -0,0 +1,44 @@ +--- +# holon-agentic-coder-ref-metadata-0541 +title: "Planner touch set exceeds the intent scope (no check between intent scope and plan touch set)" +status: scrapped +type: bug +priority: high +tags: + - flow + - planner + - admission + - holon-agentic-coder +created_at: 2026-11-26T14:28:39.444Z +updated_at: 2026-11-26T21:05:39Z +--- + +## Problem + +Flow `admission-remote-in-flight` (bean 0519, 2026-11-26) declared six files in its intent scope. The Stage 2 planner +wrote a plan whose `## Touch Set` lists fourteen files: the intent's six plus `flow/in_flight_liveness.py` (new), +`flow/worktree_checkpoints.py`, `flow/lazy_exports.py`, `tests/flow/remote_flow_fixtures.py` (new), +`tests/flow/test_in_flight.py`, `tests/flow/test_admission_order.py`, `tests/flow/stages/test_execute_touch_set.py`, +`tests/flow/stages/test_execute_budget_guard.py` and `docs/touch_set.md`. Nothing checked the plan against the scope. + +Stage 3 admission then compared the wider plan touch set and refused on open PR #342 (branch +`I-1795694671-ledgers-sorted-chronologically`) on `flow/lazy_exports.py`, a file the intent did not name. The refusal +parked the flow. + +## Expected + +A plan whose touch set adds files outside the intent scope is refused at Stage 2 (or the extra files are rejected before +admission), so a scope-limited flow is not parked by an overlap its intent never asked for. + +## Acceptance + +- A test: a planner touch set with a file absent from the intent scope fails the plan check with the extra files named. +- A test: a plan whose touch set is a subset of the intent scope passes unchanged. + +## Evidence + +Flow log: todo/flow-admission-remote-in-flight.log (Stage 3 refusal at 2026-11-26T14:28:21Z). + +## Resolution + +Scrapped: duplicate of bean 0502 (plan touch set exceeds intent scope). Evidence appended to bean 0502. diff --git a/.beans/holon-agentic-coder-ref-metadata-0542--install-holon-sync-pull-fails-once-then-passes.md b/.beans/holon-agentic-coder-ref-metadata-0542--install-holon-sync-pull-fails-once-then-passes.md new file mode 100644 index 00000000..7adaf1c5 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0542--install-holon-sync-pull-fails-once-then-passes.md @@ -0,0 +1,30 @@ +--- +# holon-agentic-coder-ref-metadata-0542 +title: "install_holon sync step failed once with 'no candidates for merging', then passed unchanged" +status: scrapped +type: bug +priority: normal +tags: + - harness + - install +created_at: 2026-11-26T20:59:53Z +updated_at: 2026-11-26T21:05:39Z +--- + +## Problem + +After PR #342 merged (`57a8aa38`, post-merge of 2026-11-26), the first `install_holon.py` run failed in +`sync_git_worktree` at `git pull --ff-only origin main` with "There are no candidates for merging among the refs that +you just fetched", although the `main` worktree was already at `origin/main` and clean. A manual pull then printed +"Already up to date", and a second run of the same script, with no other install running, completed all builds and CLI +installs. + +## Next step + +Find why the pull can report no merge candidates right after a fetch (concurrent install, fetch race, or the +`FETCH_HEAD` handling). Make the sync step retry or fail with the fetched state printed. Cause not confirmed. + +## Resolution + +Scrapped: duplicate of bean 0507 (same `install_holon` sync pull failure, `FETCH_HEAD`/"no candidates" race). Evidence +appended to bean 0507. diff --git a/.beans/holon-agentic-coder-ref-metadata-0543--derive-the-flow-lazy-export-map-from-the-modules.md b/.beans/holon-agentic-coder-ref-metadata-0543--derive-the-flow-lazy-export-map-from-the-modules.md new file mode 100644 index 00000000..e13a7106 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0543--derive-the-flow-lazy-export-map-from-the-modules.md @@ -0,0 +1,60 @@ +--- +# holon-agentic-coder-ref-metadata-0543 +title: "Derive flow/lazy_exports.py from the flow modules instead of hand-editing a hub file" +status: todo +type: task +priority: high +tags: + - flow + - architecture + - admission + - holon-agentic-coder +created_at: 2026-11-26T21:10:00Z +updated_at: 2026-11-26T21:10:00Z +--- + +## Problem + +`apps/sandbox-executor/src/sandbox_executor/flow/lazy_exports.py` (188 lines, plus `lazy_exports_review.py` and +`lazy_exports_sync.py`) is a hand-written table "owning module -> exported names". Every flow that adds, renames or +moves a flow function must edit it, so it is a hub file that no intent scope can predict. + +## Evidence (2026-11-26 13:40Z to 21:05Z audit window) + +- 3 Stage 3 refusals name `lazy_exports.py` as the overlapping path on open PR #342 (13:18:56Z + `module-budget-default-350`, 14:28:21Z `admission-remote-in-flight`, 14:50:04Z `single-runner-per-checkpoint`); a + fourth, at 20:59:41Z, is against the parked `module-budget-default-350` flow. Those 3 flows parked for 7.7 h, 6.5 h + and 6.2 h (13:18Z/14:28Z/14:50Z until PR #342 merged at 20:58Z), about 20 flow-hours, on this file (plus + `docs/architecture.md` and `docs/git_flow.md` for two of them). +- Today's earlier logs show 4 more Stage 3 discards for the same file or its siblings being edited outside the plan's + touch set (04:31Z, 05:13Z, 06:53Z, 14:47Z; "the execution changed N file(s) outside the plan's touch set ... + lazy_exports.py"), each throwing away a finished execution (bean 0414) and forcing a re-plan. +- 9 flow logs under `todo/` mention the file; PR #342 and #283 and #263 touched it in the last four days. +- The table duplicates information the modules already hold (their public names / `__all__`), so a wrong or missing + entry is only caught when the lazy `__getattr__` fails at import time. + +## Proposed change + +1. Generate the map: a deterministic script (and a unit test that fails on drift) builds `LAZY_EXPORTS` by scanning each + `flow/*.py` module's `__all__` (or its public top-level names where `__all__` is absent), written into one generated + file that is excluded from hand edits and from touch-set overlap (like a lockfile), or computed at import time from a + committed one-line-per-module manifest that is itself regenerated, never edited by flows. +2. Add the generated file to the admission "mechanical paths" list so overlap on it never refuses a flow and the flow + resolver regenerates it after a merge (it is a pure function of the tree). +3. Planner/executor: a flow that adds a flow function must not list the generated file in its touch set. + +## Expected gain + +Removes the most frequent hub overlap: about 20 parked flow-hours and 4 discarded executions in this window. Compatible +with beans 0379 and 0410 (architecture conflict magnets); extends 0410 rather than replacing it. + +## Cost + +One script, one test, a small import-time or generated file; low risk because the output is verifiable against the +current table byte for byte. + +## Acceptance + +- A test regenerates the map and asserts it equals the committed file; adding a function to a flow module without + regenerating fails the test with the command to run. +- Admission ignores the generated file when computing overlap. diff --git a/.beans/holon-agentic-coder-ref-metadata-0544--a-parked-flow-must-not-hold-a-touch-set-or-block-admission.md b/.beans/holon-agentic-coder-ref-metadata-0544--a-parked-flow-must-not-hold-a-touch-set-or-block-admission.md new file mode 100644 index 00000000..e70d0fc3 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0544--a-parked-flow-must-not-hold-a-touch-set-or-block-admission.md @@ -0,0 +1,57 @@ +--- +# holon-agentic-coder-ref-metadata-0544 +title: "A parked flow holds no touch set: admission blocks only on open PRs and running flows" +status: todo +type: task +priority: high +tags: + - flow + - admission + - stage-3 + - holon-agentic-coder +created_at: 2026-11-26T21:10:00Z +updated_at: 2026-11-26T21:10:00Z +--- + +## Problem + +Stage 3 admission refuses a candidate when its touch set overlaps an "older waiting flow", even when that flow is parked +(refused, process gone, worktree idle). A parked flow does no work and writes nothing, yet blocks younger flows, so +parks chain: the oldest parked flow holds the others. + +## Evidence + +- `admission-remote-in-flight` (0519) at 20:59:41Z: "overlaps an older waiting flow ... + `flow-module-budget-default-350`, blocked since 2026-11-26T13:18:56Z" on `lazy_exports.py`, i.e. behind a flow that + was itself parked since 13:18Z. +- `single-runner-per-checkpoint` at 13:04:41Z: refused behind parked `split-calibration-package`. +- `module-budget-default-350` at 21:04:46Z: after PR #349 merged and it resumed, it refused again on the running + `single-runner-per-checkpoint` ("local flow"), which in turn waited on #342 at 14:50Z. Three flows form a chain in + which each is parked behind a flow that is parked or has only just resumed. +- Aggregate park time on 11-26: `module-budget-default-350` 7.7 h, `flow-references-github-issues` 7.5 h, + `admission-remote-in-flight` 6.5 h, `single-runner-per-checkpoint` 6.2 h plus 1.4 h earlier, about 29 flow-hours. All + four parked on the same wide PR #342 (open from before 13:18Z to 20:58Z), then resumed together at 21:00Z. + +## Proposed change + +- A parked flow releases its touch set: admission counts only (a) open PRs and (b) flows with a live runner process. +- Order parked flows by their original admission order and let the first resume claim the set on resume (the resume + re-runs admission), so no deadlock cycle can form. +- A trial merge, not path overlap (bean 0520), stays the preferred fix for the PR case; this bean is the cheaper first + step for the parked-flow case and is needed even after 0520 because two ready flows that really conflict still need + one winner. + +## Expected gain + +Cuts the chain waits of the 4 flows above (about 29 flow-hours of parked slots, of which at least the last-stage waits +behind other parked flows disappear). + +## Cost + +Admission change in `flow/admission*.py` plus tests; touches the area of beans 0520 and 0523, so run it sequentially +with them. + +## Acceptance + +- A test: candidate overlapping a parked (no live runner) flow is admitted. +- A test: two parked flows resuming at once admit exactly one, the other refuses with a named live blocker. diff --git a/.beans/holon-agentic-coder-ref-metadata-0545--backfill-picker-launches-flows-that-park-at-once.md b/.beans/holon-agentic-coder-ref-metadata-0545--backfill-picker-launches-flows-that-park-at-once.md new file mode 100644 index 00000000..81833fd4 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0545--backfill-picker-launches-flows-that-park-at-once.md @@ -0,0 +1,58 @@ +--- +# holon-agentic-coder-ref-metadata-0545 +title: "Backfill picker launches flows that park at admission; pre-check touch sets and record each pick" +status: todo +type: task +priority: medium +tags: + - flow + - scheduling + - backfill + - holon-agentic-coder +created_at: 2026-11-26T21:10:00Z +updated_at: 2026-11-26T21:10:00Z +--- + +## Problem + +The backfill rule (keep 4 flows running, honouring disjoint touch sets) is applied from intent scope by hand. The real +Stage 3 check uses the plan's touch set, which is wider (bean 0541), so a pick can be refused only after Stage 1 and 2 +have run, and the slot then idles in a parked flow. + +## Evidence (window 13:40Z to 21:05Z) + +- 4 of the 5 flows in flight in this window (`module-budget-default-350`, `single-runner-per-checkpoint`, + `flow-references-github-issues`, `admission-remote-in-flight`) parked at first Stage 3 admission on PR #342 or an + older parked flow, after 9 to 70 min of Stage 1 to 3 work (e.g. `admission-remote-in-flight` started 14:23:32Z, + refused 14:28:21Z). They held 4 backfill slots for 6.2 h to 7.7 h each: about 29 slot-hours of the roughly 31 + slot-hours the 4 slots offered between 13:30Z and 21:00Z produced no merge. +- Only one flow of that set (`prune-single-flow-kb-failures`) reached Stage 4 without parking; the five merges in the + window (#347, #342, #346, #348, #349) came from flows already past Stage 3. +- Cost not measured: the pick decisions themselves are not logged (no `picked_at`, blockers considered, or predicted + overlap), so idle slot time per decision cannot be read from `todo/` or the flow logs. + +## Proposed change + +1. Before launching a pick, run a dry admission (`holon flow --admission-dry-run `): the intent's scope against + open PRs, live flows and the generated hub list (bean 0543); launch only when it reports no overlap, or launch a + different bean. +2. Never fill a slot with a bean whose scope contains a known hub (lazy exports, `docs/architecture.md`, shared ledgers) + while another PR or live flow holds it; queue it behind that PR instead of parking a process. +3. Append a one-line record per pick (time, bean, slots in use, predicted blockers) to a flow-launch log so idle-slot + cost becomes measurable (the audit currently lists it as not measured). + +## Expected gain + +Frees 4 slots from long parks; each pick that would have parked starts another bean instead. The record turns "idle slot +cost" into a table next audit. + +## Cost + +A read-only dry-run mode over existing admission code; a log line per launch. Depends on 0541 so intent scope matches +the plan. + +## Acceptance + +- The dry run exits non-zero and names the blocker for the 2026-11-26 `admission-remote-in-flight` intent against open + PR #342. +- A launch log with one entry per pick exists and is read by the post-merge skill. diff --git a/.beans/holon-agentic-coder-ref-metadata-0546--intent-check-misses-the-real-scope-escapes-and-over-proposes.md b/.beans/holon-agentic-coder-ref-metadata-0546--intent-check-misses-the-real-scope-escapes-and-over-proposes.md new file mode 100644 index 00000000..dc68de93 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0546--intent-check-misses-the-real-scope-escapes-and-over-proposes.md @@ -0,0 +1,38 @@ +--- +# holon-agentic-coder-ref-metadata-0546 +title: "holon intent-check misses the files plans actually escape into and over-proposes test files" +status: todo +type: bug +priority: high +tags: + - flow + - intent + - touch-set + - holon-agentic-coder +created_at: 2026-11-26T21:08:00Z +updated_at: 2026-11-26T21:08:00Z +--- + +## Problem + +First trials of `holon intent-check` (PR #348, bean 0508) on 2026-11-26: + +- On the intent of flow `single-runner-per-checkpoint` it made 30 proposals (mostly every test file that imports + `turns.py`, plus co-change neighbours) but **did not** propose + `apps/sandbox-executor/src/sandbox_executor/flow/lazy_exports.py` or `launcher/run_tracking.py` — the two files that + flow's executor actually changed outside its touch set, which forced a re-plan and then parked it on `lazy_exports.py` + for hours. +- On the first `conftest.py` split intent it proposed no companions at all. + +So it is noisy where it does not matter and silent where it does. Today's escapes were dominated by registries and hub +files: `flow/lazy_exports.py` (any new module under `flow/`), `docs/architecture.md` / `docs/git_flow.md`, and +`conftest.py`. + +## Proposed fix + +- Add a rule: a new or moved module under a package with a hand-maintained export map (`flow/lazy_exports.py`) proposes + that map (until Bean 0543 generates it). +- Rank proposals by evidence and cap the list; demote "every test that imports a listed module" to a single summary + line. +- Replay the check over today's flows that escaped scope (beans 0492, 0502, 0508 evidence) and report precision/recall. +- Related: Bean 0508 (completed), 0502, 0543. diff --git a/.beans/holon-agentic-coder-ref-metadata-0547--review-loop-identity-env-leaks-into-pre-push-tests.md b/.beans/holon-agentic-coder-ref-metadata-0547--review-loop-identity-env-leaks-into-pre-push-tests.md new file mode 100644 index 00000000..d519cd2d --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0547--review-loop-identity-env-leaks-into-pre-push-tests.md @@ -0,0 +1,85 @@ +--- +# holon-agentic-coder-ref-metadata-0547 +title: + "Review-loop git identity overlays os.environ for the whole run, so the resolver's pre-push tests see the review-loop + author" +status: completed +type: bug +priority: high +tags: + - flow + - git + - review-loop + - tests + - holon-agentic-coder +created_at: 2026-11-26T21:21Z +updated_at: 2026-11-26T22:34Z +--- + +## Problem + +Flow `single-runner-per-checkpoint` (bean 0390) reached Stage 4 on 2026-11-26 (E-1795726850). The review loop ran one +iteration (CHANGES_REQUESTED, 5 open findings). The resolver then halted at its pre-push verification with two failing +tests, both deterministic: + +- `apps/sandbox-executor/tests/test_executor_run_salvage.py::TestExecutorPartialWorkSalvage::test_agent_commits_with_clean_tree_record_the_agent_head` + expected author `executor-agent@holon-agentic-coder.com`, got `review-loop-agent@holon-agentic-coder.com`. +- `apps/sandbox-executor/tests/test_flow_repo_templates.py::test_the_history_matches_build_flow_repos_and_commit_on` + compared log identities `Holon Test` against `Holon Review Loop Agent`. + +The flow halted with "Halting review loop at iteration 1: resolver failed", and the resolver's fixes stayed uncommitted +in the flow worktree. + +## Cause + +`apps/sandbox-executor/src/sandbox_executor/entrypoint/review_loop.py`, `main()`, wraps the whole run in +`with _review_git_identity(os.environ):`, which overlays `GIT_AUTHOR_*` / `GIT_COMMITTER_*` (review-loop agent) on the +process environment. Subprocesses inherit that environment, so the resolver's pre-push pytest run commits with the +review-loop identity. Bean 0518 (PR #350) stopped the identity leaking into the shared repository config, but the +environment overlay still reaches the tests that assert the executor identity. + +## Goal + +- Keep the review-loop identity off the environment of the pre-push test run (for example scope the overlay to the git + commands the review loop makes, or clear the `GIT_*` identity variables for the test subprocesses). +- The two tests above pass inside the review loop's pre-push verification. +- Add a regression test that runs the pre-push verification with the review-loop overlay active. + +## Notes + +- Found while driving bean 0390; flow log `todo/flow-single-runner-per-checkpoint.log`. +- Bean 0390's resume from `--from-stage review` will halt the same way until this is fixed. + +## Progress + +- 2026-11-27: in-progress. Flow `review-identity-env-scope` (intent todo/intent-0547-review-identity-env-scope.json, log + todo/flow-review-identity-env-scope.log, worktree apps/holon-agentic-coder/flow-review-identity-env-scope off + origin/main cc1f256). Fix: the review identity is applied per git commit (`review_git_env()` in + flow/review/git_identity.py, used by the resolver commit) and no longer overlaid on os.environ in main(). + Intent-check: no missing files. + +## More evidence (from scrapped duplicate 0548) + +Flow main-push-superseded-skip (bean 0514, PR #353) halted the same way at Stage 4 iteration 1: resolver pre-push pytest +2 failed / 9091 passed — test_flow_repo_templates.py::test_the_history_matches_build_flow_repos_and_commit_on and +test_executor_run_salvage.py (agent commits with clean tree record the agent head). Both pass on the host. A rerun from +review failed identically. + +- 2026-11-27: flow `review-identity-env-scope` finished: PR #354 + (https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/354), 3/3 APPROVED at iteration 1 (approved head + ffc6ec12), calibration report included in the PR diff (EV 63.44), MERGEABLE/CLEAN, all CI green. Awaiting the + maintainer's merge; the bean closes after the post-merge step. + +## Resolution + +Delivered via [PR #354](https://github.com/Holon-Agentic-Coder/holon-agentic-coder/pull/354) and merged into `main` +(`0ecd970`): + +- **Key Architectural Deliverables**: the review-loop identity is applied per git commit (`review_git_env()` in + `flow/review/git_identity.py`, used by the resolver's commit) instead of being overlaid on `os.environ` for the whole + run in `main()` (`entrypoint/review_loop.py`). The resolver's pre-push tests therefore keep the executor identity. +- **Verification & Tests**: regression coverage in `tests/test_review_loop_git_identity.py`. Post-merge, + `test_review_loop_git_identity.py`, `test_executor_run_salvage.py` and `test_flow_repo_templates.py` passed in a + detached worktree off `origin/main` (25 passed). +- **Holon Flow Traversal**: flow `review-identity-env-scope` completed all 5 stages. Stage 4 approved 3/3 at iteration 1 + (approved head `ffc6ec12`), calibration included. diff --git a/.beans/holon-agentic-coder-ref-metadata-0548--review-loop-git-identity-env-leaks-into-resolver-tests.md b/.beans/holon-agentic-coder-ref-metadata-0548--review-loop-git-identity-env-leaks-into-resolver-tests.md new file mode 100644 index 00000000..c0d5661f --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0548--review-loop-git-identity-env-leaks-into-resolver-tests.md @@ -0,0 +1,38 @@ +--- +# holon-agentic-coder-ref-metadata-0548 +title: "Review-loop git identity env (PR #350) leaks into the resolver pre-push test run and fails two hermetic tests" +status: scrapped +type: bug +priority: high +tags: + - holon-agentic-coder + - review-loop + - tests +created_at: 2026-11-26T21:30:00Z +updated_at: 2026-11-26T21:30:00Z +--- + +## Evidence + +Flow main-push-superseded-skip (PR #353), Stage 4 iteration 1, twice: `Resolver pre-push test failed`, 2 failed / 9091 +passed, while the same two tests pass on the host. + +- `tests/test_flow_repo_templates.py::test_the_history_matches_build_flow_repos_and_commit_on`: expected author + `Holon Test`, got `Holon Review Loop Agent review-loop-agent@holon-agentic-coder.com`. +- `tests/test_executor_run_salvage.py::TestExecutorPartialWorkSalvage::test_agent_commits_with_clean_tree_record_the_agent_head`: + `review-loop-agent@...` != `executor-agent@...`. + +Cause: PR #350 (review loop identity via GIT_AUTHOR_* and GIT_COMMITTER_* process environment) leaves those variables in +the review-loop entrypoint's environment, and the resolver's pre-push pytest run inherits them; they override the +identity the hermetic tests configure. Every flow whose resolver runs the full suite after #350 will halt Stage 4 at its +first iteration (PR #352 is exposed too). + +## Proposed fix + +Apply the identity env only to the git commands the loop runs (a per-call env), or strip GIT_AUTHOR__, GIT_COMMITTER__ +from the environment of the pre-push test subprocess and make the hermetic test helpers scrub them. Add a test that the +pytest subprocess env carries none of the four variables. + +## Scrapped (coordinator, 2026-11-26) + +Duplicate of Bean 0547 (same leak, logged minutes apart by another flow). Evidence folded into 0547. diff --git a/.beans/holon-agentic-coder-ref-metadata-0549--resolver-pre-push-test-failure-halts-instead-of-diagnose-and-rerun.md b/.beans/holon-agentic-coder-ref-metadata-0549--resolver-pre-push-test-failure-halts-instead-of-diagnose-and-rerun.md new file mode 100644 index 00000000..058e4c15 --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0549--resolver-pre-push-test-failure-halts-instead-of-diagnose-and-rerun.md @@ -0,0 +1,66 @@ +--- +# holon-agentic-coder-ref-metadata-0549 +title: "Failed tests: record in the ledger, diagnose, fix and re-run in a loop until they pass" +status: todo +type: feature +priority: high +tags: + - flow + - review-loop + - executor + - tests + - ledger + - holon-agentic-coder +created_at: 2026-11-26T22:27:00Z +updated_at: 2026-11-27T00:10:00Z +--- + +## Instruction (maintainer, 2026-11-27) + +"Make a bean so for failed tests you record it in the ledger, diagnose the issue, rerun the tests -> diagnose/fix loop +until the tests pass." Earlier: "Shouldn't you diagnose why the tests fail and rerun the tests?" and "Every single +failure you produce is valuable information." + +## Problem + +When a test run inside a flow fails (the Stage 3 executor's run, or the Stage 4 resolver's pre-push run), the engine +marks the turn failed and halts the flow (`Resolver pre-push test failed (exit code 1)`). Nothing records which tests +failed or why, nothing classifies the failure, and nothing tries to fix it. On 2026-11-26 three flows halted on the same +two tests +(`test_executor_run_salvage.py::TestExecutorPartialWorkSalvage::test_agent_commits_with_clean_tree_record_the_agent_head`, +`test_flow_repo_templates.py::test_the_history_matches_build_flow_repos_and_commit_on`; 2 failed / 9,082-9,124 passed) +caused by the review-loop identity environment from PR #350 (Bean 0547, fix PR #354); the cause was found only by hand. + +## Design + +A test-failure loop wherever the flow runs the suite (Stage 3 executor, Stage 4 resolver pre-push, Stage 5 checks): + +1. **Record.** Every failed run appends a row to the flow's execution ledger fragment (the per-flow ledger since #314): + run id, stage, head SHA, failing test ids, a short output excerpt per test (assertion and location), environment + summary (scrubbed of secrets), and later the classification and fix attempt. Repeated failure signatures are promoted + to the knowledge base as failure modes at Stage 5, so later flows see them. +2. **Diagnose.** Re-run only the failing ids three ways: in the same environment, in a scrubbed environment (no + `GIT_AUTHOR_*`/`GIT_COMMITTER_*`, clean HOME/TMPDIR), and on the PR base (origin/main merged). Classify: + - **introduced** (fails with the change, passes on base), + - **flaky** (passes on a plain re-run), + - **environment** (fails only in the flow's environment), + - **pre-existing** (fails on base too). +3. **Fix.** Feed the classification, the failing ids and the excerpts to an agent turn: + - introduced → the executor/resolver fixes the change; + - flaky → re-run up to N times, record the flake, and propose a test fix as a finding; + - environment or pre-existing → fix the cause if it is inside the flow's scope; otherwise create or link the blocker + (a bean / flow for the cause, Bean 0497 `blocked_on`), park with the evidence, and resume automatically when the + blocker lands (Bean 0523). +4. **Re-run** the full selection after every fix and go back to step 1 **until the tests pass**. +5. **Guard against spinning.** If the same failure signature repeats after a fix with no progress, step up a model tier + (claude ladder) and try again; after the tier ladder is exhausted, park with `blocked_on` and the full ledger trail + rather than loop forever. Every iteration is in the ledger, so a park is fully diagnosed. + +## Acceptance + +- A failed test run in any stage produces ledger rows with the failing ids, excerpts and classification. +- An introduced failure gets a fix turn and a re-run; the flow continues when the suite passes, without halting. +- A flaky test is re-run and recorded; an environment / pre-existing failure parks with `blocked_on` and evidence. +- The 2026-11-26 case (identity env leak) would have been classified "environment" within one iteration. +- Tests for each classification path, using a fake test runner. +- Related: 0497, 0523, 0547, 0412. diff --git a/.beans/holon-agentic-coder-ref-metadata-0550--port-harness-ledgers-into-the-target-repos.md b/.beans/holon-agentic-coder-ref-metadata-0550--port-harness-ledgers-into-the-target-repos.md new file mode 100644 index 00000000..5348c3eb --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0550--port-harness-ledgers-into-the-target-repos.md @@ -0,0 +1,72 @@ +--- +# holon-agentic-coder-ref-metadata-0550 +title: "Reshape the harness failure ledger into the target repositories' existing ledger and knowledge base" +status: todo +type: task +priority: high +tags: + - ledger + - knowledge-base + - harness + - holon-agentic-coder + - holon-coherence +created_at: 2026-11-27T00:20:00Z +updated_at: 2026-11-27T00:30:00Z +--- + +## Instruction (maintainer, 2026-11-27) + +"We also need the `.agents/ledger` inside the repos themselves, not in the harness. Make a bean to port over all harness +ledgers to repo ledgers." Then: "No, exactly three append-only ledgers is correct. You need to find the correct place to +port it to. Target repo never references harness paths. You need to reshape the ledger!" + +## Constraints (unchanged rules) + +- A target repository keeps **exactly three** append-only ledgers: `intents`, `plans`, `executions`. No fourth ledger. +- A target repository **never references harness paths** (`.beans/`, `todo/`, `.agents/`) or bean ids. + +## Source + +The harness ledger `.agents/ledger/coordinator-failures.jsonl` (CF-0001 onwards; fields id, created_at, session_date, +category, failure, my_part, cost, rule, refs), its validator `.agents/scripts/check_failure_ledger.py` and +`tests/test_failure_ledger.py`. + +## Where it goes (maintainer, 2026-11-27: "the knowledge base failure mode is the best place") + +Each harness row becomes one **knowledge-base failure mode** under `holon-knowledge/kb/failure_modes/` (the store agents +already consult before planning and reviewing), in the existing `failure_mode` shape: + +- `kb_type`: `failure_mode`, tagged `process` plus the row's category (brief, readiness check, overlap scheduling, + intent scope, measurement, conflict handling, bookkeeping, verification); +- `payload`: `name` (short), `description` (the failure), `action` (the preventive rule), `symptoms` (how it showed: + halts, parks, wasted runs), and the cost; +- `evidence.ledger_refs`: the existing execution / intent action ids of the flows it affected (every row so far maps to + a flow or PR: #315, #319, #321, #334, #340, #343, #350, #351 and others); `failure_count` from the number of + occurrences; +- written with the deterministic stable envelope from PR #349, so concurrent flows do not conflict; +- no harness path and no bean id anywhere; the harness CF id is dropped (or kept only as an opaque external id if it + carries no harness meaning). + +No new ledger and no new execution event type are needed: the three ledgers stay exactly as they are. + +## Plan + +1. **Shape and loading (holon-agentic-coder, via a flow):** allow the `process` failure-mode tag and payload fields in + the KB schema and its validator; make knowledge consult hand process failure modes to the planner, executor, reviewer + and resolver as standing guidance. +2. **Port:** a one-off migration writes every harness CF row as a KB failure mode, sanitised. +3. **Write path afterwards:** the coordinator and the flow engine record new process failures as KB failure modes — + through the flow's own PR, or a small dedicated PR for coordinator-only failures. Bean 0549's recurring test-failure + signatures promote into the same failure modes. +4. **Harness:** retire `.agents/ledger/coordinator-failures.jsonl` and its validator (pointer note, then removal) and + point the harness instructions (`AGENTS.md` checklist step and hard rule, `coordination.md` section 8, + `self-improvement-audit.md`) at the target repository's process failure modes. +5. **holon-coherence:** the same, through its own flow. + +## Acceptance + +- Still exactly three ledgers in each target repository; no harness path or bean id in any ported row. +- Every harness CF row exists as a KB failure mode (tag `process`) with evidence refs to real flow action ids. +- Agents receive the lessons through knowledge consult in every stage that plans or reviews. +- The harness no longer keeps its own failure ledger. +- Related: Bean 0549, Bean 0371, Bean 0517, Bean 0244. diff --git a/.beans/holon-agentic-coder-ref-metadata-0551--flow-review-stage-drops-uncommitted-worktree-edits.md b/.beans/holon-agentic-coder-ref-metadata-0551--flow-review-stage-drops-uncommitted-worktree-edits.md new file mode 100644 index 00000000..8ef2ca4d --- /dev/null +++ b/.beans/holon-agentic-coder-ref-metadata-0551--flow-review-stage-drops-uncommitted-worktree-edits.md @@ -0,0 +1,33 @@ +--- +# holon-agentic-coder-ref-metadata-0551 +title: "Flow review stage drops uncommitted edits left in the flow worktree" +status: todo +type: bug +priority: normal +tags: + - flow + - review-loop + - worktree + - holon-agentic-coder +created_at: 2026-11-27T00:00:00Z +updated_at: 2026-11-27T00:00:00Z +--- + +## Problem + +Bean 0532 (secret-bundle-private-files, PR #356) was halted with one uncommitted edit in the flow worktree +(`apps/sandbox-executor/src/sandbox_executor/agent_runner.py`: move `os.fchmod` inside the `try`). The log said +"uncommitted changes remain in the worktree after Stage 5; they are carried over". Resumed from checkpoint with +`--from-stage review` after merging origin/main (clean merge, edit kept). The resumed run approved 3/3 and calibrated, +but the worktree was clean at the end and HEAD (ad02a02f) still has the original `fchmod` placement. The edit was +silently discarded by the flow, not committed. A backup patch was saved to the scratchpad before the resume. + +## Expected + +Uncommitted edits in the flow worktree are either committed as a flow row, refused up front, or preserved; never +silently dropped. + +## Follow-up + +Decide with the maintainer whether the reordered `fchmod` is still wanted on PR #356 (it would change the approved head +and need a fresh review). Backup patch: flow-secret-bundle-private-files-uncommitted-0532.patch in the scratchpad. diff --git a/.beans/self-improvement-audits.md b/.beans/self-improvement-audits.md new file mode 100644 index 00000000..8732187b --- /dev/null +++ b/.beans/self-improvement-audits.md @@ -0,0 +1,1422 @@ +# Self-Improvement Audit Log + +This log is written by the self-improvement audit described in `.agents/self-improvement-audit.md`; the newest entry is +first. + +## Entries + +### 2026-11-26T21:10:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge (`holon-agentic-coder` #347 `20:57:28Z`, #342 `20:58:25Z` commit, #346 `21:02:00Z`, #348 + `21:02:43Z`, #349 `21:03:27Z`). +- **Last merged pull requests at audit time:** `Holon-Agentic-Coder/holon-agentic-coder#349` + (`kb-wisdom-deterministic-files`, merged `2026-11-26T21:03:27Z`); `holon-coherence#56` unchanged. #350 open and + mergeable. +- **Hub file `flow/lazy_exports.py`:** named in 3 Stage 3 refusals on #342 and 1 on a parked flow; 4 flows parked about + 29 flow-hours in total; 4 execute discards today for editing it outside the touch set (bean 0543). +- **Parked flows blocking each other:** `admission-remote-in-flight` behind parked `module-budget-default-350`; + `module-budget-default-350` behind the just-resumed `single-runner-per-checkpoint` (bean 0544). +- **Backfill picks:** 4 of 5 flows parked at first Stage 3; pick decisions are not logged, so idle slot cost is **not + measured** (bean 0545). +- **Main-push CI:** #346 gate present on all 5 workflows from `aa085c38`. On the three pushes of the 21:02 to 21:03 + burst (`aa085c38`, `46a1185b`, `2c865160`) hygiene skipped its JSON and markdown checks, but unit, integration and + stress ran in full (Bookkeeping gate succeeded, did not skip); the runs overlapped as designed by 0461 (per-SHA + groups). No pure merge-origin/main push has occurred since #346, so its skip is not yet confirmed; #337 behaviour + unchanged since the 13:40Z entry. Recheck on the next such push. +- **WB add/add after #349:** no PR has merged after #349 yet; #349 and #350 file lists contain no `WB-heuristic` file. + Not yet confirmed; recheck after the next merge. +- **Not measured:** per-step timing of parks, admission waits and idle slots (beans 0412, 0496, 0545). +- **Beans created:** `0543`, `0544`, `0545`. + +### 2026-11-26T13:40:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge (`holon-agentic-coder` #341 `12:58:39Z`, #334 `13:01:37Z`, #340 `13:04:23Z`, #343 + `13:04:41Z`, #345 `13:32:07Z`). +- **Last merged pull requests at audit time:** `Holon-Agentic-Coder/holon-agentic-coder#345` + (`resume-adopts-unrecorded-branch`, merged `2026-11-26T13:32:07Z`); `holon-coherence#56` unchanged. +- **Inputs:** flow logs of the five flows and of the parked `module-budget-default-350` and + `single-runner-per-checkpoint`, `gh pr view` file lists, gate decisions in the main-push unit jobs (#334, #340, #343, + #345), commit authors in the shared repository, `.git/config`, `git worktree list`. +- **Admission and parking:** 4 refusals on 11-26 are about hub paths and one wide open PR (#342, 34 files, 79 min open); + `module-budget-default-350` parked on it, `single-runner-per-checkpoint` parked 3 times. Structural fix: trial merge + instead of path overlap, plus auto-resume (beans 0520, 0523). 0519 got today's state. +- **Conflicts after merge-queue merges:** #340 and #343 were rerun with `--from-stage review` 21 and 33 s before they + merged, restarting a full review with "last reviewed head unknown" and orphaning processes (bean 0522). +- **KB add/add:** 3 of 5 merges touch `WB-heuristic-84a6ddeb.json` (a counter-bearing wisdom entry); bean 0517 extended + with the cause and the fix on main. +- **Git identity:** leaked since at least 2026-11-20; 210 host-side commits carry the agent identity (bean 0518 + extended). +- **Main-push gates:** #333 in order; #337 skips (#345, 19 s) but #334, #340 and #343 ran in full because the head job + was still running (bean 0521). +- **Beans created:** `0520`, `0521`, `0522`, `0523`. **Extended:** `0517`, `0518`, `0519`. +- **Timing (PR open to merge; commits / posted reviews):** #341 58 min (19 / 1); #334 138 min (31 / 2); #340 71 min (17 + / 1); #343 40 min (18 / 1); #345 34 min (15 / 1); median 58 min, longest 138 min. Stage splits (working, CI, + other-flow wait, human, idle) per step are **not measured**. +- **Not measured:** per-step times of reruns and parked waits (beans 0412, 0496 still open). + +### 2026-11-26T12:20:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge (`holon-agentic-coder` #332 `10:55:07Z`, #333 `10:51:16Z`, #336 `11:34:34Z`, #335 + `12:04:42Z`, #339 `12:05:00Z`, #337 and #338 `12:06:00Z`). +- **Last merged pull requests at audit time:** `Holon-Agentic-Coder/holon-agentic-coder#338` (`settings-token-off-argv`, + merged `2026-11-26T12:06:00Z`); `holon-coherence#56` unchanged. +- **Inputs:** `gh run list` and job logs for the 9 main pushes since 10:51Z, intent files against PR file lists (#332, + #333, #335 to #339), `todo/flow-no-unneeded-full-review.log`, admission lines of the flow logs of 11-26, bean 0436 and + its flow log. +- **#333 per-SHA concurrency:** in order; no cancelled main run after 10:51Z, all 9 pushes completed green. +- **#337 tree gate:** one main push since (`5440e92`), `decision=RUN rule=main-push-tree-mismatch`, full runs. Three + merges in 80 s each ran a full CI set (about 25 runner-minutes). Bean 0514. +- **Scope escapes:** #332, #335, #337, #338 changed unlisted files; #333, #336, #339 exact; with the earlier audit 7 of + 13 flows (bean 0508 extended, keep high). 0407 children lost about 67 min of discarded Stage 3 turns (bean 0414 + extended). +- **0407 decomposed flow (04:06Z to 11:43Z+):** per child 46, 84, 80, 91 and 87 min; 21 child review iterations (2, 4, + 4, 6, 5) plus 4 parent, about 284 min of review; approval withdrawn at 11:29:45Z by a ledger-only head and Stage 4 + restarted (bean 0513 extended with the table). Step-level times still not measured (0412, 0496). +- **Backfill pickers:** none of the 11-26 flows parked on an overlap since 04:06Z (every Stage 3 admission read + "overlaps no flow in flight"); 5 flows plus `ledgers-sorted-chronologically` ran together. Risk of 0436 now running: + bean 0515. +- **Beans created:** `0514` (coalesce a burst of main pushes), `0515` (ledger reorder lands against every merge, + resolvers undo it). **Extended:** `0508`, `0513`, `0414`. +- **Examined and in order:** #333 concurrency; #337 gate fails safe (full run on mismatch, no error); #335 and #339 + matched or nearly matched scope and were approved in few iterations. + +### 2026-11-26T10:50:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge (`holon-agentic-coder` #325 `09:25:03Z`, #327 `09:38:33Z`, #326 `09:51:19Z`, #329 + `09:54:27Z`, #331 `10:37:55Z`, #330 `10:39:00Z`). +- **Last merged pull requests at audit time:** `Holon-Agentic-Coder/holon-agentic-coder#330` (`pr-url-without-gh-hints`, + merged `2026-11-26T10:39:00Z`); `holon-coherence#56` unchanged. +- **Inputs:** flow logs `todo/flow-.log` of the six flows, GitHub job times for `main` pushes (unit, survival), + intent files against PR file lists, `todo/flow-time-audit-2026-11-26.md`, `todo/test-suite-audit-2026-11-26.md`. +- **Per-flow measurements** (review iterations / pipeline heads / commits; 0 failed unit runs in all): #325 3 / 8 / 19; + #326 9 / 14 / 22 (7 iterations at 3/3 APPROVED blocked by hygiene); #327 2 / 7 / 17 (plus a Stage 3 to Stage 2 round + trip, about 33 min); #329 1 / 3 / 9; #330 2 / 5 / 13; #331 3 / 7 / 15. Step-level times for pre-flight, pushes, merges + and CI waits remain **not measured** (beans 0412, 0496). +- **CI saving on main** (medians before/after #323): macOS unit 560 to 445 s, ubuntu unit 238 to 171 s, Workspace + survival 268 to 269 s (no change). +- **Beans created:** `0508` (intent scope guessed by hand, 3 of 6 flows), `0509` (verify CI saving on main after a + performance flow; survival unchanged), `0510` (main-push CI re-runs everything for already-tested trees). + **Extended:** `0497`, `0502`, `0403`, `0447`. +- **Examined and in order:** #329 approved in one iteration with an exact scope match; no unit CI failure on any PR + head; no reviewer finding left unresolved at merge. + +### 2026-11-26T08:55:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge (`holon-agentic-coder` #314 `04:02:07Z`, #319 `06:11:39Z`, #317 `07:50:13Z`, #320 + `08:46:12Z`, #321 `08:47:03Z`, #323 `08:47:39Z`; child PRs #310-#313 already counted in the `03:50Z` entry). +- **Last merged pull requests at audit time:** `Holon-Agentic-Coder/holon-agentic-coder#323` + (`tests-fewer-git-worktree-exec`, merged `2026-11-26T08:47:39Z`); `holon-coherence#56` unchanged since the previous + entry. +- **Inputs:** `todo/flow-time-audit-2026-11-26.md` and `todo/test-suite-audit-2026-11-26.md` (their beans 0478-0496 not + duplicated); GitHub reviews and workflow runs for the six PRs; `todo/flow-module-line-budget-all-packages.log`. +- **Per-PR measurements (GitHub):** reviews approving 3/3 / workflow runs (success, failure, cancelled): #314 1 / 30 + (24, 0, 6); #319 1 / 42 (31, 0, 11); #317 1 (after 12 loop iterations) / 100 (70, 14, 16); #320 2 / 66 (43, 3, 20); + #321 2 / 66 (45, 3, 18); #323 1 / 30 (21, 2, 7). Review-loop timing of #317: iterations 1-9 cover 05:16:53Z-06:22:10Z + (65 min) and all 9 were blocked by one unfixable-by-code hygiene failure; ensemble about 3.7 min per iteration (log). + Step-level timing for the other five flows is **not measured** at step level in this audit (logs for #314/#319 stage + steps are covered by the flow time audit and bean 0412; `flow-tests-fewer-git-worktree-exec.log` stayed empty, bean + 0496). +- **Beans created:** `0497` (review loop re-runs the ensemble on a CI failure the resolver reports as not fixable in + code; #317 about 85 min), `0498` (a unit test measures the live tree against the live budget file; failed + #320/#321/#323 in 9 jobs after #317 merged), `0499` (calibration report records CI runs, review iterations and churn + class per flow). +- **Examined and in order:** #323 reached 3/3 in one iteration with the template-repo test change (git processes -35.7 + percent, 40 percent target honestly recorded as missed); #314 (+10,112 lines, 210 files) and #319 approved in one + iteration; #320/#321 second approvals trace to 0493/0494, not new beans; the `gh event listen` hint still appears in + every review body (0427); stray `=2026-11-24T08:00:00Z` still untracked (0465). + +### 2026-11-26T03:50:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge (`7` target-repo merges since `2026-11-25T22:49:00Z`: `holon-agentic-coder` `#309` + `22:51:23Z`, `#308` `00:03:10Z`, `#310` `00:38:28Z`, `#311` `02:02:27Z`, `#312` `02:48:42Z`, `#313` `03:30:27Z`; + `holon-coherence` `#56` `22:57:30Z`; plus `thomashan/dev-env` `#43` `00:03:54Z` and `#42` `03:46:21Z`, and closed + `#44` `23:28:48Z`). +- **Last merged pull requests at audit time:** + - `Holon-Agentic-Coder/holon-agentic-coder#313` (`feat(add): Add .github/workflows/promote-ledger.yml`, merged + `2026-11-26T03:30:27Z`; `#314` open in Stage 4) + - `Holon-Agentic-Coder/holon-coherence#56` (`coherence-final-self-doc`, merged `2026-11-25T22:57:30Z`) + - `thomashan/dev-env#42` (`tmux-focus-events-on`, merged `2026-11-26T03:46:21Z`, after `#43` `00:03:54Z`; + `flow-warp-shift-enter-tmux-cj` live in Stage 4) +- **End state definition:** pipeline passes on the merged head + Stage 4 review consensus passes; everything else is + churn. +- **Beans created or extended:** + - Created: `0475` (`docker-build.yml` lacks `concurrency`, running to `success` on `26/26` cancelled PR SHAs = + `39.93 runner-min` wasted), `0476` (local-flow overlap polling relaunches `holon flow` every `60 s` `200+` times, + falsely logs `"Overlap cleared"`, and bloats `checkpoint.context.logs` to `275 KB`). + - Extended: `0443` (`26/48` `hac` SHAs cancelled), `0450` (`9` blind `local_tests` findings across `#310`–`#312` and + `#308`), `0414` & `0418` (`4/4` sub-intents of `0371` failed initial Stage 3; `3/4` on `touch_set_guard`), `0384` + (`0371` sub-intent 2 `#311` Stage 3 `claude-opus-5-5` cut by `90 s` stall budget after `20.93 min`), `0451` & `0458` + (`dev-env#43` `20.18 min` Stage 5 CI; `dev-env#42` merged `29 s` after `842a47cf` while `Unit Tests` takes + `15–20 min`), `0472` (`dev-env#43` committed `4` plans across `2` intent IDs onto one PR), `0412` (unmeasured steps + and missing `coherence`/`dev-env` flow logs), `0427` (`gh event listen` hint still in `#310`–`#313` and + `dev-env#42`–`#43`), `0197` (`calibration.py` +1/+2 lines triggered Stage 4 `CHANGES_REQUESTED` on `#310` & `#311`), + `0465` & `0467` (uncommitted harness work + stray `=2026-11-24T08:00:00Z` + `5/5` post-merge harness commits). + +#### Step-Level Timing Table (`2026-11-25T22:49:00Z..2026-11-26T03:50:09Z`) + +> Flows measured: `0371` (`ledger-fragments-and-promotion`: parent overlap wait + 4 sub-intents `#310`–`#313` + parent +> integration + live `#314`), `0405-s2` (`#308` resume Iter 4–5 + Stage 5 + merge), `0438` (`#309` merge), `0400` +> (`macos-unit-only-when-relevant` Stage 1–2 + live local-flow overlap wait), `holon-coherence#56` (merge + `main` CI), +> and `thomashan/dev-env#42`–`#44` (GitHub PR/CI history). + +| Step | Count | Median (min) | Longest (min) | Notes / Where | +| :------------------------------------------------------ | ----: | -----------: | ------------: | :--------------------------------------------------------------------------------------------- | +| Pre-flight (wrapper start -> Stage 1) | - | not measured | not measured | Wrapper lines before `Pipeline run initiated` still lack UTC timestamps (`0412`) | +| Stage 1 intent (checkpoints) | 5 | 0.28 | 0.33 | `0371` sub-intents `1..4` (`0.27–0.31m`), `0400` (`0.33m`); `dev-env` not measured (`0412`) | +| Stage 2 plan — initial (checkpoints / logs) | 5 | 4.00 | 5.49 | `0371` sub1–4 (`3.30–4.03m`), `0400` (`5.49m`) | +| Stage 2 plan — re-plan after `touch_set_guard` | 4 | 2.56 | 3.15 | `0371` sub1–4 (`2.29m`, `2.52m`, `2.61m`, `3.15m`; total `10.57m` churn) | +| Stage 3 admission check — admitted | 10 | 0.07 | 0.12 | `0371` parent + sub1–4 initial & re-plan + `0371` post-merge (`sum 0.70m`) | +| Stage 3 admission check — refused (per poll round) | 202 | 0.08 | 0.13 | `0371` (`2x 0.10m`) + `0400` (`200+` logged rounds `0.05–0.13m`, `sum 16.20m+` pure churn) | +| Stage 3 overlap wait per flow (wall) | 2 | 138.71 | 274.70 | `0371` parent (`2.72m` on `0175`), `0400` (`274.70m+` live `23:02:33Z..03:37:15Z+`, `0476`) | +| Stage 3 execute — failed / discarded | 5 | 12.53 | 20.93 | `0371` sub1–4 (`15.57m` TS, `20.93m` 90s stall, `2.63m` TS, `9.12m` TS, `12.53m` TS = `60.8m`) | +| Stage 3 execute — succeeded (sub-intents) | 4 | 4.56 | 4.91 | `0371` sub1–4 (`4.25m`, `4.88m`, `4.04m`, `4.91m`; `sum 18.08m`) | +| Execute end -> PR create | 4 | 0.21 | 0.22 | `0371` sub1–4 (`0.18–0.22m`) | +| Stage 4 review ensemble + inner CI wait | 18 | 4.12 | 10.28 | `17` iters on `#310`–`#313` + `#308` i5 (`10.27m`); inner `review_local` CI split unmeasured | +| Per-reviewer latency inside ensemble | - | not measured | not measured | Engine logs only ensemble completion (`0412`) | +| Stage 4 resolver turn + verify + commit | 14 | 3.73 | 30.22 | `13` iters on `#310`–`#313` (`2.07–6.32m`, `med 3.60m`) + `#308` i4 (`30.22m`) | +| Stage 4 review iteration total | 19 | 9.38 | 30.22 | `17` iters `#310`–`#313` (`5.70–11.90m`) + `#308` i4 (`30.22m`) & i5 (`10.27m`) | +| Stage 4 git pushes & conflict/sync merges | - | not measured | not measured | Individual push and conflict-merge durations not logged separately (`0412`) | +| CI check registration wait (Stage 4 / Stage 5) | 9 | 0.03 | 0.28 | `5` Stage 4 waits (`0.02–0.03m`) + `4` Stage 5 waits (`0.28m` each) | +| PR CI wall — `hac` full code / merge | 14 | 8.83 | 10.17 | `14` completed SHAs (`#308`–`#314`, driven by `Test - Unit` `med 8.8m` / `Test - Stress`) | +| PR CI wall — `hac` bookkeeping-gated | 5 | 1.33 | 1.38 | `#308` (`1eac4196`), `#310`–`#313` calibration heads (`64–83 s` in `Test - Hygiene`) | +| PR CI wall — `hac` cancelled SHAs (`Docker Build` leak) | 26 | 1.82 | 9.77 | `26/26` cancelled SHAs ran `Docker Build` to `success` (`med 1.78m`, `sum 39.93m`, `0475`) | +| `main` push CI — `hac` / `coherence` / `dev-env` | 4 | 9.76 | 20.03 | `hac` `#309` (`10.67m`) & `#308` (`8.85m`); `coherence#56` (`1.97m`); `dev-env#43` (`20.03m`) | +| PR CI wall — `dev-env` (`#42`, `#43`, `#44`) | 7 | 14.90 | 20.18 | `3` full passes (`14.90–20.18m`), `1` partial (`11.72m`), `2` cancelled (`0.40–0.67m`), `1` IP | +| Stage 5 calibration + reconcile + promote work | 5 | 0.77 | 0.91 | `#310`–`#313` (`0.75–0.78m`) + `#308` (`0.91m`); Prettier passed locally without timeout | +| Stage 5 final-head CI wait (bookkeeping) | 5 | 1.09 | 1.35 | `#310`–`#313` (`0.82–1.35m`) + `#308` (`1.09m`) | +| Stage 5 total (`#310`–`#313`, `#308`) | 5 | 2.00 | 2.20 | `#310`–`#313` (`1.57–2.10m`) + `#308` (`2.00m`) | +| Ready-to-merge queue wait (target PRs -> `main`) | 5 | 32.48 | 1617.70 | `hac#309` (`2.88m`), `#308` (`8.75m`), `dev-env#43` (`32.48m`), `#42` (`1394.4m`), `coh#56` | +| Sub-intent merge into parent plan (`#310`–`#313`) | 4 | 0.18 | 0.18 | Auto-merged `11 s` after Stage 5 completed | +| Hand pre-merge sync to merge (`dev-env#42`) | 1 | 0.48 | 0.48 | `842a47cf` pushed `03:45:52Z`, merged `29 s` later (`03:46:21Z`) before `Unit Tests` (`0458`) | +| Idle between stop & resume | - | not measured | not measured | `0400` log buffered after `03:01:05Z` (`0385`); `coherence#56` / `dev-env#42–44` have no logs | + +**Stage / Wall Time Split (`2026-11-25T22:49:00Z..2026-11-26T03:50:09Z`):** + +- **Working (`~4.5 h` across concurrent flows):** `0371` parent & `#310`–`#313` Stages 1–5 + `#314` Stage 4 (`~4.0 h` + active work minus CI/overlap waits, including `60.78 min` discarded Stage 3 + `10.57 min` Stage 2 re-plans), `#308` + resume (`~42.9 min`), `0400` Stage 1–2 (`5.82 min`) + `200+` failed admission launches (`16.2 min+`), `dev-env#43` & + `#44` active stages (no wrapper logs). +- **Waiting on CI (`346` runs across 3 repos):** `hac` `298` runs (`206` `success`, `89` `cancelled`, `1` `failure` in + `#311` `Test - Integration` `d65b84d7`, `2` `in_progress`); `coherence` `5` runs (`5` `success`, `1.97 min` wall); + `dev-env` `43` runs (`30` `success`, `10` `cancelled`, `3` `in_progress`; `Unit Tests` `macos-latest` + `14.9–20.2 min`). +- **Waiting on another flow (`~4.6 h`):** `0371` parent waited `2.72 min` on `0175`; `0400` (`macos-unit`) blocked + `274.7+` min (`23:02:33Z..03:37:15Z+`) polling local flow `0371` every `60 s`. +- **Waiting on human merge:** `hac#309` (`2.88 min`), `hac#308` (`8.75 min`), `dev-env#43` (`32.48 min`), `dev-env#42` + (`23.2 h`), `holon-coherence#56` (`27.0 h`). + +**Churn Counts (`hac` in Window):** + +- `26/48` (`54.2%`) `hac` SHAs were cancelled mid-CI (`24` by `0443` `chore(review)` double-pushes or fast follow-ups), + yet `Docker Build` ran to `success` on all `26/26` (`39.93 runner-min` pure churn). +- `0371` sub-intents `1..4` ran `17` review iterations (`#310`: `8`, `#311`: `4`, `#312`: `3`, `#313`: `2`); `9` of + those (`#310` iters `2–7`, `#311` iters `2–3`, `#312` iter `2`, plus `#308` iter `4`) carried `FIND-CI` `local_tests` + failures (`0450`) triggered while `0443` cancelled/delayed GitHub CI, and `4/4` sub-intents lost `60.78 min` Stage 3 + + `10.57 min` Stage 2 re-plan work to initial `touch_set_guard` / `90 s` stall failures. + +#### Ranked Suggestions + +1. **`0475` (new, high — Pipeline / GitHub Actions):** Add `concurrency` (`cancel-in-progress` on `pull_request`, + `github.sha`-scoped on `push`) to `.github/workflows/docker-build.yml`. Eliminates `~40 runner-min` per 5 h wasted on + `26/26` cancelled SHAs. +2. **`0476` (new, high — Flow / Wrapper & Engine):** Fix local-flow Stage 3 overlap polling in `run_holon_flow.py` (no + false `"Overlap cleared"`, back off / inspect local blocker before re-spawning `holon flow`) and bound `context.logs` + in flow checkpoints. Eliminates `200+` redundant launches (`~16–20 min` CPU/IO churn) and stops `275 KB+` checkpoint + bloat. +3. **High-impact extensions (`0443`, `0450`, `0414`, `0418`, `0384`, `0451`):** + - `0443` + `0450`: combined, they cancelled `26/48` `hac` SHAs and caused `9` blind `local_tests` Stage 4 churn + iterations across `#310`–`#312` and `#308`. + - `0414` + `0418`: `4/4` sub-intents of `0371` failed initial Stage 3 (`3/4` on `touch_set_guard`), discarding + `37.22 min` of execution + `10.57 min` of Stage 2 re-plans. + - `0384`: `90 s` stall budget killed Stage 3 `claude-opus-5-5` on `#311` (`20.93 min` lost). + - `0451`: `dev-env#43` Stage 5 calibration commit `13844ea7` ran another `20.18 min` full CI pass (`Unit Tests`). +4. **Other extensions (`0458`, `0472`, `0427`, `0197`, `0412`, `0465`, `0467`):** `dev-env#42` merged `29 s` after + `842a47cf` before `Unit Tests` (`0458`), `dev-env#43` accumulated `4` plan commits from `2` intent IDs (`0472`), + `gh event listen` hints still corrupt review URLs (`0427`), `calibration.py` growth still blocks Iter 1 (`0197`), + unmeasured steps and buffered logs persist (`0412`), and uncommitted harness files + `5/5` post-merge commits persist + (`0465`, `0467`). + +#### Examined and Found in Order + +- `ci_bookkeeping_gate` on uncancelled `holon-agentic-coder` Stage 5 calibration heads (`1eac4196`, `e34e0be7`, + `d80fcea3`, `fb12d695`, `0acbcd18`): all `5` settled in `64–83 s` (`~1.1–1.4 min` total CI). +- `holon-coherence#56`: merged cleanly (`22:57:30Z`) and `main` push CI passed all `5` workflows in `1.97 min`. +- `post-pr-merge` sub-intent handling: correctly skipped per-sub-intent runs on `#310`–`#313` (which target the parent + plan branch) and synced `hac#309`, `coh#56`, `hac#308`, `dev-env#43`, and `dev-env#42` cleanly. +- `hac#309` (`22:51:23Z`) and `hac#308` (`00:03:10Z`) `main` push CI: both passed all `6` workflows cleanly (`10.67 min` + and `8.85 min`). + +#### Unmeasured Steps + +- Pre-flight wrapper setup duration (no UTC timestamps in `run_holon_flow.py` header lines). +- Per-reviewer latency inside the Stage 4 ensemble and `review_local` reviewer-turn vs CI-wait split inside Stage 4. +- Individual Stage 4 git push and conflict-merge durations. +- Flow logs for `holon-coherence#56` and `thomashan/dev-env#42`–`#44` (missing), and final `36+ min` of + `todo/flow-macos-unit-only-when-relevant.log` (`03:01:05Z..03:37:15Z+`, buffered under `0385`). + +### 2026-11-25T22:49:00Z — Session-Start Audit + +- **Trigger:** session start (2026-11-26 local). Evidence window: since the `2026-11-25T06:05:00Z` entry. +- **Last merged pull requests at audit time:** `Holon-Agentic-Coder/holon-agentic-coder#307` (merged + `2026-11-25T06:54:51Z`, after `#305` `06:12:01Z` and `#306` `06:51:27Z`); `holon-coherence#55` + (`2026-11-24T12:44:47Z`, `#56` open); `thomashan/dev-env` unchanged. Open: `hac#308` (CONFLICTING, 39 commits) and + `hac#309` (MERGEABLE). +- **Beans created:** `0465` (uncommitted harness beans and audit instruction), `0466` (flow aborts when Docker is + briefly down), `0467` (per-merge record commits are 60 of 92 harness commits). +- **Extended or already covered:** `0458` (#305 to #307 sat 4.3 to 4.8 h between approval `01:49Z`, `02:15Z`, `02:02Z` + and merge, each with a final `origin/main` sync commit at `05:48Z`, `06:13Z`, `06:53Z` right before merge); `0412` + (the 37 `0153` self-doc flows wrote only one `todo/flow-*-self-doc.log`, so per-step timing is not measured); the + DNS/resolver bean and `0432` (`hac#308` review halted at iteration 4 on ENOTFOUND, then target sync blocked by + uncommitted tracked changes). +- **Examined and in order:** #305 to #307 had 0 failed checks and 1 consensus review each; all 15 pipeline runs on their + branches succeeded. +- **Not measured:** per-step timing for #305 to #309 (no flow logs); no timing table was built. + +### 2026-11-25T06:05:00Z — Fifth-Merge Audit + +- **Trigger:** fifth target-repo merge since `2026-11-25T05:41:00Z` (`holon-agentic-coder` PRs `#300`, `#301`, `#302`, + `#303`, `#304`; `holon-coherence` unchanged at `#55` merged `2026-11-24T12:44:47Z` with `#56` open; + `thomashan/dev-env` unchanged at `#41` merged `2026-11-25T04:03:06Z` with `#42` open). Note a parallel peer audit + (`2026-11-25T05:45:00Z` below, uncommitted on disk) covered up to `#300` and created Beans `0458`–`0459`; this audit + covers the `#300–#304` merge sweep, `05:20:56Z–06:04:00Z` CI/flow delta, `0371`, `#308`, and `#309` (`0438`) + completion without duplicating `0458`–`0459`. +- **Last merged PR at audit time:** `Holon-Agentic-Coder/holon-agentic-coder#304` (`github-ci-self-doc`, merged + `2026-11-25T05:46:57Z`), `Holon-Agentic-Coder/holon-coherence#55` (`2026-11-24T12:44:47Z`), `thomashan/dev-env#41` + (`2026-11-25T04:03:06Z`). +- **End state definition:** pipeline passes on the merged head + Stage 4 review consensus passes; everything else is + churn. +- **Beans created or extended:** + - Created: `0460` (Stage 4 resolver runs 7,800+ pytest twice and unconditionally on Markdown/bookkeeping-only fixes), + `0461` (`main`-push CI `concurrency.group` silently cancels intermediate `main` commits during burst merges), `0462` + (epoch-second `I-`, `P-`, `REV-ITR-`, and `CAL-` IDs collide across concurrent flows), `0463` (Stage 2 planner + collapses file-scoped intents into directory touch-set entries that broaden Stage 3 overlap blocking). + - Extended: `0407` (`#309` `21.63 min` Stage 4 after `3/3` APPROVED, `#300` `FIND-DIRTY-001` churn iter, `#308` Iter + 4), `0412` (unmeasured steps in `0371`, `#309`, `#308`, `#300–#304`), `0442` (`#309` Stage 2 timeouts -> + `Test - Hygiene` failure + `2.60 min` Stage 5 overhead), `0443` (`#309` `29 s` 4-push Stage 4 burst), `0454` (`6` + more `Merge origin/main` full-CI heads `7.35–9.17 min` on `#300–#305`), `0455` (`bean-triage-prioritisation.md` + `3.5+ h` stale across `#293–#304`). + +#### Step-Level Timing Table (Cadence `#300–#304`, Active `0371` & `#309`, Live Window `05:20:56Z–06:04:00Z`) + +> Flows measured: cadence `#300–#304` (`antigravity-agent/gemini-4-neon`, execution summaries `283.2–384.3 s` and full +> PR/CI histories), plus post-`05:21Z` runs `0371` (`ledger-fragments-and-promotion`) and `#309` (`0438`, +> `calibration-merge-adapted-file`), alongside live `#308` (`workspace-survival-job-parallel`) and halted `0407`. + +| Step | Count | Median (min) | Longest (min) | Notes / Where | +| :------------------------------------------------------- | ----: | -----------: | ------------: | :---------------------------------------------------------------------------------------------- | +| Pre-flight (wrapper start -> Stage 1) | 2 | not measured | not measured | `flow-*.log:1-13` lack UTC timestamps (`0371`, `0438`); Antigravity `#300–#304` no wrapper log | +| Stage 1 intent (checkpoints) | 2 | 0.34 | 0.34 | `0371` `0.34m`, `0438` `0.34m` (`#300–#304` pruned worktrees; live `#308` `0.53m`) | +| Stage 2 plan (checkpoints) | 2 | 4.08 | 4.94 | `0438` `3.22m` (incl. `60s` Prettier timeouts), `0371` `4.94m` (incl. `60s` Prettier timeouts) | +| Plan end -> Stage 3 start gap | 2 | 0.00 | 0.00 | `0371` / `0438` checkpoint `end == start`; `#300–#304` ledger plan->override `1.9–2.7m` | +| Stage 3 admission block / overlap wait | 2 | 114.8+ | 200.3+ | `0371` refused at `05:32:48Z` on `#305` (`29.2m+` live); `0407` halted since `02:41:40Z` | +| Stage 3 execute (checkpoint / ledger summary) | 6 | 5.31 | 6.41 | `#300` `4.72m`, `#301` `5.29m`, `#302` `6.41m`, `#303` `5.10m`, `#304` `5.97m`, `0438` `5.33m` | +| Execute end -> Stage 4 start / PR open | 6 | 0.20 | 0.45 | `0438` `0.20m` to `PR create`; `#300–#304` ledger-commit to `PR created` `0.37–0.48m` | +| Stage 4 review iteration (wall / ensemble) | 9 | 7.42 | 10.15 | `#309` i1 `3.9m`/i2 `10.15m`; `#300–#304` `6` iters (`4.78–8.42m`); `#308` i4 `8.4m` (`05:25Z`) | +| Per-reviewer latency inside ensemble | - | not measured | not measured | Ledger/checkpoint log ensemble wall only (`0412`) | +| Stage 4 resolver (`#309` `.md` Prettier / `#308` i4) | 2 | 22.0+ | 37.5+ | `#309` i1 `6.58m` (`.md` Prettier only, `0460`); `#308` i4 live since `05:25:12Z` (`37.5m+`) | +| Stage 4 total (`0438` `#309`) | 1 | 21.63 | 21.63 | `05:36:09Z..05:57:47Z` (blocked `17.7m` on unformatted `.md` plan; `1` iter needed, `2` run) | +| Conflict check / in-flow target sync | 1 | 0.23 | 0.23 | `0438` `#309` `05:47:06Z..05:47:20Z` (`14 s`, `05:47:20Z`) | +| Stage 4 git pushes & `review_local` wall | - | not measured | not measured | Individual push and `review_local` durations not split (`0412`) | +| CI check registration wait (`#309` Iter 2 / Stage 5) | 2 | 0.16 | 0.30 | `#309` Iter 2 `1 s` (`05:57:32Z..33Z`); Stage 5 `18 s` (`06:00:37Z..55Z`) | +| PR CI wait — full code / `main_merge` (`05:23Z–06:02Z`) | 8 | 8.63 | 9.95 | `6` `main_merge` (`7.35–9.17m`) + `#309` `4cdc1913` (`7.93m` fail) + `4ded0b14` (`9.95m`) | +| PR CI wait — gated bookkeeping heads (`05:23Z–06:02Z`) | 2 | 0.93 | 0.95 | `#309` `32b8b868` (`0.90m`) and `0c534bf2` (`0.95m`; inner wait `48.93s`) | +| PR CI wait — cancelled burst head (`#309` `26eca98f`) | 1 | 2.47 | 2.47 | `5` checks cancelled in `7 s`; `Docker Build` ran `2.47m` (`05:47:25Z..05:49:53Z`) | +| `main` push CI (`6` pushes `05:20:57Z–05:57:42Z`) | 6 | 9.43 | 11.43 | `4` passed (`8.13–11.43m`, med `11.01m`); `67bfb621` (`#302`) & `d281e437` (`#303`) cancelled | +| Stage 5 calibration work (`#309` `05:57:50Z..06:00:26Z`) | 1 | 2.60 | 2.60 | Inflated by `npx --yes prettier` (`0442`); `#300–#304` `2.60–2.83m` ledger delta | +| Stage 5 promotion + reconciliation + ledger commit | 5 | ~0.0 | 0.02 | Within final `1–2 s` of Stage 5 work (`#300–#304`, `#309`) | +| Stage 5 total (`#309`) | 1 | 3.98 | 3.98 | `05:57:47Z..06:01:51Z` (incl. `48.93s` `final_head_ci` on `0c534bf2`) | +| Ready-to-merge queue wait (`#300–#304`) | 5 | 256.07 | 276.65 | `#300` `269.03m`, `#301` `275.35m`, `#302` `276.65m`, `#303` `254.60m`, `#304` `256.07m` | +| Hand pre-merge sync to merge (`#300–#304`) | 5 | 1.17 | 8.32 | All `5` merged early (`55 s` to `8.18m` before PR CI completed); `#300` `8.32m`, `#301` `5.75m` | +| Idle between stop & resume | - | not measured | not measured | `0407` halted since `02:41:40Z`; `#300–#304` no wrapper logs (`0412`) | + +**Stage / Wall Time Split (Post-`05:21Z` Active Flows `#309`, `0371`, `#308` live + `#300–#304` sync sweep):** + +- **Working (`~1.0 h` wall):** `#309` active stages (`34.5m` total minus CI waits), `0371` Stages 1–2 (`5.28m`), `#308` + live Iter 4 resolver container (`37m+` since `05:25:12Z`). +- **Waiting on CI (`~1.3 h` PR-head wall in window, `121` `hac` runs):** `66` `pull_request` runs across `11` heads + (`10/11 = 90.9%` churn; `7/7 = 100%` churn after `05:42Z`), `19` `dynamic` runs, `36` `push` runs on `main` (`2/6` + burst pushes `#302`/`#303` `cancelled`). +- **Waiting on another flow (`~4.1 h` accumulated):** `0371` polling `#305` (`29.2m+`), `0407` blocked in Stage 3 since + `02:41:40Z` (`202m+`). +- **Waiting on maintainer merge:** `#300–#304` cleared after `254.6–276.7m` ready waits; `#305` (`CLEAN`, synced + `05:48:38Z`), `#306` (`DIRTY`), `#307` (`DIRTY`), `#308`, `#309` (`CLEAN` at `06:01:51Z`) await merge. + +**Churn Counts (`#300–#304` Lifetime + In-Window):** + +- **`#300–#304` full lifetimes:** `20` PR-tested CI heads (`4` each): `16/20` (`80.0%`) post-open churn (`10` + bookkeeping + `6` `Merge origin/main`), with `4` PR-open heads (`934ae1c9`, `03510f82`, plus reconcile-on-open + `b9bb5c99`, `2de5dd7e`). Review iterations: `6` total across `5` PRs (`5` needed + `1` churn on `#300` + `FIND-DIRTY-001` `01:06Z`); in-window (`05:20:56Z..06:02Z`), `#309` required `1` iter + `1` churn iter (`6.58m` + resolver + `10.15m` Iter 2) solely to Prettier-format `P-1795584464-CLA-CO5.5.md`. +- **Window CI (`05:20:56Z–06:02:00Z`):** `121` total `hac` runs; `10/11` (`90.9%`) `pull_request` heads were churn (`7` + `main_merge` + `3` bookkeeping), only `1/11` (`4cdc1913` on `#309`) carried new code; `2/6` `main` push CI runs + (`67bfb621`, `d281e437`) cancelled mid-queue. + +#### Ranked Suggestions + +1. **`0460` (new, high — Flow / Stage 4):** Skip `uv run task test` in `_verify_before_push` + (`entrypoint/review_loop.py`) when resolver edits are Markdown/bookkeeping-only, and stop running the `7,800+`-test + suite twice back-to-back on code fixes (agent + `_verify_before_push`). Saves `~3–6 min` per doc-only resolver pass + (`#309` `6.58m`) and `~2–3 min` per code resolver pass. +2. **`0461` (new, high — Pipeline / GitHub Actions):** Fix `push` to `main` `concurrency.group` in + `.github/workflows/{test-unit,test-stress,test-hygiene,test-integration,make}.yml` (scope `push` by `github.sha`, not + bare `github.ref`) so burst merges (`#301–#304`) stop silently cancelling intermediate `main` `Test - Unit` and + `Test - Stress` runs (`67bfb621`, `d281e437`). +3. **`0463` (new, high — Flow / Stage 2):** Prohibit Stage 2 planner from collapsing concrete file-scoped `intent.json` + lists into directory touch-set entries (`planner.template.md`, `entrypoint/planner.py`). `0371` supplied `19` + explicit files and `0` folders, yet Stage 2 emitted `.../ledger/` with only an advisory stderr warning. +4. **`0462` (new, normal — Architecture / Flow):** Add `build_stage_disambiguator` hex suffixes to + `intent_creator.py:86`, `build_plan_id` (`ledger/rows.py:122`), `REV-ITR-...` (`flow/review/loop.py:463`), and + `CAL-...` (`calibration.py:1316`). Live flows `0371` and `0438` (`#309`) minted identical `I-1795584436-*` and + `P-1795584464-CLA-CO5.5`, adding to `5` duplicate `plan_id`s already on `main` (`#300` & `#302` shared + `P-1795567904-ANA-G4N`). +5. **Extensions (`0407`, `0442`, `0443`, `0454`, `0455`, `0412`):** Prioritized evidence strengthens the active fixes + for unneeded Iter 2 review (`0407` on `#309`), `npx prettier` Stage 2 failure + Stage 5 overhead (`0442` directly + cost `#309` `~17 min`), Stage 4 4-push burst cancellation (`0443` cancelled `26eca98f`), mechanical + `Merge origin/main` CI (`0454` ran `6` more `7.35–9.17 min` suites), `post-pr-merge` triage staleness (`0455`), and + unmeasured steps (`0412`). + +#### Examined and Found in Order + +- `hac#300–#304` `main` merges: all `5` merged cleanly, and `post-pr-merge` recorded `0153` updates cleanly (`da742b5`, + `51e3135`) without duplicate flow launches across sessions. +- `hac#309` (`0438`) Stage 5 calibration: `calibration_self_check` + `final_head_ci` settled cleanly (`3.98 min`, + `MERGEABLE/CLEAN`, `ΔEV +10.42`, `4` promoted candidates, all `11` CI checks passed on `0c534bf2`). +- `ci_bookkeeping_gate` on un-cancelled pure bookkeeping heads (`#309` `32b8b868` `0.90 min`, `0c534bf2` `0.95 min`): + gating worked accurately once parent heads were not cancelled. +- `holon-coherence` (`#55`, `#56` open) and `thomashan/dev-env` (`#41`, `#42` open): unchanged since `05:41Z`, no new + merge regressions. + +### 2026-11-25T05:45:00Z: Fifth-Merge Audit (Claude Code session, incremental from 00:28Z) + +- **Trigger:** fifth merge. Since the 00:28Z entry of this session, `holon-agentic-coder` merged #278, #280, #281, #283 + to #300 (21 PRs). Entries at 02:54Z, 04:02Z and 05:07Z overlap this period; their beans (0442 to 0451) were not + duplicated. The 05:41Z entry below was written by the other session while this audit ran; its beans are `0452` to + `0455`, so this audit's beans are `0458` and `0459`. +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#300` (`decomposition-rule-self-doc`, merged `2026-11-25T05:30:59Z`) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`; `#56` open) +- **Beans created or extended:** + - Created: `0458` (ready PRs hand-synced before each merge, 8 of 12 merged before that pipeline ended; complements + `0454`, written by the other session at 05:41Z), `0459` (maintainer rules kept only in Claude Code's private memory + never reach the Antigravity session). + - Extended: `0400` (macOS unit leg is now the critical path), `0411` (`AGENTS.md` says `gemini-4-argon`, + `holon-flow.md` and every flow use `gemini-4-neon`), `0412` (unrecorded gaps between stages), `0423` (measured + concurrency and cross-session blocking), `0398` (approved PR #305 blocks 0371), `0446` (0407 still refused, no + wrapper alive). `0371` and `0383` have uncommitted edits from another session and were left alone. +- **Outputs:** `todo/self-improvement-audit-2026-11-25a/` (`timing-period.md`, `churn-period.md`, `pipeline-fixes.md`, + `sweep.md`, `per-pr.md`, `churn-ledger.md`, scripts). + +#### 1. Timing (00:28Z to 05:41Z; ANA = Antigravity `gemini-4-neon`, CLA = Claude Code `claude-opus-5-5`) + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :-------------------------------------------------- | ----------: | --------------: | ------------: | :--------------------- | +| Pre-flight | - | not measured | not measured | (0412) | +| Stage 1 intent | 10 | 0.3 | 0.3 | | +| Stage 2 plan | 10 | 3.5 | 5.6 | 0407 | +| Plan end to Stage 3, ANA (unrecorded) | 8 | 1.4 | 1.8 | review-report-self-doc | +| Stage 3 refusal (waiting on another flow) | 3 | 178 | 181.5 | #308 on #283 HTTP 406 | +| Stage 3 executor ANA / CLA | 8 / 2 | 6.5 / 23.1 | 7.6 / 41.3 | #308 | +| Stage 4 review iteration ANA / CLA | 13 / 8 | 7.5 / 7.4 | 8.4 / 9.6 | #308 | +| Stage 4 resolver ANA / CLA | 2 / 5 | 3.2 / 5.2 | 4.2 / 27.2 | #308 | +| Stage 4 total (checkpoints) | 8 | 8.0 | 22.8 | #308 | +| Target sync (#283 path) | 7 | 0.1 | 0.2 | #308 | +| CI wait, gated heads | 3 | 0.8 | 1.1 | #308 | +| Stage 5 total (checkpoints) | 8 | 4.0 | 12.0 | #308 | +| Pipeline wall: code / main-merge / bookkeeping head | 9 / 21 / 33 | 6.5 / 7.9 / 0.9 | - | | +| Hand pre-merge sync to merge | 11 | 5.5 | 34.6 | #292 | +| Intent to ready, ANA one-iteration slice | 8 | 23.4 | 31.2 | #297 | +| Ready to maintainer merge (sweep #288 to #299) | 12 | 335.7 | 523.4 | #288 | + +Stage split: working about 5.4 h across all flows. Waiting on another flow 5.1 h (#308, 0407, 0371). Waiting on CI 0.15 +h. Waiting on the maintainer's merge 94.6 PR-hours (27 ready PRs). + +#### 2. Answers + +1. **Pipeline fixes worked.** Full pipeline median 10.8 min (p90 24.2) before #272, 7.6 min (p90 8.7) after #278. + Bookkeeping heads are gated to 0.9 min (32% of completed heads after #278). `unit (ubuntu)` went from 4.7 to 3.2 min + and `unit (macos)` from 8.2 to 7.0 min (#275). Timing-gate failures: 10 macOS and 4 Workspace survival between 16:00Z + and 21:10Z, none in the 94 PR and main heads since #278. The last one was at 20:56:19Z. No failure since #278 was + noise; the one failure (hygiene, #306) was real. +2. **#283 worked inside a flow, not outside.** #308 took 7 target syncs and no hand resolution. Its re-reviews after a + ledger-only sync are 0407/0449. PRs whose flow had already ended still needed 13 hand `resolve-conflict` merges + (02:28Z to 05:23Z, Bean 0458). After #278, review iterations on conflicting heads: none seen. +3. **Antigravity sweep:** the 12 PRs took 18.9 to 31.2 min from intent to ready when one review iteration was enough (8 + of 12; #289 63.5, #290 114.4, #292 241.3, #296 731.8). They then waited 265.9 to 523.4 min for the merge. Pipeline + heads per PR: median 4.5 (2 bookkeeping and 1 hand sync each). Review iterations: 1 to 5 (median 1). Claude Code + flows in the period: #308 intent to first approval 245 min, of which 181.5 waited on #283; working time about 75 min. + Per-iteration speed is the same (7.4 against 7.5 min). The difference is the size of the work and Stage 3. +4. **Churn left:** 65 of 78 PR heads in the period were churn. Main-merge heads use 409 runner-min against 167 for code + heads. Review churn: 26% of iterations over #272 to #308, but 1 of 11 in flows started after #278. +5. **Coordination:** at most 4 flows at once across both sessions. 0407 (Antigravity) has been refused since 02:41:40Z + on a directory in its scope. The rule against that exists only in Claude Code's memory. 0371 (Claude Code) was + refused at 05:32:48Z on Antigravity's approved #305. No duplicate flow for one bean. Merges cannot be attributed + (shared account). + +#### 3. Ranked suggestions + +1. **`0458` (new, high):** sync ready PRs once in a batch after a merge, not before each merge; skip `MERGEABLE` PRs; + wait for green on any synced head. About 12 pipelines (95 min serial) saved per sweep of 12, and no unverified + merges. +2. **`0459` (new, high):** move workspace rules from private memory into `.agents/`, and have the wrapper refuse + directory scopes. Saves about 180 min on 0407 alone. +3. **`0400` (extended):** run the macOS unit leg only where it matters; about 3 min off every code and merge head. +4. **`0423`, `0398`, `0446` (extended):** a shared registry across sessions, starting stacked on an approved PR, and + SPLIT parent admission. +5. **`0411`, `0412` (extended):** one canonical model ladder; record the unrecorded stage gaps. + +#### 4. Examined and found in order + +- `ci_bookkeeping_gate` (#272), unit speed-up (#275) and timing gate (#278): working as intended (above). +- HTTP 406 admission failure on oversized PRs: fixed by #299. No refusal of that kind after 05:20:56Z. +- Antigravity one-iteration flows: Stage 5 is a steady 3.9 to 4.1 min, already in 0442. + +### 2026-11-25T05:41:00Z — Fifth-Merge Audit + +- **Trigger:** fifth target-repo merge since `2026-11-25T05:07:00Z` (`holon-agentic-coder` PRs `#295`, `#296`, `#297`, + `#298`, `#299`; `holon-coherence` unchanged at `#55` merged `2026-11-24T12:44:47Z` with `#56` open; + `thomashan/dev-env` unchanged at `#41` with `#42` open). Note: `hac#300` (`05:31:18Z`) and `hac#301` (`05:38:33Z`) + also merged while this audit was running (`05:22:44Z–05:41:00Z`). +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#299` at trigger (`in-flight-pr-files-fallback`, merged `2026-11-25T05:20:56Z`; `#300` + `05:31:18Z` and `#301` `05:38:33Z` merged during audit) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`) + - `thomashan/dev-env`: `#41` (`tmux-shift-enter-extkeys`, merged `2026-11-25T04:03:06Z`) +- **Beans created or extended:** + - Created: `0452` (Stage 5 KB promotion persists single-flow Stage 4 review chatter as `KB-failure-*.json` — `2,896` + of `3,205` files `< 1 h` apart; `#296` added `21`, `#297` `4`, `#300` `3`, `#308` `6`), `0453` (consolidate `19` + duplicated `test_*_self_doc.py` files / `2,199` lines on `main` + `7` open PR copies / `932` lines into one + parameterized check), `0454` (`ci_bookkeeping_gate.py` `2-dot` `before..head_sha` compare forces full `7–9 min` CI + on mechanical `Merge origin/main` pushes across `#295–#301`), `0455` (`post-pr-merge` calls `install_holon.py` + without `--holon-only`, collides across burst merges, and left `bean-triage-prioritisation.md` stale since + `02:29:34Z` across `7+` merges). + - Extended: `0442` (`formatting.py` Stage 2 `prettier@3.8.4` timed out `2x 30 s` in both `0371` and `0438`/`#309`, + leaving `P-1795584464-CLA-CO5.5.md` unformatted and causing immediate `Test - Hygiene` failure on `4cdc1913`), + `0450` (`#308` Iter 3 & Iter 4 `review_local` failed `4/4` on `1` host test — Iter 3 named + `test_repository_ledgers_survive_precheck_and_reconcile_byte_for_byte` — and Iter 4 failed `47 s` after GitHub CI + passed `11/11` on `c960579d`), `0449` (`#308` Iter 3 resolver marked `R1-F1` `"applied"` on `executions/*.md` only, + driving Iter 4 where R3 reversed approval), `0443` (`#308` hit 3rd 4-push `29 s` burst cancelling `8857f506`), + `0407` (`#308` Round 2 `86+ min` on unchanged code; `#309` Iter 1 `3/3` approved blocked by Prettier failure), + `0408` (`#309` `4cdc1913` failed `Test - Hygiene` on plan Prettier; `#296` `2` Hygiene failures), `0412` (wrapper + pre-flight `lines 1–13` on `0371`/`0438` un-timestamped; Antigravity PRs `#295–#301` & `0407` unlogged; pushes, + per-reviewer, and inner tool-vs-model timings unmeasured). + +#### 1. Per-Step Timing Table (`2026-11-25T05:07:00Z` to `2026-11-25T05:40:24Z`) + +Measured across `4` active/queued `hac` flows (`workspace-survival-job-parallel` `#308`, +`ledger-fragments-and-promotion` `0371`, `calibration-merge-adapted-file` `0438`/`#309`, `no-unneeded-full-review` +`0407`) plus GitHub PR/CI/commit records (`hac#295–#309`, `coh#56`, `dev-env#42`): + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :---------------------------------------------------------------------------------------- | ----: | -----------: | ------------: | :------------------------------------------- | +| Pre-flight (credential probe, image check, worktree creation) | - | not measured | not measured | `0371`/`0438` lines 1–13 un-timed (`0412`) | +| Stage 1: intent agent turn (`0371`, `0438`; full stage `0.33 m`) | 2 | 0.24 | 0.25 | `0371` (`ledger-fragments-and-promotion`) | +| Stage 2: planner agent turn (incl. `60 s` Prettier timeouts) | 2 | 3.98 | 4.83 | `0371` (`0438`: `3.12 m`; stage `4.93/3.22`) | +| Stage 3: admission check (`0371` refused vs `#305`, `0438` admitted) | 2 | 0.27 | 0.27 | `0371` / `0438` (`0.27 m` each) | +| Stage 3: overlap wait / halted block (`0407` `33.40 m` in-win / `178.73 m` tot.; `0371`) | 2 | 20.50 | 33.40 | `0407` (`178.73 m` total since `02:41:40Z`) | +| Stage 3: executor agent turn (`#309`/`0438`; stage `5.33 m`; tool vs model unlogged) | 1 | 4.98 | 4.98 | `0438` (`calibration-merge-adapted-file`) | +| Each git push & conflict probe/merge of target | - | not measured | not measured | folded into stage turns (`0412`) | +| Stage 4: empty-diff guard + PR create (`#309`/`0438`) | 1 | 0.20 | 0.20 | `0438` (`calibration-merge-adapted-file`) | +| Stage 4: reviewer ensemble turn (`3` reviewers; per-reviewer unlogged; `#308` i4, `#309`) | 2 | 4.15 | 4.47 | `hac#308` Round 2 iter 4 (`#309` i1 `3.83`) | +| Stage 4: `review_local` host test run (`#308` i3 `05:06:12Z–05:09:01Z`, `#308` i4) | 2 | 3.36 | 3.90 | `hac#308` Round 2 iter 4 (`#308` i3 `2.82`) | +| Stage 4: resolver turn (`#308` i3; live `#308` i4 `15.20+ m`, `#309` i1 `0.12+ m`) | 1 | 7.45 | 7.45 | `hac#308` Round 2 iter 3 (live i4 `15.20+`) | +| Stage 4: target sync + ledger commit after resolver (`#308` i3) | 1 | 0.22 | 0.22 | `hac#308` Round 2 iter 3 (`29 s` burst) | +| Stage 4: individual review iteration (review+local, excl. resolver; `#308` i3/i4, `#309`) | 3 | 7.63 | 8.43 | `hac#308` Round 2 iter 4 (`#309` i1 `3.93`) | +| Stage 5: calibration work, CI registration wait, `final_head_ci` | 0 | - | - | no flow reached Stage 5 in window | +| Pre-merge `Merge origin/main` CI wait (`#297`–`#300`; `#297`/`#298`/`#300` merged early) | 4 | 8.36 | 9.12 | `hac#300` (`a4e23b9e`; `#297` `8.62 m`) | +| Wait: PR ready (last cal) $\rightarrow$ maintainer merge (`#295–#299` cadence) | 5 | 273.07 | 323.95 | `hac#295` (`#297` `295.98`, `#299` `273.07`) | +| GitHub: PR open $\rightarrow$ merged (`#295–#299` cadence) | 5 | 313.23 | 336.37 | `hac#295` (`#297` `317.95`, `#296` `313.23`) | + +Stage totals clipped strictly inside `2026-11-25T05:07:00Z–05:40:24Z` (human wait sums `1.29 h` across merged +`hac#297–#301` plus `4.45 h` across open ready queue `hac#302–#307`, `coh#56`, `dev-env#42` = `5.75 h`): + +| Stage | Total (h) | Working (h) | Waiting on CI (h) | Waiting on another flow (h) | Waiting on human (h) | Idle (h) | +| :-------- | --------: | ----------: | ----------------: | --------------------------: | -------------------: | -------: | +| intent | 0.01 | 0.01 | 0.00 | 0.00 | 0.00 | 0.00 | +| plan | 0.14 | 0.14 | 0.00 | 0.00 | 0.00 | 0.00 | +| execute | 0.78 | 0.09 | 0.00 | 0.68 | 0.00 | 0.00 | +| review | 0.63 | 0.63 | 0.00 | 0.00 | 0.00 | 0.00 | +| calibrate | 0.00 | 0.00 | 0.00 | 0.00 | 5.75 | 0.00 | + +- **Missing timing (`0412`):** `0371` and `0438` logs miss UTC timestamps on wrapper pre-flight (`lines 1–13`), + Antigravity PRs (`#295–#301`) and `0407` left no `todo/flow-*.log`, and individual git pushes, conflict merges, + per-reviewer latencies inside `4.47 / 3.83 min` ensembles, and tool-vs-model splits inside `4.98 min` Stage 3 and + `7.45 / 15.20+ min` Stage 4 resolvers remain unmeasured. + +#### 2. Churn Counts (`2026-11-25T05:07:00Z` to `2026-11-25T05:40:24Z`, plus `#295–#299` lifetimes) + +- **CI pipeline runs:** + - Across the **5 cadence merges (`hac#295–#299`, full PR lifetime):** `30` tested CI heads (`198` workflow runs: + `#295` `4/28`, `#296` `10/64`, `#297` `6/42`, `#298` `6/36`, `#299` `4/28`), of which **`27` (`90.0%`) were churn** + (`21` bookkeeping/conflict + `6` `main_merge` vs `3` resolver code-fix heads). Review iterations across `#295–#299`: + **`8` total** (`1+3+2+1+1`): `5` minimum initial + **`3` repeat churn iterations** (`#296` x2 for `Hygiene` + `FIND-CI-002` + `Merge main`, `#297` x1). + - Across **in-window `hac` CI (`05:07:00Z–05:40:24Z`):** `86` workflow runs across `17` push/PR head events (`70` + success, `1` failure on `#309` `4cdc1913` `Test - Hygiene` Prettier, `6` cancelled: `5` on `#308` `8857f506` + + `05:09:38Z` `push` `0bd580ea` `Test - Unit`, `9` still in progress). Of `9` PR heads in window (`79e0ab33`, + `821656a1`, `ebb688d6`, `69c4188f`, `8857f506`, `c960579d`, `a4e23b9e`, `cf7c77f6`, `4cdc1913`), **`8/9` (`88.9%`) + were churn** (`5` `main_merge` + `3` bookkeeping/doc-only incl. `ebb688d6` `executions/*.md`-only fix; only `#309` + `4cdc1913` carried new feature/test code). +- **Stage 2/3/4/5 & Harness churn:** + - **Stage 2 `formatting.py` Prettier timeouts $\rightarrow$ `#309` immediate CI fail (`0442`, `0408`, `0407`):** + `formatting.py:11` (`prettier@3.8.4`) timed out `2x 30 s` in both `0371` and `0438`, leaving + `P-1795584464-CLA-CO5.5.md` unformatted; `#309` (`4cdc1913`) immediately failed `Test - Hygiene` (`make lint-md`), + blocking `3/3` `APPROVED (0/0/0)` reviewers at `05:40:16Z` into a full resolver/re-review cycle. + - **Stage 5 KB chatter bloat (`0452`):** `3,205` `KB-failure-*.json` files on `main` (`2,896` = `90.4%` with `ACT-*` + refs `< 1 h` apart); `#296` added `21`, `#297` `4`, `#300` `3`, `#308` `6`. + - **Duplicate `self_doc` test scanners (`0453`):** `#295`, `#297`, `#298`, `#300` added separate copy-pasted scanners; + `19` files (`2,199` lines) on `main` + `7` open (`932` lines) duplicate identical AST/allowlist guards. + - **Pre-merge `Merge origin/main` CI & queue cascade (`0454`, `0371`):** `#295–#301` (`7/7` PRs) triggered full + `7–9 min` CI on `Merge origin/main` despite `pr_own_identical=True`; `#302–#308` remain queued (`#305`–`#308` + `DIRTY`/`UNKNOWN`), while `0371` itself blocked at `05:32:48Z` on `#305` (`warning: folder touch set ledger/`). + - **`#308` Round 2 `86+ min` loop (`0407`, `0449`, `0450`, `0443`):** Iter 3 doc-only fix (`ebb688d6`) + `29 s` 4-push + burst cancelled `8857f506` and triggered Iter 4 (`R3` reversed approval); host `review_local` failed `4/4` on `1` + test (`1/7755`, `1/7788`), failing Iter 4 `47 s` after GitHub CI passed `11/11` on `c960579d`. + - **Harness burst-merge rebuilds & stale triage (`0455`):** `7` `hac` merges in `39 min` omitted `--holon-only` and + left `.beans/bean-triage-prioritisation.md` stale since `02:29:34Z`. + +#### 3. Ranked Suggestions + +1. **Bean `0452` (high, Stage 5 / Knowledge — new):** Exclude intra-flow Stage 4 `ACT-REV`/`ACT-FIND` rows (or require + `>= 2` distinct intents) from `KB-failure-*.json` promotion (`2,896/3,205` single-flow artifacts bloating + git/`lint-json` and conflicts; `#296` added `21`). +2. **Bean `0454` (high, Pipeline / CI Gate — new):** Avoid redundant `7–9 min` full CI in `ci_bookkeeping_gate.py` on + mechanical `Merge origin/main` pushes with `pr_own_identical=True` and disjoint `main` changes (after/alongside + `0371`; `#295–#301` `7/7` hit full CI). +3. **Bean `0455` (high, Harness / `post-pr-merge` — new):** Pass `--holon-only` on `hac` merges, coalesce concurrent + burst rebuilds, and run/commit `prioritise_beans.py` cleanly (`bean-triage-prioritisation.md` stale `3.1+ h` across + `7` merges). +4. **Bean `0453` (normal, Code Quality / Tests — new):** Consolidate `19` (`2,199` lines) + `7` open (`932` lines) + duplicated `test_*_self_doc.py` AST/tokenize scanners into one shared parameterized guard after `#301–#307` drain. +5. **Extended `0442`, `0450`, `0449`, `0443`, `0407`, `0408`, `0412`:** Fix `formatting.py:11` (`prettier@3.8.4` + timeouts causing `#309` `4cdc1913` CI failure despite `3/3` approval), probe finished GitHub CI in `review_local` + (`#308` Iter 4 failed `47 s` after green CI) and isolate + `test_repository_ledgers_survive_precheck_and_reconcile_byte_for_byte`, count `"applied"` on `executions/*.md`-only + diffs as no code change for `unchanged_streak`, batch Stage 4 pushes (`29 s` 4-push burst on `#308`), skip unchanged + `end_of_flow_sync` / Markdown-only re-reviews, gate local Markdown before push, and timestamp wrapper pre-flight + lines (`lines 1–13`). _(Existing critical/high `0371`, `0446`, `0448`, `0403`/`0405` remain top priorities.)_ + +#### 4. Examined and Found in Order + +- **Cadence `#295–#299` CI & review churn:** `27/30` (`90.0%`) tested PR heads were bookkeeping/conflict (`21`) or + `main_merge` (`6`); `#295, #298, #299` passed reviewers in `1` iteration (`#297` `2`, `#296` `3` due to `Hygiene` + Prettier + `Merge main`), while every PR waited `255–324 min` (`median 273.07 min`) for maintainer merge and hit queue + conflicts. +- **Live Stage 2 $\rightarrow$ Stage 4 `#309` (`0438`) causality:** Double `30 s` `npx --yes prettier@3.8.4` timeouts in + `formatting.py` directly caused unformatted `P-1795584464-CLA-CO5.5.md` $\rightarrow$ `Test - Hygiene` failure + $\rightarrow$ blocked `3/3` approved reviewers at `05:40:16Z`. +- **Stage 5 KB audit on `main`:** Confirmed `2,896/3,205` (`90.4%`) `KB-failure-*.json` files record single-flow `< 1 h` + `ACT-*` references generated by `wisdom.py:278-296` + flow-scoped branch targets. +- **`#308` Iter 3–4 + `0371` admission block:** Confirmed + `test_repository_ledgers_survive_precheck_and_reconcile_byte_for_byte` (`test_ledger_append_only.py:469-488`) failed + host `review_local` `4/4` while passing CI/container/isolated runs; `0371` (`ledger-fragments-and-promotion`) blocked + immediately at `05:32:48Z` overlapping `PR #305`. + +### 2026-11-25T05:07:00Z — Fifth-Merge Audit + +- **Trigger:** fifth target-repo merge since `2026-11-25T04:02:00Z` (`holon-agentic-coder` PRs `#290`, `#291`, `#292`, + `#293`, `#294`; `holon-coherence` unchanged at `#55` merged `2026-11-24T12:44:47Z` with `#56` open; + `thomashan/dev-env` merged `#41` at `04:03:06Z` and completed flow `#42`). Note: `hac#295` (`04:59:58Z`) and `hac#296` + (`05:01:49Z`) also merged while this audit was running (`04:56:57Z–05:07:00Z`). +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#294` at trigger (`core-helpers-test-helpers`, merged `2026-11-25T04:55:29Z`; `#296` + `split-cli-init-modules` merged during audit at `2026-11-25T05:01:49Z`) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`) + - `thomashan/dev-env`: `#41` (`tmux-shift-enter-extkeys`, merged `2026-11-25T04:03:06Z`) +- **Beans created or extended:** + - Created: `0448` (`end_of_flow_sync._reenter_review_and_calibrate` leaves stale `calibrate=SUCCESS` + stale `review`, + causing nested `Stage 5 rerun` inside Stage 4, bogus `ACT-WITHDRAW`, 4-push CI cancellations, and double Stage 5 on + `hac#308`), `0449` (Stage 4 `unchanged_streak` keys on raw `head_sha` and ignores unresolvable `open` findings, + letting `hac#308` Round 2 loop `49.6+ min` over `3` iterations on doc-only/sync commits), `0450` (Stage 4 + `review_local` drops `TestMeasurement.output_excerpt` and preempts pending GitHub CI with `2.8–2.9 min` macOS host + runs failing `1/7690`), `0451` (`dev-env` CI lacks `ci_bookkeeping_gate` and runs `test-unit (macos-latest)` + serially in `14.4 min`, causing `18.63 min` Stage 5 overruns on `dev-env#41`/`#42`). + - Extended: `0407` (`hac#308` Round 2 ledger-only `end_of_flow_sync` `1a6c1ab1` re-entered `49.6+ min` Stage 4 and + allowed reviewer reversal; `0407` idled `69.25 min` more = `142.33 min` total), `0443` (`hac#308` hit two `30–39 s` + quadruple-push bursts cancelling CI; `15/17` PR heads churn; `dev-env#42` `ef1fbd76` cancelled `b1dc27bb` runs), + `0445` (`hac#308` checkpoint stayed frozen at `current_stage: "completed"` across all `49.6+ min` of Round 2), + `0442` (`hac#308` Round 1 re-calibration `2.50 min`; `dev-env#42` Stage 5 calibration `2.60 min`), `0412` + (`dev-env#42` and `0407` unlogged in `todo/flow-*.log`; pre-flight, pushes, conflict merges, per-reviewer/tool + latencies unmeasured). _(Concurrent Claude Code session dirty beans such as `0371`, `0383`, `0405` left untouched.)_ + +#### 1. Per-Step Timing Table (`2026-11-25T03:54:45Z` to `2026-11-25T05:04:00Z`) + +Measured across `2` active `hac` flows (`workspace-survival-job-parallel` `#308` in +`todo/flow-workspace-survival-job-parallel.log` + git/GitHub; `no-unneeded-full-review` `0407` checkpoint, halted in +Stage 3), `1` completed `dev-env` flow (`tmux-focus-events-on` `#42` checkpoint), and GitHub PR/CI/commit records +(`hac#290`–`#308`, `coh#56`, `dev-env#41`–`#42`): + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :------------------------------------------------------------------------------------------ | ----: | -----------: | ------------: | :------------------------------------------- | +| Pre-flight (credential probe, image check, worktree creation) | - | not measured | not measured | `dev-env#42` & `0407` unlogged (`0412`) | +| Stage 1: intent agent turn (`dev-env#42` total stage `0.28 m`) | 1 | 0.18 | 0.18 | `dev-env#42` (`tmux-focus-events-on`) | +| Stage 2: planner agent turn (`dev-env#42` total stage `2.53 m`) | 1 | 2.45 | 2.45 | `dev-env#42` (`tmux-focus-events-on`) | +| Stage 3: admission check (`dev-env#42`) | 1 | 0.05 | 0.05 | `dev-env#42` (`tmux-focus-events-on`) | +| Stage 3: overlap wait / admission refusal (`0407` blocked `03:54:45Z–05:04:00Z+`) | 1 | 69.25 | 69.25 | `no-unneeded-full-review` (`142.33 m` tot.) | +| Stage 3: executor agent turn (tool vs model split unlogged) | 1 | 4.80 | 4.80 | `dev-env#42` (`tmux-focus-events-on`) | +| Each push & conflict probe/merge of target | - | not measured | not measured | folded into surrounding stage (`0412`) | +| Stage 4: empty-diff guard + PR create/edit (`dev-env#42`, `hac#308` r2) | 2 | 0.19 | 0.20 | `dev-env#42` (`tmux-focus-events-on`) | +| Stage 4: reviewer ensemble turn (`3` reviewers; per-reviewer unlogged; r2i3 `2.55+ m`) | 4 | 6.84 | 14.85 | `dev-env#42` iter 1 (`hac#308`: `4.13–9.28`) | +| Stage 4: local test run after reviewers (`review_local` on `1a6c1ab1`, `31fdc482`) | 2 | 2.85 | 2.87 | `hac#308` Round 2 iter 2 | +| Stage 4: resolver turn (incl. push; tool vs model split unlogged) | 2 | 15.75 | 27.02 | `hac#308` Round 2 iter 1 (`FIND-CI` blind) | +| Stage 4: conflict gate + nested `Stage 5 rerun` + ledger (`hac#308` `0.80 m` / `#42`) | 2 | 0.46 | 0.80 | `hac#308` r1i2 (incl. `0.25 m` Stg5 rerun) | +| Stage 4: individual review iteration (review pass only; full r2i1+res `34.48 m`) | 4 | 8.34 | 14.98 | `dev-env#42` iter 1 (`hac#308`: `7.05–9.40`) | +| CI wait (Stage 5 `merged_head_ci` on `3357edd2`) | 1 | 7.97 | 7.97 | `hac#308` Round 1 post-sync | +| Stage 5: calibration work + reconciliation + promotion (excl. CI waits) | 2 | 2.55 | 2.60 | `dev-env#42` (`hac#308`: `2.50 m`) | +| CI registration wait (Stage 5 `final_head_ci`: `1 s` `#308`, `18 s` `#42`) | 2 | 0.16 | 0.30 | `dev-env#42` (`tmux-focus-events-on`) | +| CI wait (Stage 5 `final_head_ci`: `65 s` `#308`, `926.88 s` `ef1fbd76` `#42`) | 2 | 8.27 | 15.45 | `dev-env#42` (serial macOS `862.45 s`) | +| Stage 5: final-head check & exit | 2 | 0.10 | 0.12 | `hac#308` (`f727226d`) | +| End-of-flow sync check + `origin/main` merge (`04:14:18Z–04:14:26Z`) | 1 | 0.13 | 0.13 | `hac#308` Round 2 entry (`1a6c1ab1`) | +| Pre-merge `Merge origin/main` CI wait (`#290`–`#293` completed; `#294`–`#295` merged early) | 4 | 8.08 | 8.67 | `holon-agentic-coder#292` | +| Wait: PR ready (last calibration) $\rightarrow$ maintainer merge (`#290`–`#294`) | 5 | 338.43 | 482.95 | `holon-agentic-coder#291` (`#41`: `235.0`) | +| GitHub: PR open $\rightarrow$ merged (`#290`–`#294`) | 5 | 494.13 | 516.15 | `holon-agentic-coder#290` (`#292`: `504.6`) | + +Stage totals across in-window events (`03:54:45Z`–`05:04:00Z`; human/merge wait sums in-window `03:54:45Z`/ready +$\rightarrow$ `mergedAt`/`05:04Z` across `hac#290`–`#296` + `dev-env#41`–`#42` = `5.86 h`, `#290`–`#294` alone = +`3.25 h`): + +| Stage | Total (h) | Working (h) | Waiting on CI (h) | Waiting on another flow (h) | Waiting on human (h) | Idle (h) | +| :-------- | --------: | ----------: | ----------------: | --------------------------: | -------------------: | -------: | +| intent | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | +| plan | 0.04 | 0.04 | 0.00 | 0.00 | 0.00 | 0.00 | +| execute | 1.24 | 0.08 | 0.00 | 1.15 | 0.00 | 0.00 | +| review | 1.21 | 1.21 | 0.00 | 0.00 | 0.00 | 0.00 | +| calibrate | 0.51 | 0.10 | 0.41 | 0.00 | 5.86 | 0.00 | + +- **Missing timing (`0412`):** `dev-env#42` and `0407` left no `todo/flow-*.log`; pre-flight (credential probe, image + check, worktree creation), individual git pushes, conflict merges, per-reviewer latencies inside `4.13 / 4.40 / 14.85` + min ensembles, and Stage 3 / resolver tool-vs-model splits remain unmeasured. + +#### 2. Churn Counts (`2026-11-25T03:54:45Z` to `2026-11-25T05:05:00Z`) + +- **CI pipeline runs:** + - Across the **5 cadence merges** (`hac#290`–`#294`, full PR lifetime): `47` tested CI heads (`459` check-runs), of + which **`43` (`91.5%`) were churn** (`29` bookkeeping, `14` `main`-merge, vs `4` code heads; `#290` `11`, `#291` + `4`, `#292` `19`, `#293` `8`, `#294` `5` heads). + - Across **in-window `hac` CI activity** (`03:54:45Z`–`05:05:00Z`): `144` workflow runs across `24` head SHAs (`112` + success, `23` cancelled, `9` in progress): `7` `main` push heads (`ae2c5b41`..`4c6232cb`, with `daf3fa74` & + `099025f8` cancelled mid-run on `Test - Unit`/`Test - Stress` by subsequent merges) and `17` PR heads (`#291`–`#295` + - `12` heads on `#308`). Of the `17` PR heads, **`15` (`88.2%`) were churn** (`7` `main`-merge, `8` bookkeeping, vs + `2` code-push heads `3595c1f1` & `54321e50` which themselves only edited `executions/E-*.md` after + `review_local`). + - Across **`dev-env#42`** (`04:14:12Z`–`04:48:00Z`): `15` workflow runs across `3` heads (`2/3 = 66.7%` bookkeeping + churn; `2` cancelled on `b1dc27bb` when `ef1fbd76` pushed). **Zero** CI check failures occurred in `hac` or + `dev-env` during the window; all cancellations were self-inflicted head replacements/merges. +- **Review, Stage 3/5, and Queue churn:** + - **Queue conflict cascade (`0371`):** after `#290`–`#296` merged (`4c6232cb`), **`12/12` open `hac` PRs** + (`#297`–`#308`) sit `CONFLICTING`/`DIRTY`; `git merge-tree` confirms all `17` non-merged `flow-*` worktrees conflict + **solely** on `holon-knowledge/ledger/*.jsonl`. + - **Nested `Stage 5 rerun` + false consensus withdrawal (`0448`):** `end_of_flow_sync._reenter_review_and_calibrate` + left stale `calibrate=SUCCESS` + stale `review` in `context`, triggering a `0.25 min` `Stage 5 rerun` inside Stage 4 + (`04:01:58Z`), false `ACT-WITHDRAW` (`04:02:08Z`), a `4`-push CI-cancelling burst (`39 s`), and `12.08 min` of + double Stage 5 work/CI wait on `hac#308`. + - **Ledger-only `End-of-flow sync` re-review + frozen checkpoint (`0407`, `0445`):** `hac#308` merged ledger-only + `origin/main` (`1a6c1ab1`, `04:14:22Z`) and re-entered full Stage 4 (`49.6+ min` still live in Iter 3) while + `checkpoint.current_stage` stayed stuck at `"completed"`, allowing reviewers to reverse Round 1 approval on + unchanged code. + - **Infinite `unchanged_streak` loop + blind `review_local` (`0449`, `0450`):** `hac#308` Round 2 ran `2` macOS host + `review_local` passes (`2.82 + 2.87 min`, failing `1/7690` unseen in Linux CI) with `output_excerpt` dropped from + `FIND-CI`, driving `27.02 min` + `4.47 min` doc-only resolver churn (`3595c1f1`, `54321e50`) and target merge + `bd581a65` that reset raw-`head_sha` `unchanged_streak`, dispatching Iter 3 (`05:01:27Z+`). + - **Stage 4 quadruple-push bursts (`0443`):** `hac#308` hit `2` quadruple-push bursts (`39 s` at `04:01:29Z`, `30 s` + at `05:00:49Z`), cancelling `03b6dbe7`, `b95c09b7`, `3595c1f1`, and `bd581a65`. + - **`dev-env` bookkeeping & serial macOS CI (`0451`):** `dev-env#42` waited `15.45 min` (`926.88 s`) on bookkeeping + head `ef1fbd76` (`18.68 min` Stage 5 vs `10 min` budget) because `dev-env` lacks `ci_bookkeeping_gate` and runs + `203` macOS unit tests serially (`862.45 s` vs `2.3 min` Ubuntu). + - **Stage 3 `SPLIT` admission block (`0446`, `0407`):** `0407` stayed idle an additional `69.25 min` (`142.33 min` + total). **Container rebuild churn (`0402`):** `5` post-merge 8-image Docker Bake rebuilds ran during live Stage 4. + +#### 3. Ranked Suggestions + +1. **Extended `0407` & `0445` (critical/high, Flow / End-of-Flow Sync):** Skip full Stage 4 re-entry when + `end_of_flow_sync` merges zero code diff (`hac#308` Round 2 `49.6+ min` still live; reviewer reversal on unchanged + code) and clear `checkpoint.current_stage == "completed"` before re-entry. +2. **Bean `0448` (high, Flow / Stage 4 / Stage 5 — new):** Clear stale `context.stage_results["calibrate"]` (and + supersede prior `review`) in `end_of_flow_sync._reenter_review_and_calibrate` so `review_calibration_freshness` + cannot run nested Stage 5 inside Stage 4 (`hac#308` false `ACT-WITHDRAW`, 4-push cancellation burst, `12.08 min` + double Stage 5). +3. **Bean `0449` (high, Flow / Stage 4 / Convergence — new):** Key `unchanged_streak` in `flow/review/loop.py:568-578` + on `(reviewer_finding_sigs, PR-own code diff fingerprint)` instead of raw `head_sha`, and halt when actionable + findings stay `open` with zero code diff (`hac#308` Round 2 `49.6+ min` loop across `3` iterations). +4. **Bean `0450` (high, Flow / Stage 4 / `review_local` — new):** Preserve `TestMeasurement.output_excerpt` and failing + test names in `local_tests.py` / `review_report.py`, and wait briefly for `pending > 0` GitHub CI instead of eager + host `7,690`-test runs on objected iterations (`hac#308` `2` host runs failing `1/7690`, driving `27.02 min` + + `4.47 min` blind resolver churn). +5. **Bean `0451` (high, Pipeline / `dev-env` — new):** Port `ci_bookkeeping_gate` and `pytest -n auto --dist worksteal` + to `thomashan/dev-env` workflows (`dev-env#42` `15.45 min` `final_head_ci` wait on `ef1fbd76`, `18.68 min` Stage 5; + `dev-env#41` `d6fb465c` `15.1 min`). +6. **Extended `0443`, `0442`, `0412` (high/normal):** Batch Stage 4 pushes (`hac#308` `2` quadruple-push bursts, + `dev-env#42` `b1dc27bb` cancelled), avoid double `npx prettier` (`2.50–2.60 min` calibration in `#308`/`#42`), and + close remaining logging/timing gaps (`dev-env#42`/`0407` unlogged, per-reviewer/tool splits unmeasured). _(Existing + `0371` critical and `0446` high remain urgent for the `12/12` `CONFLICTING` PR cascade and `142.33 min` `0407` + block.)_ + +#### 4. Examined and Found in Order + +- **Zero CI failures in window (`hac` & `dev-env`):** All `112` completed `hac` workflow runs and `13` completed + `dev-env` runs passed; all `25` cancellations (`23` `hac`, `2` `dev-env`) were self-inflicted head + replacements/merges. +- **Mechanical ledger-only queue cascade confirmed:** `git merge-tree` across all `17` non-merged `hac` `flow-*` + worktrees against `origin/main` (`4c6232cb`) showed zero non-ledger code conflicts; all conflicts lie in + `holon-knowledge/ledger/*.jsonl`. +- **`dev-env` end-to-end flow healthy except Stage 5 CI wait:** `dev-env#42` completed Stage 1–3 cleanly in `7.75 min` + (`04:06:16Z..04:14:01Z`) and passed reviewers in 1 iteration (`14.98 min`), with `15.45 min` of its `41.73 min` + runtime spent waiting on serial macOS unit CI over a bookkeeping-only commit (`ef1fbd76`). + +### 2026-11-25T04:02:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge since `2026-11-25T02:54:00Z` (`holon-agentic-coder` PRs `#285`, `#286`, `#287`, `#288`, + `#289`; `holon-coherence` last merged `#55` at `2026-11-24T12:44:47Z`, with `#56` open). +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#289` (`core-helpers-self-doc`, merged `2026-11-25T03:42:30Z`) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`) +- **Beans created or extended:** + - Created: `0445` (end-of-flow sync leaves `checkpoint.current_stage` stuck at `"completed"` with frozen + `context.logs` during `15.3+ min` Stage 4/5 re-entry on `PR #308`), `0446` (Stage 3 admission checks `SPLIT` parent + plans against their union touch set before decomposition, blocking `0407` `60.75 min` on + `apps/sandbox-executor/tests/` and `budgets.py`), `0447` (`Workspace survival` concurrent child runs saturate 4-vCPU + runners at `364 s` vs `365.5 s` baseline on `PR #308`, needing one shared child run or separate CI jobs). + - Extended: `0439` (`PR #287` `ba6b525a` edited `7` and `PR #290` `a06586a6`/`0b7f019c` edited `12` out-of-scope files + on macOS `CI Timing Gate` `FIND-CI` failures, colliding on `9` code/test files in `#290` `a344ce2f` after `#287` + merged and putting `#287`/`#290` into `0407`'s `blocked_by`), `0443` (`PR #308` hit `3` Stage 4 `9–16 s` + double/triple-push CI cancellations across `16` cancelled runs and `317 s` wasted `Docker Build`), `0407` (`PR #308` + ran full re-reviews on `0b986f9b`, `11721091`, and ledger-only `End-of-flow sync` `adaf72a8`; `0407` itself blocked + `60.75 min` in Stage 3), `0442` (`PR #308` spent `2.60 min` in Stage 5 calibration and hit `2×30 s` `npx prettier` + timeouts in Stage 2), `0412` (`no-unneeded-full-review` unlogged in `todo/flow-*.log`; wrapper pre-flight + untimestamped; `End-of-flow sync` unlogged in checkpoint; per-reviewer/tool-vs-model split unmeasured). _(Note: + `0371`, `0400`, `0405` had concurrent session edits and were left untouched.)_ + +#### 1. Per-Step Timing Table (`2026-11-25T02:54:00Z` to `2026-11-25T03:54:45Z`) + +Measured across `2` active flows (`workspace-survival-job-parallel` `#308` in +`todo/flow-workspace-survival-job-parallel.log` and checkpoint; `no-unneeded-full-review` `0407` checkpoint, halted in +Stage 3) and GitHub PR/CI/commit records (`hac#285`–`#308`, `coh#56`): + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :----------------------------------------------------------------------------------------------------- | ----: | -----------: | ------------: | :------------------------------------------ | +| Pre-flight (credential probe, image check, worktree creation) | - | not measured | not measured | wrapper lines untimestamped (`0412`) | +| Stage 1: intent agent turn | 0 | - | - | none in window (`0407` at `02:35Z`) | +| Stage 2: planner agent turn | 0 | - | - | none in window (`0407` at `02:35Z–02:41Z`) | +| Stage 3: admission wait / refusal (`0407` blocked `02:54:00Z–03:54:45Z`) | 1 | 60.75 | 60.75 | `no-unneeded-full-review` (`73.08 m` total) | +| Stage 3: executor work in window (`#308` `02:54:00Z–03:10:31Z`; `42.09 m` total) | 1 | 16.52 | 16.52 | `workspace-survival-job-parallel` (`#308`) | +| Each push & conflict probe/merge of target | - | not measured | not measured | folded into surrounding stage (`0412`) | +| Stage 4: empty-diff guard + PR create/edit (`#308` initial + re-entry) | 2 | 0.19 | 0.20 | `workspace-survival-job-parallel` (`#308`) | +| Stage 4: reviewer ensemble turn (`3` reviewers; per-reviewer unlogged) | 3 | 4.20 | 9.42 | `workspace-survival-job-parallel` iter 2 | +| Stage 4: local test run after reviewers (`review_local` on `adaf72a8`) | 1 | 2.87 | 2.87 | `workspace-survival-job-parallel` re-entry | +| Stage 4: resolver turn (incl. push) | 2 | 3.60 | 5.17 | `workspace-survival-job-parallel` re-entry | +| Stage 4: conflict gate + ledger commits (`5cb52b05` $\rightarrow$ `b14bd3dd` $\rightarrow$ `24d23329`) | 1 | 0.47 | 0.47 | `workspace-survival-job-parallel` (`#308`) | +| Stage 4: individual review iteration (completed in window; iter 4 `2.73 m` live) | 3 | 7.13 | 9.55 | `workspace-survival-job-parallel` iter 2 | +| Stage 4: full review stage (`16.00 m` initial + `15.28 m` re-entry in progress) | 2 | 15.64 | 16.00 | `workspace-survival-job-parallel` (`#308`) | +| CI wait (Stage 5 `merged_head_ci` on `24d23329`) | 1 | 8.75 | 8.75 | `workspace-survival-job-parallel` (`#308`) | +| Stage 5: calibration work + reconciliation + promotion (excl. CI waits) | 1 | 2.60 | 2.60 | `workspace-survival-job-parallel` (`#308`) | +| CI registration + CI wait (Stage 5 `final_head_ci` on `de6441ff`: `18 s` + `49 s`) | 1 | 1.13 | 1.13 | `workspace-survival-job-parallel` (`#308`) | +| Stage 5: final-head check & exit (`03:39:13Z–03:39:19Z`) | 1 | 0.10 | 0.10 | `workspace-survival-job-parallel` (`#308`) | +| End-of-flow sync check + `origin/main` merge (`03:39:20Z–03:39:28Z`) | 1 | 0.13 | 0.13 | `workspace-survival-job-parallel` (`#308`) | +| Pre-merge `Merge origin/main` CI wait (`#285`–`#289` merge commit $\rightarrow$ CI) | 5 | 6.95 | 10.12 | `holon-agentic-coder#287` (`3b9ad780`) | +| Wait: PR ready (last calibration) $\rightarrow$ maintainer merge (`#285`–`#289`) | 5 | 523.05 | 564.13 | `holon-agentic-coder#285` | +| GitHub: PR open $\rightarrow$ merged (`#285`–`#289`) | 5 | 552.62 | 587.47 | `holon-agentic-coder#285` | + +Stage totals across in-window events (`02:54:00Z`–`03:54:45Z`; `PR #285`–`#289` pre-merge waits accrued largely before +`02:54Z`; in-window `02:54Z`–`mergedAt` human/merge-queue wait across `#285`–`#289` was `2.70 h`): + +| Stage | Total (h) | Working (h) | Waiting on CI (h) | Waiting on another flow (h) | Waiting on human (h) | Idle (h) | +| :-------- | --------: | ----------: | ----------------: | --------------------------: | -------------------: | -------: | +| intent | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | +| plan | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | +| execute | 1.29 | 0.28 | 0.00 | 1.01 | 0.00 | 0.00 | +| review | 0.52 | 0.52 | 0.00 | 0.00 | 0.00 | 0.00 | +| calibrate | 0.21 | 0.05 | 0.16 | 0.00 | 2.70 | 0.00 | + +- **Missing timing (`0412`):** `no-unneeded-full-review` (`0407`) left no `todo/flow-*.log`; + `flow-workspace-survival-job-parallel.log` wrapper pre-flight lines have no timestamps; `End-of-flow sync` re-entry + (`03:39:20Z–03:54:45Z+`) is absent from `checkpoint.context.logs` and `checkpoint.stage_results` while running + (`0445`); per-reviewer latencies and executor tool-vs-model split remain unmeasured. + +#### 2. Churn Counts (`2026-11-25T02:54:00Z` to `2026-11-25T03:54:45Z`) + +- **CI pipeline runs:** + - Across the **5 cadence merges** (`hac#285`–`#289`, full PR lifetime): `25` tested CI heads (`275` check-runs), of + which **`18` (`72.0%`) were churn** (`13` bookkeeping, `5` `main`-merge, `7` code). + - Across **all CI activity in the window** (`02:54:00Z`–`03:54:45Z`): `20` distinct head SHAs (`128` GitHub Actions + workflow runs: `108` success, `16` cancelled, `4` in progress at cutoff), comprising `5` `main` push heads (`35` + runs) and `15` PR heads (`93` runs). Of the `15` PR heads, **`12` (`80.0%`) were churn** (`7` `main`-merge: `#286` + `59abd6bc`, `#287` `3b9ad780`, `#288` `d3d6f5a8`, `#289` `f2c8b08f`, `#290` `a344ce2f`, `#308` `b14bd3dd` & + `adaf72a8`; `5` bookkeeping: `#308` `8f533e24`, `5cb52b05`, `24d23329`, `de6441ff`, `a27a4ce4`; vs `3` code heads: + `#308` `2b840055`, `0b986f9b`, `11721091`). + - **Zero** CI failures occurred in the window; all `16` cancelled workflow runs were self-inflicted head replacements + on `PR #308` (`3` double/triple-push ledger cancellations + `2b840055` `Test - Unit` cancelled at `371 s` when + `0b986f9b` arrived). +- **Review, Stage 3/5, and Queue churn:** + - **Queue conflict cascade (`0371`):** after `#285`–`#289` merged, **`16` of `19` open `hac` PRs** (`#291`–`#295`, + `#297`–`#307`) sit `CONFLICTING`/`DIRTY` solely on `holon-knowledge/` files (`non_kb_overlaps_285_289={}` for all + `17` PRs `#291`–`#307`), while `5` `Merge origin/main` CI runs executed in-window (`6.95 min` median CI). + - **Out-of-scope `FIND-CI` resolver edits (`0439`):** discovered in `#287` (`ba6b525a`, `7` out-of-scope files) and + `#290` (`a06586a6`/`0b7f019c`, `12` out-of-scope files) after macOS `CI Timing Gate` failures; when `#287` merged + (`03:21:48Z`), `#290`'s `a344ce2f` merge (`03:50:30Z`) hit **9 code/test conflicts** (plus 3 ledgers) and both PRs + blocked `0407`. + - **Stage 4 double/triple-push cancellations (`0443`):** on `PR #308`, `0b986f9b` $\rightarrow$ `8f533e24` (`+13 s`), + `5cb52b05` $\rightarrow$ `b14bd3dd` $\rightarrow$ `24d23329` (3 pushes in `20 s`), and `11721091` $\rightarrow$ + `a27a4ce4` (`+16 s`) cancelled `15` workflow runs (`317 s` wasted `Docker Build`) and forced full CI on all `3` + `chore(review)` heads. + - **End-of-flow sync & checkpoint bug (`0445`, `0407`):** `PR #308` merged ledger-only `origin/main` (`adaf72a8`, + `03:39:23Z`), unconditionally re-entered full Stage 4 (`15.3+ min` in window) instead of carrying approval by + fingerprint, and left `checkpoint.current_stage == "completed"` for `15.3+ min` while live. + - **Stage 3 admission block on `SPLIT` parent (`0446`):** `0407` (`no-unneeded-full-review`) sat blocked + **`60.75 min`** (`73.08 min` total) on `apps/sandbox-executor/tests/` and `budgets.py` across `7` in-flight items + before child 1 could even plan. + - **`Test - Stress` 4-vCPU saturation (`0447`):** `PR #308`'s concurrent child runs (`~334 s` each vs `~180 s` serial) + yielded `364 s` (`399 s` workflow) vs `365.5 s` baseline (`R3-F1` left `open`). + +#### 3. Ranked Suggestions + +1. **Extended `0439` (high, Flow / Stage 4 / Resolver):** Enforce Stage 4 resolver touch-set guards and ignore + timing-gate `FIND-CI` failures (evidence: `#287` `7` and `#290` `12` out-of-scope files $\rightarrow$ `9` code/test + conflicts in `#290` `a344ce2f`). +2. **Extended `0443` (high, Flow / Stage 4 / CI Churn):** Batch Stage 4 resolver/conflict-gate and `chore(review)` + pushes into one push (evidence: `#308` `3` double/triple-push cancellations wasting `317 s` `Docker Build` and + defeating `ci_bookkeeping_gate` `3` times). +3. **Bean `0445` (high, Flow / End-of-Flow Sync / Checkpoint — new):** Transition `checkpoint.current_stage` out of + `"completed"` and flush logs before `finish_flow` re-enters Stage 4/5 (`PR #308` stuck at `"completed"` for + `15.3+ min` while re-entry ran). +4. **Bean `0446` (high, Flow / Stage 3 / Admission — new):** Skip Stage 3 union touch-set admission on + `DECISION_DECOMPOSED` (`SPLIT`) parent plans so children admit on their own narrow touch sets, and ban bare directory + prefixes (`apps/sandbox-executor/tests/`) in intent scopes (`0407` blocked `60.75 min` in window). +5. **Extended `0407` & `0442` (critical/high, Stage 4/5):** Documented `#308`'s `0b986f9b`/`11721091` full re-reviews + + `15.3+ min` ledger-only `End-of-flow sync` re-review (`0407`), plus Stage 5 `2.60 min` calibration and `2×30 s` Stage + 2 `npx prettier` timeouts (`0442`). +6. **Bean `0447` (normal, Pipeline / CI / Stress — new) & Extended `0412` (normal, Timing/Logging):** Share one child + unit run or split `Workspace survival` into two CI jobs (`#308` `364 s` vs `365.5 s` on 4-vCPU runner), and close + remaining unlogged/unmeasured gaps (`0412`). _(Plus existing `0371` critical for the `16/19` `CONFLICTING/DIRTY` + ledger-only queue cascade.)_ + +#### 4. Examined and Found in Order + +- **Timing Gate (`PR #278`):** Zero timing-gate CI failures occurred across all `128` workflow runs (`20` heads) in + `02:54Z–03:54:45Z`. +- **Bookkeeping Gate (`PR #272`):** On `PR #308`, `5cb52b05` (`03:26:07Z`) and `de6441ff` (`03:38:05Z`, `48.6 s` + `final_head_ci`) ran only `CodeQL`/`Analyze`, skipping all `Unit`/`Stress`/`Integration`/`Hygiene`/`Docker` runs when + their parent heads had passing CI. +- **Self-doc merge queue (`PR #285`–`#289`):** All `5` pre-merge `Merge origin/main` CI runs passed `11/11` checks + cleanly on first run (`6.95 min` median CI). + +### 2026-11-25T02:54:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge since `2026-11-25T00:28:00Z` (`holon-agentic-coder` PRs `#278`, `#280`, `#281`, `#283`, + `#284`; `holon-coherence` last merged `#55` at `2026-11-24T12:44:47Z`, with `#56` open; `dev-env` `#41` open). +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#284` (`e2e-self-doc`, merged `2026-11-25T02:47:53Z`) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`) +- **Beans created or extended:** + - Created: `0442` (Stage 5 calibration invokes `npx --yes prettier` twice per run, consuming `~140 s` of `155 s` Stage + 5 work vs `64 ms` with direct local `prettier`), `0443` (Stage 4 pushes `chore(review): record review ledger rows` + `9–12 s` after resolver/conflict-gate pushes, causing `5/5` cancelled CI heads and defeating `ci_bookkeeping_gate`), + `0444` (Stage 5 `calibrate_sync._fetch_execution_branch` lacks transient retry on `Permission denied (publickey)` + errors, halting `touch-set-self-doc`). + - Extended: `0408` (`PR #306` `2c31f500` failed `Test - Hygiene` solely on engine-generated + `executions/E-1795571328-ANA-G4N.md`, the window's only CI failure), `0433` (`9/9` new flows launched + `00:28Z–02:25Z` halted on `gh pr diff 283` HTTP 406; `workspace-survival` idled `181.5 min`), `0422` (`11/13` active + checkpoints ran with `allow_overlap=True`), `0407` (`PR #300` full `6.0 min` re-review after `main` merge + + `PR #306` full `7.6 min` re-review after `E-*.md` Prettier fix), `0403` (verified `22` bookkeeping heads dropped + `Unit`/`Stress` to `9–23 s` and `final_head_ci` to `0.82 min` median, while `9–12 s` double pushes negated skipping + on `5` heads), `0412` (`12/14` flows unlogged in `todo/flow-*.log`, wrapper pre-flight untimestamped, + `calibrate.end_time` vs `elapsed_seconds` divergence). + +#### 1. Per-Step Timing Table (`2026-11-25T00:28:00Z` to `2026-11-25T02:54:07Z`) + +Measured across `13` active checkpoints (`split-cli-init-modules`, `touch-set-self-doc`, `in-flight-pr-files-fallback`, +`decomposition-rule-self-doc`, `preflight-self-doc`, `review-report-self-doc`, `agent-defaults-self-doc`, +`github-ci-self-doc`, `git-refs-self-doc`, `github-pr-merge-self-doc`, `github-misc-self-doc`, +`workspace-survival-job-parallel`, `no-unneeded-full-review`), `2` `todo/flow-*.log` files with post-`00:28Z` entries +(`flow-timing-gate-judges-test-time.log`, `flow-workspace-survival-job-parallel.log`), and GitHub PR/CI/commit records +(`hac#278`, `#280`, `#281`, `#283`, `#284`, `#285`–`#307`, `coh#56`, `dev-env#41`): + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :----------------------------------------------------------------------- | ----: | -----------: | ------------: | :------------------------------------------ | +| Pre-flight (credential probe, image check, worktree creation) | - | not measured | not measured | wrapper lines untimestamped (`0412`) | +| Stage 1: intent agent turn (`context.logs`) | 9 | 0.25 | 0.32 | `no-unneeded-full-review` | +| Stage 2: planner agent turn (`context.logs`) | 10 | 3.53 | 5.62 | `no-unneeded-full-review` | +| Stage 3: admission check (`context.logs`) | 19 | 0.60 | 1.13 | `review-report-self-doc` | +| Stage 3: refusal $\rightarrow$ resume wait (`9` 406 + `1` `#283` wait) | 10 | 0.86 | 181.48 | `workspace-survival-job-parallel` | +| Stage 3: executor agent turn (tool vs model split unlogged) | 9 | 5.85 | 6.68 | `review-report-self-doc` | +| Stage 3: re-plan after touch-set breach | 0 | - | - | none in window (`split-cli-init` pre-00:28) | +| Each push & conflict probe/merge of target | - | not measured | not measured | folded into surrounding stage (`0412`) | +| Stage 4: empty-diff guard + PR create (`context.logs`) | 9 | 0.17 | 0.20 | `agent-defaults-self-doc` | +| Stage 4: reviewer ensemble turn (`3` reviewers; per-reviewer unlogged) | 14 | 7.03 | 7.92 | `review-report-self-doc` | +| Stage 4: resolver turn (incl. push) | 2 | 3.19 | 4.23 | `github-pr-merge-self-doc` (`#306`) | +| Stage 4: ledger commit (`Consensus approval` $\rightarrow$ `Committed`) | 11 | 0.12 | 0.13 | `agent-defaults-self-doc` | +| Stage 4: individual review iteration | 14 | 7.14 | 8.03 | `review-report-self-doc` | +| Stage 4: full review stage (`10` in-win + `#296` spanning `00:28Z`) | 11 | 7.65 | 47.58 | `split-cli-init-modules` (`#296`) | +| CI registration wait (Stage 5 `final_head_ci`) | 16 | 0.28 | 0.30 | `decomposition-rule-self-doc` (`#300`) | +| CI wait (Stage 5 `merged_head_ci`) | 3 | 7.92 | 7.97 | `touch-set-self-doc` (`#298`) | +| CI wait (Stage 5 `final_head_ci` after calibration push) | 13 | 0.82 | 1.81 | `split-cli-init-modules` (`#296`) | +| Stage 5: calibration work + reconciliation + promotion (excl. CI waits) | 13 | 2.58 | 2.65 | `timing-gate-judges-test-time` (`#278`) | +| Stage 5: final-head check after CI settled | 13 | 0.10 | 0.17 | `timing-gate-judges-test-time` (`#278`) | +| Idle: interrupted / failed Stage 4/5 $\rightarrow$ resume | 2 | 1.37 | 1.37 | `decomposition-rule-self-doc` (`#300`) | +| Wait: PR ready (last calibration) $\rightarrow$ maintainer merge (5 PRs) | 5 | 588.38 | 632.45 | `holon-agentic-coder#281` | +| GitHub: PR open $\rightarrow$ merged (`#278,#280,#281,#283,#284`) | 5 | 638.73 | 648.33 | `holon-agentic-coder#281` | + +Stage totals across in-window events (`00:28:00Z`–`02:54:07Z`; `no-unneeded-full-review` also stayed halted `12.45 min` +on real overlap at cutoff; `split-cli-init-modules` carried `0.66 h` pre-`00:28Z` Stage 4 work): + +| Stage | Total (h) | Working (h) | Waiting on CI (h) | Waiting on another flow (h) | Waiting on human (h) | Idle (h) | +| :-------- | --------: | ----------: | ----------------: | --------------------------: | -------------------: | -------: | +| intent | 0.04 | 0.04 | 0.00 | 0.00 | 0.00 | 0.00 | +| plan | 0.63 | 0.63 | 0.00 | 0.00 | 0.00 | 0.00 | +| execute | 4.24 | 1.09 | 0.00 | 3.02 | 0.00 | 0.13 | +| review | 1.73 | 1.71 | 0.00 | 0.00 | 0.00 | 0.02 | +| calibrate | 1.25 | 0.58 | 0.64 | 0.00 | 38.88 | 0.02 | + +- **Missing timing (`12/14` active flows unlogged in `todo/flow-*.log`):** only `flow-timing-gate-judges-test-time.log` + and `flow-workspace-survival-job-parallel.log` contain post-`00:28Z` entries; wrapper pre-flight lines in the latter + have no timestamps; `calibrate.end_time` precedes `publish_calibration` and `final_head_ci` wait (`0412`). +- **Stage 5 Prettier overhead (`~140 s` per flow):** profiling `flow-agent-defaults-self-doc` showed Python/git + calibration + self-check + promotion takes `9.36 s`, while `_converge_report`'s two `npx --yes prettier` calls take + `~140 s` (direct cached `prettier --check`: `0.064 s`; `0442`). + +#### 2. Churn Counts (`2026-11-25T00:28:00Z` to `2026-11-25T02:54:07Z`) + +- **CI pipeline runs:** + - Across the **5 cadence merges** (`hac#278, #280, #281, #283, #284`, full PR lifetime): `35` CI heads (`210` workflow + runs), of which **`23` (`65.7%`) were churn** (`15` bookkeeping, `8` `main`-merge, `12` code), with `5` failed heads + and `8` cancelled heads (`#278`: 1, `#280`: 1, `#281`: 1, `#283`: 5). + - Across **all CI heads in the window** (`17` `hac` PRs, `00:28Z–02:54Z`): `46` CI heads (`276` workflow runs), of + which **`36` (`78.3%`) were churn** (`28` bookkeeping, `8` `main`-merge, `10` code), with `1` failed head (`PR #306` + `2c31f500` `Test - Hygiene`) and **`5` cancelled heads** (`#296` twice, `#305` once, `#306` twice). +- **Review & Stage 3/5 churn:** + - **HTTP 406 storm on `PR #283` (`0433`, `0422`):** `9/9` new flows launched `00:28Z–02:25Z` failed Stage 3 admission + on `gh pr diff 283` (`>300 files`), forcing `9` manual `--allow-overlap` resumes (`11/13` active checkpoints carried + `allow_overlap=True`), while `workspace-survival-job-parallel` idled `181.5 min` waiting for `#283` to merge. + - **Stage 4 `9–12 s` double-push cancellations (`0443`):** every Stage 4 resolver or conflict-gate push (`b646d346`, + `59d41deb`, `4ea64923`, `1a49bac5`, `4ba9ecf7`) was cancelled `8–51 s` later by + `chore(review): record review ledger rows`, wasting `Docker Build` runs (`96–126 s`) and forcing full `6–9 min` CI + on the ledger commit. + - **Unnecessary full re-reviews (`0407`, `0408`):** `PR #300` re-reviewed `6.0 min` after a `DIRTY` ledger conflict + with `#280`; `PR #306` failed `Test - Hygiene` on engine-generated `executions/E-1795571328-ANA-G4N.md` after 3/3 + `APPROVED` (`0/0/0`), costing a `4.2 min` resolver pass + `7.6 min` re-review. + - **Transient Stage 5 SSH fetch halt (`0444`):** `touch-set-self-doc` failed Stage 5 at `00:30:27Z` on + `Permission denied (publickey)` without retry (`1.37 min` stop/resume), then collided with `#278`'s merge + (`7.97 min` `merged_head_ci` wait). + - **Cross-PR `KB-failure-*.json` promotion sprawl (`0371`):** `6` feature PRs independently promoted `40` shared + `holon-knowledge/kb/failure_modes/KB-failure-*.json` files into their PR diffs (`#296`: 21, `#305`: 7, `#297`: 4, + `#300`: 3, `#292`: 3, `#306`: 2). + - **Open PR backlog & merge-wait amplification:** `25` PRs (`hac#285`–`#307`, `coh#56`, `dev-env#41`) await human + merge (`588.4 min` median wait on the 5 merged PRs; `8` `main`-merge CI heads triggered in window). + +#### 3. Ranked Suggestions + +1. **Bean `0442` (high, Flow / Stage 5 / Calibration — new):** Resolve local/cached `prettier` directly in + `calibration.py:_converge_report` before falling back to `npx --yes prettier` (cuts Stage 5 calibration work from + `~2.58 min` / `155 s` to `~0.2 min` / `10–12 s`, saving `~2.3 min` per flow / `~30 min` across `13` runs in this + window). +2. **Bean `0443` (high, Flow / Stage 4 / CI Churn — new):** Eliminate the `9–12 s` double push between Stage 4 + resolver/conflict-gate pushes and `chore(review): record review ledger rows` (`loop.py:329,857`, + `ledger_commit.py:135-155`), stopping self-inflicted CI cancellations (`5/5` cancelled heads in window) and restoring + `ci_bookkeeping_gate` savings on post-resolver/post-merge ledger rows. +3. **Extended `0408` & `0407` (high/critical, Pipeline / Stage 4):** Recorded `PR #306`'s `Test - Hygiene` failure on + engine-generated `executions/E-1795571328-ANA-G4N.md` (`0408`) and avoidable full re-reviews on `#300` (`6.0 min`) + and `#306` (`7.6 min`) (`0407`). +4. **Extended `0433` & `0422` (high, Flow / Stage 3):** Recorded `9/9` new flows hitting `gh pr diff 283` HTTP 406, + `181.5 min` wait on `workspace-survival`, and `11/13` flows running with `allow_overlap=True` (noting `PR #299` + awaits merge). +5. **Bean `0444` (normal, Flow / Stage 5 — new):** Add bounded transient retry to + `calibrate_sync._fetch_execution_branch` (`touch-set-self-doc` `00:30:27Z` `Permission denied (publickey)` halt). +6. **Extended `0403` & `0412` (high/normal, CI / Timing):** Recorded `ci_bookkeeping_gate` `9–23 s` skips across `22` + clean bookkeeping heads (`0.82 min` median `final_head_ci`), `12/14` unlogged flows in `todo/flow-*.log`, and + `calibrate.end_time` divergence (`0412`). Also documented `KB-failure-*.json` promotion sprawl (`40` files across `6` + PRs) against `0371` (left untouched due to concurrent session edits). + +#### 4. Examined and Found in Order + +- **Timing Gate (`PR #278`, Bean `0404`/`0419`):** Merged `00:33:04Z`; **zero** timing-gate failures occurred across all + `46` CI heads (`276` workflow runs) in `00:28Z–02:54Z`. +- **Bookkeeping Gate (`PR #272`, Bean `0403`):** `22` uncancelled post-Stage-3 bookkeeping heads skipped + `Unit`/`Stress`/`Integration`/`Docker`/`Make` in `9–23 s`, holding Stage 5 `final_head_ci` waits to `48–65 s` + (`0.82 min` median vs `7.92 min` on `merged_head_ci`). +- **Self-doc slice quality (`Bean 0153`):** `9` of `11` Stage 4 runs in the window (`#298`–`#304`, `#307`) passed + 3-reviewer consensus on **iteration 1 with `0/0/0` findings** (`7.0–8.4 min` Stage 4), and `#305` resolved its sole + nit in `2.2 min`. + +### 2026-11-25T00:28:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge since `2026-11-24T12:59:00Z` (`holon-agentic-coder` PRs `#282`, `#272`, `#275`, `#276`, + `#277`; plus decomposed child PR `#279` merged into `#283`'s plan branch; `holon-coherence` last merged `#55` at + `12:44:47Z`, with `#56` open). +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#277` (`ci-wait-fast-poll-and-early-fail`, merged `2026-11-25T00:18:17Z`) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`) +- **Beans created or extended:** + - Created: `0438` (Stage 5 `counted_target_only_file` false positive on PR `#283` after merge commit `221f9d73` + adapted `test_replan_request.py`), `0439` (Stage 4 resolver has no scope guard and edits unrelated files on + timing-gate `FIND-CI` failures), `0440` (harness `.git/hooks/pre-commit` runs Prettier across unstaged working-tree + `.md` files), `0441` (Stage 5 `final_head_ci` reports `unknown` on bookkeeping-gated / transient-probe heads). + - Extended: `0433` (HTTP 406 recurred on `infra-helpers-self-doc` and `workspace-survival-job-parallel`; + cross-referenced companion `0437`), `0412` (`19/24` flows unlogged, `split-cli-init-modules` missing `review` + start/end, `+11:00` mixed into `Z` log timestamps, `calibrate.elapsed_seconds` vs `start_time..end_time`), `0407` + (timing-gate `FIND-CI` re-reviews on `#276`/`#290`/`#292`, 3 approvals on `#292`, merge withdrawal on `#283`), + `0408` (`PR #296` failed `Test - Hygiene` on engine-generated `executions/E-1795563737-ANA-G4N.md` and + `Lint with Ruff`; `PR #289` failed hygiene), `0422` (`14/23` `hac` flows ran with `allow_overlap=True`). + +#### 1. Per-Step Timing Table (`2026-11-24T12:59:00Z` to `2026-11-25T00:19:32Z`) + +Measured across `24` active checkpoints (`23` `holon-agentic-coder` + `1` `holon-coherence`), `5` `todo/flow-*.log` +files with post-`12:59Z` entries (`ci-skip-bookkeeping-only-pushes`, `launcher-proxy-self-doc`, +`timing-gate-judges-test-time`, `unit-suite-slowest-tests-speedup`, `workspace-survival-job-parallel`), and GitHub +PR/CI/commit records (`hac#272`, `#275`–`#297`, `coh#55`–`#56`): + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :--------------------------------------------------------------------- | ----: | -----------: | ------------: | :------------------------------------------- | +| Pre-flight (credential probe, image check, worktree creation) | - | not measured | not measured | missing wrapper timestamps (`0412`) | +| Stage 1: intent agent turn (checkpoint) | 20 | 0.3 | 1.7 | `entrypoint-exec-self-doc` | +| Stage 2: planner agent turn (checkpoint) | 22 | 3.8 | 22.9 | `timing-gate-judges-test-time` | +| Stage 3: admission check (`todo/flow-*.log` only; 22 unlogged) | 1 | 0.1 | 0.1 | `timing-gate-judges-test-time` | +| Stage 3: overlap wait / admission refusal (14/23 used `allow_overlap`) | - | not measured | not measured | 2 immediate HTTP 406 halts (`0433`, `0437`) | +| Stage 3: executor agent turn (checkpoint, incl. local tests) | 23 | 7.9 | 34.6 | `timing-gate-judges-test-time` | +| Stage 3: re-plan after touch-set / entropy breach (2 flows) | - | not measured | not measured | `split-cli-init-modules`, `end-of-flow-sync` | +| Each push & conflict probe/merge of target | - | not measured | not measured | folded into surrounding stage (`0412`) | +| Stage 4: empty-diff guard + PR create/edit | - | not measured | not measured | not split in checkpoints (`0412`) | +| Stage 4: reviewer ensemble turn (3 reviewers; per-reviewer unlogged) | 10 | 24.5 | 56.9 | `unit-suite-slowest-tests-speedup` (`#275`) | +| Stage 4: resolver turn (incl. push; 1 aborted `-6` pass ran 227.1m) | 3 | 9.4 | 33.4 | `timing-gate-judges-test-time` (`#278`) | +| Stage 4: ledger commit | - | not measured | not measured | not logged individually (`0412`) | +| Stage 4: individual review iteration (log) | 12 | 26.6 | 56.9 | `unit-suite-slowest-tests-speedup` (`#275`) | +| Stage 4: full review stage (checkpoint, all iters + CI/local tests) | 19 | 17.0 | 122.9 | `timing-gate-judges-test-time` (`#278`) | +| CI registration wait (`todo/flow-*.log`) | 8 | 0.3 | 3.0 | `unit-suite-slowest-tests-speedup` (budget) | +| CI wait (Stage 5 `final_head_ci.ci_wait` in checkpoints) | 16 | 11.9 | 30.0 | `timing-gate-judges-test-time` (budget) | +| CI wait (`todo/flow-*.log`) | 5 | 7.9 | 18.0 | `ci-skip-bookkeeping-only-pushes` (`#272`) | +| Stage 5: calibration work + promotion + reconciliation (excl. CI) | 19 | 0.3 | 2.6 | `config-env-self-doc` (+4 self-doc flows) | +| Stage 5: final-head check after CI settled | - | not measured | not measured | folded into Stage 5 (`0412`) | +| Wait: PR ready (`last_calib`) $\rightarrow$ maintainer merge | 6 | 132.5 | 615.0 | `holon-agentic-coder#277` | +| Idle: interrupted / stopped run $\rightarrow$ resume (`flow-*.log`) | 7 | 21.7 | 393.4 | `ci-skip-bookkeeping-only-pushes` (`#272`) | +| GitHub: PR open $\rightarrow$ merged (`#272,#275,#276,#277,#282,#279`) | 6 | 621.3 | 658.4 | `holon-agentic-coder#277` | + +Stage totals across the `24` active checkpoints in the window (Stage 5 split into working vs `final_head_ci` wait; +inter-stage gaps/idle across unlogged flows `not measured`): + +| Stage | Total (h) | Working (h) | Waiting on CI (h) | Waiting on another flow (h) | Waiting on human (h) | Idle in logs (h) | +| :-------- | --------: | ----------: | ----------------: | --------------------------: | -------------------: | ---------------: | +| intent | 0.13 | 0.13 | 0.00 | 0.00 | 0.00 | - | +| plan | 1.71 | 1.71 | 0.00 | 0.00 | 0.00 | - | +| execute | 3.34 | 3.34 | 0.00 | not measured | 0.00 | - | +| review | 10.44 | 10.44 | incl. in working | 0.00 | 0.00 | 3.07 | +| calibrate | 3.37 | 0.28 | 3.09 | 0.00 | 22.61 | 6.92 | + +- **Missing timing (`19/24` active flows unlogged in `todo/flow-*.log`):** only `5` flows wrote post-`12:59Z` entries to + `todo/flow-*.log`; `split-cli-init-modules` recorded `review: status=failed start=None end=None elapsed=1.161`; + `todo/flow-unit-suite-slowest-tests-speedup.log` mixed `+11:00` container timestamps inside `[...Z]` lines (`0412`). +- **Bookkeeping-gate before/after (`PR #272` merged `21:10:12Z`):** Stage 5 `ci_wait` dropped from `11.9–30.0 min` + before `21:10Z` to `0.3–1.9 min` (`16–112 s`) after `21:10Z`, and bookkeeping-only `Test - Unit` workflow runs dropped + to `18–25 s`. + +#### 2. Churn Counts (`2026-11-24T12:59:00Z` to `2026-11-25T00:19:32Z`) + +- **CI pipeline runs:** + - Across the **5 cadence merges** (`hac#282`, `#272`, `#275`, `#276`, `#277`): `47` CI heads in the window, of which + **37 (79%) were churn** (`30` bookkeeping-only, `7` `main`-merge), with `6` failed heads (`3` `Workspace survival`, + `2` `unit (macos-latest)` timing gate on `#276` bookkeeping commits, `1` `build` on `#282`). + - Across **all 24 `hac` PRs + `coh#56` in the window**: `136` `hac` CI heads (`26` code, `20` `main`-merge, `90` + bookkeeping) + `16` reruns = `152` `hac` runs, of which **126 (83%) were churn**, with `26` failed heads (`20` on + bookkeeping/merge heads, `6` on code heads) and `1` failure on `coh#56` (`4` heads: `1` code, `3` bookkeeping). +- **Review & Stage 3/5 churn:** + - `PR #276` (`launcher-proxy-self-doc`): 6 review iterations; `unit (macos-latest)` timing-gate failures on + bookkeeping heads (`c1f20b9e`, `f5baea47`) triggered `FIND-CI-002` / `FIND-CI-004` and pushed resolver edits into 8 + out-of-scope files (`cli/__init__.py`, `config_env_report.py`, `scripts/pre_commit_check.py`, and 5 test files), + causing `PR #296` (`split-cli-init-modules`) to collide in `cli/__init__.py` (`23:47:23Z`). + - `PR #292` (`config-env-self-doc`): 7 review iterations (3 separate 3/3 approvals) across 30 commits (20 bookkeeping, + 4 `main`-merges) and out-of-scope resolver edits in `redaction.py`/`test_redaction.py`. + - `PR #290` (`knowledge-self-doc`): 4 review iterations driven by `unit (macos-latest)` timing-gate `FIND-CI-002` / + `FIND-CI-003` on bookkeeping heads (`9b4d2bd4`, `b15549be`), then `final_head_ci: unknown`. + - `PR #283` (`resolve-conflicts-in-flow`): `221f9d73` merge adaptation caused consensus withdrawal (`e1e7150`) and a + false-positive Stage 5 `counted_target_only_file` halt (`23:36:28Z`); PR #283's >300-file / >20k-line diff also + blocked Stage 3 admission on `infra-helpers-self-doc` (`19:32:54Z`) and `workspace-survival-job-parallel` + (`23:26:48Z`). + - `PR #275` (`unit-suite-slowest-tests-speedup`): 9 review iterations total; hit `227.1 min` `-6` resolver abort + + `94.0 min` idle on `monthly spend limit` (`0434`). + - `PR #272` (`ci-skip-bookkeeping-only-pushes`): `393.4 min` idle before `calibrate` failed at `21:10:18Z` (`6 s` + after PR #272 merged and deleted the remote branch, `0420`). + +#### 3. Ranked Suggestions + +1. **Bean `0439` (high, Flow / Architecture / Stage 4 — new):** Enforce a touch-set / scope boundary on Stage 4 resolver + commits and filter out `CI Timing Gate` failures from `FIND-CI` resolver dispatch (prevents cross-PR collisions like + `PR #276` $\rightarrow$ `PR #296`, silent test-budget weakening, and `9.4–33.4 min` wasted resolver turns + + `26.6 min` re-reviews). +2. **Bean `0438` (high, Flow / Stage 5 — new):** Fix `target_only_paths` in `calibration_self_check.py` to stop using + `git log --no-merges` so conflict-merge adaptations of `main`-added files (e.g. `PR #283` `221f9d73` on + `test_replan_request.py`) do not trigger false-positive `counted_target_only_file` Stage 5 failures. +3. **Bean `0440` (high, Harness — new):** Scope `.git/hooks/pre-commit` Prettier checks to staged Markdown files only so + concurrent sessions with unstaged `.md` edits do not block `git commit --only` in other sessions. +4. **Extended `0433` (high, Flow / Stage 3):** Added `infra-helpers-self-doc` (`19:32:54Z`) and + `workspace-survival-job-parallel` (`23:26:48Z`) HTTP 406 Stage 3 admission halts on PR `#283` and cross-referenced + companion `0437`. +5. **Extended `0407` & `0408` (critical/high, Flow / Pipeline):** Recorded timing-gate `FIND-CI` re-review churn on + `#276`/`#290`/`#292` and merge withdrawal on `#283` in `0407`, plus engine-generated + `executions/E-1795563737-ANA-G4N.md` Prettier hygiene failures on `PR #296` and `#289` in `0408`. +6. **Bean `0441` (normal, Flow / Stage 5 — new):** Fix `ci_final_head.py` so transient non-`github_cli` poll hiccups + retry within budget and bookkeeping-gated final heads classify cleanly instead of reporting `unknown` (`PR #290`, + `PR #293`). +7. **Extended `0412` & `0422` (high/normal, Flow / Harness):** Recorded `19/24` unlogged flows, missing `review` failure + timestamps (`PR #296`), mixed `+11:00`/`Z` log timestamps, `calibrate` elapsed mismatch in `0412`, and `14/23` + `allow_overlap=True` flows in `0422`. + +#### 4. Examined and Found in Order + +- **PR #272 (`ci_bookkeeping_gate`, Bean `0403`):** Once merged at `21:10:12Z`, bookkeeping-only `Test - Unit` runs + dropped to `18–25 s` and Stage 5 `final_head_ci` waits dropped from `11.9–30.0 min` to `0.3–1.9 min` on clean flows + (`git-flow-self-doc`, `local-llm-self-doc`, `claude-auth-self-doc`, `config-env-self-doc`). +- **PR #277 (`ci_wait` fast-poll & early-fail, Bean `0399`):** Merged cleanly at `00:18:17Z`, capping CI wait polling at + `15 s` instead of `120 s` backoff. +- **Self-doc slice flows (`PR #280`, `#281`, `#282`, `#284`–`#288`, `#291`, `#294`, `#295`):** `11` slice PRs passed + Stage 4 consensus in `1–2` iterations with `7.6–17.0 min` review stages when not hit by timing-gate `FIND-CI` or + `main`-merge churn. + +### 2026-11-24T12:59:00Z — Fifth-Merge Audit (Antigravity verification pass) + +- **Trigger:** fifth merge since `2026-11-24T11:05:00Z` (`holon-coherence#53`, `holon-agentic-coder#269`, + `holon-agentic-coder#270`, `holon-coherence#54`, `holon-coherence#55`; plus `holon-agentic-coder#274` merged at + `12:45:46Z`, right at audit launch `12:47:33Z`). Complements the concurrent `12:58:00Z` pass (`0422`–`0425`). +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#274` (`preflight-retry`, merged `2026-11-24T12:45:46Z`; `#270` at `11:31:45Z` was the 5th + merge in the `11:05Z–12:45Z` cadence) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`) +- **Beans created or extended:** + - Created: `0426` (slug truncation, `bean_progress` attribution & subagent intent rewrites), `0427` (`gh` stderr hints + corrupting `pr_url` in posted consensus reviews), `0428` (2-dot vs 3-dot PR-own diff in `ci_final_head` & overlap + inspection), `0429` (`.beans/` header ID & title uniqueness check in `pre_commit_check.py`). + - Extended: `0404` (`hac#273` `unit (macos-latest)` `634 s > 600 s` ceiling failure at `12:17:52Z`), `0414` (`hac#273` + `21.3 min` Stage 3 discarded at `11:07:42Z` over 18 out-of-set files). + +#### 1. Per-Step Timing Table (`2026-11-24T11:05:00Z` to `12:47:33Z`) + +Measured across `todo/flow-*.log` (`ci-skip-bookkeeping-only-pushes`, `ledger-temp-worktree-cleanup`, +`unit-suite-slowest-tests-speedup`), worktree checkpoints (`0376` child 4 `route-stage-4-and-stage-5`, `0399`, `0265`), +and GitHub PR/CI/commit timestamps (`coh#53`, `coh#54`, `coh#55`, `hac#269`, `hac#270`, `hac#274`): + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :------------------------------------------------------------------- | ----: | -----------: | ------------: | :---------------------------------- | +| Pre-flight (credential probe, image check, worktree creation) | - | not measured | not measured | missing wrapper timestamps (`0412`) | +| Stage 1: intent agent turn (logged/checkpoint) | 4 | 0.1 | 0.2 | `split-cli-init-modules` (`0265`) | +| Stage 2: planner agent turn (logged/checkpoint) | 3 | 4.6 | 5.3 | `split-cli-init-modules` (`0265`) | +| Stage 3: admission check (admitted / refused) | 4 | 0.0 | 0.1 | `route-stage-4-and-stage-5` (`273`) | +| Wait: stage 3 overlap refusal -> retry / still waiting | 2 | 40.8 | 65.3 | `ci-wait-fast-poll-and-early-fail` | +| Stage 3: executor agent turn (incl. tests) | 3 | 24.9 | 125.3 | `unit-suite-slowest-tests-speedup` | +| Stage 3: re-plan after touch-set breach | 1 | 4.7 | 4.7 | `route-stage-4-and-stage-5` (`273`) | +| Each push & conflict probe/merge of target | - | not measured | not measured | folded into turns (`0412`) | +| Stage 4: empty-diff guard + PR create/edit | 5 | 0.1 | 0.1 | `route-stage-4-and-stage-5` (`273`) | +| Stage 4: reviewer ensemble turn (3 reviewers; per-reviewer unlogged) | 7 | 25.5 | 27.9 | `ci-skip-bookkeeping-only-pushes` | +| Stage 4: resolver turn (incl. push) | 5 | 14.0 | 18.8 | `route-stage-4-and-stage-5` (`273`) | +| Stage 4: ledger commit | 11 | 0.0 | 4.1 | `ci-skip-bookkeeping-only-pushes` | +| Stage 4: review iteration (reviewers + CI/local tests) | 9 | 13.2 | 27.9 | `ci-skip-bookkeeping-only-pushes` | +| CI registration wait | 3 | 0.0 | 0.3 | `ledger-temp-worktree-cleanup` | +| CI wait (tracked checks to settled) | 1 | 9.9 | 9.9 | `ledger-temp-worktree-cleanup` | +| Stage 5: calibration work + promotion + reconciliation | 2 | 0.3 | 0.3 | `ledger-temp-worktree-cleanup` | +| Stage 5: final-head check after CI settled | 1 | 0.0 | 0.0 | `ledger-temp-worktree-cleanup` | +| Wait: PR ready (CI green + calibrated) -> maintainer merge | 6 | 10.9 | 25.2 | `holon-coherence#55` | +| Idle: interrupted / review halt -> resume | 4 | 0.7 | 2.5 | `ledger-temp-worktree-cleanup` | +| GitHub: PR open -> merged (5 cadence merges + `hac#274`) | 6 | 50.9 | 357.4 | `holon-agentic-coder#269` | + +- **Missing timing (5/9 PRs unlogged in `todo/flow-*.log`):** `coh#53`, `coh#54`, `coh#55`, `hac#269`, and `hac#274` + left no `todo/flow-*.log`; `0376` child 4, `0399`, and `0265` recorded logs only inside checkpoints (`0412`, `0423`). + +#### 2. Churn Counts (`11:05:00Z` to `12:47:33Z`) + +- **CI pipeline runs:** + - Across the **5 cadence merges** (`coh#53`, `coh#54`, `coh#55`, `hac#269`, `hac#270`): `35` pipeline heads + `2` job + re-runs = `37` runs total, of which **25 (68%) were churn** (`18` bookkeeping-only, `5` `main`-merge, `2` re-runs), + and `5` failed (`hac#270` timing gate at `11:36:14Z`; `hac#269` `Workspace survival` `609 s > 600 s`). + - Across **all 9 PRs in the window** (adding `hac#274`, `#272`, `#273`, `#275`): `49` heads + `2` re-runs = `51` runs, + of which **31 (61%) were churn** (`23` bookkeeping-only, `6` `main`-merge, `2` re-runs), with `7` failures (all + timing-gate ceilings: `hac#273` `unit (macos-latest)` `634 s > 600 s` at `12:17:52Z`). +- **Review & Stage 3 churn:** + - `hac#272` (`0403`): iter 3 spent `25.6 min` on a `main`-merged head, hit 2 `APPROVED` + 1 documentation nit + (`0/0/1`), and started full iter 4 (`12:47:53Z`); halted on `DIRTY` at `12:13:51Z`. + - `hac#273` (`0376` child 4): Stage 3 lost `21.3 min` at `11:07:42Z` on 18 out-of-set files + `4.7 min` re-plan. + - `hac#270` (`0387`): `9.9 min` Stage 5 calibration CI wait (`10.7 min / 10 min`) pushed past `main` merge, triggered + a second Stage 5 CI wait (`8.1 min`), hit the `360 s > 344 s` timing gate (`0419`), withdrew consensus + (`11:37:55Z`), and failed Stage 4 after PR #270 had already merged (`0420`). + +#### 3. Ranked Suggestions (new beans `0426`–`0429` + extended `0404`, `0414`) + +1. **Bean `0426` (high, Harness):** Fix `run_holon_flow.py` uncommitted slug-truncation/hardcoded `0380` patch, fix + `bean_progress.py` truncated-slug attribution (`coh#55` showed `Bean # = —`), and forbid `flash_lite` subagents from + rewriting `todo/intent-*.json` (`0393` overwritten, stale worktree left behind). +2. **Bean `0427` (high, Flow / Stage 4):** Strip `gh` CLI `stderr` hints (`gh event listen ...`) from `pr_url` in + `adapter.py`/`loop.py:723` so posted consensus review Markdown links (`hac#273`, `hac#274`, `coh#55`) are not + corrupted. +3. **Bean `0428` (medium, Flow / Diff Semantics):** Replace 2-dot `{approved}..{head}` in `ci_final_head.py:213` with + PR-own 3-dot diff so merged-head timing-gate retries stay eligible across `main` merges, and standardize touch-set + inspection on 3-dot `origin/main...head` (`407` vs `217` files on `#273`; `33` vs `19` on `#275`). +4. **Bean `0429` (medium, Harness / `.beans/`):** Validate `.beans/` header ID vs filename ID and title uniqueness in + `pre_commit_check.py` (preventing silent overwrites like `907c0255` on `0417`). +5. **Extended `0404` & `0414`:** Recorded `hac#273` `unit (macos-latest)` `634 s > 600 s` failure (`12:17:52Z`) in + `0404` and `hac#273` `21.3 min` Stage 3 touch-set discard (`11:07:42Z`) in `0414`. + +### 2026-11-24T12:58:00Z: Fifth-Merge Audit + +- **Trigger:** fifth merge (period `2026-11-24T11:05:00Z` to `12:58:00Z`; merges `hac#269`, `#270`, `#274`, `coh#53`, + `#54`, `#55`). Scripts and outputs: `todo/self-improvement-audit-2026-11-24b/`. +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#274` (`preflight-retry`, merged `2026-11-24T12:45:46Z`) + - `holon-coherence`: `#55` (`coherence-module-line-budget-all`, merged `2026-11-24T12:44:47Z`) +- **Beans created or extended:** + - Created: `0422` (sticky `--allow-overlap`), `0423` (two sessions, no shared flow registry or cap), `0424` (transient + DNS or Docker failure ends the review stage), `0425` (Fable review iterations three times as long). + - Extended: `0376` (pre-iteration DIRTY probe ignored; PR #273 is the hub), `0371` (ledger-only conflicts on PRs #272 + and #275), `0419` (7 of 7 failures were timing gates; forecast after PR #275), `0412` (unlogged Antigravity flows, + checkpoint elapsed mismatch, executor turn not split), `0407` (full re-review for one nit). + +#### Period timing (summary; full table in `timing-period.md`) + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :----------------------------------------- | ----: | -----------: | ------------: | :----------------------- | +| Stage 2 plan | 4 | 4.0 | 5.3 | `split-cli-init-modules` | +| Stage 3 executor turn | 3 | 25.2 | 125.4 | `hac#275` | +| Stage 3 overlap wait (still waiting) | 2 | - | 73 | Bean 0399 on `#273` | +| Stage 4 reviewer ensemble (`fable-5-2`) | 3 | 26.1 | 27.9 | `hac#272` | +| Stage 4 resolver turn | 3 | 4.1 | 18.5 | `hac#272` | +| Stage 4 review on a conflicting head | 2 | - | 26.1 | `hac#272` iteration 2 | +| Stage 4 iteration lost to DNS / Docker 125 | 2 | - | 12.5 | `hac#275` iteration 1 | +| Stage 5 CI wait / merged-head CI wait | 2 | 8.9 | 9.9 | `hac#270` | +| PR ready to maintainer merge | 1 | 34.0 | 34.0 | `hac#274` | +| Pre-flight, pushes, Antigravity flow steps | - | not measured | not measured | Beans 0412, 0423 | + +#### Churn + +- Pipelines: 49 heads plus 2 reruns on 9 PRs; 31 (61%) on bookkeeping-only or main-merge heads. All 7 failed runs since + 09:58Z were timing gates with every test green; main had none in 24 runs. +- Reviews: PR #272 has run 5 iterations, of which 3 were churn (one on a conflicting head, one full re-review for one + nit, one lost to the DNS outage); PR #275 lost its first iteration to the outage and started its second on a + conflicting head. + +#### Ranked suggestions + +1. Merge PR #273 first (Bean `0376`): it removes the review-on-a-conflicting-head churn and unblocks Beans 0399, 0197 + and 0216. +2. Bean `0419` (extended): timing gates are now the only cause of pipeline failure, on both runners. +3. Bean `0422` (new): an `--allow-overlap` override is sticky and inherited by sub-intents. +4. Bean `0423` (new): one flow registry and cap across agent sessions; every runtime logs. +5. Bean `0371` (extended): ledger-only conflicts knocked PR #272 out three times and PR #275 within six minutes. +6. Bean `0424` (new): retry transient DNS or Docker failures in place. +7. Bean `0425` (new, maintainer decision): Fable review iterations take a median 18.4 min against 5.9 on Opus. +8. Beans `0407` and `0412` (extended). + +### 2026-11-24T11:05:00Z — Fifth-Merge Audit + +- **Trigger:** fifth merge (first recorded audit entry; period `2026-11-21T00:00:00Z` to `2026-11-24T11:05:00Z`, + consolidating the `2026-11-24T10:55Z` measurement pass in `todo/self-improvement-audit-2026-11-24/` with PRs and flow + runs through `11:05Z`). +- **Last merged pull requests at audit time:** + - `holon-agentic-coder`: `#271` (`claude-token-os-keychain-only`, merged `2026-11-24T09:55:35Z`) + - `holon-coherence`: `#52` (`coherence-scripts-self-doc`, merged `2026-11-24T10:56:55Z`) +- **Beans created or extended:** + - Created: `0407`, `0408`, `0409`, `0410`, `0411`, `0412`, `0413`, `0414` (from the `10:55Z` pass), `0415`, `0416`, + `0417`, `0418` (new findings at `11:05Z`). + - Extended: `0394`, `0395`, `0403`, `0404` (added `Workspace survival` `--ceiling 600` failure at `609 s` on + `hac#269`). + +#### 1. Per-Step Timing Table (140 runs across 35 flow logs + GitHub/checkpoint records) + +| Step | Count | Median (min) | Longest (min) | Longest in | +| :-------------------------------------------------------------------- | ----: | -----------: | ------------: | :----------------------------------------- | +| Pre-flight (credential probe, image check, worktree creation) | - | not measured | not measured | missing wrapper timestamps (Bean 0412) | +| Stage 1: intent agent turn | 29 | 0.1 | 0.2 | `derive-kb-index` | +| Stage 2: planner agent turn | 34 | 4.0 | 34.3 | `unit-suite-slowest-tests-speedup` | +| Stage 3: admission check | 49 | 0.1 | 0.2 | `stale-calibration-warning-fix` | +| Stage 3: admission refusal to exit (waiting on another flow) | 50 | 0.0 | 0.0 | `split-calibration-package` | +| Wait: stage 3 overlap refusal $\rightarrow$ relaunch | 48 | 1.1 | 1053.0 | `execute-stage-object` | +| Stage 3: refresh plan onto `main` after admission wait | 8 | 0.0 | 0.0 | `unlimited-stage-budgets` | +| Stage 3: executor agent turn (incl. tests) | 39 | 10.5 | 102.5 | `name-and-seed-redaction-tests` | +| Stage 3: re-plan after touch-set breach | 6 | not measured | not measured | `approval-survives-main-merge` (+5 others) | +| Each push (execution branch, resolver, ledger rows, calibration) | - | not measured | not measured | folded into surrounding turn (Bean 0412) | +| Each conflict probe and merge of target | - | not measured | not measured | start time not logged (Bean 0412) | +| Stage 4: empty-diff guard + PR create/edit | 61 | 0.1 | 0.2 | `executor-execution-run` | +| Stage 4: reviewer ensemble turn (3 reviewers; per-reviewer unlogged) | 121 | 6.6 | 26.5 | `ledger-temp-worktree-cleanup` | +| Stage 4: local test run after reviewers | 32 | 1.3 | 2.6 | `resolve-conflicts-in-flow` | +| Stage 4: resolver turn (incl. push) | 83 | 3.0 | 22.0 | `review-approved-and-fresh-tests` | +| Stage 4: ledger commit | 148 | 0.1 | 8.5 | `no-fallback-calibration-report` | +| Stage 4: review iteration (reviewers + local tests/CI evidence) | 125 | 6.7 | 26.6 | `ledger-temp-worktree-cleanup` | +| CI registration wait | 26 | 0.0 | 0.3 | `github-issues-replace-beads` | +| CI wait (tracked checks to settled) | 35 | 7.9 | 18.0 | `ledger-temp-worktree-cleanup` | +| Stage 5: calibration work + promotion | 37 | 0.2 | 0.4 | `github-issues-replace-beads` | +| Stage 5: reconciliation | 8 | 0.2 | 0.3 | `flow-no-auto-sidecar-spawn-v2` | +| Stage 5: final-head check after CI settled | 36 | 0.0 | 3.8 | `github-issues-replace-beads` | +| Wait: PR ready at merge boundary $\rightarrow$ maintainer merge | 10 | 1.9 | 26.8 | `claude-token-os-keychain-only` | +| Idle: interrupted / stopped run $\rightarrow$ resume (all stop kinds) | 47 | 1.1 | 135.3 | `intent-plan-stage-decomposition` | +| GitHub: PR open $\rightarrow$ merged (both repos) | 48 | ~96 | 2428.6 | `hac#230` | + +Stage totals across the measured logs: + +| Stage | Total (h) | Working (h) | Waiting on CI (h) | Waiting on another flow (h) | Waiting on human (h) | Idle (h) | +| :-------- | --------: | ----------: | ----------------: | --------------------------: | -------------------: | -------: | +| intent | 0.11 | 0.07 | 0.00 | 0.00 | 0.00 | 0.00 | +| plan | 3.74 | 3.56 | 0.00 | 0.00 | 0.00 | 0.00 | +| execute | 10.60 | 9.72 | 0.00 | 39.81 | 0.00 | 1.63 | +| review | 20.90 | 20.87 | 0.44 | 0.00 | 0.00 | 9.20 | +| calibrate | 5.81 | 0.16 | 5.10 | 0.00 | 0.75 | 0.00 | + +#### 2. Churn Counts + +- **CI pipeline runs across 48 merged PRs (`hac` 39 + `coh` #44–#52):** 426 pipeline head runs total, of which **305 + (72%) were churn** (233 bookkeeping-only heads, 57 `main`-merge heads, 15 job re-runs); 20 pipeline runs failed on + churn heads. Recent spotlights: `hac#263` (16/18 churn, 3 failed), `hac#267` (16/17 churn, 2 failed), `hac#268` (11/12 + churn, 5 failed), `coh#44`–`#52` (24/33 churn across 9 PRs, 1 failed). +- **Review iterations across 26 logged `holon-agentic-coder` flows:** 126 full review iterations (934 min; median 6.7 + min, longest 26.6 min on `hac#270`), of which 26 were first iterations, 52 fixed reviewer findings (406 min), and **48 + (38%, 339 min) were churn**: 17 `main`-merge/conflict iterations (127 min), 18 after a resolver pass pushed no new + head (160 min together with 8 stop/resume churn iterations), 2 after approval withdrawal on CI failure/unknown CI (30 + min), and 3 on infrastructure failures (22 min). Additionally, 7 iterations ended with all 3 reviewers + `APPROVED (0/0/0)` while the container verdict reported `CHANGES_REQUESTED` due to `DIRTY`/conflicting PR state + (including `hac#269` iteration 10 at `10:28:57Z`). +- **Additional churn observed since `10:55Z`:** + - `flow-ci-skip-bookkeeping-only-pushes` (`0403`): 30.5 min Stage 3 lost to container `exit code -9` (OOM under + `-n auto`) at `10:48:42Z`; resumed at `10:54:28Z` and passed in `5.7 min`. + - `hac#269` (`0226` / `flow-e2e-test-teardown`): `Workspace survival (ubuntu-latest)` failed at `10:59:27Z` + (`609 s > 600 s` ceiling, 0% per-test regression). + - `coh#52` (`0153`): 4 pipeline heads (3 bookkeeping-only, 1 code), 2 review iterations, merged `10:56:55Z` (no flow + log kept). + +#### 3. Ranked Suggestions + +1. **Bean `0407` (critical, Flow / Stage 4):** Stop re-running the full review ensemble when nothing reviewable changed; + decouple consensus on diff D from CI on head H and use scoped delta re-reviews (saves ~339 min / 48 churn review + iterations). +2. **Bean `0403` (high, Pipeline — extended):** Skip full CI on bookkeeping-only pushes (`plans/`, `executions/`, + `holon-knowledge/`), avoiding 233/426 (55%) of pipeline runs (~8 min each). +3. **Bean `0408` (high, Flow / Pipeline):** Run CI's hygiene, ruff, Prettier, `jq`, and file-growth checks locally + before any push leaves the machine (prevents 17 `hygiene` CI failures + 10 lint + 25 file-growth findings). +4. **Bean `0404` (high, Pipeline — extended):** Fix `--ceiling 600` timing-gate failures on runner variance across both + `unit (macos-latest)` (`hac#267`, `#270`, `#271`) and `Workspace survival (ubuntu-latest)` (`hac#269` at `609 s` with + 0% per-test regression). +5. **Bean `0415` (high, Flow / Stage 3 — new):** Cap pytest workers inside role containers instead of unbounded + `-n auto` to stop `exit code -9` OOM kills under concurrent 4-flow runs (`flow-ci-skip-bookkeeping-only-pushes`, 30.5 + min lost). +6. **Bean `0410` (high, Architecture):** Replace hand-edited conflict magnets (`apps/sandbox-executor/README.md`, + `docs/environment_variables.md`, shared `flow_module_budgets.json`, `flow/__init__.py` re-exports) to cut the 39.8 h + of Stage 3 overlap waits. +7. **Bean `0409` (high, Flow / Stage 4):** Do not re-run a full review when a resolver pushes no new head (18 churn + iterations) and adjudicate rejected findings once. +8. **Bean `0417` (high, Harness — new):** Make `run_holon_flow.py`'s `verify_pr_and_calibration` fail non-zero on + missing PR/calibration/conflicting PR and write `.subagent/flow__state.json` deterministically instead of + trusting `flash_lite` prose. +9. **Bean `0416` (high, Harness — new):** Scan only the tail and last reset match in `parse_limit_reset`, parse seconds + (`s`) in `limit_reset.py`, and use OS-keychain lookup + `antigravity-agent` relaunch in `watch_limits.py`. +10. **Bean `0411` (high, Harness):** Remove harness instruction contradictions (runner switching, 8 duplicated model + ladders, default runner, 3 conflicting file-size limits). +11. **Bean `0413` (medium, Coding Standards):** Feed recurring reviewer findings (1,000-line growth, allow-lists vs + deny-lists, helper reuse, generated docs, PR evidence) to planner/executor upfront (~120 of 249 findings). +12. **Bean `0414` (medium, Flow / Stage 3):** Enforce the plan's touch set during the executor turn instead of + discarding finished executions after the turn (~102 min discarded across 6 flows). +13. **Bean `0418` (medium, Flow / Stage 2–3 — new):** Preserve passing execution branches on companion touch-set + expansion and keep decomposed parent flows resumable per sub-intent (`flow-claude-code-mode-default-on`, + `flow-resolve-conflicts-in-flow`). +14. **Bean `0412` (medium, Flow / Harness):** Record start/end timestamps for pre-flight, pushes, conflict + probes/merges, individual reviewers, overlap waits, and ensure every flow (including `holon-coherence`) writes + `todo/flow-.log`. + +#### 4. Examined and Found in Order + +- `holon-coherence` PRs `#44`–`#52` all reached 3/3 `APPROVED` in 1–3 review iterations with clean calibration reports + in the PR diff and 0 CI failures on `#44`–`#46`, `#48`–`#52` (only 1 CI failure on `#47`), showing that small, + single-package slices avoid the multi-hour churn seen on large `holon-agentic-coder` PRs. +- Bean `0406` (`flow_env.py` OS-keychain lookup) resolved the `09:56Z` credential outage for `run_holon_flow.py` with 22 + passing unit tests in `tests/test_flow_env.py`. +- Commit `465da5f` added `parse_relative_limit_reset` to `run_holon_flow.py` and updated `tests/test_flow_fallback.py` + for `gemini-4-neon` default and relative reset durations. diff --git a/.claude/settings.json b/.claude/settings.json index 0f9dce52..45f6d6c2 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -12,5 +12,8 @@ ] } ] + }, + "env": { + "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1" } } diff --git a/AGENTS.md b/AGENTS.md index 1de94657..79fa53d0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,6 +25,8 @@ entirety before performing any operations or modifying any code. - [.agents/pr-merging.md](.agents/pr-merging.md) - Human-only PR merging, post-merge protocol. - [.agents/engineering-rules.md](.agents/engineering-rules.md) - Benchmarks, tokens, isolation, tests, ledgers. - [.agents/subagents.md](.agents/subagents.md) - Subagent invocation, Antigravity runtime. +- [.agents/self-improvement-audit.md](.agents/self-improvement-audit.md) - Self-improvement audit at session start and + every fifth merge. - [.agents/skills/](.agents/skills/) - Project-specific agent skills. - [todo/](todo/) - Git-ignored scratchpad for local notes; never committed. @@ -38,11 +40,14 @@ These apply to every task. Each links to the file that holds the full rule. flow, driven with `holon flow `; never hand-patch a target repository outside it. The harness files in this repository (`.beans/`, `.agents/`, `AGENTS.md`) stay directly editable. See [holon-flow.md](.agents/holon-flow.md). +- **Self-explaining code (invariant)**: no docstrings and no explanatory comments in any language; names carry the + intent, and the only allowed comment is a `# why:` comment recording a reason the code cannot show (maintainer, + 2026-11-27). Every intent states it in its goal. See [rules.md](.agents/rules.md). - **Never pass `--skip-review`** (to `holon flow` or any wrapper). No case needs it (maintainer, 2026-11-21); if Stage 4 fails or stalls, halt and report instead of bypassing review. See [holon-flow.md](.agents/holon-flow.md). -- **Default Holon coding model**: use `antigravity-agent` with `gemini-4-argon` for all Holon coding tasks until tokens - run out, then fall back to `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` (maintainer, 2026-11-22). See - [holon-flow.md](.agents/holon-flow.md). +- **Default Holon coding model**: use `antigravity-agent` with `gemini-4-neon` for all Holon coding tasks until tokens + run out, then fall back to `gemini-4-argon` $\rightarrow$ `gemini-4-hydrogen` $\rightarrow$ `gemini-3.8-flash` + (maintainer, 2026-11-24). See [holon-flow.md](.agents/holon-flow.md). - **Never merge a PR that targets `main`**, enable auto-merge or use the merge queue; the human maintainer merges. Stop after consensus approval and calibration, and report. See [pr-merging.md](.agents/pr-merging.md). - **One worktree per agent**, named for the flow or bean; the `main` worktrees are off-limits (never edit, stage, commit @@ -56,6 +61,20 @@ These apply to every task. Each links to the file that holds the full rule. - **Format before commit**: `npx prettier --write "**/*.md"` in the harness; only changed files in a target worktree. - **Subagents** follow [subagents.md](.agents/subagents.md) and the model tiers in [model-tiers.md](.agents/model-tiers.md); post-merge steps run through the `post-pr-merge` skill. +- **Flow concurrency & merge backfill**: up to **4 concurrent `holon-flow` background subagents** may run at once on + hosted runtimes (local runtimes stay at 1). Once a target-repo PR merges and `post-pr-merge` completes, automatically + pick up and launch the next highest-priority ready bean (honouring `blocked_by`, solo-sweep rules, and disjoint touch + sets) to keep up to 4 flows running (maintainer, 2026-11-24). A blocked flow (Stage 3 overlap refusal or waiting on + another flow's PR) does not hold a slot: park it, backfill at once, and resume parked flows from their checkpoint + ahead of new beans (maintainer, 2026-11-26). See [coordination.md](.agents/coordination.md) and + [pr-merging.md](.agents/pr-merging.md). +- **Coordinator failure ledger**: every coordinator failure (halt, park, wasted run, false readiness, wrong brief) is + appended to [.agents/ledger/coordinator-failures.jsonl](.agents/ledger/coordinator-failures.jsonl) with its preventive + rule before moving on (maintainer, 2026-11-27). See [coordination.md](.agents/coordination.md). +- **Self-improvement audit**: at the start of every session and after every fifth merge, a dedicated subagent runs a + comprehensive audit for self-improvement (pipeline, flow, coding standards, architecture standards, harness) and logs + one bean per suggestion; the brief says plainly that it is a self-improvement audit (maintainer, 2026-11-24). See + [self-improvement-audit.md](.agents/self-improvement-audit.md). --- @@ -63,10 +82,15 @@ These apply to every task. Each links to the file that holds the full rule. 1. **Verify your environment**: check the working directory and locate `.beans`. If `apps/holon-agentic-coder/` or `apps/holon-coherence/` is missing, follow the checkout steps in [README.md](README.md). -2. **Pick up a task**: list [.beans/](.beans/) for your assignment, or log a new bean if none exists. -3. **Load constraints**: [.agents/rules.md](.agents/rules.md), then the task lifecycle in +2. **Run the self-improvement audit**: spawn the audit subagent described in + [.agents/self-improvement-audit.md](.agents/self-improvement-audit.md) and carry on; do not wait for it. +3. **Read the coordinator failure ledger**: read + [.agents/ledger/coordinator-failures.jsonl](.agents/ledger/coordinator-failures.jsonl) and apply its rules to every + brief, readiness check and launch. +4. **Pick up a task**: list [.beans/](.beans/) for your assignment, or log a new bean if none exists. +5. **Load constraints**: [.agents/rules.md](.agents/rules.md), then the task lifecycle in [.agents/workflows.md](.agents/workflows.md). -4. **Report**: summarise changes concisely and point to the updated files. +6. **Report**: summarise changes concisely and point to the updated files. --- diff --git a/docs/ecosystem-audit-report-2026-11.md b/docs/ecosystem-audit-report-2026-11.md new file mode 100644 index 00000000..5eda2c49 --- /dev/null +++ b/docs/ecosystem-audit-report-2026-11.md @@ -0,0 +1,100 @@ +# Holon Ecosystem Architecture & Source-Code Audit (2026-11) + +**Audit Date:** 2026-11-26 +**Scope:** `holon-agentic-coder` (`HEAD f1e18bcd`), `holon-coherence` (`HEAD 18084f3`) +**Remediation Beans:** `0524`–`0539` (plus cross-referenced existing beans) + +--- + +## 1. Executive Comparison & Scorecard + +| Metric | `holon-agentic-coder` | `holon-coherence` | +| ----------------------------------- | -------------------------------------: | ------------------------------------: | +| Source files / LOC | 341 `.py` / 52,457 LOC | 63 `.py` / 10,994 LOC | +| Test files / scale | 372 `.py` / ~97,463 LOC (~6,965 cases) | 60 `.py` (1,511 unit + 8 integration) | +| Functions / return-typed | 2,730 / 99.5% | 527 / 98.3% | +| Files > 200L / > 400L | 57 / 21 (default budget 400L) | 19 / 8 (default budget 200L) | +| Max cyclomatic complexity | 205–210 (`run_review_loop`) | 24 (`normalize_anthropic_request`) | +| Bare `except:` / `except Exception` | 0 / 133 | 0 / 35 | + +| # | Aspect | `holon-agentic-coder` | `holon-coherence` | Summary Takeaway | +| :-: | ------------------------------------------ | :-------------------: | :---------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | Clean Architecture & Layer Boundaries | 6.5 / 10 | 7.8 / 10 | Coherence uses a crisp declarative proxy step pipeline; HAC carries an 11-edge `flow` ↔ `entrypoint` cycle. | +| 2 | Modularity, Cohesion & File Sizing | 6.5 / 10 | 7.5 / 10 | Both enforce module budgets, yet HAC has 1,471L/991L/940L god modules and 834L of compat shims. | +| 3 | Complexity & Control Flow | 5.5 / 10 | 8.0 / 10 | Coherence caps CC at 24 with a locked `# noqa` ratchet; HAC retains CC=205 and CC≈50 functions. | +| 4 | Clean Code & Idiomatic Python | 7.2 / 10 | 7.0 / 10 | Modern Python 3.13 idioms throughout both, but neither runs `mypy`/`pyright` in CI and both have DRY drift. | +| 5 | Intention-Revealing & Self-Doc Code | 7.0 / 10 | 8.2 / 10 | Coherence hits 100% repo-wide self-doc naming; HAC's strict zero-comment ban hides critical "why" invariants. | +| 6 | Extensibility & Plug-in Seams | 6.8 / 10 | 7.4 / 10 | Coherence has `StepSpec` + `ProviderFormat`, though providers still edit core files; adding a HAC runner touches ~8 files. | +| 7 | Testability & Verification Quality | 7.5 / 10 | 7.0 / 10 | HAC has standout suite hermeticity (with heavy white-box patching); Coherence lacks real `mitmproxy` wire tests. | +| 8 | Error Handling, Resilience & Failure Modes | 7.6 / 10 | 7.0 / 10 | HAC locks, checkpoints, and supervises turns well; Coherence has fail-open steps but unbounded queues & SSE chunk bugs. | +| 9 | Security, Isolation & Secret Hygiene | 8.0 / 10 | 5.5 / 10 | HAC's `.git` worktree & credential hardening excels; Coherence `chmod 0o666`s its Root CA private key and leaves `/holon/api/mode` unauthenticated. | +| 10 | Observability, Provenance & Config | 7.8 / 10 | 7.4 / 10 | HAC's 3-ledger fragment architecture & env registry shines; Coherence has honest `X-Holon-*` telemetry but scattered `os.getenv`. | +| | **Overall Score** | **7.0 / 10** | **7.3 / 10** | **HAC:** battle-hardened systems engineering slowed by structural debt. **Coherence:** disciplined pipeline codebase held back by fixable security & SSE bugs. | + +--- + +## 2. Remediation Matrix + +### `holon-coherence` Findings + +| Area | Priority | Summary | Remediation Bean | +| ----------------------------- | :--------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------- | +| Security / CA & Secrets | `critical` | `world_accessible_mounts=True` (`0o777` dirs, `0o666` Root CA private key), `web_password` in argv/`?token=`, unscrubbed `0o777` cache | Bean `0524` | +| Security / Control Plane | `critical` | Host-less `/holon/*` interception, wildcard CORS, unauthenticated `POST /holon/api/mode` with arbitrary `wire_log_dir`, `GET /mode` override bug | Bean `0525` | +| SSE Streaming & Wire Tests | `high` | Unbuffered chunk `\n` split & non-incremental UTF-8 decode, zero real `mitmproxy.test.tflow` / `HTTPServer` tests, `example.com` call, `unittest`, `".beans"` ref | Bean `0526` | +| Extensibility & Import Cycles | `high` | Divergent `detect_provider`, closed `ProviderName` Literal, hardcoded `KNOWN_PROVIDERS`, `parsers` ↔ `providers` & `docker_ops` ↔ `endpoints` cycles | Bean `0527` | +| Performance & DRY Drift | `normal` | Up to 4× `copy.deepcopy` per request, 2× token parse, 3× `normalize_payload`, unused SQLite index, duplicate SSE/metrics helpers, `ab_test` leaks, unused `cryptography` | Bean `0528` | +| Config, Resilience & Docker | `normal` | Scattered/frozen `os.getenv`, unbounded wire-log futures & disk duplication, silent CA `suppress`, 4-level `__file__` Dockerfile lookup, `pip` vs `uv.lock` | Bean `0529` | +| Typing & Hygiene | `normal` | No `mypy`/`pyright` in CI, 9 redundant `*_self_doc.py` files (922 LOC), `_compat.py` probe & barrels, root experimental clutter, inline dashboard HTML, parity naming | Bean `0530` | + +### `holon-agentic-coder` Findings + +| Area | Priority | Summary | Existing / New Bean | +| --------------------------- | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | +| Layer Cycles & Hotspots | `high` | `flow` ↔ `entrypoint` & `ledger` ↔ `knowledge` cycles, `FlowContext.__post_init__` side effects, 5-mixin `ExecutionRun`, `planner.py:main` (CC=50), `turns.py:run_turn` (CC=49) | Bean `0531` _(plus `0192`, `0197`, `0152`)_ | +| Security & Containers | `high` | Missing `--memory`/`--cpus`/`--pids-limit`/`--read-only`, writable `/tmp/intent.json`, direct metadata IP egress, `0o777`/`0o644` `local_llm`, umask secret unpack, `git.py` `--`, unpinned `install.sh` | Bean `0532` | +| Typing, DRY & Env Drift | `high` | No `mypy`/`pyright` in CI, 4× agent-ID normalizers, 5× `git diff --numstat`, runtime/doc drift on `HOLON_AGENT_EFFORT`, `os.environ` mutations, dead shims | Bean `0533` _(coord. `0223`)_ | +| Resilience & Adapters | `normal` | 3 silent `except Exception: pass` blocks (incl. temp-cred cleanup), `sys.exit(1)` in library code, `GitHubAdapter` raw `json.loads` / dropped `proxy_env`, generic `RuntimeError` in `git.py` | Bean `0534` | +| Extensibility & Protocols | `normal` | Runner registration spans ~8 files despite `RunnerSpec`, missing `GitForge` Protocol, `if/elif` stage dispatch in `pipeline.py`, only 2 `Protocol`s in 341 modules | Bean `0535` _(rel. `0270`)_ | +| Observability & Checkpoints | `normal` | Mixed `print`/`logging` plain text, unbounded `context.logs` in checkpoint JSON, `FlowCheckpoint.to_dict` `admission`/`repo_dir` dual-write | Bean `0536` _(coord. `0412`)_ | +| Hygiene, Tests & `# WHY:` | `normal` | 834L legacy shims exposing `_` symbols, 9 stale budget overrides, empty `token_reduction/`, `conftest.py` name allowlist & 2,677 mocks, zero-comment ban hiding subtle invariants | Bean `0537` _(plus `0379`, `0405`, `0489`, `0176`)_ | + +--- + +## 3. What's Been Done Well vs. What Could Be Better + +### `holon-agentic-coder` + +- **Done Well:** Worktree `.git` mount hardening & `0o600` temp env-files; suite-wide hermetic `tests/conftest.py` + guards and drift suites; append-only 3-ledger fragment routing with prefix-integrity locking and crash-recoverable + turn supervision; cleaner modular trajectory in newer packages (`flow/admission.py`, `approval_gates.py`, + `ledger/route.py`, `cli/commands/`). +- **Could Be Better:** Break `flow` ↔ `entrypoint` and `ledger` ↔ `knowledge` cycles while finishing `run_review_loop` / + `calibration` decomposition; enforce Docker resource quotas and `0o600` secret unpacking; wire static type checking + into CI alongside single-source `env_registry.py` and `RunnerSpec`; retire 834L of compat shims and allow concise + `# WHY:` invariant comments. + +### `holon-coherence` + +- **Done Well:** Declarative fail-open `StepSpec` proxy pipeline keeping `MitmproxyAddon` compact; 200L module budget + + locked complexity baseline (`max CC = 24`) + 100% self-documenting symbol naming; honest `"unmeasured"` labels and + recursive wire-log scrubbing; fast 2.3s pytest collection with golden pipeline parity tests. +- **Could Be Better:** Eliminate `0o777`/`0o666` Root CA key permissions and harden `/holon/*` Host checks & + `/holon/api/mode` authentication immediately; fix SSE chunk-splitting and UTF-8 buffering backed by real + `mitmproxy.test.tflow` / `HTTPServer` wire tests; unify `ProviderFormat.matches()` and trim multi-`deepcopy` hot-path + overhead; centralize `CoherenceSettings` and wire `mypy`/`pyright` into CI. + +--- + +## 4. Curated Knowledge Base Additions + +Under the Sole Change Path rule, target-native KB JSON payloads matching `docs/knowledgebase_schema.md` are staged in +dedicated KB-curation beans for execution via `holon flow`: + +- **Bean `0538` (`holon-agentic-coder`):** 3 proven patterns (`worktree-git-hardening`, `hermetic-pytest-conftest`, + `three-ledger-fragment-routing`) and 4 failure modes (`bidirectional-flow-entrypoint-cycle`, + `monolithic-review-loop-complexity`, `env-registry-runtime-drift`, `container-resource-and-secret-perm-gaps`). +- **Bean `0539` (`holon-coherence`):** 3 proven patterns (`declarative-proxy-step-pipeline`, + `locked-complexity-and-self-doc-hygiene`, `honest-unmeasured-wire-telemetry`) and 4 failure modes + (`world-writable-ca-mount-permissions`, `unauthenticated-hostless-proxy-control`, + `unbuffered-sse-chunks-without-wire-tests`, `hot-path-deepcopy-and-provider-drift`). diff --git a/tests/test_bean_progress.py b/tests/test_bean_progress.py index 20d9859c..0257c8dd 100644 --- a/tests/test_bean_progress.py +++ b/tests/test_bean_progress.py @@ -259,7 +259,7 @@ def test_ancestor_owner_ignores_child_claude_agent_flag(self, tmp_path: Path) -> assert tree.docker_iteration == 7 assert bean_progress._derive_stage(wt, tree, True) == "Stage 4 (Resolve iter 7)" - assert bean_progress._derive_live_runner(wt, tree) == "opus-5-5 · 32m (PID 32031, Antigravity)" + assert bean_progress._derive_live_runner(wt, tree) == "live · 32m (PID 32031, Antigravity)" assert bean_progress._derive_notes([], wt, None, tree) == "Resolving review findings" def test_detects_claude_code_parent_and_duplicate_trees(self, tmp_path: Path) -> None: @@ -333,7 +333,12 @@ def test_table_escaping_and_empty_cli(self, tmp_path: Path, capsys) -> None: ) md = bean_progress.render_markdown_table([row]) assert "Pipe \\| inside title" in md - assert "a \\| b" in md + # The compact table carries no notes; they sit in the details list, where pipes need no escaping. + assert "- **0123**: Idle; a | b" in md + assert "a | b" not in md.split("**Last activity and notes**")[0] + wide = bean_progress.render_markdown_table([row], wide=True) + assert "Pipe \\| inside title" in wide + assert "a \\| b" in wide (tmp_path / ".beans").mkdir() rc = bean_progress.main(["--repo-root", str(tmp_path), "--no-gh", "--no-ps"]) @@ -436,9 +441,15 @@ def test_row_columns_and_runner_in_notes(self, tmp_path: Path) -> None: assert rows[0].total_time == "2d3h" md = bean_progress.render_markdown_table(rows) header = md.splitlines()[0] - assert header == "| Bean # | Target | Title | Stage | Time in Stage | PR & CI | Total Time | Notes |" + assert header == "| Bean # | Target | Title | Agent | Model | Stage | In Stage | Live | PR & CI | Total |" line = md.splitlines()[2] - assert "| 12m |" in line and "| 2d3h |" in line and "idle (opus-5-5)" in line + assert "| 12m |" in line and "| 2d3h |" in line + assert "idle" in md.split("**Last activity and notes**")[1] + wide_header = bean_progress.render_markdown_table(rows, wide=True).splitlines()[0] + assert wide_header == ( + "| Bean # | Target | Title | Agent | Model | Stage | Time in Stage | Live | PR & CI | Total Time " + "| Last Activity | Notes |" + ) wt2 = _wt(tmp_path, "flow-bar", "bar") assert bean_progress.build_in_flight_rows(beans, [], [wt2], [], {}, now=NOW)[0].time_in_stage == "—" @@ -544,7 +555,8 @@ def test_duplicate_attempts_merge_per_bean(self, tmp_path: Path) -> None: rows = bean_progress.build_in_flight_rows(beans, intents, wts, [], live, now=NOW) assert len(rows) == 1 assert rows[0].stage.startswith("Stage 4") - assert "opus-5-5 · 1h00m" in rows[0].notes_cell() + assert "live · 1h00m (PID 1, Claude Code)" in rows[0].notes_cell() + assert rows[0].model == "claude-opus-5-5" assert "stale attempt flow-scopes" in rows[0].notes_cell() def test_untracked_flow_gets_bean_from_intent_file_slug(self, tmp_path: Path) -> None: @@ -560,3 +572,315 @@ def test_untracked_flow_gets_bean_from_intent_file_slug(self, tmp_path: Path) -> ) assert row2.bean_nums == ["0175"] assert row2.total_time != "—" + + +class TestBlockedStage: + """The Stage cell names what blocks a flow at Stage 3 admission.""" + + def _run(self, tmp_path: Path, blocked_by: list, prs=None, live=None, pr_state=None, intents=None): + beans_dir = tmp_path / ".beans" + beans_dir.mkdir(exist_ok=True) + for n in ("0376", "0400", "0401"): + _make_bean(beans_dir, n, f"b{n}", f"title: Bean {n}\nstatus: in-progress\n") + beans = bean_progress.scan_beans(beans_dir) + intents = [ + bean_progress.IntentMapping(tmp_path / "a.json", "resolve-conflicts-in-flow", ["0376"], "x"), + bean_progress.IntentMapping(tmp_path / "b.json", "blocked-flow", ["0400"], "blocked-flow"), + bean_progress.IntentMapping(tmp_path / "c.json", "other-flow", ["0401"], "other-flow"), + ] + wt = _wt( + tmp_path, + "flow-blocked-flow", + "blocked-flow", + admission={"state": "blocked", "blocked_by": blocked_by}, + ) + rows = bean_progress.build_in_flight_rows( + beans, intents, [wt], prs or [], live or {}, now=NOW, pr_state=pr_state + ) + return next(r for r in rows if r.bean_nums == ["0400"]) + + @staticmethod + def _local(slug: str, worktree: Path, files=("calibrate.py",)) -> dict: + return { + "kind": "local_flow", + "number": None, + "plan_branch": f"I-1795425253-{slug}/P-1795425271-CLA-CO5.5/_", + "worktree": str(worktree), + "files": list(files), + } + + def test_pull_request_blocker(self, tmp_path: Path) -> None: + row = self._run(tmp_path, [{"kind": "pull_request", "number": 275, "files": ["a.py"]}]) + assert row.stage == "Stage 3 (Blocked: #275)" + assert row.blockers[0].kind == "pull_request" + assert row.blockers[0].pr == 275 + + def test_local_flow_with_open_pr(self, tmp_path: Path) -> None: + wt_dir = tmp_path / "flow-resolve-conflicts-in-flow" + wt_dir.mkdir() + prs = [_pr(281, "I-1795425253-resolve-conflicts-in-flow/P-1/E-1/_")] + row = self._run(tmp_path, [self._local("resolve-conflicts-in-flow", wt_dir)], prs=prs) + assert row.stage == "Stage 3 (Blocked: #281 (bean 0376))" + assert row.blockers[0].bean == "0376" + assert row.blockers[0].pr == 281 + + def test_local_flow_without_pr(self, tmp_path: Path) -> None: + wt_dir = tmp_path / "flow-resolve-conflicts-in-flow" + wt_dir.mkdir() + row = self._run(tmp_path, [self._local("resolve-conflicts-in-flow", wt_dir)]) + assert row.stage == "Stage 3 (Blocked: bean 0376, no PR yet)" + assert "overlap" not in row.stage + + def test_local_flow_without_bean_and_slug_from_worktree(self, tmp_path: Path) -> None: + wt_dir = tmp_path / "flow-mystery" + wt_dir.mkdir() + entry = {"kind": "local_flow", "number": None, "worktree": str(wt_dir), "files": []} + row = self._run(tmp_path, [entry]) + assert row.stage == "Stage 3 (Blocked: flow mystery, no PR yet)" + + def test_duplicate_blocker_shown_once(self, tmp_path: Path) -> None: + wt_dir = tmp_path / "flow-resolve-conflicts-in-flow" + wt_dir.mkdir() + entry = self._local("resolve-conflicts-in-flow", wt_dir) + row = self._run(tmp_path, [entry, dict(entry, files=["flow.py"])]) + assert row.stage == "Stage 3 (Blocked: bean 0376, no PR yet)" + assert len(row.blockers) == 1 + assert row.blockers[0].files == ["calibrate.py", "flow.py"] + + def test_two_distinct_blockers(self, tmp_path: Path) -> None: + wt_dir = tmp_path / "flow-resolve-conflicts-in-flow" + wt_dir.mkdir() + row = self._run( + tmp_path, + [{"kind": "pull_request", "number": 275}, self._local("resolve-conflicts-in-flow", wt_dir)], + ) + assert row.stage == "Stage 3 (Blocked: #275, bean 0376, no PR yet)" + assert row.stage_compact == "Stage 3 (Blocked: #275 +1 more)" + assert "Blocked by #275, bean 0376, no PR yet" in row.notes_cell() + md = bean_progress.render_markdown_table([row]) + table, _, details = md.partition("**Last activity and notes**") + assert "+1 more" in table + assert "bean 0376, no PR yet" not in table + assert "bean 0376, no PR yet" in details + + def test_short_cell_is_not_truncated(self, tmp_path: Path) -> None: + row = self._run(tmp_path, [{"number": 1}, {"number": 2}]) + assert row.stage == "Stage 3 (Blocked: #1, #2)" + assert row.stage_compact == row.stage + + def test_blocker_gone_not_resumed(self, tmp_path: Path) -> None: + gone_dir = tmp_path / "flow-removed" + states = {275: "MERGED"} + row = self._run( + tmp_path, + [{"kind": "pull_request", "number": 275}, self._local("removed", gone_dir)], + pr_state=lambda _repo, n: states.get(n), + ) + assert row.stage.endswith("; blocker gone, not resumed)") + assert row.stage.startswith("Stage 3 (Blocked: #275, flow removed, no PR yet") + assert all(b.gone for b in row.blockers) + + def test_not_gone_when_one_blocker_remains_or_unknown(self, tmp_path: Path) -> None: + live_dir = tmp_path / "flow-resolve-conflicts-in-flow" + live_dir.mkdir() + row = self._run( + tmp_path, + [{"kind": "pull_request", "number": 275}, self._local("resolve-conflicts-in-flow", live_dir)], + pr_state=lambda _repo, _n: "MERGED", + ) + assert "blocker gone" not in row.stage + assert [b.gone for b in row.blockers] == [True, False] + # State unknown (no gh): never claimed as gone. + row = self._run(tmp_path, [{"kind": "pull_request", "number": 275}]) + assert "blocker gone" not in row.stage + # An open pull request is not gone even if the lookup says merged. + row = self._run( + tmp_path, + [{"kind": "pull_request", "number": 275}], + prs=[_pr(275, "I-5-x/_")], + pr_state=lambda _repo, _n: "MERGED", + ) + assert "blocker gone" not in row.stage + + def test_live_runner_suppresses_gone(self, tmp_path: Path) -> None: + wt_dir = tmp_path / "flow-blocked-flow" + live = { + str(wt_dir): bean_progress.LiveFlowTree( + 9, "01:00", "polling", "terminal", str(wt_dir), "blocked-flow", [], None, None, None, False, None + ) + } + row = self._run( + tmp_path, + [{"kind": "pull_request", "number": 275}], + live=live, + pr_state=lambda _repo, _n: "MERGED", + ) + assert row.stage == "Stage 3 (Blocked: #275)" + + def test_empty_or_unreadable_list_keeps_overlap(self, tmp_path: Path) -> None: + assert self._run(tmp_path, []).stage == "Stage 3 (Blocked: overlap)" + assert self._run(tmp_path, "garbage").stage == "Stage 3 (Blocked: overlap)" # type: ignore[arg-type] + assert self._run(tmp_path, [None, "x"]).blockers == [] + + def test_json_blocked_by_field(self, tmp_path: Path) -> None: + wt_dir = tmp_path / "flow-resolve-conflicts-in-flow" + wt_dir.mkdir() + row = self._run(tmp_path, [self._local("resolve-conflicts-in-flow", wt_dir)]) + assert row.as_dict()["blocked_by"] == [ + { + "kind": "local_flow", + "pr": None, + "bean": "0376", + "slug": "resolve-conflicts-in-flow", + "files": ["calibrate.py"], + "gone": False, + } + ] + other = bean_progress.InFlightRow(["0001"], "HAC", "t", "Not started", "—", "idle", "—", 3) + assert other.as_dict()["blocked_by"] == [] + + +def _live(wt: bean_progress.WorktreeFlow, pid: int, slug: str) -> bean_progress.LiveFlowTree: + return bean_progress.LiveFlowTree( + pid, + "00:10:00", + "running", + "Claude Code", + str(wt.path), + slug, + [], + None, + "claude-opus-5-5", + "executor", + False, + None, + ) + + +def _closed(number: int, head: str, state: str) -> bean_progress.PullRequestInfo: + return bean_progress.PullRequestInfo("HAC", number, "t", f"u/{number}", head, "", False, 0, 0, "", state) + + +class TestMultiRowFlows: + """One row per live flow or PR of a bean, stale-row handling, and decomposed flows.""" + + def _beans(self, tmp_path: Path, nums: list[str], status: str = "in-progress") -> dict: + beans_dir = tmp_path / ".beans" + beans_dir.mkdir(exist_ok=True) + for n in nums: + _make_bean(beans_dir, n, f"b{n}", f"title: Bean {n}\nstatus: {status}\n") + return bean_progress.scan_beans(beans_dir) + + def _three_flows(self, tmp_path: Path): + beans = self._beans(tmp_path, ["0405"]) + slugs = ["tests-a", "tests-b", "tests-c"] + intents = [bean_progress.IntentMapping(tmp_path / f"{s}.json", s, ["0405"], s) for s in slugs] + wts = [_wt(tmp_path, f"flow-{s}", s) for s in slugs] + return beans, intents, wts + + def test_two_concurrent_flows_of_one_bean_get_two_rows(self, tmp_path: Path) -> None: + beans, intents, wts = self._three_flows(tmp_path) + wts = wts[:2] + prs = [_pr(325, "I-1-tests-a/P-1/E-1/_"), _pr(327, "I-2-tests-b/P-1/E-1/_")] + wts[0].execution_branch, wts[1].execution_branch = prs[0].head_ref_name, prs[1].head_ref_name + rows = bean_progress.build_in_flight_rows(beans, intents, wts, prs, {}, now=NOW) + assert [r.bean_nums for r in rows] == [["0405"], ["0405"]] + assert {r.slug for r in rows} == {"tests-a", "tests-b"} + assert sorted("#325" in r.pr_ci or "#327" in r.pr_ci for r in rows) == [True, True] + text = bean_progress.render_markdown_table(rows) + assert "- **0405** `tests-a`" in text and "- **0405** `tests-b`" in text + + def test_live_column_dots_and_json(self, tmp_path: Path) -> None: + beans, intents, wts = self._three_flows(tmp_path) + live = {str(wts[0].path): _live(wts[0], 1, wts[0].slug)} + pr = _pr(325, "I-2-tests-b/P-1/E-1/_") + wts[1].execution_branch = pr.head_ref_name + rows = bean_progress.build_in_flight_rows(beans, intents, wts, [pr], live, now=NOW) + by_slug = {r.slug: r for r in rows} + assert by_slug[wts[0].slug].live is True and by_slug[wts[1].slug].live is False + md = bean_progress.render_markdown_table(rows) + header = [c.strip() for c in md.splitlines()[0].split("|")] + assert header[header.index("In Stage") + 1] == "Live" + lines = md.splitlines()[2 : 2 + len(rows)] + assert sum("🟢" in ln for ln in lines) == 1 and sum("🔴" in ln for ln in lines) == 1 and len(rows) == 2 + data = {r["flow"]: r["live"] for r in (r.as_dict() for r in rows)} + assert data[wts[0].slug] is True and data[wts[1].slug] is False + + def test_not_started_bean_is_red(self, tmp_path: Path) -> None: + beans_dir = tmp_path / ".beans" + beans_dir.mkdir() + _make_bean(beans_dir, "0500", "x", "title: X\nstatus: in-progress\n") + beans = bean_progress.scan_beans(beans_dir) + rows = bean_progress.build_in_flight_rows(beans, [], [], [], {}, now=NOW) + assert rows[0].stage == "Not started" and rows[0].live is False + assert "🔴" in bean_progress.render_markdown_table(rows) and rows[0].as_dict()["live"] is False + + def test_live_concurrent_flow_is_never_a_stale_attempt(self, tmp_path: Path) -> None: + beans, intents, wts = self._three_flows(tmp_path) + live = {str(w.path): _live(w, i + 1, w.slug) for i, w in enumerate(wts)} + rows = bean_progress.build_in_flight_rows(beans, intents, wts, [], live, now=NOW) + assert len(rows) == 3 + assert all("stale attempt" not in r.notes_cell() for r in rows) + assert [r.source for r in rows] == sorted(r.source for r in rows) # adjacent, deterministic + + def test_dead_idle_attempt_still_collapses_into_stale_note(self, tmp_path: Path) -> None: + beans, intents, wts = self._three_flows(tmp_path) + live = {str(wts[0].path): _live(wts[0], 1, wts[0].slug)} + rows = bean_progress.build_in_flight_rows(beans, intents, wts, [], live, now=NOW) + assert len(rows) == 1 + assert rows[0].notes_cell().count("stale attempt") == 2 + + def test_merged_pr_pending_post_merge(self, tmp_path: Path) -> None: + beans = self._beans(tmp_path, ["0404", "0419"]) + intents = [bean_progress.IntentMapping(tmp_path / "a.json", "done-flow", ["0404"], "done-flow")] + head = "I-3-done-flow/P-1/E-1/_" + wts = [_wt(tmp_path, "flow-done-flow", "done-flow", execution_branch=head, current_stage="calibrate")] + merged = [_closed(321, head, "MERGED"), _closed(330, "I-9-x/bean-0419/_", "MERGED")] + rows = bean_progress.build_in_flight_rows(beans, intents, wts, [], {}, now=NOW, closed_prs=merged) + by_bean = {r.bean_nums[0]: r for r in rows} + assert by_bean["0404"].stage == bean_progress.MERGED_STAGE + assert "#321" in by_bean["0404"].pr_ci and "merged" in by_bean["0404"].pr_ci + assert by_bean["0419"].stage == bean_progress.MERGED_STAGE # no flow at all, found by bean number + assert "post-pr-merge" in by_bean["0419"].notes_cell() + + def test_closed_pr_with_dead_runner_and_completed_bean_omitted(self, tmp_path: Path) -> None: + beans = self._beans(tmp_path, ["0404"]) + intents = [bean_progress.IntentMapping(tmp_path / "a.json", "gone", ["0404"], "gone")] + wts = [_wt(tmp_path, "flow-gone", "gone")] + closed = [_closed(7, "I-4-gone/P-1/E-1/_", "CLOSED")] + (row,) = bean_progress.build_in_flight_rows(beans, intents, wts, [], {}, now=NOW, closed_prs=closed) + assert row.stage == bean_progress.CLOSED_STAGE + beans["0404"].status = "completed" + assert bean_progress.build_in_flight_rows(beans, intents, wts, [], {}, now=NOW, closed_prs=closed) == [] + + def test_non_flow_worktree_is_ignored(self, tmp_path: Path) -> None: + app = tmp_path / "apps" / "holon-agentic-coder" + (app / "main").mkdir(parents=True) + (app / "audit-tmp").mkdir() + (app / "flow-real").mkdir() + (app / "other" / ".holon" / "flow").mkdir(parents=True) + (app / "other" / ".holon" / "flow" / "checkpoint-other.json").write_text("{}", encoding="utf-8") + repo = bean_progress.RepoTarget("HAC", app, True) + names = {w.dir_name for w in bean_progress.scan_worktrees([repo])} + assert names == {"flow-real", "other"} + + def test_decomposed_flow_shows_child_n_of_m_and_child_prs(self, tmp_path: Path) -> None: + beans = self._beans(tmp_path, ["0201"]) + intents = [bean_progress.IntentMapping(tmp_path / "s.json", "big", ["0201"], "big")] + root = "I-100-big" + child = f"{root}/P-5-CLA--4-route-ci/P-6/E-7/_" + children = [{"index": i, "slug": f"c{i}", "pr_number": 310 + i, "merged": i < 4} for i in range(1, 6)] + wts = [_wt(tmp_path, "flow-big", "big", execution_branch=child, intent_branch=f"{root}/P-5-CLA--4-route-ci/_")] + wts[0].children = children + prs = [_pr(340, child)] + (row,) = bean_progress.build_in_flight_rows(beans, intents, wts, prs, {}, now=NOW) + assert row.stage == "Stage 3 (child 4 of 5: route-ci)" + assert "#340" in row.pr_ci and "merged #311 #312 #313" in row.pr_ci + # parent PR into main, once it exists, is shown instead of the child PR + parent = _pr(350, f"{root}/P-5/_") + (row2,) = bean_progress.build_in_flight_rows(beans, intents, wts, [prs[0], parent], {}, now=NOW) + assert "#350" in row2.pr_ci + # unknown count -> "child N" + wts[0].children = [] + (row3,) = bean_progress.build_in_flight_rows(beans, intents, wts, [], {}, now=NOW) + assert row3.stage == "Stage 3 (child 4: route-ci)" diff --git a/tests/test_beans_to_issues.py b/tests/test_beans_to_issues.py new file mode 100644 index 00000000..fa6a6fe2 --- /dev/null +++ b/tests/test_beans_to_issues.py @@ -0,0 +1,218 @@ +"""Tests for the beans-to-issues importer. Fixtures are real bean files copied from .beans/; no GitHub call is made.""" + +import json +import sys +from pathlib import Path + +SCRIPT_DIR = Path(__file__).resolve().parent.parent / ".agents" / "scripts" +if str(SCRIPT_DIR) not in sys.path: + sys.path.insert(0, str(SCRIPT_DIR)) + +import beans_to_issues as b # noqa: E402 + +BEANS = Path(__file__).resolve().parent.parent / ".beans" + + +def bean_file(bid: str) -> Path: + return next(BEANS.glob(f"{b.ID_PREFIX}{bid}--*.md")) + + +def corpus(tmp_path: Path, ids: list[str], edits: dict[str, list[tuple[str, str]]] | None = None) -> Path: + """Copy real beans into tmp_path, optionally rewriting frontmatter lines to open them.""" + d = tmp_path / "beans" + d.mkdir() + for bid in ids: + text = bean_file(bid).read_text(encoding="utf-8") + for old, new in (edits or {}).get(bid, []): + assert old in text + text = text.replace(old, new, 1) + (d / bean_file(bid).name).write_text(text, encoding="utf-8") + return d + + +def test_real_corpus_parses_and_every_open_bean_has_a_title(): + beans = b.load_beans(BEANS) + open_beans = [x for x in beans.values() if x["fm"].get("status") in b.OPEN_STATUSES] + assert open_beans + assert all(isinstance(x["fm"].get("title"), str) and x["fm"]["title"] for x in open_beans) + + +def test_folded_multiline_title_is_joined(): + bean = b.parse_bean(bean_file("0153")) + assert bean["fm"]["title"].startswith("Remove comments and docstrings") and "\n" not in bean["fm"]["title"] + + +def synthetic_bean(d: Path, n: int, priority: str | None) -> str: + bid = f"{n:04d}" + pri_line = f"priority: {priority}\n" if priority is not None else "" + (d / f"{b.ID_PREFIX}{bid}--synthetic-{bid}.md").write_text( + f"---\n# {b.ID_PREFIX}{bid}\ntitle: Synthetic {bid}\nstatus: todo\ntype: task\n{pri_line}" + "tags:\n - holon-agentic-coder\ncreated_at: 2026-01-01T00:00:00Z\n" + "updated_at: 2026-01-01T00:00:00Z\n---\n\nBody.\n", + encoding="utf-8", + ) + return bid + + +def test_priority_labels_and_the_invalid_medium_maps_to_p2(tmp_path): + d = tmp_path / "beans" + d.mkdir() + cases = {"critical": "P0", "high": "P1", "normal": "P2", "medium": "P2", "low": "P3", None: "P2", "bogus": "P2"} + ids = {pri: synthetic_bean(d, 9000 + i, pri) for i, pri in enumerate(cases)} + plan = b.build_plan(b.load_beans(d)) + for pri, label in cases.items(): + labels = plan["issues"][ids[pri]]["labels"] + assert f"priority:{label}" in labels + assert sum(x.startswith("priority:") for x in labels) == 1 + assert plan["fidelity"]["priority"]["coerced"] == 1 + assert plan["fidelity"]["priority"]["exact"] == 4 + assert plan["fidelity"]["priority"]["defaulted"] == 2 + + +def test_labels_drop_routing_tags_and_carry_type_priority_status(): + plan = b.build_plan(b.load_beans(BEANS)) + for iss in plan["issues"].values(): + assert not set(iss["labels"]) & b.ROUTING_TAGS + assert sum(x.startswith("type:") for x in iss["labels"]) == 1 + assert sum(x.startswith("priority:") for x in iss["labels"]) == 1 + in_progress = [i for i in plan["issues"].values() if "status:in-progress" in i["labels"]] + beans = b.load_beans(BEANS) + assert len(in_progress) == sum(1 for i in plan["issues"] if beans[i]["fm"]["status"] == "in-progress") + + +def test_no_harness_references_survive_in_any_payload(): + plan = b.build_plan(b.load_beans(BEANS)) + known = set(b.load_beans(BEANS)) + for bid, iss in plan["issues"].items(): + text = iss["title"] + "\n" + iss["body"] + assert b.ID_PREFIX not in text, bid + for marker in (".beans/", ".agents/", "todo/"): + assert marker not in text, (bid, marker) + assert not b.residual_refs(text, known), bid + + +def test_references_to_migrated_beans_become_placeholders_and_others_are_reworded(): + out = b.strip_text( + "See Beans 0215-0217 and holon-agentic-coder-ref-metadata-0333, also 0376.", + migrated={"0216", "0376"}, + known={"0215", "0216", "0217", "0333", "0376"}, + ) + assert out == ( + "See an earlier work item, {{issue:0216}}, an earlier work item and an earlier work item, also {{issue:0376}}." + ) + + +def test_self_reference_and_paths_are_removed(): + out = b.strip_text("Plan in todo/plan-0376.md and .beans/x.md, bean 0376.", set(), known={"0376"}, self_id="0376") + assert out == "Plan in [harness path] and [harness path], this issue." + + +def test_routing_by_tag_and_not_migrated_list(): + plan = b.build_plan(b.load_beans(BEANS)) + beans = b.load_beans(BEANS) + for bid, iss in plan["issues"].items(): + tags = set(beans[bid]["fm"].get("tags") or []) + if iss["route_basis"] == "tag" and tags & set(b.REPOS): + assert iss["repo"].endswith("/" + sorted(tags & set(b.REPOS))[0]) + nm = {n["id"]: n for n in plan["not_migrated"]} + assert "0215" in nm and nm["0215"]["reason"] == "harness-only" + assert len(plan["issues"]) + len(nm) == plan["open_total"] + + +def test_dependencies_accept_every_key_spelling_and_parent_becomes_sub_issue(tmp_path): + # 0122 is the real parent of 0124 and 0125; open the three and give 0124 the other spellings. + open_ = ("status: completed", "status: todo") + d = corpus( + tmp_path, + ["0122", "0124", "0125", "0126"], + { + "0122": [open_, ("tags:", "tags:\n - holon-agentic-coder")], + "0124": [ + open_, + ("tags:", "tags:\n - holon-agentic-coder"), + ("parent:", "blocked-by:\n - " + b.ID_PREFIX + "0125\nparent:"), + ], + "0125": [open_, ("tags:", "tags:\n - holon-agentic-coder")], + "0126": [ + open_, + ("tags:", "tags:\n - holon-agentic-coder"), + ("parent:", "blocks:\n - " + b.ID_PREFIX + "0125\nparent:"), + ], + }, + ) + plan = b.build_plan(b.load_beans(d)) + assert ("0124", "0125") in plan["blocked_by"] # blocked-by + assert ("0125", "0126") in plan["blocked_by"] # blocks: 0126 blocks 0125 + assert ("0122", "0124") in plan["sub_issues"] and ("0122", "0125") in plan["sub_issues"] + + +def test_edges_to_unmigrated_beans_are_dropped_and_reported(): + plan = b.build_plan(b.load_beans(BEANS)) + migrated = set(plan["issues"]) + assert all( + e["blocked"] not in migrated or e["blocker"] not in migrated + for e in plan["dropped_edges"] + if e["kind"] == "blocked_by" + ) + assert all(a in plan["issues"] and c in plan["issues"] for a, c in plan["blocked_by"]) + + +def test_dry_run_writes_files_and_calls_no_gh(tmp_path, monkeypatch): + def boom(*a, **k): + raise AssertionError("dry run must not call gh") + + monkeypatch.setattr(b.subprocess, "run", boom) + out = tmp_path / "out" + code = b.main(["--out", str(out), "--map", str(tmp_path / "map.json")]) + assert code == 0 + assert (out / "report.md").read_text().startswith("# Beans to issues: dry run report") + for name in ("labels.json", "dependencies.json", "not_migrated.json", "unmapped.json"): + json.loads((out / name).read_text()) + assert not (tmp_path / "map.json").exists() + payloads = list((out / "issues").glob("*/*.json")) + assert payloads and json.loads(payloads[0].read_text())["labels"] + + +class FakeGh: + def __init__(self): + self.calls, self.n = [], 0 + + def __call__(self, cmd, capture_output, text, input=None): + self.calls.append((cmd, input)) + out = "" + if cmd[1:3] == ["issue", "create"]: + self.n += 1 + out = f"https://github.com/{b.ORG}/x/issues/{self.n}" + elif cmd[1] == "api" and "--jq" in cmd: + out = "9001" + return type("R", (), {"returncode": 0, "stdout": out, "stderr": ""})() + + +def test_apply_is_idempotent_creates_labels_first_and_links_second(tmp_path): + open_ = ("status: completed", "status: todo") + tag = ("tags:", "tags:\n - holon-agentic-coder") + d = corpus( + tmp_path, + ["0124", "0125"], + { + "0124": [open_, tag, ("parent:", "blocked_by:\n - " + b.ID_PREFIX + "0125\nparent:")], + "0125": [open_, tag], + }, + ) + plan = b.build_plan(b.load_beans(d)) + map_path = tmp_path / "map.json" + gh = FakeGh() + mapping = b.apply_import(plan, map_path, runner=gh) + kinds = [c[0][1] for c in gh.calls] + assert kinds.index("label") < kinds.index("issue") + assert kinds.count("label") and mapping["0124"]["repo"] == "holon-agentic-coder" + creates = [c for c in gh.calls if c[0][1:3] == ["issue", "create"]] + assert len(creates) == 2 + assert any("blocked_by" in " ".join(c[0]) for c in gh.calls) + before = len(gh.calls) + gh2 = FakeGh() + b.apply_import(plan, map_path, runner=gh2) + assert [c for c in gh2.calls if c[0][1:3] == ["issue", "create"]] == [] + assert not [c for c in gh2.calls if c[0][1] == "api" and "POST" in c[0]] + assert before > 0 + assert json.loads(map_path.read_text())["0125"]["issue"] in (1, 2) diff --git a/tests/test_failure_ledger.py b/tests/test_failure_ledger.py new file mode 100644 index 00000000..2b77b7e8 --- /dev/null +++ b/tests/test_failure_ledger.py @@ -0,0 +1,35 @@ +import importlib.util +import json +from pathlib import Path + +_p = Path(__file__).resolve().parents[1] / ".agents" / "scripts" / "check_failure_ledger.py" +_s = importlib.util.spec_from_file_location("check_failure_ledger", _p) +m = importlib.util.module_from_spec(_s) +_s.loader.exec_module(m) + + +def _entry(n, **kw): + e = {k: "x" for k in m.REQUIRED} + e.update(id=f"CF-{n:04d}", category="brief", refs=[]) + e.update(kw) + return json.dumps(e) + + +def test_real_ledger_is_valid(): + lines = [x for x in m.LEDGER.read_text().splitlines() if x.strip()] + assert len(lines) >= 9 + assert m.check_lines(lines) == [] + + +def test_detects_bad_json_missing_field_and_gap(): + assert m.check_lines(["{nope"]) + assert m.check_lines([json.dumps({"id": "CF-0001"})]) + assert m.check_lines([_entry(1), _entry(3)]) + assert m.check_lines([_entry(1, category="other")]) + + +def test_append_only(): + head = [_entry(1), _entry(2)] + assert m.check_append_only(head + [_entry(3)], head) == [] + assert m.check_append_only([_entry(1), _entry(2, rule="y")], head) + assert m.check_append_only([_entry(1)], head) diff --git a/tests/test_flow_completion.py b/tests/test_flow_completion.py new file mode 100644 index 00000000..9cef8b15 --- /dev/null +++ b/tests/test_flow_completion.py @@ -0,0 +1,192 @@ +"""Spend-limit step-down (bean 0434) and the wrapper's completion gate and state file (bean 0417). No real gh calls.""" + +import json +import subprocess +import sys +from pathlib import Path + +import pytest + +SCRIPTS = Path(__file__).resolve().parent.parent / ".agents" / "skills" / "holon_flow" / "scripts" +if str(SCRIPTS) not in sys.path: + sys.path.insert(0, str(SCRIPTS)) + +import run_holon_flow as rhf # noqa: E402 + +SPEND = "You've hit your monthly spend limit. Switch to another model to continue." + + +def _flow(monkeypatch, tmp_path, outputs, with_checkpoint=True): + intent = tmp_path / "intent.json" + intent.write_text(json.dumps({"slug": "demo", "goal": "g"})) + worktree = tmp_path / "flow-demo" + (worktree / ".git").mkdir(parents=True) + if with_checkpoint: + chk = worktree / ".holon/flow/checkpoint-demo.json" + chk.parent.mkdir(parents=True) + chk.write_text(json.dumps({"completed_stages": ["intent", "plan"]})) + runs, waits, outcome = [], [], {} + results = iter(outputs) + monkeypatch.setattr(rhf, "run_prerequisites_check", lambda w: None) + monkeypatch.setattr(rhf, "build_flow_env", lambda agent: {}) + monkeypatch.setattr(rhf, "verify_pr_and_calibration", lambda *a, **k: {"ok": True, "problems": []}) + monkeypatch.setattr(rhf, "wait_for_limit_reset", lambda reset, slug: waits.append(reset)) + monkeypatch.setattr(rhf, "execute_flow_process", lambda cmd, **k: runs.append(cmd) or next(results)) + code = rhf.run_flow(intent, worktree, "claude-agent", "claude-fable-5-2", outcome=outcome) + return code, runs, waits, worktree + + +def test_the_spend_limit_message_is_a_quota_error(): + assert rhf.is_quota_error("noise\n" + SPEND + "\n") + assert rhf.is_quota_error("You've hit your monthly spend limit.") + + +def test_a_spend_limit_only_in_the_head_of_the_output_is_ignored(): + assert not rhf.is_quota_error(SPEND + "\n" + "ok\n" * 300) + + +def test_a_spend_limit_without_a_reset_steps_down_and_resumes_from_the_checkpoint(monkeypatch, tmp_path): + code, runs, waits, worktree = _flow(monkeypatch, tmp_path, [(1, SPEND), (0, "")]) + assert code == 0 and waits == [] + assert runs[0][runs[0].index("--model") + 1] == "claude-fable-5-2" + assert runs[1][runs[1].index("--model") + 1] == "claude-opus-5-5" + assert runs[1][runs[1].index("--agent") + 1] == "claude-agent" + assert runs[1][runs[1].index("--checkpoint") + 1] == str(worktree / ".holon/flow/checkpoint-demo.json") + + +def test_a_spend_limit_naming_a_reset_is_waited_out_on_the_same_model(monkeypatch, tmp_path): + code, runs, waits, _ = _flow(monkeypatch, tmp_path, [(1, SPEND + " Resets in 51m58s"), (0, "")]) + assert code == 0 and len(waits) == 1 + assert all(r[r.index("--model") + 1] == "claude-fable-5-2" for r in runs) + + +# --- completion gate --------------------------------------------------------------------------------------------- + +PR = {"number": 7, "headRefName": "flow/demo", "title": "demo", "url": "https://x/pull/7", "state": "OPEN"} + + +class FakeGh: + def __init__(self, prs=(PR,), diff="a.py\nI-1_calibration.md\n", view=None, checks=(), fail=None): + self.prs, self.diff, self.fail = list(prs), diff, fail + self.view = view or {"mergeable": "MERGEABLE", "mergeStateStatus": "CLEAN"} + self.checks = [list(c) for c in checks] or [[]] + self.polls = 0 + + def __call__(self, cmd, **kwargs): + assert cmd[0] == "gh", cmd + sub = cmd[1:3] + if self.fail == "list" and sub == ["pr", "list"]: + raise subprocess.CalledProcessError(1, cmd) + out = "" + if sub == ["pr", "list"]: + out = json.dumps(self.prs) + elif sub == ["pr", "diff"]: + out = self.diff + elif sub == ["pr", "view"]: + out = json.dumps(self.view) + elif sub == ["pr", "checks"]: + out = json.dumps(self.checks[min(self.polls, len(self.checks) - 1)]) + self.polls += 1 + return subprocess.CompletedProcess(cmd, 0, stdout=out, stderr="") + + +def _verify(monkeypatch, tmp_path, gh, **kw): + monkeypatch.setattr(rhf.subprocess, "run", gh) + return rhf.verify_pr_and_calibration(tmp_path, "demo", sleep=lambda s: None, checks_timeout=90, **kw) + + +def test_a_complete_pull_request_passes(monkeypatch, tmp_path): + result = _verify(monkeypatch, tmp_path, FakeGh()) + assert result["ok"] and result["problems"] == [] and result["calibration"] == ["I-1_calibration.md"] + + +@pytest.mark.parametrize( + ("gh", "needle"), + [ + (FakeGh(prs=[]), "No pull request"), + (FakeGh(fail="list"), "Could not query"), + (FakeGh(diff="a.py\n"), "_calibration.md"), + (FakeGh(view={"mergeable": "CONFLICTING", "mergeStateStatus": "DIRTY"}), "CONFLICTING"), + (FakeGh(view={"mergeable": "UNKNOWN", "mergeStateStatus": "DIRTY"}), "CONFLICTING"), + (FakeGh(prs=[{**PR, "state": "CLOSED"}]), "closed"), + ], +) +def test_each_missing_deliverable_fails(monkeypatch, tmp_path, gh, needle): + result = _verify(monkeypatch, tmp_path, gh) + assert not result["ok"] and any(needle in p for p in result["problems"]) + + +def test_a_merged_pull_request_is_a_clean_finish(monkeypatch, tmp_path): + result = _verify(monkeypatch, tmp_path, FakeGh(prs=[{**PR, "state": "MERGED"}], diff="")) + assert result["ok"] and result["merge_state"] == "MERGED" + + +def test_pending_checks_are_waited_for_then_pass(monkeypatch, tmp_path): + pending = [{"name": "unit (macos-latest)", "state": "PENDING", "bucket": "pending"}] + done = [{"name": "unit (macos-latest)", "state": "SUCCESS", "bucket": "pass"}] + gh = FakeGh(checks=[pending, pending, done]) + result = _verify(monkeypatch, tmp_path, gh) + assert result["ok"] and gh.polls == 3 and result["checks"] == done + + +def test_checks_still_pending_at_the_bound_fail(monkeypatch, tmp_path): + pending = [{"name": "unit", "state": "PENDING", "bucket": "pending"}] + result = _verify(monkeypatch, tmp_path, FakeGh(checks=[pending])) + assert not result["ok"] and any("pending checks" in p for p in result["problems"]) + + +def test_dry_run_verifies_nothing(monkeypatch, tmp_path): + def boom(*a, **k): + raise AssertionError("gh must not run") + + monkeypatch.setattr(rhf.subprocess, "run", boom) + assert rhf.verify_pr_and_calibration(tmp_path, "demo", dry_run=True)["ok"] + + +def test_a_flow_that_exits_0_with_an_incomplete_pull_request_exits_1(monkeypatch, tmp_path): + intent = tmp_path / "intent.json" + intent.write_text(json.dumps({"slug": "demo", "goal": "g"})) + worktree = tmp_path / "flow-demo" + (worktree / ".git").mkdir(parents=True) + monkeypatch.setattr(rhf, "run_prerequisites_check", lambda w: None) + monkeypatch.setattr(rhf, "build_flow_env", lambda agent: {}) + monkeypatch.setattr(rhf, "execute_flow_process", lambda cmd, **k: (0, "done")) + monkeypatch.setattr(rhf, "verify_pr_and_calibration", lambda *a, **k: {"ok": False, "problems": ["no PR"]}) + assert rhf.run_flow(intent, worktree, "claude-agent", "claude-opus-5-5") == 1 + + +# --- state file -------------------------------------------------------------------------------------------------- + + +def test_the_state_file_records_the_outcome(tmp_path): + worktree = tmp_path / "flow-demo" + chk = worktree / ".holon/flow/checkpoint-demo.json" + chk.parent.mkdir(parents=True) + chk.write_text(json.dumps({"completed_stages": ["intent", "plan", "execute", "review", "calibrate"]})) + outcome = { + "output": "Review consensus: APPROVED\nCalibration EV: 0.42\n", + "agent": "claude-agent", + "model": "claude-opus-5-5", + "verification": { + "ok": True, + "problems": [], + "pr": PR, + "calibration": ["c_calibration.md"], + "mergeable": "MERGEABLE", + "merge_state": "CLEAN", + }, + } + path = rhf.write_flow_state("demo", 0, outcome, worktree, state_dir=tmp_path / ".subagent") + state = json.loads(path.read_text()) + assert path.name == "flow_demo_state.json" + assert state["status"] == "completed" and state["pr_number"] == 7 and state["pr_url"] == PR["url"] + assert state["stage_reached"] == "calibrate" and state["consensus"] == "Review consensus: APPROVED" + assert state["calibration_ev"] == 0.42 and state["merge_state"] == "CLEAN" + assert state["next_action"] == "maintainer merges the pull request" + + +def test_the_state_file_of_a_failed_flow_names_the_problems(tmp_path): + outcome = {"verification": {"ok": False, "problems": ["No pull request found"], "pr": None}} + state = rhf.build_flow_state("demo", 1, outcome, None) + assert state["status"] == "failed" and state["pr_number"] is None + assert "No pull request found" in state["next_action"] diff --git a/tests/test_flow_env.py b/tests/test_flow_env.py index ec2290c3..85dd01a3 100644 --- a/tests/test_flow_env.py +++ b/tests/test_flow_env.py @@ -16,6 +16,12 @@ FAKE = "sk-ant-oat-fake-token-for-tests" +@pytest.fixture(autouse=True) +def empty_keychain(monkeypatch): + """No test reads the real OS secret store; a test that wants a stored token patches this again.""" + monkeypatch.setattr(flow_env, "_keychain_token", lambda: "") + + @pytest.fixture def secrets(tmp_path): (tmp_path / flow_env.TOKEN_FILE).write_text(FAKE + "\n") @@ -50,6 +56,42 @@ def test_missing_credentials_fail_loudly_and_name_what_is_missing(tmp_path): assert "HOLON_AGENT_SETTINGS" in message and str(tmp_path / flow_env.TOKEN_FILE) in message +def test_the_os_keychain_is_used_when_no_variable_and_no_file_hold_a_token(monkeypatch, tmp_path): + monkeypatch.setattr(flow_env, "_keychain_token", lambda: "from-keychain") + env = flow_env.build_flow_env("claude-agent", environ={}, secrets_dir=tmp_path) + assert json.loads(env["HOLON_AGENT_SETTINGS"])["env"]["CLAUDE_CODE_OAUTH_TOKEN"] == "from-keychain" + + +def test_the_legacy_file_wins_over_the_keychain(monkeypatch, secrets): + monkeypatch.setattr(flow_env, "_keychain_token", lambda: "from-keychain") + env = flow_env.build_flow_env("claude-agent", environ={}, secrets_dir=secrets) + assert json.loads(env["HOLON_AGENT_SETTINGS"])["env"]["CLAUDE_CODE_OAUTH_TOKEN"] == FAKE + + +def test_a_keychain_tool_that_cannot_run_or_has_no_entry_gives_no_token(monkeypatch): + monkeypatch.undo() + + def missing_tool(*_args, **_kwargs): + raise FileNotFoundError("security") + + monkeypatch.setattr(flow_env.subprocess, "run", missing_tool) + assert flow_env._keychain_token() == "" + + class NoEntry: + returncode = 44 + stdout = "" + + monkeypatch.setattr(flow_env.subprocess, "run", lambda *_a, **_k: NoEntry()) + assert flow_env._keychain_token() == "" + + +def test_the_missing_credentials_message_names_the_keychain_entry(tmp_path): + with pytest.raises(flow_env.AuthRouteMissing) as raised: + flow_env.build_flow_env("claude-agent", environ={}, secrets_dir=tmp_path) + assert "keychain" in str(raised.value) + assert flow_env.KEYCHAIN_ACCOUNT in str(raised.value) + + def test_other_runners_need_no_claude_credentials(tmp_path): env = flow_env.build_flow_env("antigravity-agent", environ={}, secrets_dir=tmp_path) assert "HOLON_AGENT_SETTINGS" not in env @@ -101,6 +143,22 @@ def test_the_execute_budget_is_raised_unless_the_caller_set_one(secrets): assert kept["HOLON_STAGE_BUDGET_EXECUTE_MINUTES"] == "90" +def test_claude_runs_get_code_mode_unless_the_caller_set_a_value(secrets): + env = flow_env.build_flow_env("claude-agent", environ={}, secrets_dir=secrets) + assert env["CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"] == "1" + assert json.loads(env["HOLON_AGENT_SETTINGS"])["env"]["CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"] == "1" + off = flow_env.build_flow_env( + "claude-agent", environ={"CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "0"}, secrets_dir=secrets + ) + assert off["CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"] == "0" + assert json.loads(off["HOLON_AGENT_SETTINGS"])["env"]["CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"] == "0" + + +def test_other_runners_do_not_get_code_mode(tmp_path): + env = flow_env.build_flow_env("antigravity-agent", environ={}, secrets_dir=tmp_path) + assert "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE" not in env + + REFUSAL = ( "[2026-11-18T06:22:15Z] Stage 3 refused: the touch set overlaps pull request #205 on flow/x.py; wait for it to " "merge, or rerun with --allow-overlap\n" @@ -161,7 +219,7 @@ def test_an_overlap_is_waited_out_and_stage_3_resumes_from_the_checkpoint(monkey states = {207: iter(["OPEN", "MERGED"]), 209: iter([None, "CLOSED"])} monkeypatch.setattr(run_holon_flow, "run_prerequisites_check", lambda w: None) monkeypatch.setattr(run_holon_flow, "build_flow_env", lambda agent: {}) - monkeypatch.setattr(run_holon_flow, "verify_pr_and_calibration", lambda *a, **k: None) + monkeypatch.setattr(run_holon_flow, "verify_pr_and_calibration", lambda *a, **k: {"ok": True}) monkeypatch.setattr(run_holon_flow, "execute_flow_process", lambda cmd, **k: launched.append(cmd) or next(runs)) monkeypatch.setattr(run_holon_flow, "pr_state", lambda n, d: polled.append(n) or next(states[n])) monkeypatch.setattr("time.sleep", slept.append) diff --git a/tests/test_flow_fallback.py b/tests/test_flow_fallback.py index bbef0904..c67bdb8c 100644 --- a/tests/test_flow_fallback.py +++ b/tests/test_flow_fallback.py @@ -36,6 +36,24 @@ def test_a_pm_reset_with_minutes_keeps_them(): assert (reset.hour, reset.minute) == (17, 40) +@pytest.mark.parametrize( + ("text", "expected_seconds"), + [ + ("RESOURCE_EXHAUSTED (code 429): Individual quota reached. Resets in 51m58s.", 51 * 60 + 58), + ("Quota reached. Resets in 1h 2m 3s", 3723), + ("limit hit, resets in 45s", 45), + ], +) +def test_a_relative_reset_is_that_far_from_now(text, expected_seconds): + reset = run_holon_flow.parse_limit_reset(text) + remaining = (reset - datetime.now(reset.tzinfo)).total_seconds() + assert expected_seconds - 5 <= remaining <= expected_seconds + + +def test_resets_in_with_no_duration_is_not_a_reset(): + assert run_holon_flow.parse_limit_reset("it resets in a while") is None + + def test_no_reset_time_returns_none(): assert run_holon_flow.parse_limit_reset("insufficient_quota") is None @@ -57,12 +75,17 @@ def test_an_exhausted_antigravity_ladder_never_switches_to_claude(): assert run_holon_flow.resolve_next_model("antigravity-agent", last) is None -def test_antigravity_ladder_starts_with_gemini_4_argon_then_hydrogen_then_flash(): +def test_antigravity_ladder_starts_with_gemini_4_neon_then_argon_hydrogen_flash(): assert run_holon_flow.FALLBACK_LADDER_ANTIGRAVITY == [ + "gemini-4-neon", "gemini-4-argon", "gemini-4-hydrogen", "gemini-3.8-flash", ] + assert run_holon_flow.resolve_next_model("antigravity-agent", "gemini-4-neon") == ( + "antigravity-agent", + "gemini-4-argon", + ) assert run_holon_flow.resolve_next_model("antigravity-agent", "gemini-4-argon") == ( "antigravity-agent", "gemini-4-hydrogen", @@ -77,6 +100,7 @@ def test_antigravity_ladder_starts_with_gemini_4_argon_then_hydrogen_then_flash( @pytest.mark.parametrize( ("suffixed_model", "expected_next"), [ + ("gemini-4-neon-medium", ("antigravity-agent", "gemini-4-argon")), ("gemini-4-argon-medium", ("antigravity-agent", "gemini-4-hydrogen")), ("gemini-4-hydrogen-medium", ("antigravity-agent", "gemini-3.8-flash")), ("gemini-3.8-flash-medium", None), @@ -98,7 +122,7 @@ def test_quota_error_patterns_match_gemini_and_usage_limit_messages(text): assert run_holon_flow.is_quota_error(text) is True -def test_cli_default_model_is_gemini_4_argon(monkeypatch): +def test_cli_default_model_is_gemini_4_neon(monkeypatch): captured = {} def fake_run_flow(**kwargs): @@ -110,4 +134,4 @@ def fake_run_flow(**kwargs): with pytest.raises(SystemExit) as exc_info: run_holon_flow.main() assert exc_info.value.code == 0 - assert captured["model"] == "gemini-4-argon" + assert captured["model"] == "gemini-4-neon" diff --git a/tests/test_flow_log_streaming.py b/tests/test_flow_log_streaming.py new file mode 100644 index 00000000..ebc1f5e4 --- /dev/null +++ b/tests/test_flow_log_streaming.py @@ -0,0 +1,41 @@ +"""The wrapper's output reaches a redirected log as it happens, not when the process exits (bean 0385).""" + +import subprocess +import sys +import time +from pathlib import Path + +SCRIPTS = Path(__file__).resolve().parents[1] / ".agents/skills/holon_flow/scripts" + +DRIVER = """ +import sys +sys.path.insert(0, {scripts!r}) +import run_holon_flow as r +r.enable_line_buffering() +r.log_info("wrapper line") +code, _ = r.execute_flow_process( + [sys.executable, "-c", "import time; print('STAGE 1 intent', flush=True); time.sleep(30)"] +) +""" + + +def test_wrapper_and_child_lines_reach_redirected_log_before_exit(tmp_path): + log = tmp_path / "flow.log" + with log.open("w") as out: + proc = subprocess.Popen( + [sys.executable, "-c", DRIVER.format(scripts=str(SCRIPTS))], stdout=out, stderr=subprocess.STDOUT + ) + try: + deadline = time.time() + 20 + text = "" + while time.time() < deadline: + text = log.read_text() + if "STAGE 1 intent" in text: + break + time.sleep(0.1) + assert proc.poll() is None, "driver exited early" + assert "wrapper line" in text + assert "STAGE 1 intent" in text + finally: + proc.kill() + proc.wait() diff --git a/tests/test_flow_scope_files.py b/tests/test_flow_scope_files.py new file mode 100644 index 00000000..a0c72994 --- /dev/null +++ b/tests/test_flow_scope_files.py @@ -0,0 +1,34 @@ +"""The flow runner refuses an intent whose scope names a directory.""" + +import json +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent / ".agents" / "skills" / "holon_flow" / "scripts" +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +import run_holon_flow # noqa: E402 + + +def test_a_trailing_slash_entry_is_a_directory(): + assert run_holon_flow.directory_scope_entries(["a/b.py", "apps/x/tests/"]) == ["apps/x/tests/"] + + +def test_an_existing_directory_without_a_slash_is_a_directory(tmp_path): + (tmp_path / "pkg").mkdir() + (tmp_path / "pkg" / "mod.py").write_text("") + assert run_holon_flow.directory_scope_entries(["pkg", "pkg/mod.py", "pkg/new.py"], tmp_path) == ["pkg"] + + +def test_a_scope_of_files_passes(): + assert run_holon_flow.directory_scope_entries(["a.py", "b/c.py"]) == [] + + +def test_run_flow_refuses_a_directory_scope_before_any_stage(tmp_path, capsys): + intent = tmp_path / "intent.json" + intent.write_text(json.dumps({"slug": "s", "goal": "g", "scope": ["tests/"]})) + code = run_holon_flow.run_flow(intent, tmp_path, "claude-agent", "m", dry_run=True) + assert code == 2 + captured = capsys.readouterr() + assert "never directories" in captured.out + captured.err diff --git a/tests/test_resolve_known.py b/tests/test_resolve_known.py new file mode 100644 index 00000000..4b72f6a5 --- /dev/null +++ b/tests/test_resolve_known.py @@ -0,0 +1,69 @@ +"""Tests for the ledger merge in resolve_known: the base side stays byte for byte, only new rows are appended.""" + +import difflib +import json +import sys +from pathlib import Path + +SCRIPT_DIR = Path(__file__).resolve().parent.parent / ".agents" / "skills" / "resolve_conflict" / "scripts" +if str(SCRIPT_DIR) not in sys.path: + sys.path.insert(0, str(SCRIPT_DIR)) + +import resolve_known # noqa: E402 + + +def row(n: int, ts: str) -> str: + return json.dumps({"id": n, "created_at": ts}) + + +def text(*rows: str) -> str: + return "".join(r + "\n" for r in rows) + + +MAIN = [row(1, "2026-01-05T00:00:00Z"), row(2, "2026-01-01T00:00:00Z"), row(3, "2026-01-09T00:00:00Z")] + + +def test_main_order_preserved_when_unsorted(): + out, kept, added = resolve_known.merge_ledger_text(text(*MAIN), text(*MAIN, row(4, "2026-01-02T00:00:00Z"))) + assert out.startswith(text(*MAIN)) + assert (kept, added) == (3, 1) + + +def test_branch_rows_appended_sorted(): + new = [row(5, "2026-02-03T00:00:00Z"), row(4, "2026-02-01T00:00:00Z")] + out, _, _ = resolve_known.merge_ledger_text(text(*MAIN), text(*MAIN, *new)) + assert out.splitlines()[3:] == [new[1], new[0]] + + +def test_shared_row_appears_once(): + out, _, added = resolve_known.merge_ledger_text(text(*MAIN), text(MAIN[1], row(4, "2026-02-01T00:00:00Z"))) + assert out.splitlines().count(MAIN[1]) == 1 + assert added == 1 + + +def test_mixed_z_and_offset_sort(): + a = row(4, "2026-02-01T10:00:00+00:00") + b = row(5, "2026-02-01T09:00:00Z") + c = row(6, "2026-02-01T09:30:00.5+00:00") + out, _, _ = resolve_known.merge_ledger_text(text(*MAIN), text(a, b, c)) + assert out.splitlines()[3:] == [b, c, a] + + +def test_valid_jsonl_no_markers_and_diff_only_adds(): + main_text = text(*MAIN) + out, _, _ = resolve_known.merge_ledger_text(main_text, text(row(4, "2026-02-01T00:00:00Z"), MAIN[0])) + assert not any(line.startswith(("<<<<<<<", "=======", ">>>>>>>")) for line in out.splitlines()) + assert out.endswith("\n") + for line in out.splitlines(): + json.loads(line) + diff = list(difflib.unified_diff(main_text.splitlines(), out.splitlines(), lineterm="", n=0)) + assert not [d for d in diff if d.startswith("-") and not d.startswith("---")] + assert [d for d in diff if d.startswith("+") and not d.startswith("+++")] + + +def test_base_stage_flip(monkeypatch, tmp_path): + stages = {2: text(*MAIN), 3: text(MAIN[1], row(9, "2026-03-01T00:00:00Z"))} + monkeypatch.setattr(resolve_known, "stage", lambda n, path, cwd: stages[n]) + resolve_known.merge_jsonl("l.jsonl", str(tmp_path), base_stage=2) + lines = (tmp_path / "l.jsonl").read_text().splitlines() + assert lines[:3] == MAIN and len(lines) == 4