merge(520): parallel-orientation startup + #237 retirement [decisions-edit]

This commit is contained in:
2026-07-21 11:49:32 +02:00
12 changed files with 438 additions and 248 deletions
+2
View File
@@ -752,6 +752,8 @@ jobs:
PYTHONPATH=. python3 scripts/decisions_validate.py --base "origin/${base_ref}" --head HEAD
- name: Active catalog in sync
run: PYTHONPATH=. python3 scripts/build_decisions_catalog.py --check
- name: Kickoff guard
run: bash scripts/check-kickoff-guard.sh
# BLOCKING (unlike docs-reminder): the mechanizable half of the "docs-update in the
# same PR" rule for the API contract (ersatztv#303 H4/H5). If a PR touches the API
+15 -2
View File
@@ -56,7 +56,7 @@ docker build -f docker/Dockerfile -t ersatztv:dev .
## Conventions
- **Read [`docs/contributing.md`](docs/contributing.md)** before non-trivial changes — it documents the established patterns (layering, CQRS handlers, LanguageExt, the ChicoryTV SPA, EF Core + dual-provider migrations, the FFmpeg pipeline, analyzers, testing) and the **deviation policy**: match the established style; diverge only with a concrete, stated reason.
- **Docs-first is a HARD RULE — read before you explore**: before ANY API / SPA / E2E / parity / scheduling work, read `docs/README.md` (index) → the convention docs (`api-conventions`, `spa-conventions`, `e2e-local`, `domain-model`, `blazor-route-parity`, `decisions`). **Do NOT reverse-engineer conventions from source (Grep/Read) before reading these** — they exist precisely so you don't. Only recon the task-specific delta the docs deliberately don't freeze (a merged endpoint's exact DTO, a Blazor page's field list). **This applies to delegated subagents too**: tell each agent which doc section to read; never let one re-derive conventions from code.
- **Docs-first is a HARD RULE — read before you explore**: before ANY API / SPA / E2E / parity / scheduling work, read the `docs/README.md` **task-signal map** and only the sections it points to for your task — not the whole corpus. **Do NOT reverse-engineer conventions from source (Grep/Read) before reading these** — they exist precisely so you don't. Only recon the task-specific delta the docs deliberately don't freeze (a merged endpoint's exact DTO, a Blazor page's field list). **This applies to delegated subagents too**: tell each agent which doc section to read; never let one re-derive conventions from code. **Decision/convention lookups start at the active catalog**, `docs/decisions/README.md` — resolve by topic/key, never by chasing a file path named in a historical comment (the breadcrumb rule; see `docs/README.md` → "Knowledge retrieval").
- **Docs-update is part of "done" — same PR, never a follow-up**: any PR that changes a convention, adds/migrates/redirects a route, adds/changes a `/api/*` endpoint, or reverses a decision MUST update the relevant doc in that same PR:
| Change | Update in the same PR |
@@ -91,11 +91,24 @@ Both need Gitea read creds in the env to enforce (**`ETV_GITEA_BASICAUTH=user:pa
1. **Root cause** (bug fixes / incidents only): Document WHY the problem existed, not just what was changed. If root cause is unknown, say so explicitly and open a follow-up investigation issue. Fixing symptoms without understanding causes creates recurring problems.
2. **Comment on issues** as you work — what you found, what approach you're taking, any deviations from the suggested fix.
3. **Push changes**: `git push` all commits before closing. Use `fixes #N` in commit messages to auto-close where appropriate.
4. **Close comment**: Add a structured closing comment on the issue covering: what was done, root cause (if applicable), files changed, anything deferred, follow-up issues created, and which docs were updated.
4. **Close comment**: Add a structured `## Closing record` comment on the issue (template below).
5. **Close the issue** via API or `fixes #N` commit. Leave open with a comment only if partially addressed.
6. **Update docs**: If the change affects operational behavior, update the relevant Obsidian docs (`~/homelab-docs/`), MEMORY.md, or CLAUDE.md inline — not as a follow-up.
7. **Reply to reviewer** (if from adversarial review): Summary of done/deferred/questions. This triggers the next review cycle.
**`## Closing record` template** (step 4 — this is both the human-readable summary and the per-issue unit MemPalace mines for retrieval; see `docs/handoffs/chicorytv-issue-queue.md` → "Knowledge retrieval" for the retrieval contract this feeds):
```markdown
## Closing record
**Outcome:** <what shipped / what didn't; PR link>
**Root cause:** <for bug fixes/incidents — why the problem existed, or "unknown, see follow-up #N">
**Decisions/conventions changed:** <keys added/superseded in docs/decisions.md, or "none">
**Reusable knowledge:** <a fact/gotcha worth surfacing to a future session or MemPalace search>
**Verification:** <tests run, live-E2E, CI status>
**Deferred:** <anything explicitly punted, with a follow-up issue link, or "none">
**Docs updated:** <which docs/*.md files changed in this PR, or "none required and why">
```
## Project Boundaries
**ersatztv OWNS**: ErsatzTV fork code (C#/.NET), channel/collection/schedule management, M3U/XMLTV generation, the ErsatzTV skill in server-management.
+77 -28
View File
@@ -1,34 +1,81 @@
# docs/ — reading order
# docs/ — task-signal map
Purpose: index of `docs/` so a fresh contributor/agent knows what to read and in what order.
**Update this doc in the same PR that adds, removes, or retitles a doc below.**
Purpose: route a fresh contributor/agent to the minimal set of docs for the task at hand, instead of
a mandatory front-to-back read. **Update this doc in the same PR that adds, removes, or retitles a
doc below, or that changes which sections a task signal points to.**
Read in this order at session start:
## Start here, always
1. **`CLAUDE.md`** (repo root) — project intro: architecture, layout, dev commands, conventions.
2. **`docs/contributing.md`** — established code patterns (CQRS/MediatR, LanguageExt, the ChicoryTV
SPA, EF Core dual-provider migrations, FFmpeg pipeline, analyzers, testing). Read before
any non-trivial change.
3. **`docs/domain-model.md`** — what the app IS: entity glossary, channel→playout→schedule/block
concept map, where each concept is edited in the SPA.
4. **`docs/api-conventions.md`** — checklist for adding/changing a `/api/*` endpoint (controllers,
DTOs, error mapping, auth, OpenAPI regen, tests).
5. **`docs/spa-conventions.md`** — playbook for adding a screen to the ChicoryTV React SPA.
6. **`docs/e2e-local.md`** (+ `scripts/e2e-local.sh`) — how to run a live local instance for manual
or Playwright-MCP verification.
7. **`docs/testing.md`** — testing map: what each `*.Tests` project / `web` suite covers,
golden-file nets, the timezone-independence rule, how to run subsets, the per-PR verification
gate.
8. **`docs/blazor-route-parity.md`** — historical record of the completed #91 phase (b) cutover:
the Blazor Server UI is removed and every legacy route now 302-redirects to its SPA equivalent
(or falls through to the catch-all → `/app`). Read it for the full legacy→SPA route inventory.
9. **`docs/decisions.md`** — lifecycle "why" log: active records plus retired/superseded ones
relocated to `docs/decisions/archive/`. Check here before challenging an existing convention;
start from the generated active catalog, `docs/decisions/README.md`.
10. **`docs/ci-cd.md`** — build/test/release pipeline, versioning, dependency management.
- **`CLAUDE.md`** (repo root) — project intro: architecture, layout, dev commands, conventions,
Task Completion Protocol.
- **`docs/contributing.md`** — established code patterns (CQRS/MediatR, LanguageExt, the ChicoryTV
SPA, EF Core dual-provider migrations, FFmpeg pipeline, analyzers, testing). Read before any
non-trivial change.
Also present in `docs/`:
## Task signal → minimal sections
| Signal | Read |
| --- | --- |
| Session startup / "what's next" (no issue named) | `docs/handoffs/chicorytv-issue-queue.md` (standing kickoff — two concurrent tracks: orientation ‖ `scripts/select-queue.sh 5`) |
| Named-issue pickup | Skip queue selection; go straight to focused retrieval — see "Knowledge retrieval" below, then the issue body |
| Adding/changing a `/api/*` endpoint | `docs/api-conventions.md` checklist + `docs/endpoint-index.md` |
| Adding a ChicoryTV SPA screen | `docs/spa-conventions.md` |
| Scheduling / playout engine work | `docs/domain-model.md` + decisions catalog rows keyed `sched.*` (`docs/decisions/README.md`) |
| Concurrency / optimistic-locking work | `docs/api-conventions.md` §7a/b/c + `docs/decisions/optimistic-concurrency.md` |
| Auth / security-surface work | `docs/decisions/api-auth-security.md` |
| CI / release pipeline work | `docs/ci-cd.md` + `docs/decisions/release-ci-governance.md` |
| Live local run / Playwright-MCP verification | `docs/e2e-local.md` + `scripts/e2e-local.sh` |
| What does a test suite cover | `docs/testing.md` |
| Legacy Blazor route lookup | `docs/blazor-route-parity.md` (historical #91 phase (b) inventory) |
| "Why do we do X this way" / challenging a convention | **Catalog-first**: `docs/decisions/README.md` (active rows) → `docs/decisions.md` + `docs/decisions/*.md` for full rationale. `docs/decisions/archive/` only for "what did the rule used to be." |
## Knowledge retrieval (MemPalace + catalog + Gitea)
These four rules are the seam agreed with server-management#642 (the Gitea→MemPalace exporter).
They apply whether the question comes up via MemPalace, a grep, or a stale comment:
1. **Current conventions/decisions → catalog-first.** Start at `docs/decisions/README.md`; discover
via the `ErsatzTV-Decisions` wing (active) / `ErsatzTV-Decisions-Archive` (superseded/retired).
**Resolve by topic/key, never by chasing a file path.**
2. **Issue history → evidence, not authority.** The `Gitea-ErsatzTV` wing is historical narrative
that may be stale; it never overrides current Markdown.
3. **The breadcrumb rule (the crux behavior change).** A file path named inside a *historical issue
comment* (e.g. "grep `docs/decisions.md` 2026-07-17", "see …") is a **breadcrumb, not a live
pointer.** Find the current rule via the catalog / active wing **by concept**; do not treat the
named path as current. (Why it's safe: still-current → in the active wing, breadcrumb resolves;
superseded → the active wing returns the *successor* and a literal follow lands on a record that
announces its own `status: superseded`; retired → the active wing returns nothing, which is
itself the signal. The validator-enforced move-to-`archive/` is what prevents the catastrophic
"superseded rule read as current" case.)
4. **Fallback when MemPalace is stale/down:** `docs/decisions/README.md` catalog, then
`` rg '^`key: <dotted.key>`' docs/decisions/ ``. MemPalace is never authority nor sole fallback.
MemPalace is candidate discovery only — every passage is verified against its cited Markdown/Gitea
source before use. Never derive live queue state from MemPalace, #237, or historical comments; queue
state is live Gitea state, retrieved via `scripts/select-queue.sh` (see
`docs/handoffs/chicorytv-issue-queue.md`). Full retrieval contract (altitude/precedence, staleness
bounds, what's mined per issue): `docs/handoffs/chicorytv-issue-queue.md` → "Knowledge retrieval".
## Also present in `docs/`
- **`docs/domain-model.md`** — what the app IS: entity glossary, channel→playout→schedule/block
concept map, where each concept is edited in the SPA.
- **`docs/api-conventions.md`** — checklist for adding/changing a `/api/*` endpoint (controllers,
DTOs, error mapping, auth, OpenAPI regen, tests).
- **`docs/spa-conventions.md`** — playbook for adding a screen to the ChicoryTV React SPA.
- **`docs/e2e-local.md`** (+ `scripts/e2e-local.sh`) — how to run a live local instance for manual
or Playwright-MCP verification.
- **`docs/testing.md`** — testing map: what each `*.Tests` project / `web` suite covers,
golden-file nets, the timezone-independence rule, how to run subsets, the per-PR verification
gate.
- **`docs/blazor-route-parity.md`** — historical record of the completed #91 phase (b) cutover:
the Blazor Server UI is removed and every legacy route now 302-redirects to its SPA equivalent
(or falls through to the catch-all → `/app`). Read it for the full legacy→SPA route inventory.
- **`docs/decisions.md`** + **`docs/decisions/*.md`** — active decision records (lifecycle schema:
key/status/since/supersedes/superseded-by). **Generated active view**: `docs/decisions/README.md`
(catalog / task router) — start there. Superseded/retired records live in
`docs/decisions/archive/` and are read only for history, never for "what is the current rule."
- **`docs/ci-cd.md`** — build/test/release pipeline, versioning, dependency management.
- **`docs/rest-api.md`** — REST API design doc for ersatztv#2 (goals, conventions, per-slice plan).
Largely superseded day-to-day by `docs/api-conventions.md`; read this for the original rationale.
- **`docs/mcp.md`** — the `ErsatzTV.Mcp` stdio JSON-RPC MCP server (#58): how it wraps `/api/v1` as
@@ -41,6 +88,8 @@ Also present in `docs/`:
OpenAPI tag). Do not edit by hand; regenerated by `scripts/generate-endpoint-index.py` /
`scripts/update-openapi.sh`.
- **`docs/handoffs/chicorytv-issue-queue.md`** — static session kickoff prompt + workflow lore.
Queue state (goal, arc, what's in flight/next) lives in the pinned Gitea tracker ersatztv#237
— read that, not this file, for current state (protocol: decisions.md 2026-07-11).
Queue state is **live Gitea state**, retrieved each session via `scripts/select-queue.sh` — see
that file's standing kickoff for the two concurrent tracks (orientation ‖ selection). ersatztv#237
is a closed, archival historical tracker (superseded by `startup.parallel-orientation` in
`docs/decisions.md`) — not a live pointer.
- **`docs/handoffs/rest-api.md`** — original handoff prompt for kicking off the REST API work (#2).
+6 -4
View File
@@ -50,11 +50,13 @@ step is now continuous. The release boundary is instead where you:
`docs/decisions/archive/` (the validator fails this, but eyeball it at the boundary too).
3. Regenerate the active catalog: `PYTHONPATH=. python3 scripts/build_decisions_catalog.py` and
commit any drift.
4. Check the aggregate active-corpus budget (`decisions_validate.py --budget <n>`, default 4200
4. Check the aggregate active-corpus budget (`decisions_validate.py --budget <n>`, default **4800**
lines across `docs/decisions.md` + topic files + the catalog — replaces the old single-file
1800-line floor). Going over budget is a **non-blocking warning** (`::warning::` to stderr, not a
validator error) — a ratchet/reminder to migrate more `legacy-unmigrated` records or extract a new
topic file, not a release gate.
1800-line floor). **Re-baselined 2026-07-21 (#520)**: the corpus is now fully migrated at
~4366 lines; 4800 gives headroom so the warning fires on real future growth, not on the expected
post-migration size. Going over budget is a **non-blocking warning** (`::warning::` to stderr,
not a validator error) — a ratchet/reminder to extract a new topic file or archive more history,
not a release gate.
5. Report the remaining `legacy-unmigrated` count (the validator prints it as a `::notice::`) so the
backlog is visible, even though it isn't required to hit zero before a release.
A genuine rationale-prose rewrite still needs `[decisions-edit]` in the commit message (see the
+49 -22
View File
@@ -91,7 +91,6 @@ in-file entries.
- [2026-07-10 — Playout API mutations return 409 while the build lock is held (#215)](#2026-07-10--playout-api-mutations-return-409-while-the-build-lock-is-held-215)
- [2026-07-11 — Schedules SPA editor: draft/explicit-Save over instant-persist; Copy includes multi/smart/rerun; shuffled-GET normalization preserved](#2026-07-11--schedules-spa-editor-draftexplicit-save-over-instant-persist-copy-includes-multismartrerun-shuffled-get-normalization-preserved)
- [2026-07-11 — Channel editor: bare-create entry point + external-logo mutual exclusion (#212)](#2026-07-11--channel-editor-bare-create-entry-point--external-logo-mutual-exclusion-212)
- [2026-07-11 — Queue state lives in the pinned Gitea tracker (#237), not in the handoff file](#2026-07-11--queue-state-lives-in-the-pinned-gitea-tracker-237-not-in-the-handoff-file)
- [2026-07-11 — EntityLocker: atomic flags + single-owner release discipline, no owner tokens (#231)](#2026-07-11--entitylocker-atomic-flags--single-owner-release-discipline-no-owner-tokens-231)
- [2026-07-11 — Media-source management REST write API + SPA (#202)](#2026-07-11--media-source-management-rest-write-api--spa-202)
- [2026-07-11 — Legacy→SPA redirect matcher: exact map + ordered segment-template patterns (#204)](#2026-07-11--legacyspa-redirect-matcher-exact-map--ordered-segment-template-patterns-204)
@@ -130,6 +129,7 @@ in-file entries.
- [2026-07-20 — External-URL channel logos pass through to the graphics engine; never `File.Exists`-gated, never ffmpeg-native (#502)](#2026-07-20--external-url-channel-logos-pass-through-to-the-graphics-engine-never-fileexists-gated-never-ffmpeg-native-502)
- [2026-07-20 — Remote graphics-engine images are fetched through a bounded, pooled `IRemoteImageFetcher`; re-fetched per element init, not cached (#511)](#2026-07-20--remote-graphics-engine-images-are-fetched-through-a-bounded-pooled-iremoteimagefetcher-re-fetched-per-element-init-not-cached-511)
- [2026-07-21 — Decision records carry a lifecycle schema, validated by a script; append-only-by-diff is retired (#521)](#2026-07-21--decision-records-carry-a-lifecycle-schema-validated-by-a-script-append-only-by-diff-is-retired-521)
- [2026-07-21 — Parallel orientation + selection is the startup protocol; #237 retired (#520)](#2026-07-21--parallel-orientation--selection-is-the-startup-protocol-237-retired-520)
---
@@ -605,27 +605,6 @@ it's absent from the reference list (`optionsKeepingCurrent` in `ChannelEditScre
an existing channel never silently changes the value out from under an unmanaged language code or a
template/selector file removed from disk since save.
## 2026-07-11 — Queue state lives in the pinned Gitea tracker (#237), not in the handoff file
`key: docs.queue-state-gitea-tracker` · `status: active` · `since: 2026-07-11` · `supersedes: none` · `superseded-by: none`
**Rule:** Volatile session/queue state lives in pinned Gitea tracker issue #237 (goal + arc in the body, append-only session-comment log, in-progress/review labels), not in a wholesale-rewritten handoff file; the handoff file keeps only the static kickoff prompt and append-only lore.
**Signals:** last-writer-wins race, claim/`in-progress` label, triage verdict · paths: `docs/handoffs/chicorytv-issue-queue.md` · issues: #237
**Mechanics:** Gitea tracker issue #237
With multiple sessions/agents working the repo in parallel, the old protocol — every session
wholesale-rewrites `docs/handoffs/chicorytv-issue-queue.md` on main (session state + queue +
next-session prompt) — became a last-writer-wins race. New protocol: **volatile queue state
moved to Gitea**, which is concurrency-safe by construction. Pinned tracker issue **#237**
holds the goal + ordered arc in its body (edited rarely, only on arc changes, re-read before
edit) and an append-only session-comment log (fixed template: Closed / Filed / Triage /
Arc change / Recommended next). Milestone `Blazor removal (#91 phase b)` + the `review` and
`in-progress` labels are the machine-queryable view. Sessions **claim** an issue before working
it (`in-progress` label + claim comment; the tiny read→claim race window is accepted, later
claimant backs off; stale claims — no commits/comments ~48h — may be taken over with a comment).
Every new issue gets an explicit end-of-session triage verdict — gate-blocker (milestone + arc
slot) or backlog (label only) — so review findings adjust the queue only through that step and
the arc doesn't drift. The handoff file keeps only the **static kickoff prompt** and the
**append-only Lessons lore** (per-session prompts are gone; task context lives in issue bodies).
## 2026-07-11 — EntityLocker: atomic flags + single-owner release discipline, no owner tokens (#231)
`key: locking.entitylocker-atomic-flags` · `status: active` · `since: 2026-07-11` · `supersedes: none` · `superseded-by: none`
**Rule:** `EntityLocker` uses `Interlocked.CompareExchange`-guarded atomic flags plus a documented single-owner-release discipline (no owner tokens/leases); `Unlock*` on an already-unlocked slot returns `false` and logs a Warning rather than throwing.
@@ -3155,3 +3134,51 @@ record as its `superseded-by` and this record's `supersedes` pointing back — t
pattern the new rule itself mandates for every future reversal. `docs/decisions/migration-map.md`
tracks the legacy-heading → key → status → location mapping as the rest of the log migrates
(ersatztv#520/#521, ongoing — most existing headings remain `legacy-unmigrated` until touched).
## 2026-07-21 — Parallel orientation + selection is the startup protocol; #237 retired (#520)
`key: startup.parallel-orientation` · `status: active` · `since: 2026-07-21` · `supersedes: docs.queue-state-gitea-tracker@2026-07-11` · `superseded-by: none`
**Rule:** A fresh session runs two concurrent tracks at startup — Orientation (`AGENTS.md`/`CLAUDE.md` → `docs/README.md` task-signal map → the active decisions catalog `docs/decisions/README.md`) and, only when no issue is named, Selection (`scripts/select-queue.sh N`, deterministic live-Gitea ranking). A named issue skips Selection entirely. ersatztv#237, the closed pickup tracker this replaces, is reduced to a single archival breadcrumb and MUST NOT be read for live state.
**Signals:** startup protocol, queue selection, MemPalace retrieval, breadcrumb rule · paths: `docs/handoffs/chicorytv-issue-queue.md`, `scripts/select-queue.sh`, `docs/README.md`, `scripts/check-kickoff-guard.sh` · issues: #237, #520, #521, server-management#642
**Mechanics:** `docs/handoffs/chicorytv-issue-queue.md` → "Two concurrent tracks at session start" + "Knowledge retrieval"; `scripts/select-queue.sh`; regression guard `scripts/check-kickoff-guard.sh` (wired into the `decisions lifecycle` CI job)
**Why this reverses `docs.queue-state-gitea-tracker` (2026-07-11), not just extends it.** That
record's rule was "queue state lives in pinned tracker #237, not in the handoff file" — sound in
2026-07-11 when the arc was live and #237's body/comments were the only concurrency-safe place to
put session state. Two things changed: (1) `scripts/select-queue.sh` (2026-07-19) already replaced
the *mechanical* selection logic with a deterministic query over live Gitea state — no script reads
#237's prose; and (2) the arc itself completed and #237 **closed** on 2026-07-13. A closed issue
cannot be "where live queue state lives" — continuing to point agents at it was no longer just
stale, it was actively wrong, and the old record's own text ("Pinned tracker issue #237 holds the
goal + ordered arc") was live regression bait: a session reading it verbatim would try to treat a
closed tracker as authoritative. So this is a genuine reversal (the *store* changes from "a specific
Gitea issue" to "live Gitea queries, no pinned issue required"), not a mechanical follow-on.
**What the new protocol is.** Session start runs two independent tracks, neither blocking the other:
**Orientation** — read `AGENTS.md`/`CLAUDE.md`, then `docs/README.md`'s task-signal map (replacing
the old mandatory 1–10 reading order), then the active decisions catalog `docs/decisions/README.md`
for "why do we do X" questions. **Selection** — only when the user hasn't named an issue, run
`scripts/select-queue.sh [N]`, which excludes `in-progress`/`parked`/PRs, resolves
`GET /issues/{n}/dependencies`, tiers by LOCAL `.milestone.state`/`review`/`priority:` filters, and
orders deterministically; it flags `CLAIM?`/`UMBRELLA?` for the orchestrator to resolve by reading
the flagged issue, and does not rank an arc tier (none is active in maintenance/backlog mode — if
one is ever re-established, extend the script, never revert to prose-derived ranking). A
user-named issue skips Selection outright and goes straight to focused retrieval on that issue.
**MemPalace retrieval contract (server-management#642, the sole Gitea→MemPalace exporter).**
MemPalace is candidate discovery only, verified against its cited source before use, at a default
`ErsatzTV-Decisions` wing; the four load-bearing orientation bullets — catalog-first for current
rules, issue history as evidence not authority, the breadcrumb rule (a file path in a historical
comment resolves by concept via the active wing, never by literal path-chase), and the
catalog→`rg` exact-search fallback when MemPalace is stale/down — are carried verbatim in
`docs/README.md` and `docs/handoffs/chicorytv-issue-queue.md`. Never derive live queue state from
MemPalace, #237, or historical comments; live Gitea state via `scripts/select-queue.sh` is the only
source of truth for pickup ordering. The `## Closing record` template (Outcome / Root cause /
Decisions changed / Reusable knowledge / Verification / Deferred / Docs updated) is the structured
per-issue artifact this retrieval contract is built to consume — see `CLAUDE.md` → Task Completion
Protocol and the kickoff's "Closing record" section.
**Regression guard.** `scripts/check-kickoff-guard.sh` greps the standing startup docs
(`docs/handoffs/chicorytv-issue-queue.md`, `docs/README.md`, `CLAUDE.md`, `scripts/select-queue.sh`)
for #237-as-live-state phrasings ("read #237", "tracker #237", "queue state lives in", …), exempting
lines/sections that are explicitly archival. It is wired into the `decisions lifecycle` CI job so a
future PR cannot silently reintroduce the reversed rule.
+1 -1
View File
@@ -47,7 +47,6 @@ the link for rationale. Superseded/retired history lives in `archive/`. Regenera
| `concurrency.schedule-item-child-identity` | `PUT /api/schedules/{id}/items` reconciles by an optional round-tripped child `Id` (null/absent/0 ⇒ new item), never by array position, so fill-group/shuffle state follows the logical item across reorders; an unknown or duplicate id is rejected 422 (checked after the §7a `CheckVersion`, so 412 precedes 422). | 2026-07-11 | [link](optimistic-concurrency.md#2026-07-11--stable-child-identity-for-schedule-item-replace-259-split-from-252253) |
| `docs.convention-docs-session-start` | The standing convention-doc set (api-conventions, spa-conventions, e2e-local, blazor-route-parity, domain-model, decisions, README) is read at session start and updated in the same PR that changes what it documents, replacing per-session recon. | 2026-07-07 | [link](../decisions.md#2026-07-07--convention-docs-read-at-session-start-updated-in-pr) |
| `docs.decision-lifecycle` | every decision `##` record (active or archived) carries a 5-field metadata block (`key`, `status`, `since`, `supersedes`, `superseded-by`) checked by `scripts/decisions_validate.py`; a record is never deleted or line-edited to reverse a call — it is moved to `docs/decisions/archive/` with `status: superseded`/`retired` and a reciprocal `superseded-by`/`supersedes` key pair to its replacement. | 2026-07-21 | [link](../decisions.md#2026-07-21--decision-records-carry-a-lifecycle-schema-validated-by-a-script-append-only-by-diff-is-retired-521) |
| `docs.queue-state-gitea-tracker` | Volatile session/queue state lives in pinned Gitea tracker issue #237 (goal + arc in the body, append-only session-comment log, in-progress/review labels), not in a wholesale-rewritten handoff file; the handoff file keeps only the static kickoff prompt and append-only lore. | 2026-07-11 | [link](../decisions.md#2026-07-11--queue-state-lives-in-the-pinned-gitea-tracker-237-not-in-the-handoff-file) |
| `ffmpeg.external-logo-graphics-engine` | External-URL channel logos pass through to the graphics engine like any other watermark source; `WatermarkSelector` must never gate them on `File.Exists` (always false for a URL) and never route them through the ffmpeg-native overlay shortcut. | 2026-07-20 | [link](../decisions.md#2026-07-20--external-url-channel-logos-pass-through-to-the-graphics-engine-never-fileexists-gated-never-ffmpeg-native-502) |
| `ffmpeg.hls-cold-start-burst` | HLS cold-start latency is fixed with a bounded `-readrate_initial_burst` (gated on FFmpeg ≥6.1 capability detection), not by raising `work_ahead_limit`, which would remove the concurrency guarantee it exists for. | 2026-07-20 | [link](../decisions.md#2026-07-20--hls-cold-start-is-fixed-with--readrate_initial_burst-not-by-raising-the-work-ahead-limit-350) |
| `ffmpeg.qsv-decode-encode-split` | QSV decode is decoupled from QSV encode via a single `FFmpegProfile.QsvPreferNativeDecoder` bool (default ON, Linux-only), so a QSV encode profile can decode with the more tolerant native VA-API decoder instead of the QSV decoder. | 2026-07-20 | [link](../decisions.md#2026-07-20-498--qsv-decode-is-split-from-qsv-encode-via-a-single-qsvprefernativedecoder-bool) |
@@ -116,3 +115,4 @@ the link for rationale. Superseded/retired history lives in `archive/`. Regenera
| `spa.templates-editor-table` | The SPA templates editor renders day/block assignment as a table, not Blazor's drag-and-drop calendar grid — an accepted, deliberate parity deviation. | 2026-07 | [link](../decisions.md#2026-07--templates-editor-in-the-spa-is-a-table-not-blazors-drag-calendar) |
| `spa.topbar-primary-action` | The TopBar's primary-action "+" button renders only when the active route declares a non-empty `primaryAction`, is wired (via a shared `usePrimaryAction` hook) only on single-unambiguous-create-flow list screens, and is dropped everywhere else rather than left as a dead/no-op button. | 2026-07-12 | [link](../decisions.md#2026-07-12--topbar-primary-action-button-wire-creates-drop-the-rest-238) |
| `spa.yaml-validator-textarea` | The YAML playout validator takes pasted YAML via a `<textarea>`, not a server-side file path, since the SPA has no filesystem access. | 2026-07-09 | [link](../decisions.md#2026-07-09--yaml-playout-validator-paste-textarea-instead-of-a-server-file-path) |
| `startup.parallel-orientation` | A fresh session runs two concurrent tracks at startup — Orientation (`AGENTS.md`/`CLAUDE.md` → `docs/README.md` task-signal map → the active decisions catalog `docs/decisions/README.md`) and, only when no issue is named, Selection (`scripts/select-queue.sh N`, deterministic live-Gitea ranking). A named issue skips Selection entirely. ersatztv#237, the closed pickup tracker this replaces, is reduced to a single archival breadcrumb and MUST NOT be read for live state. | 2026-07-21 | [link](../decisions.md#2026-07-21--parallel-orientation--selection-is-the-startup-protocol-237-retired-520) |
+40
View File
@@ -0,0 +1,40 @@
# Archive — startup / kickoff protocol
Superseded/retired records for the session-startup / queue-selection protocol. See
`docs/decisions/archive/README.md` for the archive's general rules (rationale kept verbatim,
never in the active read-path). Active successor: `startup.parallel-orientation` in
`docs/decisions.md`.
---
## 2026-07-11 — Queue state lives in the pinned Gitea tracker (#237), not in the handoff file
`key: docs.queue-state-gitea-tracker` · `status: superseded` · `since: 2026-07-11` · `supersedes: none` · `superseded-by: startup.parallel-orientation@2026-07-21`
**Rule:** (superseded) Volatile session/queue state lives in pinned Gitea tracker issue #237 (goal + arc in the body, append-only session-comment log, in-progress/review labels), not in a wholesale-rewritten handoff file; the handoff file keeps only the static kickoff prompt and append-only lore.
**Signals:** last-writer-wins race, claim/`in-progress` label, triage verdict · paths: `docs/handoffs/chicorytv-issue-queue.md` · issues: #237, #520
**Mechanics:** superseded by `scripts/select-queue.sh` (ersatztv#520); see `docs/decisions.md` → `startup.parallel-orientation`
With multiple sessions/agents working the repo in parallel, the old protocol — every session
wholesale-rewrites `docs/handoffs/chicorytv-issue-queue.md` on main (session state + queue +
next-session prompt) — became a last-writer-wins race. New protocol: **volatile queue state
moved to Gitea**, which is concurrency-safe by construction. Pinned tracker issue **#237**
holds the goal + ordered arc in its body (edited rarely, only on arc changes, re-read before
edit) and an append-only session-comment log (fixed template: Closed / Filed / Triage /
Arc change / Recommended next). Milestone `Blazor removal (#91 phase b)` + the `review` and
`in-progress` labels are the machine-queryable view. Sessions **claim** an issue before working
it (`in-progress` label + claim comment; the tiny read→claim race window is accepted, later
claimant backs off; stale claims — no commits/comments ~48h — may be taken over with a comment).
Every new issue gets an explicit end-of-session triage verdict — gate-blocker (milestone + arc
slot) or backlog (label only) — so review findings adjust the queue only through that step and
the arc doesn't drift. The handoff file keeps only the **static kickoff prompt** and the
**append-only Lessons lore** (per-session prompts are gone; task context lives in issue bodies).
**Why superseded (#520, 2026-07-21):** the arc completed and #237 closed (2026-07-13); a closed
tracker cannot serve as live queue state, and continuing to read it as such was a live regression
risk (an agent skimming an old comment or this very record could re-treat #237's prose as current).
`scripts/select-queue.sh` (2026-07-19) already replaced the mechanical parts of this rule with a
deterministic, live-Gitea-only query — this record's job was really "queue state lives in Gitea,
not in the handoff file," and that half is still true; what's superseded is the *specific store*
(#237's body/comments) now that maintenance/backlog mode has no arc to narrate. See
`startup.parallel-orientation` for the replacement: two concurrent session-start tracks
(orientation via the docs/decisions catalog + `docs/README.md` map, and selection via the script),
with #237 reduced to a single archival breadcrumb.
+2 -2
View File
@@ -13,6 +13,8 @@ the running legacy-unmigrated count; it must trend to 0 over the arc, not drop t
| 2026-07-12 — decisions.md is append-only, enforced; root-screenshot guard (#303 H9/H3) — heading kept identical to the pre-split original (only the body/metadata were split) so the lifecycle validator's relocation check matches it | `docs.append-only-guard` | superseded (`superseded-by: docs.decision-lifecycle@2026-07-21`) | `docs/decisions/archive/release-ci-governance.md` |
| 2026-07-12 — Root-screenshot guard: pre-commit refuses root-level `*.png` (#303 H3) — split from the original H9/H3 bundle | `ci.root-screenshot-guard` | active | `docs/decisions/release-ci-governance.md` |
| 2026-07-21 — Decision records carry a lifecycle schema, validated by a script; append-only-by-diff is retired (#521) | `docs.decision-lifecycle` | active (`supersedes: docs.append-only-guard@2026-07-12`) | `docs/decisions.md` |
| 2026-07-11 — Queue state lives in the pinned Gitea tracker (#237), not in the handoff file | `docs.queue-state-gitea-tracker` | superseded (`superseded-by: startup.parallel-orientation@2026-07-21`) | `docs/decisions/archive/startup.md` |
| 2026-07-21 — Parallel orientation + selection is the startup protocol; #237 retired (#520) | `startup.parallel-orientation` | active (`supersedes: docs.queue-state-gitea-tracker@2026-07-11`) | `docs/decisions.md` |
## Migration conventions
@@ -49,8 +51,6 @@ sibling.
## Still open (tracked for later migration passes, not this PR)
- `## 2026-07-11 — Queue state lives in the pinned Gitea tracker (#237), not in the handoff file` is
reversed by #520, not #521 — per the task-5 brief its supersession lands in PR2/Task 8, not here.
- The remaining ~90 headings in `docs/decisions.md` and the other three `docs/decisions/*.md` topic
files (`optimistic-concurrency.md`, `api-auth-security.md`, `spa-modularization.md`, and the rest of
`release-ci-governance.md`) are unmigrated (`status: legacy-unmigrated`, no metadata block). They are
+195 -183
View File
@@ -1,22 +1,21 @@
# ChicoryTV issue-queue handoff (client-neutral kickoff + workflow lore)
> **PROTOCOL CHANGED 2026-07-11** (decisions.md entry of same date). Queue state lives in the
> **pinned Gitea tracker [ersatztv#237](http://192.168.1.95:3000/timothy/ersatztv/issues/237)**,
> not in this file. Do **NOT** write session state, queue order, or next-session prompts here —
> sessions ending under the old protocol should append their session comment to #237 instead.
> This file holds only stable operating guidance: the standing kickoff prompt and the workflow lore.
> Historical per-session state: `git log` of this file (last state-bearing revision: 8b77d5e7).
Static kickoff prompt + workflow lore, pruned (not appended) as protocols change — git history has
the rest. **Queue state is live Gitea state**, resolved fresh every session by
`scripts/select-queue.sh`; never written here as a snapshot, never read from stale prose or a
closed tracker.
<!-- archival:237 --> ersatztv#237 was the pinned pickup tracker through 2026-07-21; it is CLOSED
and now purely historical (superseded by `startup.parallel-orientation` in `docs/decisions.md`; full
history in `docs/decisions/archive/startup.md`). Do not read it for current queue state.
---
## Current phase — maintenance / backlog mode (terminal transition, 2026-07-13)
The ChicoryTV rewrite + go-live arc is **COMPLETE**: the pinned arc tracker
[ersatztv#237](http://192.168.1.95:3000/timothy/ersatztv/issues/237) is **CLOSED** and all six
numbered arc items shipped. The project is now in **maintenance / backlog mode**. This is a
*terminal* fact (the arc will not re-open), so it belongs in this standing file — unlike any
"current frontier issue", which must never be written here (read it live; see the queue-drift
lesson at the end of this file).
The ChicoryTV rewrite + go-live arc is **COMPLETE** and closed out. The project is now in
**maintenance / backlog mode**. This is a *terminal* fact (the arc will not re-open), so it belongs
in this standing file — unlike any "current frontier issue", which must never be written here (read
it live; see the queue-drift lesson in the archived section below).
So a fresh session stops re-discovering this every time:
- The **arc / gate / open-`review` tiers are normally EMPTY now.** An empty arc frontier is the
@@ -100,40 +99,41 @@ already-collected bounded evidence for explicitly tool-free synthesis or report
silently expanding orchestrator reconnaissance. Global Codex hook enforcement is tracked in
`timothy/server-management#592`; the wider Claude-hook port is tracked in `timothy/server-management#593`.
**When the user has not named an issue, queue selection is mechanical fast/small work, never orchestrator
work.** FIRST run the deterministic selector — `ETV_GITEA_BASICAUTH=user:pass scripts/select-queue.sh [N]`
— which does the parts a cheap model kept getting wrong IN CODE: it excludes `in-progress`/`parked`/PRs,
resolves `GET /issues/{n}/dependencies` on every candidate (dropping any with an OPEN blocker), tiers by
LOCAL `.milestone.state`/`review`/`priority:` filters (never the server `?milestones=` name filter, which
no-ops on `:`/`+`), and orders by (tier, priority, issue#). **Its DEPS/tiering/ordering are deterministic —
trust them, do not re-derive them by hand.** It also raises two JUDGMENT flags it deliberately does not
decide — `CLAIM?` (a claim can precede the label) and `UMBRELLA?` (an epic whose children are the real
pickups); the orchestrator (or a cheap model) resolves ONLY those by reading the flagged issue's
comments/body. The script does not rank the arc tier (arc order is #237 prose, currently CLOSED) — read
#237 if an arc re-opens. If the script is unavailable (no creds / Gitea down), fall back to the cheap-model
path below. Dispatch exactly one selector on the cheapest suitable model at `low` effort. Give it #237's
body and last ~6 comments, then have it query live candidates as a cascade in this exact tier order:
**arc → OPEN issues assigned to OPEN milestones → open `review` → unmilestoned/unreviewed
`priority: high` → `priority: medium` → `priority: low`**. Every candidate row represents an issue
(or eligible reviewer audit): milestone records provide tier metadata and are NEVER pickup candidates.
An OPEN milestone with zero eligible OPEN issues contributes zero candidates. Deduplicate candidates,
apply the live eligibility exclusions at each tier (including automatic exclusion of `parked` issues and any issue with an open `blocked-by` dependency),
and stop as soon as five eligible issues have been accumulated (or all tiers are exhausted). It returns
only that ranked top-five shortlist, with one-line rationales and live-state evidence; a small result
packet is the desired behavior, but an empty or undersized higher tier must fall through to the next tier.
The orchestrator receives only that compact packet, then performs a focused live recheck of the winner
before claiming. If the cheap worker lacks a repository-scoped issue-list tool, it must immediately return
the literal result `TOOL_LIMITATION`; it must not rank issue IDs mentioned in tracker prose, turn milestone
records into candidates, or infer that any tier is empty. The orchestrator then performs only the mechanical
tier queries (repository + state + milestone/label), passes at most the bounded raw ISSUE rows back to the
cheap worker, and leaves all filtering/ranking to that worker. Never substitute an owner-wide/global search
or treat that tool limitation as an empty tier.
Do not load implementation docs or issue bodies into the selector. If the client cannot route a
cheaper subagent, run the selector in a separate low-cost session before starting or resuming the orchestrator
and pass in its packet. **Do not fall back to inline sorting or an equally expensive selector.** If no cheaper
route or session is available, pause and request the selector packet rather than consuming orchestrator tokens
on queue ranking. If the user names an issue, skip selection and only verify that issue's live claimability;
this explicit user choice is the sole path by which a `parked` issue may be worked.
## Two concurrent tracks at session start
A fresh session runs **two independent tracks** — neither blocks the other, and both are cheap/mechanical,
never orchestrator-tier work:
- **Track A — Orientation** (always, regardless of whether an issue is named): read `AGENTS.md` and
`CLAUDE.md` when present, then `docs/README.md`'s task-signal map, and the active decisions catalog
`docs/decisions/README.md`. This is what replaces re-deriving conventions from source or from a
pinned tracker's prose — see "Knowledge retrieval" below for the full catalog-first / breadcrumb-rule
contract.
- **Track B — Selection** (only when the user has NOT named an issue): run the deterministic selector,
`ETV_GITEA_BASICAUTH=user:pass scripts/select-queue.sh [N]`. It does the mechanical parts a cheap
model used to get wrong IN CODE: excludes `in-progress`/`parked`/PRs, resolves
`GET /issues/{n}/dependencies` on every candidate (dropping any with an OPEN blocker), tiers by
LOCAL `.milestone.state`/`review`/`priority:` filters (never the server `?milestones=` name filter,
which no-ops on `:`/`+`), and orders by (tier, priority, issue#). **Its DEPS/tiering/ordering are
deterministic — trust them, do not re-derive them by hand** (see the archived section below for why
that used to be necessary and isn't anymore). It also raises two JUDGMENT flags it deliberately does
not decide — `CLAIM?` (a claim can precede the label) and `UMBRELLA?` (an epic whose children are the
real pickups) — resolve ONLY those by reading the flagged issue's comments/body. The script does not
rank an arc tier (there is no active arc right now — maintenance/backlog mode, see above); if a new
arc/milestone is ever established, add it as a script tier rather than reverting to prose-derived
ranking. If the script is unavailable (no creds / Gitea down), it fails open (prints a notice, exits
0) — in that case fall back to a single low-cost model session querying live tiers directly
(OPEN-milestone → `review` → `priority: high/medium/low`), never to inline sorting by the
orchestrator.
**If the user names an issue, skip Track B entirely** and go straight to focused retrieval (below)
plus a live claimability check on that issue; this explicit user choice is the sole path by which a
`parked` issue may be worked.
Dispatch exactly one selector on the cheapest suitable model at `low` effort when the client can route
a cheaper subagent; otherwise run it in a separate low-cost session before starting or resuming the
orchestrator and pass in its packet. **Do not fall back to inline sorting or an equally expensive
selector.** If no cheaper route or session is available, pause and request the selector packet rather
than consuming orchestrator tokens on queue ranking.
FIRST read `AGENTS.md` and `CLAUDE.md` when present, then `docs/README.md`, the convention docs it
indexes, and the Lessons below. Apply both client instruction files; where they differ, follow the
@@ -154,75 +154,101 @@ the client cannot route the escalation. Do not block merely because one brand-sp
Everything else (claiming, worktrees, dispatching implementers, CI monitoring, protocol
bookkeeping, routine merges of green reviewed PRs with user consent) stays at your level.
## Knowledge retrieval (MemPalace + catalog + Gitea — the #642 seam)
**MemPalace = candidate discovery only**, retrieved at a bounded `k`; every passage **verified
against its cited Markdown/Gitea source** before use. **Default wing = `ErsatzTV-Decisions`** (active
`docs/decisions.md` + `docs/decisions/*.md` + catalog). History wings `ErsatzTV-Decisions-Archive`
(`docs/decisions/archive/**`) and `Gitea-ErsatzTV` (issues/comments incl. closing records) are touched
**only** when the question is explicitly "what did the rule *used to be*." "What is the current rule
for X" never touches the history wings.
The four load-bearing orientation bullets — carry these **VERBATIM** wherever this contract is
referenced (`docs/README.md` too):
1. **Current conventions/decisions → catalog-first.** Start at `docs/decisions/README.md`; discover
via the `ErsatzTV-Decisions` wing (active) / `ErsatzTV-Decisions-Archive` (superseded/retired).
**Resolve by topic/key, never by chasing a file path.**
2. **Issue history → evidence, not authority.** The `Gitea-ErsatzTV` wing is historical narrative
that may be stale; it never overrides current Markdown.
3. **The breadcrumb rule (the crux behavior change).** A file path named inside a *historical issue
comment* (e.g. "grep `docs/decisions.md` 2026-07-17", "see …") is a **breadcrumb, not a live
pointer.** Find the current rule via the catalog / active wing **by concept**; do not treat the
named path as current. (Why it's safe: still-current → in the active wing, breadcrumb resolves;
superseded → the active wing returns the *successor* and a literal follow lands on a record that
announces its own `status: superseded`; retired → the active wing returns nothing, which is itself
the signal. The validator-enforced move-to-`archive/` is what prevents the catastrophic "superseded
rule read as current" case.)
4. **Fallback when MemPalace is stale/down:** `docs/decisions/README.md` catalog, then
`` rg '^`key: <dotted.key>`' docs/decisions/ ``. MemPalace is never authority nor sole fallback.
**Graceful degradation (calibration, not a correctness cliff):** even an under-oriented agent that
literally greps `docs/decisions.md` post-#521 gets valid-but-*incomplete* results (misses topic files
+ archived records), never *wrong* ones — that file holds only active records. So this is a
completeness/latency risk during rollout, not a correctness cliff.
**Altitude / precedence:** `docs/decisions.md` (+ topic files) is **normative/current** ("the rule is
X") — the `ErsatzTV-Decisions` wing, authority for "what is the current rule." Gitea issues are
**evidentiary/historical** ("we worked X on date D; spec, discussion, outcome") — the `Gitea-ErsatzTV`
wing, authority for "how was this handled / what was the context." A decision record points to its
issue; the issue carries the provenance the record compresses. Same fact, two altitudes — canonical
Markdown wins for "current."
**Issues in MemPalace are for DISCOVERY, not queue state.** Encounter a problem → search MemPalace →
find relevant docs AND relevant open issue(s): this **avoids filing duplicates** and **surfaces
bundles** (related issues to pick up together). But a MemPalace issue hit is a *candidate*:
open/closed/claimed/blocked/priority flip constantly and MemPalace lags (seconds–1h, up to a week if
the webhook is down), so a hit may be a since-closed issue shown open, or miss a just-filed one.
**Always re-confirm live state in Gitea (`scripts/select-queue.sh`) before acting** — never treat a
MemPalace issue hit as current queue state.
**What to mine per issue:** open issue → the BODY (dedup + bundle-clustering; no closing record yet).
Closed issue → body + the `## Closing record` (how it was resolved). Ephemeral comments (claim /
progress / `Review-verdict:`) → skip or de-weight both ways — process exhaust, not the knowledge
store. The `## Closing record` is the one structured per-issue summary meant for retrieval + export.
**Staleness bounds** (so agents know when to distrust a hit): webhook re-mine in seconds; hourly
reconcile; weekly full sweep catches file moves/deletes. Worst case before a supersession takes effect
in retrieval: ~1h, or ~1 week if the webhook is down and only the move happened. When in doubt, fall
back to exact search (bullet 4 above).
**Never** derive live queue state from MemPalace, #237, or historical comments.
Then work the queue:
1. Unless the user named an issue, dispatch or obtain the mandatory low-cost selector packet. The
**selector**, not the orchestrator, reads the pinned tracker **ersatztv#237** — body = goal + ordered
arc + session protocol — and its **last ~6 session comments** (newest-first; the full comment
payload is large, so stop at ~6).
**SOURCE OF TRUTH = live Gitea issue state, NEVER the prose.** The arc body carries ORDER + goal
only; a session comment's "Recommended next" is a forward *guess* written before the next session
acted. Both go stale the instant an item closes (especially under parallel sessions narrating each
other's work as "the gate that unblocks X"). So derive the candidate set from LIVE state, not from
any inline marker or a prior comment's "next": the **current gate = the lowest-numbered OPEN arc
item in #237's arc list**; its open children are the gate cluster (query them by the `review`
label). Cross-check every arc / "recommended" item's real open/closed state (issue **and**
milestone) before trusting it — do NOT hardcode which issue is the frontier; read it. Candidate
discovery is a bounded cascade, not a full inventory: query **arc → OPEN issues assigned to OPEN
milestones → open `review` → unmilestoned/unreviewed `priority: high` → `priority: medium` →
`priority: low`**, carrying eligible unique results forward until the shortlist contains five issues
or all tiers are exhausted. Milestone records are tier metadata, NEVER pickup candidates; an OPEN
milestone with zero eligible OPEN issues contributes zero candidates.
This priority-label fall-through is mandatory: an empty arc/milestone/review pool is never evidence
that the queue is empty. Each priority tier queries all OPEN `timothy/ersatztv` issues carrying that
label, not only IDs mentioned in #237 or recent comments, and excludes pull requests. Treat an
umbrella/epic as a container rather than a pickup when #237 names its eligible children. In the
review tier, ALSO list
open `ersatztv`-labeled issues in **timothy/adversarial-reviewer** — unclaimed audits there are
pickup candidates too (read-only, parallel-safe; see the tracker's "Pending adversarial reviews"
section). Reviewer audits are claimed by comment: a claim remains active until a later comment
explicitly releases or abandons it, and a posted audit/review deliverable is completed work even
when its issue stays open for implementer replies. If the Gitea MCP is down, hit the REST API
directly (use credentials supplied by the environment or your global client instructions; never
print them):
`curl -u <user>:<pass> http://192.168.1.95:3000/api/v1/repos/timothy/ersatztv/issues/237`.
**The authoritative pickup + ranking protocol lives in #237's "Session protocol" section — this is a summary; if the two ever disagree, #237 wins.**
2. The selector returns the highest-ranked eligible candidate plus up to four fallbacks. Apply this
strict tier order: **(1)** open arc items in #237 arc order; **(2)** OPEN issues assigned to an OPEN
milestone;
**(3)** OPEN `review`-labeled issues and eligible reviewer-repo audits; **(4)** remaining
unmilestoned/unreviewed `priority: high` issues; **(5)** `priority: medium`; **(6)** `priority: low`.
Within milestone and review tiers, order by `priority: high` > `medium` > `low`; for otherwise equal
candidates preserve #237's explicit eligible order, then use lowest issue number. At every tier exclude
pull requests, CLOSED issues, `in-progress` claims, `parked` issues, issues blocked by a CLOSED milestone,
**any issue with an open `blocked-by` dependency** (`GET /issues/{n}/dependencies`; Gitea auto-clears the
block when the blocker closes — do not pick an issue ahead of its open blocker), containers whose children
are the pickups, and reviewer audits that are already claimed or have a posted deliverable. Note the
2026-07-17 convention: `parked` (no concrete plans) issues are **closed**, not left parked, so `parked`
should rarely appear; if it does, treat it as excluded and surface it to the user.
Query the next tier only while fewer than five eligible unique candidates have been collected; do not
enumerate the remainder after the shortlist is full.
The orchestrator then makes one focused Gitea read to confirm the proposed winner is still OPEN,
unclaimed, and not blocked by a closed milestone; if it changed, check the next supplied fallback.
**An empty arc frontier is not a stopping condition.** If the selector returns any eligible
candidate, claim its top-ranked winner; do not ask the user to choose merely because candidates
belong to different workstreams.
Do not reread the full tracker or comments for selection. If the prose says "recommended next / now
unblocked" but the issue (or its milestone) is already CLOSED, it is done — skip it and fix the
stale line in your session comment. Prose lags live state; live state wins; tier + `priority:` labels
decide order, not the prose. Never invent a fix-size, recency, or perceived-relevance tiebreaker.
(This mirrors #237's Session-protocol ranking — #237 is canonical.)
1. Run the two tracks above (orientation always; selection unless an issue is named).
2. If Track B ran: apply its ranked shortlist. The orchestrator makes one focused live recheck of the
winner (still OPEN, unclaimed, not blocked) before claiming; if it changed, check the next fallback.
**An empty backlog is not a stopping condition** — if the selector returns any eligible candidate,
claim its top-ranked winner; do not ask the user to choose merely because candidates belong to
different workstreams. Never invent a fix-size, recency, or perceived-relevance tiebreaker.
3. **Claim it**: add the `in-progress` label + a "claiming" comment on the issue(s);
reviewer-repo audits are claimed by comment only. Treat that claim as live until a later comment
explicitly releases or abandons it, and exclude audits with a posted deliverable even while the
issue remains open for implementer replies.
4. Read the issue bodies (they carry the task context/evidence) and work the item under the
HARD CONSTRAINTS below.
5. Finish by following the session-end protocol in #237: run the **H12 qualification audit**
5. Finish the session: run the **H12 qualification audit**
(`ETV_GITEA_BASICAUTH=user:pass scripts/issue-qualification-audit.sh`) and add a `priority:`
label to anything it lists (every issue you filed this session included); then ONE session
comment on the tracker (template in the tracker body, incl. triage verdicts for any new issues),
remove your `in-progress` labels, and complete the per-issue Task Completion Protocol from the
applicable `AGENTS.md` / `CLAUDE.md` instructions (including the `done` workflow when required).
label to anything it lists (every issue you filed this session included); post a `## Closing
record` (template below) on each issue you closed or substantially progressed; remove your
`in-progress` labels; and complete the per-issue Task Completion Protocol from the applicable
`AGENTS.md` / `CLAUDE.md` instructions (including the `done` workflow when required).
## Closing record (session-end / issue-close artifact)
Post this as the structured closing comment on any issue you close (or substantially progress) — it
is both the human-readable summary and the per-issue unit MemPalace mines for retrieval:
```markdown
## Closing record
**Outcome:** <what shipped / what didn't; PR link>
**Root cause:** <for bug fixes/incidents — why the problem existed, or "unknown, see follow-up #N">
**Decisions/conventions changed:** <keys added/superseded in docs/decisions.md, or "none">
**Reusable knowledge:** <a fact/gotcha worth surfacing to a future session or MemPalace search>
**Verification:** <tests run, live-E2E, CI status>
**Deferred:** <anything explicitly punted, with a follow-up issue link, or "none">
**Docs updated:** <which docs/*.md files changed in this PR, or "none required and why">
```
HARD CONSTRAINTS:
- Work in worktrees off `origin/main` — ALWAYS, including for a one-line docs commit. `/Users/timothy/ersatztv`
@@ -315,58 +341,19 @@ HARD CONSTRAINTS:
> (+ `api-conventions.md` §7a/b/c for the concurrency/side-effect mechanics, `spa-conventions.md`,
> `e2e-local.md`). Do NOT re-record a code/API/SPA decision here — it will duplicate and drift.
> Pruned 2026-07-12: issue-specific engineering bullets now covered in those docs, and dead
> Blazor-parity process notes, were removed (git history has them).
> Blazor-parity process notes, were removed (git history has them). Pruned 2026-07-21: pre-script
> selector lore and the #237-specific queue-drift narrative moved to the archived section below —
> the mechanism they describe no longer exists.
- READ docs/README.md → the convention docs FIRST; point recon/implementer agents at specific
doc sections. Only recon the task-specific delta.
- **The mechanical selection checks now live in `scripts/select-queue.sh` — run it instead of
re-deriving them by hand (2026-07-19).** The three bullets below are the *evidence* for why the
script exists: a cheap model repeatedly reported blocked issues as `deps:clear`, mis-tiered on the
no-op `?milestones=` filter, and ranked by issue number instead of priority-within-tier — so the
lore grew to "re-derive the whole contested tier every session," which is exactly the tax the
script pays down. The script does the deterministic work in code (dependency exclusion via
- **The mechanical selection checks live in `scripts/select-queue.sh` — run it instead of
re-deriving them by hand.** It does the deterministic work in code (dependency exclusion via
`GET /dependencies`, LOCAL `.milestone.state`/`review`/`priority:` tiering, (tier, priority, issue#)
ordering, `in-progress`/`parked`/PR exclusion) and only *flags* `CLAIM?`/`UMBRELLA?` for judgment.
**Trust its DEPS/tiering/ordering; do the focused recheck only on the flagged rows.** Keep the
evidence bullets below (they explain the failure modes the script encodes), but the *prescription*
is now "run the script," not "hand-re-derive." If you extend the tiers/filters, update the script
first, then these bullets.
- **Gitea milestone-name issue filter silently NO-OPS on names with special chars (2026-07-17,
#77 selection)**: `GET /issues?milestones=<name>` returns the WHOLE open-issue list — not a
filtered set — when the milestone title contains `:` or `+` (e.g. `Scheduling: refactor +
distribution`), because the raw name doesn't round-trip through Gitea's filter. A selector that
trusts that response will mis-tier issues (it made #72 look like a milestone-10 member when it's
unmilestoned, and hid #77's true sibling set). **Robust recipe: fetch all open issues once and
filter LOCALLY on each issue's `.milestone.title`** (`?state=open&type=issues&limit=50`, then
`[i for i in issues if (i['milestone'] or {}).get('title')==NAME]`) — do not rely on the
server-side `milestones=` name filter. If a count looks suspiciously like "all open issues," that
filter silently failed; re-derive membership locally. (Dependencies API is fine: `POST
/issues/{n}/dependencies` with `{"owner","repo","index"}` sets blocked-by; the bare `{index}`
form 201s but may not attach — verify with the GET.)
- **Confirmed again + widened (2026-07-17, #72/#164 selection): treat EVERY mechanical claim in the
selector packet as unverified — not just deps and priority.** That run's dependency data was
correct, yet it still ranked **#383 first while missing that #384 was `in-progress`** (claimed 40
minutes earlier) **and that #383 is that bundle's umbrella** (its body: "Follow-up arc to #69" with
#384–#386 as deferred sub-work). Claiming its #1 pick would have collided head-on with a live
parallel session. The packet does not reliably see: `blocked-by`, priority-within-tier,
**`in-progress` claim state**, or umbrella-vs-child. Before claiming, check the candidate's **last
comments** for a live claim (a claim stays live until explicitly released) and read its **body** for
umbrella framing. An empty-ish tier is normal in maintenance mode — three of the four open
milestone issues that day were legitimately blocked or claimed, which is the expected steady state,
not a reason to relax the checks.
- **The cheap selector's dependency + priority data is NOT trustworthy — re-derive the whole contested tier,
not just the winner (2026-07-17, #73 selection)**: the selector packet reported **#385/#386 as `deps:clear`
when both were blocked** (#385 by open #70; #386 by open #385+#384) — it never called
`GET /issues/{n}/dependencies` — and **missed #383 entirely** (the only `priority: medium` in tier 1),
ranking by issue number and ignoring the priority-within-tier rule. Either error alone produces a bad
pickup: working a blocked issue, or skipping the top-priority one. The kickoff's "orchestrator makes one
focused recheck of the **winner**" is **insufficient** whenever a tier has >1 candidate — a wrong winner is
invisible to a winner-only recheck. **Recipe: fetch all open issues once, filter locally on
`.milestone.title`/labels (the `?milestones=` filter no-ops on `:`/`+` names — see the bullet above; both
current open milestones have them), then run `GET /issues/{n}/dependencies` yourself on every candidate you'd
plausibly claim.** That's ~3 cheap calls and it is the only thing standing between the packet and a wasted
session. Keep delegating selection (it's still not orchestrator work) — just verify its two mechanical
outputs (deps, priority order) rather than its ranking prose.
**Trust its DEPS/tiering/ordering; do the focused recheck only on the flagged rows.** If you extend
the tiers/filters, update the script first, then these bullets. (See the archived section below for
the pre-script failure modes that motivated writing it, if you need the history.)
- **Codex cheap-worker launch (tested 2026-07-14)**: the native `spawn_agent` interface currently
has no model/effort selector, so it provides parallelism but not cost savings. For bounded,
tool-bearing selector/recon work, launch a separate worker with
@@ -437,7 +424,7 @@ HARD CONSTRAINTS:
refs/heads/v4: …` is act refreshing its `/root/.cache/act` action cache and is followed by `Cloned …`
— it is NOISE, not a cause. Grep for the failure marker, not for the word "error".
- **`cancelled` is NOT `failure` — never read a cancel as a CI verdict** (2026-07-17, operator-surfaced).
The operator cancels runs by hand (they're the only one who can — see the batching constraint), and a
The operator cancels runs by hand (they're the only one who can — see the batching constraint above), and a
run-level `conclusion: cancelled` means **no verdict**, not a pass and not a fail. Two traps: (1) a
run whose overall state is `failure` may hold a *genuine* job failure that happened **before** the
cancel — check job-level `conclusion` + timestamps, don't attribute it to the cancel; (2) a
@@ -467,16 +454,15 @@ HARD CONSTRAINTS:
(tiny ffmpeg testsrc MKVs + `LibraryPath` SQL rows + scan). Live-E2E is a **stated requirement**
for write-path handler changes — see that doc's "When live-E2E is required" + the decisions.md
entry; it's the only net for the lazy-enumeration / reload-through-read-path 500 class (#229).
- **Parallel sessions (2026-07-11 protocol)**: claim before working (`in-progress` label — the
tiny read→claim race window is accepted; later claimant backs off). Claiming prevents
duplicate pickup, NOT overlapping code changes — check the tracker's dependency notes
("#234 after #231", "coordinate with #215") before touching shared surfaces. Editing THIS
lore: prune covered/stale bullets too (not append-only — git keeps history), `git pull --rebase`
before commit. Two runners (ci-runner VM 127 + bumblebee-runner, 4 slots); **no cancel route exists
on this Gitea version — verified 1.25.4: REST and MCP `cancel_run` both 404** (see the batching
constraint above). Superseded runs do finish on their own, but they hold a runner slot while doing
it, so with 4 parallel sessions they are a real cost — batch pushes rather than relying on them to
drain.
- **Parallel sessions**: claim before working (`in-progress` label — the tiny read→claim race window
is accepted; later claimant backs off). Claiming prevents duplicate pickup, NOT overlapping code
changes — check the issue's dependency notes ("#234 after #231", "coordinate with #215") before
touching shared surfaces. Editing THIS lore: prune covered/stale bullets too (not append-only — git
keeps history), `git pull --rebase` before commit. Two runners (ci-runner VM 127 + bumblebee-runner,
4 slots); **no cancel route exists on this Gitea version — verified 1.25.4: REST and MCP
`cancel_run` both 404** (see the batching constraint above). Superseded runs do finish on their own,
but they hold a runner slot while doing it, so with 4 parallel sessions they are a real cost — batch
pushes rather than relying on them to drain.
- **Two sessions touching one machine**: a branch may be checked out in ANOTHER session's
worktree — never commit/merge inside a worktree you didn't create. To land a merge on such a
branch without touching their checkout: plumbing merge (`git read-tree -m base ours theirs`
@@ -510,7 +496,7 @@ HARD CONSTRAINTS:
them plausibly-but-wrong and `npm run check:api` is the guard. Escape hatch for a deliberate
non-rebased push: `ETV_SKIP_REBASE_CHECK=1 git push`.
- **H12 issue-qualification audit** (ersatztv#312, `scripts/issue-qualification-audit.sh`): a
session-end check that lists OPEN issues missing a `priority:` label — the #237 ranking keys off
session-end check that lists OPEN issues missing a `priority:` label — the queue tiering keys off
`priority:`/gate labels, so an unlabeled issue is invisible to it. "Fully qualified" = has a
`priority: {high,medium,low}` label (that signals triage ran; gate-vs-backlog is then derivable
from the `review` label / milestone, and a milestone is NOT required — backlog is unmilestoned).
@@ -582,20 +568,46 @@ HARD CONSTRAINTS:
`CancellationTokenSource.CancelAfter(timeout)` into BOTH `SendAsync` and the stream reads +
`HttpClient.Timeout = InfiniteTimeSpan`; catch transport/timeout exceptions and turn them into a response.
(Not yet in decisions.md — #289 landed on PR#76, not main.)
- **Queue-drift root cause + standing rule (2026-07-12, user-surfaced)**: pickups repeatedly re-picked
already-done work — #91b was framed "recommended next / now unblocked" for two sessions *after* it had
merged (2026-07-11), and the #251/#252 priority-pickups sat listed "open" after closing — requiring a
reactive body correction (tracker comment 16:00). ROOT CAUSE: DONE/OPEN status was read from **prose** (the
arc body's inline "DONE" markers + each session comment's "Recommended next"), which is append-only and
hand-edited, so it lags real issue state — worst under parallel sessions that narrate each other's merges as
"the gate that unblocks X" (#271 got cast as the last gate for an already-merged #91b). It is a *structural*
bug, not a stale-writer bug: any status embedded in prose will drift. STANDING FIX (don't just re-patch the
body next time): **live Gitea state is the ONLY source of truth for status.** The arc body carries order+goal;
a comment's "Recommended next" is a *candidate* that MUST be re-verified OPEN (issue **and** milestone) at
pickup. When prose disagrees with live state, live state wins — correct the prose in your session comment,
never propagate it. STRUCTURAL CURE (2026-07-12 review, Fable): #237's arc no longer carries inline `DONE`
markers — closed items move to a "Done (history)" section, so status lives ONLY in live Gitea state and can't
drift; and the gate/frontier is defined **structurally** (lowest-numbered open arc item), never hardcoded to
an issue number. Beware: the *first* pass at this fix re-planted the very bug by hardcoding "#197 cluster" /
"#91b milestone CLOSED" into the kickoff — if you name today's frontier issue in this standing file, you are
writing the next drift. Gate cluster = open `review`-labeled issues serving the current open arc item.
---
## Archived — pre-script selector history (do not follow)
> This section is history, not instruction. It explains why `scripts/select-queue.sh` exists and
> why the closed #237 tracker used to be the queue-state store; none of it is a live protocol. The
> current protocol is "Two concurrent tracks at session start" above.
- **(Pre-2026-07-19) Before the selector script existed**, a cheap model was dispatched each session
to rank the backlog by reading tracker prose directly, and the orchestrator was told to RE-DERIVE
its mechanical claims because the model kept getting them wrong: it reported blocked issues as
`deps:clear` (never called `/dependencies`), mis-tiered issues when the server-side `?milestones=`
filter silently no-ops on `:`/`+` names, ranked by issue number and ignored priority-within-tier,
and missed live `in-progress` claims. `scripts/select-queue.sh` was written to do the mechanical
parts deterministically in code instead — the evidence bullets below are kept for context, not
because you need to re-derive anything by hand anymore.
- **Gitea milestone-name issue filter silently NO-OPS on names with special chars (2026-07-17,
#77 selection)**: `GET /issues?milestones=<name>` returns the WHOLE open-issue list — not a
filtered set — when the milestone title contains `:` or `+` (e.g. `Scheduling: refactor +
distribution`), because the raw name doesn't round-trip through Gitea's filter. A selector that
trusts that response will mis-tier issues (it made #72 look like a milestone-10 member when it's
unmilestoned, and hid #77's true sibling set). Robust recipe (now encoded in the script): fetch
all open issues once and filter LOCALLY on each issue's `.milestone.title`.
- **Confirmed again + widened (2026-07-17, #72/#164 selection): the packet does not reliably see
`blocked-by`, priority-within-tier, `in-progress` claim state, or umbrella-vs-child** — that run's
dependency data was correct, yet it still ranked #383 first while missing that #384 was
`in-progress` (claimed 40 minutes earlier) and that #383 is that bundle's umbrella. The script's
`CLAIM?`/`UMBRELLA?` flags now surface exactly this instead of relying on a full manual re-check.
- **The cheap selector's dependency + priority data was NOT trustworthy — the fix was to make the
script compute them, not to re-derive the whole contested tier by hand every session** (2026-07-17,
#73 selection): the old packet reported #385/#386 as `deps:clear` when both were blocked, and
missed #383 entirely (the only `priority: medium` in tier 1). The script now runs
`GET /issues/{n}/dependencies` on every surviving candidate and tiers by priority-within-tier
deterministically, closing this class.
- **Queue-drift root cause (2026-07-12, user-surfaced, historical)**: pickups repeatedly re-picked
already-done work because DONE/OPEN status was read from **prose** (the old tracker's arc body
inline markers + session comments' "Recommended next"), which lags real issue state — worst under
parallel sessions narrating each other's merges. STANDING FIX (still the rule, just no longer tied
to any specific tracker): **live Gitea state is the ONLY source of truth for status**; a comment's
"Recommended next" is a candidate that MUST be re-verified OPEN before pickup, never propagated
when stale. Do not name today's frontier issue in this standing file — that's how the drift
started the first time.
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# ersatztv#520 — block re-treating the CLOSED arc tracker #237 as live queue state / source of truth.
# Scans active startup docs for forbidden phrasings. A hit is exempt when the line itself contains
# "archiv" OR the line is inside an archival section (a heading whose text contains "archiv", up to
# the next heading of the same or higher level). The "archiv" escape is an anti-footgun convenience,
# not an anti-adversary control.
set -euo pipefail
FILES=(
"docs/handoffs/chicorytv-issue-queue.md"
"docs/README.md"
"CLAUDE.md"
"scripts/select-queue.sh"
)
# Case-insensitive patterns that assert #237 is live/authoritative.
PATTERNS='read #237|#237.?s (body|arc|comments)|tracker #237|queue state lives in|read that, not this file'
rc=0
for f in "${FILES[@]}"; do
[ -f "$f" ] || continue
archive_level=0 # 0 = not in an archival section; else the heading level that opened it
lineno=0
while IFS= read -r line; do
lineno=$((lineno + 1))
# Track archival-section state via Markdown ATX headings.
if [[ "$line" =~ ^(#{1,6})[[:space:]] ]]; then
level=${#BASH_REMATCH[1]}
if printf '%s' "$line" | grep -qi 'archiv'; then
archive_level=$level
elif [ "$archive_level" -ne 0 ] && [ "$level" -le "$archive_level" ]; then
archive_level=0 # a same-or-higher heading closes the archival section
fi
continue
fi
[ "$archive_level" -ne 0 ] && continue # inside archival section → exempt
printf '%s' "$line" | grep -qi 'archiv' && continue # per-line escape
if printf '%s' "$line" | grep -qiE "$PATTERNS"; then
echo "kickoff-guard: $f:$lineno reintroduces #237-as-live-state: ${line}" >&2
rc=1
fi
done < "$f"
done
[ "$rc" -eq 0 ] && echo "kickoff-guard: OK"
exit "$rc"
+1 -1
View File
@@ -288,7 +288,7 @@ def main(argv=None) -> int:
ap = argparse.ArgumentParser()
ap.add_argument("--base")
ap.add_argument("--head")
ap.add_argument("--budget", type=int, default=4200) # aggregate; ratchet down as archive grows
ap.add_argument("--budget", type=int, default=4800) # aggregate; re-baselined post-#521 migration
args = ap.parse_args(argv)
records = dl.all_active_records()
+6 -5
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# scripts/select-queue.sh — deterministic queue selector for the #237 pickup protocol.
# scripts/select-queue.sh — deterministic queue selector (live Gitea state, never a tracker issue).
#
# WHY THIS EXISTS. The kickoff dispatches a cheap model to rank the backlog, and the lore then makes
# the orchestrator RE-DERIVE the selector's mechanical claims because a small model kept getting them
@@ -25,8 +25,9 @@
# whose most-recent comments look like a live claim so the orchestrator reads them before claiming.
# - UMBRELLA? — an epic/umbrella whose children are the real pickups reads like a normal issue; the
# script flags bodies that open with umbrella framing so the orchestrator treats it as a container.
# - ARC tier — arc order lives in #237's prose (currently CLOSED / arc complete), not in any label,
# so this script deliberately does NOT rank an arc tier. If an arc ever re-opens, read #237.
# - ARC tier — there is no active arc right now (maintenance/backlog mode; arc complete), so this
# script deliberately does not rank an arc tier. If a new arc/milestone is ever established, add
# it as a tier here — never fall back to hand-ranking from a tracker's prose.
#
# Usage:
# ETV_GITEA_BASICAUTH=user:pass scripts/select-queue.sh [N]
@@ -94,7 +95,7 @@ rows=$(
| (($L | index("review")) != null) as $isReview
| ((.milestone != null) and (.milestone.state == "open")) as $inOpenMs
# tier: 2=open-milestone, 3=review, 4/5/6=priority high/medium/low (unmilestoned/unreviewed).
# (Tier 1 = arc; not label-derivable, handled by the orchestrator via #237 prose.)
# (Tier 1 = arc; there is no active arc right now — see the header comment above.)
| (if $inOpenMs then 2
elif $isReview then 3
elif $prank==0 then 4
@@ -162,4 +163,4 @@ done <<< "$rows"
echo
echo "Ranked by (tier, priority, issue#). DEPS/tiering/ordering are deterministic — trust them."
echo "Resolve CLAIM?/UMBRELLA? flags before claiming (read the issue's comments/body). Arc tier: read #237."
echo "Resolve CLAIM?/UMBRELLA? flags before claiming (read the issue's comments/body). No active arc tier right now."