Files
cleveragents-core/tools/pr-velocity-notes.example.toml
T
drew 07013335b9 Auto-agents pipeline: enforce merge invariant with deterministic driver
Implement the improve_auto-agents_pipeline plan end-to-end and apply post-implementation hardening fixes so master can only advance via SHAs that passed CI against the exact current master.

Key changes:
- Add deterministic merge driver in `tools/merge_drive.py`:
  - Single-instance lock (`fcntl.flock`) + heartbeat/status surfaces.
  - Train-merge with bisect-on-failure and independent bisect/restart budgets.
  - `head_commit_id` optimistic lock enforcement on merge endpoint.
  - Single-PR strategy switched to `Do=merge` (sha-stable) to avoid unverified rewritten commits.
  - Restart throttling/sleeps to prevent burning retry budget under master churn.
  - Persistent clone management (`ensure_repo`: fetch/reset/clean with fresh-clone fallback on corruption).
  - Cooperative SIGTERM/SIGINT stop propagation through long CI polling.
  - Explicit claim lifecycle for `auto/claimed-merge`:
    - claim/release comments with TTL,
    - expired-claim sweep,
    - operational labels on release (`auto/ci-timeout`, `auto/restart-throttled`,
      `auto/needs-implementer`, `auto/needs-conflict-resolution`).
  - Claim-marker interoperability: sweep recognizes both driver and `claim_pr.ts` markers.
  - Hardened API semantics: split idempotent GET retries vs state-change semantics.
  - Remove token-in-URL clone pattern; use git `http.extraheader` auth instead.
  - Adopt structured module logging + env-configurable levels.

- Add/expand invariant auditor in `tools/verify_invariant.py`:
  - Non-zero exit when violations exist (cron/alert correctness).
  - Robust auto-close routine using forward patch applicability on current `origin/master`.
  - Merge-bot commit validation now checks:
    - required CI contexts passed,
    - associated PR has non-dismissed APPROVED review.
  - Improve close-path wording/docs to match forward-apply algorithm.
  - Add logger-based output and verbosity controls.

- Add operational setup/audit tooling:
  - `tools/forgejo_audit.py` (preconditions/audit report).
  - `tools/setup_auto_labels.py` (idempotent `auto/*` label provisioning).
  - `tools/setup_branch_protection.py` (direct-push allow-list enforcement).
  - `tools/audit_branch_protection.py` (dismiss_stale_approvals audit/flip support).
  - `tools/migrate_to_new_driver.py` (claim/schedule/train cleanup migration).
  - `tools/flag_stale_prs.py` (idle PR triage flow).
  - `tools/local_ci_gate.sh` canonical local gate runner with `--continue-on-fail`.

- Add claim orchestration support in skills scripts:
  - New `claim_pr.ts` helper (claim/release + TTL comments).
  - `list_prs.ts` gains `--exclude-claimed` filter.
  - Update script reference docs accordingly.

- Telemetry/schema upgrades in `tools/_forgejo_cache.py`:
  - Add `merge_cycle`, `ci_gate_events`, `llm_activity`.
  - Add batched `ci_gate_events` insertion API with rollback semantics.
  - Ensure `bisect_depth` default handling is safe.
  - Surface merge-driver telemetry in velocity reporting pipeline.

- Agent prompt/behavior updates:
  - Review supervisor idle loop tuned (300s -> 60s).
  - Review worker cycle cap/escalation behavior refined.
  - Task implementor guidance updated to use local CI gate wrapper.

- Documentation and operational guidance:
  - Expand `AGENTS.md` with merge invariant runbook, label registry, tool links,
    and full merge-driver env var catalog (including logging/restart/claim TTL knobs).
  - Update `CHANGELOG.md` with implementation and hardening entries, plus deferred TS-test note.

- Repo hygiene:
  - Correct `.gitignore` to stop blanket ignoring `tools/*`; keep only generated artifacts ignored.

Testing/validation:
- Add comprehensive unit suite under `tests/auto_agents/` covering:
  - merge driver recursion/restarts/409 paths/signal handling/claim sweeps,
  - verifier auto-close logic with real local git fixtures,
  - schema migration + telemetry batch writes,
  - branch protection and setup/audit helpers.
- Current result: `100 passed` in `tests/auto_agents/`.
2026-05-03 21:31:16 -04:00

49 lines
2.2 KiB
TOML

# tools/pr-velocity-notes.toml — optional editorial overrides for the PR-velocity canvas.
#
# Copy this file to `tools/pr-velocity-notes.toml` and edit any slot you want
# to override. Any slot omitted here falls back to the deterministic narrative
# generated by tools/render-pr-velocity.py.
#
# Run `python3 tools/render-pr-velocity.py` to re-render after editing.
#
# IMPORTANT: commentary strings are emitted inside JSX <Text>...</Text> nodes,
# so you can include most Markdown-ish text but must escape `>` as `&gt;` and
# avoid stray `{` / `}` (use \u007B / \u007D or split strings).
[notes]
# Top hero callout (Callout tone=success|warning|danger|info)
# hero_tone = "success"
# hero_title = "HAL9000 Sunday-morning burst — 5 PRs in 3 hours"
# hero_body = "Long paragraph explaining context the numbers don't capture..."
# Commentary beneath each chart or table
# window_stats_note = "Observation about the 5-metric window table."
# weekly_note = "Observation about the weekly chart."
# monthly_note = "Observation about the monthly chart."
# daily_note = "Observation about the daily throughput chart."
# last_48h_note = "Observation above the 48h merges table."
# open_by_author_note = "Observation about who owns the open-PR backlog."
# open_age_note = "Observation about the age distribution."
# top_authors_note = "Observation about all-time contributors."
# oldest_open_note = "Observation about the oldest PR cohort."
# Final snapshot Callout body (plain text; `<Code>` etc. allowed)
# snapshot_body = "Sunday morning snapshot — pipeline active, backlog draining."
# Full replacement for the Key Findings & Recommendations cards block.
# When present, this raw JSX replaces the auto-generated 4 cards. Useful for
# hand-written recommendations after a notable event. The string must be valid
# JSX and will be dropped inside a <Stack gap={12}>...</Stack>.
#
# findings_cards_jsx = """
# <Card>
# <CardHeader trailing={<Pill tone="warning" active size="sm">Investigate</Pill>}>
# Custom recommendation
# </CardHeader>
# <CardBody>
# <Text>Hand-written analysis here.</Text>
# </CardBody>
# </Card>
# """