From 8006d517676b9dfe4f9dd26e4194ffb3b7e8df49 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 16 Nov 2026 12:05:48 +0000 Subject: [PATCH 1/2] feat: queue.md maintained by chat; remove the dashboard input path (PyAutoBrain#640) Human ruling 2026-11-16: the design C input path (PyAutoMind#565) is overkill. queue.md now has one writer, the human in a /queue chat. - Remove .github/workflows/dashboard_input.yml, scripts/dashboard_input.py and tests/test_dashboard_input.py, and their spawn rule and spec row. - policy/github_tokens.md: drop the dashboard input token section and its inventory row; the dispatchable-workflow hardening stays under its own heading. - queue.md header: one writer, chat via /queue. goals.md, REFERENCE.md, batches/AGENTS.md and the dashboard_refresh comments follow. - New scripts/queue_edit.py (show, add, remove, move) so the skill never hand-edits markdown: resolves pasted copy lines, paths, links, titles and whole prompts; refuses refs with no draft/ or active/ prompt; renumbers headings to the planner's rank; remove reuses lifecycle.queue_retire_text (now taking key= and by=) to retire with shelved-as:; a write that adds a lifecycle queue finding is undone. tests/test_queue_edit.py runs lifecycle.py check on a fixture Mind after each edit. - dashboard.html and state.json regenerated with the read-only renderer. - The questions-inbox draft no longer assumes the dashboard input route. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/dashboard_input.yml | 174 --- .github/workflows/dashboard_refresh.yml | 14 +- REFERENCE.md | 18 +- batches/AGENTS.md | 9 +- dashboard.html | 1203 +++++------------ docs/pyautobrain/spawn_spec.md | 2 +- .../questions_inbox_bulk_answering.md | 2 +- goals.md | 11 +- policy/github_tokens.md | 94 +- queue.md | 17 +- scripts/dashboard_input.py | 719 ---------- scripts/lifecycle.py | 14 +- scripts/queue_edit.py | 364 +++++ scripts/spawn.py | 6 - state.json | 2 +- tests/test_dashboard_input.py | 607 --------- tests/test_queue_edit.py | 295 ++++ tests/test_workflow_input_injection.py | 8 +- 18 files changed, 1028 insertions(+), 2531 deletions(-) delete mode 100644 .github/workflows/dashboard_input.yml delete mode 100644 scripts/dashboard_input.py create mode 100755 scripts/queue_edit.py delete mode 100644 tests/test_dashboard_input.py create mode 100644 tests/test_queue_edit.py diff --git a/.github/workflows/dashboard_input.yml b/.github/workflows/dashboard_input.yml deleted file mode 100644 index 174956d0b..000000000 --- a/.github/workflows/dashboard_input.yml +++ /dev/null @@ -1,174 +0,0 @@ -name: Dashboard Input - -# The write side of the published dashboard (PyAutoMind#565, design C). A ★ -# tap or a Goals edit on dashboard.html opens ONE issue here, then labels it -# `dashboard-input`, with a fine-grained token of a dedicated machine account -# holding Issues permission on this repo and nothing else. The trigger is the -# LABEL event, not `opened`: GitHub silently drops labels set at creation by -# anyone without push access, and the machine account has only Triage. This workflow — not the browser — validates it, -# writes queue.md or goals.md, commits as the bot, and closes the issue with a -# one-line result the page reads back. Reference: policy/github_tokens.md -# "The dashboard input token". -# -# Why an issue and not workflow_dispatch: an `issues` event always runs the -# workflow file on the DEFAULT branch, so the code that handles the input is -# never chosen by the caller. A dispatch token can run any workflow at any -# ref, including old branches' unhardened copies. -# -# SECURITY. The issue body is attacker-controlled (a leaked token can open -# any issue), so: -# - the job runs only when the `dashboard-input` label is added, which -# takes at least Triage on this repo; the script also requires the issue -# to be open and unlocked and both its opener and the labeller to be the -# machine account; -# - scripts/dashboard_input.py reads the event JSON itself (no issue text -# passes through a shell or an expression), refuses any author but -# vars.DASHBOARD_INPUT_LOGIN — a dedicated machine account, refused if it -# equals vars.HUMAN_LOGIN — refuses anything but a real draft/ or -# active/ prompt ref or at most 10 short plain goals, and refuses a write -# that adds `lifecycle.py check` drift; -# - the guard step refuses a tree in which anything but queue.md or -# goals.md changed, and only those two paths are ever staged. -# -# RATE. One issue per run; runs are serialised by the concurrency group. A -# group keeps one pending run and cancels older pending ones, so a run first -# closes any OLDER open dashboard-input issue as superseded (its run was -# dropped; the page reverts and says "tap again"). The page itself keeps one -# issue in flight and coalesces taps behind it, so one device never trips this. -# An issue that changes nothing is closed "no change" with no commit. Every -# input issue is closed AND locked. GitHub cannot be made to refuse issue -# creation, so past 30 inputs in an hour (GitHub search) each new one is -# refused unprocessed and locked as spam; each still costs one short run. - -on: - issues: - types: [labeled] - -concurrency: - group: dashboard-input - cancel-in-progress: false - -# contents: write → the bot commit to main. issues: write → the result comment -# and the close. actions: write → dispatch dashboard_refresh.yml afterwards: a -# GITHUB_TOKEN push triggers no workflow, so the page would not re-render. -permissions: - contents: write - issues: write - actions: write - -jobs: - apply: - if: >- - github.repository == 'PyAutoLabs/PyAutoMind' - && github.event.label.name == 'dashboard-input' - runs-on: ubuntu-latest - timeout-minutes: 5 - env: - GH_TOKEN: ${{ github.token }} - ISSUE_NUMBER: ${{ github.event.issue.number }} - steps: - - uses: actions/checkout@v4 - with: - ref: main - - - name: Validate, apply, commit - id: apply - env: - DASHBOARD_INPUT_LOGIN: ${{ vars.DASHBOARD_INPUT_LOGIN }} - HUMAN_LOGIN: ${{ vars.HUMAN_LOGIN }} - run: | - set -euo pipefail - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - msg="$RUNNER_TEMP/dashboard_commit_msg.txt" - result="$RUNNER_TEMP/dashboard_result.txt" - for attempt in 1 2 3 4 5; do - git fetch --quiet origin main - git reset --quiet --hard FETCH_HEAD - rm -f "$msg" - # Exit 1 is a refusal: the result line says why, the step - # summary too, and nothing is written. - if ! python3 scripts/dashboard_input.py apply --rate-check \ - --event "$GITHUB_EVENT_PATH" --message-file "$msg" --result-file "$result"; then - exit 0 - fi - if [ ! -s "$msg" ]; then - echo "nothing to commit (already so)" - exit 0 - fi - git add -- queue.md goals.md - staged="$(git diff --cached --name-only)" - if ! python3 scripts/dashboard_input.py guard \ - || printf '%s\n' "$staged" | grep -qvxE 'queue\.md|goals\.md'; then - echo "::error title=Dashboard input refused::a path other than queue.md or goals.md changed" - echo "dashboard-input: refused — a path other than queue.md or goals.md changed" > "$result" - echo "outcome=refused" >> "$GITHUB_OUTPUT" - exit 0 - fi - git commit --quiet -F "$msg" - if git push --quiet origin HEAD:main; then - sha="$(git rev-parse --short HEAD)" - printf '%s (commit %s)\n' "$(head -n 1 "$result")" "$sha" > "$result" - echo "Committed \`$sha\`." >> "$GITHUB_STEP_SUMMARY" - exit 0 - fi - echo "push rejected (attempt ${attempt}) — re-applying on the new tip of main" - done - echo "dashboard-input: refused — main moved under five attempts in a row; tap again" > "$result" - echo "outcome=refused" >> "$GITHUB_OUTPUT" - - # Only the dashboard account's own input issues are ever touched: the - # label alone proves nothing (anyone with Triage can add it anywhere). - - name: Close older inputs whose runs were dropped - if: steps.apply.outputs.respond == 'true' - env: - DASHBOARD_INPUT_LOGIN: ${{ vars.DASHBOARD_INPUT_LOGIN }} - run: | - set -euo pipefail - gh issue list --repo "$GITHUB_REPOSITORY" --label dashboard-input \ - --author "$DASHBOARD_INPUT_LOGIN" \ - --state open --limit 50 --json number --jq '.[].number' | - while read -r n; do - [[ "$n" =~ ^[0-9]+$ ]] || continue - if [ "$n" -lt "$ISSUE_NUMBER" ]; then - gh issue comment "$n" --repo "$GITHUB_REPOSITORY" --body \ - "dashboard-input: superseded — not applied (a newer input's run replaced this one's); tap again" - gh issue close "$n" --repo "$GITHUB_REPOSITORY" --reason "not planned" - gh issue lock "$n" --repo "$GITHUB_REPOSITORY" --reason resolved \ - || echo "::warning::could not lock #$n" - fi - done - - # Written only when the script decided this is the dashboard account's - # own input (respond=true); on any other labelled issue: nothing. - - name: Answer, close and lock the issue - if: always() && steps.apply.outputs.respond == 'true' - env: - LOCK_REASON: ${{ steps.apply.outputs.lock }} - run: | - set -euo pipefail - result="$RUNNER_TEMP/dashboard_result.txt" - if [ ! -s "$result" ]; then - echo "dashboard-input: refused — the run failed before it could decide; tap again" > "$result" - fi - gh issue comment "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY" --body-file "$result" - if grep -q '^dashboard-input: refused' "$result"; then - gh issue close "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY" --reason "not planned" - else - gh issue close "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY" --reason completed - fi - case "${LOCK_REASON:-}" in spam) reason=spam ;; *) reason=resolved ;; esac - gh issue lock "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY" --reason "$reason" \ - || echo "::warning::could not lock the issue" - - - name: Re-render the dashboard - if: steps.apply.outputs.outcome == 'applied' - run: | - gh workflow run dashboard_refresh.yml --repo "$GITHUB_REPOSITORY" --ref main \ - || echo "::warning::could not dispatch dashboard_refresh.yml — the page catches up at its next trigger" - - - name: Fail a refused input - if: steps.apply.outputs.outcome == 'refused' - run: | - echo "::error title=Dashboard input refused::see the issue's result comment" - exit 1 diff --git a/.github/workflows/dashboard_refresh.yml b/.github/workflows/dashboard_refresh.yml index 1be2f2e1b..1e9ffd595 100644 --- a/.github/workflows/dashboard_refresh.yml +++ b/.github/workflows/dashboard_refresh.yml @@ -46,10 +46,9 @@ on: - "state.json" - "looks_shipped.json" - "looks_shipped_dismissed.md" - # The ★ state and the Goals box (PyAutoMind#565): the page renders both, - # so a hand edit or a session's commit to either makes it stale. The - # dashboard's own writes come from dashboard_input.yml with GITHUB_TOKEN, - # which triggers nothing, so that workflow dispatches this one itself. + # The ★ ranks and the Goals box (PyAutoMind#565, PyAutoBrain#640): the + # page renders both, so a commit to either (a `/queue` chat, a hand + # edit) makes it stale. - "queue.md" - "goals.md" pull_request: @@ -69,10 +68,9 @@ on: - "state.json" - "looks_shipped.json" - "looks_shipped_dismissed.md" - # The ★ state and the Goals box (PyAutoMind#565): the page renders both, - # so a hand edit or a session's commit to either makes it stale. The - # dashboard's own writes come from dashboard_input.yml with GITHUB_TOKEN, - # which triggers nothing, so that workflow dispatches this one itself. + # The ★ ranks and the Goals box (PyAutoMind#565, PyAutoBrain#640): the + # page renders both, so a commit to either (a `/queue` chat, a hand + # edit) makes it stale. - "queue.md" - "goals.md" workflow_dispatch: diff --git a/REFERENCE.md b/REFERENCE.md index 416b1bb0a..4123ddf37 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -477,16 +477,14 @@ history unattended will not record it. backlog dip to their epics and tags; `lifecycle.py check` validates the file (numbered 1..n, at most 10 goals of at most 200 characters). Public, like the rest of the Mind. -- **The dashboard writes both.** A ★ on the published `dashboard.html`, or an - edit in its Goals box, opens one issue and labels it `dashboard-input`, - with a dedicated machine account's token that holds Issues permission on - this repo only. The `issues: labeled` run of `.github/workflows/dashboard_input.yml` (always the default branch's - copy) checks the author against `vars.DASHBOARD_INPUT_LOGIN` (a dedicated - machine account, never `vars.HUMAN_LOGIN`), validates the - body (`scripts/dashboard_input.py`), refuses a write that adds - `lifecycle.py check` drift or touches any other path, commits as the bot and - closes the issue with a one-line result. Token scope, storage and what a leaked one can do: - [`policy/github_tokens.md`](policy/github_tokens.md). +- **The human writes both; the dashboard reads them.** `queue.md` is edited in + a chat that ran `/queue` (PyAutoBrain `skills/queue`): a pasted prompt, + path, title or dashboard 📋 text adds an entry, never starts dev. + `scripts/queue_edit.py` does the edit (`show`, `add`, `remove`, `move`) so + nothing hand-edits the markdown, and the write lands through a temporary + worktree detached on `origin/main` and `prompt_sync_push`. The published + dashboard shows a read-only ★ and rank `#n` on each queued task (PyAutoBrain#640, + which removed the earlier issue-driven input path of PyAutoMind#565). - **`batches/-.md`** — one record per dispatched batch, written at dispatch and appended at collection. Schema and the three fields that are easy to get wrong are in [`batches/AGENTS.md`](batches/AGENTS.md). diff --git a/batches/AGENTS.md b/batches/AGENTS.md index 9b3adfe53..baeb37cef 100644 --- a/batches/AGENTS.md +++ b/batches/AGENTS.md @@ -216,14 +216,9 @@ batch brief --new --review-at ` writes a skeleton brief whose their `epics:`/`tags:` (or `fill-idle` when no goal names any) and safe defaults (`merge-cap: 0`) for the rest; it prints to stdout unless `--out` names a file, so writing the record — the dispatch — stays the human's act. -A goal whose line was last written by a `Via: mind-dashboard` commit is free -text from a web page, so it is emitted **commented out** with "from dashboard, -last edited ": a worker never sees it until the human uncomments it. -When provenance cannot be read (no git, or the blame does not line up), every -goal is emitted that way, marked "provenance unknown". +`goals.md` is written by the human alone, so every goal is copied as written. `--new` also prints, on stderr, how the goals changed since the newest brief. -`brief --check` warns when goal 1 of `goals.md` is missing from a brief, -unless goal 1 came from the dashboard. +`brief --check` warns when goal 1 of `goals.md` is missing from a brief. **The keep-Heart-green lane** (PyAutoBrain#625). `brief --new` first reads Heart's release verdict and sorts every reason into `fixable-dev`, diff --git a/dashboard.html b/dashboard.html index 4f8dd174e..d08733e75 100644 --- a/dashboard.html +++ b/dashboard.html @@ -2,7 +2,7 @@ - + PyAutoMind Dashboard @@ -317,32 +317,10 @@ .steer h3{margin:.7rem 0 .2rem} .steer ol{margin:.2rem 0;padding-left:1.4rem} .steer ol.steer-queue{list-style:none;padding-left:0} -.steer-row{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap} -.steer textarea{box-sizing:border-box;width:100%;min-height:9rem;font:inherit; - font-size:16px;color:var(--fg);background:var(--bg);border:1px solid var(--line); - border-radius:8px;padding:.5rem} -.steer details{margin-top:.6rem} -.steer input[type=password]{box-sizing:border-box;width:100%;min-height:44px; - font-size:16px;color:var(--fg);background:var(--bg);border:1px solid var(--line); - border-radius:8px;padding:.4rem .6rem} -.steer button.act{min-height:44px;min-width:44px;font:inherit;font-weight:650; - border:1px solid var(--edge);border-radius:9px;background:var(--btn);color:var(--accent); - padding:0 .9rem;cursor:pointer} -.steer .pending{opacity:.6} -button.star{flex:0 0 auto;min-width:2.75rem;height:2.75rem;font-size:1.15rem; - border:1px solid var(--edge);border-radius:9px;background:transparent;cursor:pointer; - color:var(--muted);opacity:.55;position:relative;padding:0} -button.star[aria-pressed="true"]{color:#d4a017;opacity:1;background:var(--tint)} -button.star:disabled{cursor:default} -button.star.pending{animation:starpulse 1s ease-in-out infinite} -@keyframes starpulse{50%{opacity:.35}} -button.star .qpos{position:absolute;right:2px;bottom:1px;font-size:.62rem; - font-weight:700;color:var(--fg)} -.steer-toast{position:fixed;left:50%;bottom:1rem;transform:translateX(-50%); - max-width:calc(100vw - 2rem);box-sizing:border-box;padding:.6rem .9rem; - border-radius:10px;background:var(--fg);color:var(--bg);z-index:10; - box-shadow:0 4px 16px #0004} -.steer-toast a{color:inherit;text-decoration:underline} +span.star{flex:0 0 auto;display:inline-flex;align-items:center;gap:.15rem; + min-height:2.75rem;padding:0 .4rem;font-size:1.05rem;color:#d4a017; + border:1px solid var(--edge);border-radius:9px;background:var(--tint)} +span.star .qpos{font-size:.75rem;font-weight:700;color:var(--fg)} @@ -361,254 +339,245 @@ Keep track of decisions and outstanding questions throughout this conversation. After changes, report what was recorded, where it lives and what remains to do. Work on GitHub: -- Open Mind repository: https://github.com/PyAutoLabs/PyAutoMind
Last updated 2026-11-16 12:10:40 UTC
↻ Update

-