Skip to content

fix: ledger_merge must dispatch dashboard_refresh after a merge #103

Done

Description

@Jammy2211

Overview

A ledger auto-merge that adds or retires a project (e.g. 09a0de6, the sdssj0946_subhalo_v2 birth, 2026-11-26) leaves Cortex main red: ledger_merge.yml pushes with GITHUB_TOKEN and dispatches cortex_check.yml and pages_dashboard.yml, but never dashboard_refresh.yml, so dashboard.md stays stale until the 03:35 cron. While main is red, later ledger merges and PRs (e.g. #102) inherit the failure.

Plan

  • After a merge, ledger_merge.yml dispatches the dashboard refresh instead of the check.
  • dashboard_refresh.yml dispatches the Cortex Check itself, so the check always sees a healed board.
  • A text test guards both hand-offs.
  • Result: main is red for minutes after a birth, not until the nightly cron.

Effective level: human-required; merge mode: auto-merge on green if the Witness passes.

Detailed implementation plan

Affected Repositories

  • PyAutoCortex (primary)

Branch Survey

Repository Current Branch Dirty?
organs/PyAutoCortex main clean

Suggested branch: feature/cortex-ledger-merge-refresh

Implementation Steps

  1. .github/workflows/ledger_merge.yml, step "Run the check on main and publish the board": dispatch dashboard_refresh.yml on main instead of cortex_check.yml; drop the now-redundant pages_dashboard.yml dispatch (the refresh publishes on both paths); update the comments and the actions: write note. Both workflows share the cortex-main-writers concurrency group, so the refresh runs after this run's push.
  2. .github/workflows/dashboard_refresh.yml: after a successful heal push, also dispatch cortex_check.yml on main (the heal push is GITHUB_TOKEN, so nothing checks it today). On the fresh path, dispatch cortex_check.yml only for workflow_dispatch / schedule events, so a board-neutral ledger merge still gets its merge commit checked. PR runs still never dispatch.
  3. tests/test_ledger_merge.py: add a text assertion that ledger_merge.yml dispatches dashboard_refresh.yml and dashboard_refresh.yml dispatches cortex_check.yml.
  4. Run the Cortex tests; after merge, show the Witness with run links from one birth (or audit-mode ledger_merge + manual refresh).

Key Files

  • .github/workflows/ledger_merge.yml — merge-and-dispatch step
  • .github/workflows/dashboard_refresh.yml — heal and dispatch
  • tests/test_ledger_merge.py — workflow text tests

Original Prompt

Click to expand starting prompt

Cortex ledger auto-merge leaves main red after a project birth — ledger_merge.yml never dispatches dashboard_refresh.yml

Type: bug
Target: pyautocortex
Repos:

  • PyAutoCortex
    Themes:
  • cortex
  • ci
    Difficulty: easy
    Autonomy: safe-capped
    Priority: high
    Status: draft
    Consequence: glance
    Witness: After a claude/birth-* ledger branch auto-merges via ledger_merge.yml, dashboard_refresh.yml runs on main without a human dispatch, heals dashboard.md/dashboard.html/state.json, and the Cortex Check on the resulting main tip is green — shown by the run links of one real or test birth after the change.
    Review-minutes: 2
    Unattended: ready
    Lane: any
    Filed: 2026-11-26
    Updated: 2026-11-26

Request (verbatim)

"Draft a start_dev prompt to make ledger_merge.yml trigger dashboard_refresh" — the permanent fix
for the Cortex main-red found in the 2026-11-26 orchestrator PR sweep.

Finding

2026-11-26 17:27, PyAutoCortex 09a0de6 ("cortex: auto-merge ledger branch
claude/birth-sdssj0946_subhalo_v2") added projects/sdssj0946_subhalo_v2.md and its
projects.yaml row, but did not re-render the board. Cortex Check on main then failed:

FAILED tests/test_cortex.py::test_the_committed_board_files_each_project_under_its_folders_kind
AssertionError: sdssj0946_subhalo_v2 is not in its active section

The same thing happened at 17:14 after the erc_angular_structure birth (23ec5b5); a later
push happened to heal it. While main is red, later ledger merges and PRs (e.g. Cortex#102) inherit
the failure.

Cause

ledger_merge.yml pushes the merge with GITHUB_TOKEN, which triggers no workflows. Its final
step ("Run the check on main and publish the board") explicitly dispatches cortex_check.yml and
pages_dashboard.yml — but not dashboard_refresh.yml. So a ledger merge that changes the board
(a birth, retirement or status move) leaves dashboard.md stale until the 03:35 cron or another
push. Manual heal used on 2026-11-26: gh workflow run dashboard_refresh.yml --ref main, then
gh workflow run cortex_check.yml --ref main (the heal push is also GITHUB_TOKEN, so it does
not trigger Cortex Check either).

Fix sketch

  • In ledger_merge.yml's final step, dispatch dashboard_refresh.yml on main (it already
    dispatches Pages after its own heal push).
  • Ordering: cortex_check.yml dispatched at the same moment would check the stale tip and fail.
    Either have dashboard_refresh.yml dispatch cortex_check.yml after its heal push (it has
    actions: write semantics to add if missing), or drop the direct check dispatch from
    ledger_merge.yml and let the refresh own "check main after heal". Keep the no-op path: when
    the board is already fresh, the refresh should still dispatch the check so the merge commit is
    checked.
  • Confirm dashboard_refresh.yml declares workflow_dispatch (it does, line ~48) and the
    actions: write permission it needs to dispatch.

Activity

  1. Jammy2211 commented on Nov 26, 2026

    @Jammy2211
    ContributorAuthor

    Shipped in #104 (merge cca40ce).

    • ledger_merge.yml now dispatches dashboard_refresh.yml after a landed merge (falls back to cortex_check.yml if that dispatch fails).
    • dashboard_refresh.yml dispatches cortex_check.yml after a heal push, and on a fresh tip for dispatched/scheduled runs.
    • Text test guards both hand-offs; 107 tests pass.

    Witness still to show: the next birth/retirement ledger merge (e.g. #102 after its board is regenerated) should leave main green with no manual dispatch — add the ledger_merge → dashboard_refresh → cortex_check run links here.

  2. Jammy2211 commented on Nov 26, 2026

    @Jammy2211
    ContributorAuthor

    Witness shown (2026-11-26), with no manual dispatch after the trigger push:

    1. Push to claude/run-adapt_snr_cap-416981 (main merged in after adapt_snr_cap: partition gpu → both, so its RAL ledger branches can land #105) → ledger_merge 45876337369 auto-merged it as bb0bd41 and left the board stale.
    2. → dashboard_refresh 45876364368 (workflow_dispatch from ledger_merge) healed it as 4aa03d9.
    3. → cortex_check 45876413183 (workflow_dispatch from the refresh) green on 4aa03d9; Pages republished from 4aa03d9.

    The fresh-tip path was shown earlier: refresh 45875106025 → check 45875130384 green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions