| 1 | ## User Directive: Write Issues Before Development [2026-06-06T21:23:50.664+00:00] |
| 2 | |
| 3 | **By:** jmservera (via Copilot) |
| 4 | |
| 5 | **What:** Respect the way we work: write issues for plans before jumping straight on to development. |
| 6 | |
| 7 | **Why:** User request — captured for team memory |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | # Run 27055543722 — Analysis Failure Root Cause & Diagnosis [2026-06-06] |
| 12 | |
| 13 | ## Executive Summary |
| 14 | |
| 15 | Workflow run 27055543722 confirmed persistent analysis failures traced to **AI output contract inconsistency**, **deterministic retry loops**, and **unavailable fallback**. The crawler was healthy; analysis failed deterministically after ~25 minutes across all Copilot attempts, falling through to no-AI fallback which the safety manifest correctly blocked. |
| 16 | |
| 17 | ## Consolidated Root Causes (Ranked by Confidence) |
| 18 | |
| 19 | ### 1. Prompt/Spec/Gate Schema Drift — Very High Confidence |
| 20 | - `prompts/analyze-weekly.md` and `docs/analysis-spec.md` specify predictions as `{repo, direction, confidence}` |
| 21 | - `scripts/analysis_gate.py` requires `predictions[].claim_type in {signal, noise, gap}` |
| 22 | - Run 27030646485: All 3 Copilot attempts failed on `predictions[*].claim_type must be one of signal, noise, gap` |
| 23 | - Run 27055543722: Same deterministic failure across all 3 attempts |
| 24 | - **Immediate action:** Align contract; update gate or prompt to match |
| 25 | |
| 26 | ### 2. Context Bloat & Undercounted Preflight — Very High Confidence |
| 27 | - Preflight estimates: ~74k tokens (raw JSON + skills only) |
| 28 | - Actual final ledger: ~113k tokens (preflight + template + identity/wisdom + prior summary + press context + agent wrapper) |
| 29 | - Gap of ~39k tokens (38% undercount) dilutes model attention |
| 30 | - Renders skills payload (~45.8 KB / 11.4k tokens) contains unrelated operational/design skills, not analysis-specific |
| 31 | - **Immediate action:** Render exact prompt before preflight; use analysis-specific wisdom capsule |
| 32 | |
| 33 | ### 3. Blind Deterministic Retry Loop — Very High Confidence |
| 34 | - Three full Copilot attempts (9-11 min each) repeated identical flawed prompt |
| 35 | - No gate-error classification or deterministic repair (e.g., timestamp/schema normalization) |
| 36 | - Retries waste 25-29 minutes, then fall through to no-AI |
| 37 | - **Immediate action:** Classify gate failures; repair frontmatter once; fail-fast on systematic errors |
| 38 | |
| 39 | ### 4. Unavailable AI Fallback — High Confidence |
| 40 | - GitHub Models configured to `openai/gpt-4o` → `403 no_access` on both runs |
| 41 | - No fallback to accessible model; pipeline jumps directly to no-AI |
| 42 | - **Immediate action:** Preflight model access before expensive Copilot attempts |
| 43 | |
| 44 | ### 5. No-AI Fallback Provenance Not Enforced — High Confidence |
| 45 | - `analysis_gate.py` checks structure only, not provenance |
| 46 | - No-AI output (quality_score 62, self-referential language) passed structural gate |
| 47 | - Run 27030646485: No-AI published despite existing AI article from previous week |
| 48 | - **Immediate action:** Enforce no-AI publish-blocking in manifest (already done in #249); add to diagnostics |
| 49 | |
| 50 | ### 6. Weak Evidence/Citation Validation — Medium-High Confidence |
| 51 | - Gate does not validate repo-link coverage (every mentioned repo must be `[owner/repo](url)`) |
| 52 | - Gate does not validate press citation integrity or that links resolve to retained articles |
| 53 | - No-AI fallback uses raw descriptions without editorial curation |
| 54 | |
| 55 | ### 7. Learned Context Overhead & Agent Wrapper — Medium-High Confidence |
| 56 | - Workflow calls `copilot --agent squad` for publication analysis |
| 57 | - Squad agent adds routing/delegation instructions on top of the rendered prompt |
| 58 | - Flat skills bundle mixes unrelated squad operational skills with analysis context |
| 59 | |
| 60 | ## Recommended Immediate Fixes |
| 61 | |
| 62 | ### 1. Align Prediction Contract (Blocker for Next Run) |
| 63 | - **Decision:** Require `claim_type in {signal, noise, gap}` (supports hindsight classification) |
| 64 | - **Actions:** |
| 65 | - Update `docs/analysis-spec.md` and `prompts/analyze-weekly.md` to specify predictions as `{repo, claim_type, direction, confidence}` |
| 66 | - Add contract-drift test: parse docs/prompt/gate and assert matching prediction schema |
| 67 | - Add regression fixtures for bad-date and prediction-shape errors |
| 68 | |
| 69 | ### 2. Deterministic Frontmatter & Repair Loop |
| 70 | - **Actions:** |
| 71 | - Precompute and mechanically inject `date`, `week`, `year`, `repos_featured`, `stars_tracked` |
| 72 | - Add focused repair prompt for gate failures (classifies errors; repairs timestamp/schema once) |
| 73 | - Fail-fast if error is systematic; do not retry if only deterministic fields are wrong |
| 74 | |
| 75 | ### 3. Exact Rendered Prompt Preflight |
| 76 | - **Actions:** |
| 77 | - Build `analysis-input-manifest.json` with component byte/token counts |
| 78 | - Render exact prompt (template + raw JSON + wisdom + skills + press context + prior summary) |
| 79 | - Compare rendered-prompt estimate to final ledger; fail or compact if gap > 10% |
| 80 | |
| 81 | ### 4. Analysis-Specific Wisdom Capsule |
| 82 | - **Actions:** |
| 83 | - Replace full learned-context injection with `{{EDITORIAL_WISDOM_CAPSULE}}` (~1-2k tokens max) |
| 84 | - Select only analysis-relevant learnings; exclude operational/design/PR workflow skills |
| 85 | - Keep prior-week continuity notes (~500 tokens) for editorial context |
| 86 | |
| 87 | ### 5. GitHub Models Access Preflight |
| 88 | - **Actions:** |
| 89 | - Add fast `models-health` check before Copilot attempts |
| 90 | - If configured model is inaccessible, switch to known-good fallback or mark unavailable up front |
| 91 | - Record provider/model/access status in `models-health.json` artifact |
| 92 | |
| 93 | ### 6. No-AI as Diagnostic Only |
| 94 | - **Actions:** |
| 95 | - Keep no-AI fallback for diagnostics/artifact purposes |
| 96 | - Tag as `diagnostic_no_ai_candidate` (not fallback recovery) |
| 97 | - Ensure manifest blocks promotion unless explicit force flag is set |
| 98 | - Do not let no-AI replace existing good AI article |
| 99 | |
| 100 | ### 7. Direct Analyzer Invocation |
| 101 | - **Actions:** |
| 102 | - Stop calling `--agent squad` for publication analysis |
| 103 | - Use plain Copilot CLI or minimal analyzer agent (Farnsworth-only) |
| 104 | - Remove squad routing/delegation context from analysis prompt |
| 105 | |
| 106 | ## Map/Reduce Status |
| 107 | |
| 108 | **Hold for now.** Map/reduce remains dry-run candidate only after immediate fixes land. The signal-type claim-ledger architecture is sound but adding a second pipeline before deterministic contract/repair/preflight are solid risks masking the same root causes across more calls. |
| 109 | |
| 110 | ## Observability to Add |
| 111 | |
| 112 | - `analysis-input-manifest.json`: component token counts by segment |
| 113 | - `analysis-attempts.jsonl`: per-attempt provider, model, duration, gate errors, failure class |
| 114 | - `models-health.json`: endpoint, model, access status, fallback selected |
| 115 | - `gate-report.json`: structured `analysis_gate.py` output |
| 116 | - Persist failed candidates under `data/candidates/{week}/{run_id}/` for reproduction |
| 117 | |
| 118 | ## Acceptance Criteria for Next Run |
| 119 | |
| 120 | 1. ✅ Prediction contract aligned across docs, prompt, gate |
| 121 | 2. ✅ Exact rendered-prompt preflight within 10% of final ledger |
| 122 | 3. ✅ Deterministic frontmatter/schema failures do not trigger full retries |
| 123 | 4. ✅ GitHub Models access is preflighted or marked unavailable |
| 124 | 5. ✅ No-AI manifest blocks promotion unless existing AI article is gone |
| 125 | 6. ✅ Final markdown passes both structural and evidence-citation gates |
| 126 | 7. ✅ Attempt artifacts retained for root-cause analysis |
| 127 | |
| 128 | ## Cross-Team Notes |
| 129 | |
| 130 | - **Farnsworth:** Comprehensive root-cause diagnosis and process proposal documented |
| 131 | - **Bender:** Pipeline failure mechanics, contract mismatch, context bloat analysis |
| 132 | - **Fry:** QA test fixtures, gate/spec alignment, publish protection test plan, rollout phases |
| 133 | - **Leela:** Issue hierarchy (#248-#261), GitHub creation/updates, PR #245 safety review |
| 134 | |
| 135 | ## Related Issues |
| 136 | |
| 137 | - #248 — Parent epic: protect published analysis from unsafe reruns |
| 138 | - #249 — Publish eligibility manifest with no-AI blocking (✅ safety gate worked this run) |
| 139 | - #255 — Strengthen publish gate beyond structural validation |
| 140 | - #256 — Deterministic preflight compaction and fallback policy |
| 141 | - #265 — Triaged run 27055543722 as real P0 analysis bug |
| 142 | - #266 — New immediate P0 child for contract alignment and deterministic repair |
| 143 | |
| 144 | --- |
| 145 | |
| 146 | --- |
| 147 | |
| 148 | ## Run 27056632166 — Successful analysis and publish cycle |
| 149 | |
| 150 | **Date:** 2026-06-06T07:43:44.173+00:00 |
| 151 | **Run:** #27056632166 |
| 152 | **Status:** ✅ End-to-end success: Copilot analysis passed; publish manifest decision promoted; generate/deploy succeeded; notify skipped (publish_release=false) |
| 153 | |
| 154 | ### Key outcomes |
| 155 | |
| 156 | - **Analysis:** Copilot-only path completed successfully with prediction schema aligned and gate passing |
| 157 | - **Publish decision:** Manifest promotion confirmed eligibility; run 27055543722 overwrite-protection validated |
| 158 | - **Deploy:** Content and weekly page generated and deployed to main |
| 159 | - **PRs merged:** #267, #268, #271, #272 integrated into main |
| 160 | |
| 161 | ### Related PRs and commits |
| 162 | |
| 163 | - **#267** (QA guard prediction schema repair loop): Fixed schema mismatch between prediction format and `analysis_gate.py` requirement; validated with regression tests |
| 164 | - **#268** (Copilot-only analysis): Made weekly analysis Copilot-only with failure classifier and token-renewal issue handling |
| 165 | - **#271** (Exclude squad state from publish sync): Fixed publish sync to exclude .squad directory |
| 166 | - **#272** (Sync publish data to main): Successfully synced generated content and data to main |
| 167 | |
| 168 | ### Failure classification and handling |
| 169 | |
| 170 | - **Run 27055543722 failure** (safely blocked): No-AI blocked by publish manifest; no overwrite occurred |
| 171 | - **Immediate action:** Created issue for Copilot token renewal if needed; classified failures by cause (inaccessible, token, context, timeout, transient, other) |
| 172 | |
| 173 | ### Analysis insights |
| 174 | |
| 175 | - Analysis time: ~28m41s with initial Copilot attempts |
| 176 | - Token usage: ~112.9k estimated input tokens |
| 177 | - Crawl/news: Healthy; no performance issues |
| 178 | - Press context: Capped at ~8k tokens; working as designed |
| 179 | - Key learning: Schema contract discipline prevents retry cascade |
| 180 | |
| 181 | ### Follow-up PRs and decisions |
| 182 | |
| 183 | - **#269** (closed as unsafe): Would have regressed .squad state; closed per safety policy |
| 184 | - **#270** (closed): Superseded by #271 and #272 |
| 185 | - **#271 & #272** (merged): Safely synced generated content and squad state exclusion |
| 186 | |
| 187 | ### Decision summary |
| 188 | |
| 189 | 1. ✅ Copilot analysis Copilot-only when GitHub Models/OpenAI unavailable |
| 190 | 2. ✅ Token failures fail immediately with issue creation for renewal |
| 191 | 3. ✅ Transient failures retry; eventually fail for rerun |
| 192 | 4. ✅ Publish manifest blocks unsafe reruns effectively |
| 193 | 5. ✅ No-AI candidates tagged diagnostic, not as fallback recovery |
| 194 | 6. ✅ Schema contract alignment prevents retry cascade |
| 195 | |
| 196 | ### Model research outcome |
| 197 | |
| 198 | Model recommendations from #268 analysis: |
| 199 | - **GPT-5.5**: Best choice for high-reasoning coding/editorial (high cost) |
| 200 | - **GPT-5.3-Codex / Sonnet**: Routine coding tasks |
| 201 | - **Haiku / GPT mini**: Mappers and Scribe tasks |
| 202 | - **Cross-family rubber-duck reviews**: Recommended for code quality |
| 203 | |
| 204 | --- |
| 205 | |
| 206 | ## Analysis Decomposition Feasibility & Architecture |
| 207 | |
| 208 | **Authors:** Bender (Crawler & Data Collector), Farnsworth (Content Curator), Fry (QA) |
| 209 | **Date:** 2026-06-05T20:57:09.910+00:00 |
| 210 | **Status:** Recommendation finalized; proceeding post-safety layer |
| 211 | |
| 212 | ### Executive recommendation |
| 213 | |
| 214 | **Adopt hierarchical claim-ledger map/reduce pipeline with signal-type mappers as MVP**, deterministic retrieval/compaction before every LLM call, and single reducer/final writer responsible for global thesis and reader-facing prose. |
| 215 | |
| 216 | **Best candidate:** deterministic preflight/compaction + signal-type claim-ledger mappers + reducer/editorial-plan + single final writer, run as non-publishing dry-run until rerun safety layer (#248-#259) is complete. |
| 217 | |
| 218 | ### Why this architecture wins |
| 219 | |
| 220 | 1. **Uses existing artifacts:** `data/raw/{week}.json`, `data/raw/{week}-external-news.json`, `data/analyzed/{week}-correlations.json`, rendered press context, prior summaries, token/cost telemetry |
| 221 | 2. **Deterministic slicing:** Matches current data contracts (`new_repos`, `trending_repos`, `press_correlations`, `prior_continuity`) |
| 222 | 3. **Minimal new machinery:** No embeddings, vector store, source-specific model swarm, or GitHub crawl matrix needed for MVP |
| 223 | 4. **Targets measured problem:** Analysis was ~28m41s with three failed Copilot gates and ~112.9k tokens; crawl/news healthy |
| 224 | 5. **Preserves quality:** Mappers emit cited JSON ledgers; reducer/final writer owns article voice; must pass `analysis_gate.py` + evidence-contract validator |
| 225 | |
| 226 | ### Rejected alternatives |
| 227 | |
| 228 | - **Source-specific news mappers:** Low MVP value; defer until source heterogeneity demands isolation |
| 229 | - **Independent full analyses + comparer:** Poor context hygiene; multiplies cost without improving provenance; acceptable only for human A/B during dry-run |
| 230 | - **Repo clusters first:** Risky without stable cluster IDs, overlap policy, and coverage accounting; phase 2 after deterministic topic/language sidecars |
| 231 | |
| 232 | ### MVP mappers (signal-type) |
| 233 | |
| 234 | 1. `signal-type:new-repos` — novelty, launch quality, repo clusters within discoveries |
| 235 | 2. `signal-type:trending-repos` — momentum, star gains, established anchors, noise |
| 236 | 3. `signal-type:press-correlations` — strong/weak alignment, divergence, source caveats |
| 237 | 4. `signal-type:prior-continuity` — prior predictions, reversals, follow-through |
| 238 | |
| 239 | ### Deterministic compaction (MVP, improves current path) |
| 240 | |
| 241 | **Before map/reduce:** |
| 242 | - Preflight computes authoritative totals, repo/article inventories, sizes, token estimates, source status, top candidates |
| 243 | - Emit compact per-slice evidence with: `full_name`, `url`, `description`, `language`, `topics`, `stars`, `stars_gained`, `created_at`, plus source/correlation metadata |
| 244 | - Remove repeated raw JSON, skills, boilerplate; keep untrusted evidence delimiters |
| 245 | - Cap press context; pass machine-readable correlation/article citations to press mapper |
| 246 | |
| 247 | **Avoid for MVP:** |
| 248 | - Embeddings/vector retrieval |
| 249 | - LLM choosing retrieval without deterministic coverage ledger |
| 250 | - Raw README fetching unless explicitly bounded and cached |
| 251 | |
| 252 | ### Data contracts (MVP minimum) |
| 253 | |
| 254 | 1. **Shared run context:** `run_id`, `week`, `current_datetime`, `raw_sha256`, `external_news_sha256`, `correlations_sha256`, `code_sha`, created timestamp |
| 255 | 2. **Preflight manifest:** Authoritative repos/counts/stars tracked, source coverage, citation inventory, token estimates by segment, slice definitions |
| 256 | 3. **Mapper output:** `analysis_map_v1` JSON with shard_id, input_refs, token estimate, coverage, claims/findings, citations, confidence, uncertainties, contradictions, status, model/provider, duration, errors |
| 257 | 4. **Reducer input:** Only preflight manifest + validated mapper ledgers + compact global metadata |
| 258 | 5. **Reducer output:** `analysis_editorial_plan_v1` with selected claims, citation bindings, rejected claims, contradictions, quality notes, title/top_repo/tags |
| 259 | 6. **Final writer output:** Existing markdown contract only; no mapper prose seams |
| 260 | 7. **Evidence validation:** Final repo/press links must resolve to inventories/ledgers before `analysis_gate.py` passes |
| 261 | |
| 262 | ### Fan-in failure policy |
| 263 | |
| 264 | - **Missing raw GitHub/preflight:** Fail closed |
| 265 | - **Missing required mapper (new_repos, trending_repos):** Fall back to current path |
| 266 | - **Missing optional mapper (press/prior):** Allowed with explicit degraded note and source caveat |
| 267 | - **Malformed mapper JSON/citations/week mismatch:** Reject and fail/degrade per shard criticality |
| 268 | - **Reducer over budget:** Compact or hierarchical reduce before model call |
| 269 | - **Final gate/evidence validation failure:** Do not publish map/reduce; preserve good article per #248-#259 |
| 270 | |
| 271 | ### Token/runtime baseline |
| 272 | |
| 273 | Known baseline: |
| 274 | - Final observed: ~112.9k input tokens / ~119.6k total |
| 275 | - Preflight estimated: ~74.3k |
| 276 | - Press context: ~8k tokens (capped) |
| 277 | - Wall time: ~28m41s across three Copilot attempts |
| 278 | |
| 279 | Expected MVP budget shape: |
| 280 | - Preflight/manifest: deterministic, no model call |
| 281 | - new_repos mapper: 15k-25k input tokens |
| 282 | - trending_repos mapper: 15k-25k input tokens |
| 283 | - press_correlations mapper: 8k-12k input tokens |
| 284 | - prior_continuity mapper: 3k-8k input tokens |
| 285 | - Reducer/editorial plan: 10k-20k input tokens |
| 286 | - Final writer: 8k-15k input tokens |
| 287 | |
| 288 | **Acceptance target:** max per-call context reduction >=30% first, then total token/runtime improvement after prompt boilerplate is compacted. |
| 289 | |
| 290 | ### QA validation strategy |
| 291 | |
| 292 | 1. Deterministic preflight: test week/checksum mismatch, missing citations, malformed mapper output, duplicates, contradictions, over-budget reduce input |
| 293 | 2. Mapper ledgers: test claims/citations coverage, confidence/uncertainty preservation, contradiction sidecars |
| 294 | 3. Reducer: test editorial plan quality, claim bindings, rejected-claim reasons |
| 295 | 4. Final writer: test markdown contract, citation provenance, gate pass/fail, evidence validator pass/fail |
| 296 | 5. Rerun stability: compare same-input reruns for top_repo/key-reference overlap before default-on |
| 297 | 6. A/B against current path: gate pass, citation coverage, unsupported claims, max per-call tokens, total tokens, wall time, fallback count |
| 298 | |
| 299 | ### Staged MVP after #248-#259 |
| 300 | |
| 301 | **Stage A — Contracts and deterministic preflight** |
| 302 | - Add schemas/validators for preflight, mapper ledgers, reducer input, editorial plan, evidence validation |
| 303 | - Build compact deterministic slices from existing artifacts |
| 304 | - Add fixture tests for week/checksum mismatch, missing citations, malformed mapper, duplicates, contradictions, over-budget reduce |
| 305 | |
| 306 | **Stage B — Local/no-publish map/reduce dry-run** |
| 307 | - Implement four signal-type mappers as claim-ledger producers |
| 308 | - Reducer emits editorial plan and rejected/contradiction sidecars |
| 309 | - Final writer emits candidate markdown |
| 310 | - Run `analysis_gate.py` and evidence validator; do not publish as canonical |
| 311 | |
| 312 | **Stage C — CI A/B mode (4 weekly cycles)** |
| 313 | - Add workflow_dispatch flag and scheduled dry-run for replay fixtures |
| 314 | - Upload artifacts/metrics; compare against current source-of-truth |
| 315 | |
| 316 | **Stage D — Guarded promotion (after A/B success)** |
| 317 | - Candidate into staged publish eligibility manifest only after: existing gate passes, evidence validator zero missing citations, max per-call context drops >=30%, no publish failure increase, no quality regression, fallback available |
| 318 | |
| 319 | ### Decision |
| 320 | |
| 321 | Proceed with **signal-type map/reduce + deterministic compaction** as safest and highest-leverage candidate after safety epic. Treat source-specific maps, repo clusters, hierarchical reduce as later scale tools. |
| 322 | |
| 323 | --- |
| 324 | |
| 325 | ## Issue #249 — Candidate staging and publish manifest |
| 326 | |
| 327 | **Author:** Bender |
| 328 | **Status:** ✅ Implemented in run 27056632166 |
| 329 | |
| 330 | Weekly analysis candidates are now staged under `data/candidates/<week>/<run_id>/` and promoted to `data/analyzed/<week>-summary.md` only after `publish_eligibility_v1` manifest confirms eligibility. |
| 331 | |
| 332 | **Rationale:** Makes failed, degraded, stale-evidence-backed, and no-AI candidates debuggable without overwriting good published articles. Promotion jobs verify candidate/source checksums, AI provenance, analysis gate status, source freshness, and promotion decision. |
| 333 | |
| 334 | **Follow-ups:** Future safe-rerun and same-day reuse work can add explicit per-source reuse markers to manifest; current manifests default missing reuse metadata to `not_reused` for visibility rather than inference. |
| 335 | |
| 336 | --- |
| 337 | |
| 338 | ## Issue #266 — Analysis contract repair |
| 339 | |
| 340 | **Author:** Farnsworth |
| 341 | **Date:** 2026-06-06T07:19:25Z |
| 342 | **Status:** ✅ Fixed in PR #267 |
| 343 | |
| 344 | **Context:** Run 27055543722 failed repeatedly because prompt/spec showed legacy prediction frontmatter while `analysis_gate.py` required `claim_type`. |
| 345 | |
| 346 | **Decision:** Treat `predictions[]` as `{repo, claim_type, direction, confidence}` everywhere. Allow only audited deterministic metadata/schema repairs before gate validation. Persist gate reports and candidate snapshots per attempt. |
| 347 | |
| 348 | **Rationale:** Repeating full generation on deterministic schema drift wastes AI attempts and risks no-AI fallback pressure against the product north star of high-quality AI-authored analysis. |
| 349 | |
| 350 | --- |
| 351 | |
| 352 | ## Issue #257 — Rerun protection and regression tests |
| 353 | |
| 354 | **Author:** Fry |
| 355 | **Date:** 2026-06-05T21:16:49Z |
| 356 | **Parent:** #248 |
| 357 | **Status:** ✅ Merged in main |
| 358 | |
| 359 | Added small deterministic promotion-guard helper and regression tests for publish eligibility contract while #249 staging/manifest work proceeded in parallel. |
| 360 | |
| 361 | **Quality rule captured:** A normal rerun may promote only from `data/staging/` with valid `publish_eligibility_v1` manifest, AI-authored non-degraded provenance, passing analysis/editorial/evidence gates, and fresh or explicitly same-day-reused source artifacts. Missing, malformed, stale, failed, degraded, or no-AI candidates are blocked and written to diagnostics without touching canonical weekly summary/content. |
| 362 | |
| 363 | **Validation:** ✅ Local validation passed with `PYTHONPATH=. .tools/venv/bin/python -m pytest tests -q` (581 passed). |
| 364 | |
| 365 | --- |
| 366 | |
| 367 | ## Copilot analysis directive |
| 368 | |
| 369 | **By:** jmservera (via Copilot) |
| 370 | **Date:** 2026-06-06T07:43:44.173+00:00 |
| 371 | **Status:** ✅ Implemented |
| 372 | |
| 373 | **What:** GitHub Models/OpenAI fallback is not configured for this repository. Workflow analysis must use GitHub Copilot as the AI path. If Copilot analysis fails, classify the cause: |
| 374 | - Copilot inaccessible / token failure → fail immediately; create/update issue for token renewal assigned to repo owner |
| 375 | - Context too large → record in diagnostics; fall back only after safety layer ready |
| 376 | - Timeout → classify as transient |
| 377 | - Transient error → use existing retry procedure; can eventually fail for later rerun |
| 378 | - Other → classify and record |
| 379 | |
| 380 | **Captured for team memory:** User request that prioritizes Copilot reliability and token lifecycle management over automatic fallback. |
| 381 | |
| 382 | |
| 383 | |
| 384 | --- |
| 385 | |
| 386 | ## Bender: Issue #250 — Preserve Good Analysis on Rerun Failure |
| 387 | |
| 388 | **Date:** 2026-06-06 |
| 389 | |
| 390 | **Decision:** Weekly publish reruns fail closed by default. The analyze workflow now emits a rejected no-AI candidate and manifest instead of exiting before manifest creation, hydrates the currently published summary from `publish`, and lets `publish_manifest.py` decide `promote`, `preserve`, or `block`. |
| 391 | |
| 392 | **Rationale:** Downstream jobs and operators need a stable handoff contract. A failed/degraded/no-AI/stale rerun should leave the last good published weekly summary discoverable while preserving the rejected candidate artifacts for diagnosis. |
| 393 | |
| 394 | --- |
| 395 | |
| 396 | ## Bender: Issue #255 — Regression-Safe Gate Revision |
| 397 | |
| 398 | **Date:** 2026-06-06 |
| 399 | |
| 400 | **Decision:** |
| 401 | - Calibrated deterministic publish quality against the current known-good W22 and W23 summaries instead of relying on brittle exact wording checks. |
| 402 | - Kept Copilot CLI on its platform default model operationally, while recording omitted model provenance as `copilot-default` so existing valid Copilot runs are not blocked as `unknown`. |
| 403 | - Final promotion remains fail-closed: `validation.gate_report.passed` and all required structural/provenance/evidence/editorial gate families must be present and passing. |
| 404 | - Rejected no-AI fallback candidates now still emit a manifest and gate report before the workflow exits, preserving diagnostics without promotion. |
| 405 | |
| 406 | --- |
| 407 | |
| 408 | ## User Directive: Review Copilot PR Comments |
| 409 | |
| 410 | **Date:** 2026-06-06T17:29:38.291+00:00 |
| 411 | **By:** jmservera (via Copilot) |
| 412 | |
| 413 | **Directive:** Review all Copilot Review PR comments and resolve them before considering PR work complete. |
| 414 | |
| 415 | **Reason:** User request — captured for team memory. |
| 416 | |
| 417 | --- |
| 418 | |
| 419 | ## Farnsworth: Issue #251 — No-AI Fallback Policy |
| 420 | |
| 421 | **Date:** 2026-06-06T08:48:43.587+00:00 |
| 422 | |
| 423 | **Decision:** No-AI weekly fallback output is diagnostic by default and cannot replace an existing good AI-authored article unless an operator selects `force-replace` and supplies actor/reason audit metadata. |
| 424 | |
| 425 | **Implementation Note:** Explicit first publish of no-AI fallback uses `allow-no-ai-first-publish`, requires no existing good AI article, a passing analysis gate, source provenance, attempted AI paths, and quality_score >= 70. |
| 426 | |
| 427 | --- |
| 428 | |
| 429 | ## Farnsworth: Issue #255 — Publish Quality Gate |
| 430 | |
| 431 | **Date:** 2026-06-06T08:48:43.587+00:00 |
| 432 | |
| 433 | **Decision:** Keep structural analysis validation deterministic, but make publication depend on a structured gate report with separate structural schema, AI provenance, evidence/citation, and editorial-quality gate families. The publish manifest records those gate outcomes and promotion consumes them before replacing a published article. |
| 434 | |
| 435 | **Rationale:** This preserves existing schema repair behavior while preventing structurally valid but low-quality, stale-evidence-backed, contradictory, or no-AI fallback summaries from becoming publishable artifacts. |
| 436 | |
| 437 | --- |
| 438 | |
| 439 | ## Fry: QA Audit Decision Memo — Run #27056632166 |
| 440 | |
| 441 | **Date:** 2026-06-06T08:38:45.537+00:00 |
| 442 | **Context:** Run 27056632166 succeeded end-to-end after PRs #267, #268, #271, #272 merged. |
| 443 | |
| 444 | ### Immediate Actions — Close These Issues |
| 445 | - **#251** (Block no-AI fallback from replacing AI-authored summaries) |
| 446 | - ✅ Promotion guard rejects no-ai source; manifest marks no-ai ineligible |
| 447 | - ✅ Run 27056632166 produced no-ai but did NOT promote (guard worked) |
| 448 | - **Verdict:** CLOSE — blocking confirmed in production |
| 449 | |
| 450 | - **#250** (Preserve existing good weekly analysis on failed/degraded reruns) |
| 451 | - ✅ Promotion guard rejects degraded/failed candidates |
| 452 | - ✅ Workflow copies only eligible week; does not overwrite prior |
| 453 | - ✅ Test `test_same_successful_rerun_is_stable_and_does_not_duplicate_content` passing |
| 454 | - **Verdict:** CLOSE — preservation confirmed in production |
| 455 | |
| 456 | ### Defer These Issues (Design-Complete, Waiting for Upstream Work) |
| 457 | - **#258** (Add map/reduce dry-run) — Deliberately deferring until #255/#257 (editorial/evidence gates) prove reliable in production. Timeline: 2-3 successful weeks with full gates, then begin map/reduce sidecar. |
| 458 | - **#256** (Add preflight compaction and fallback policy) — Design complete (decisions.md documented); needs to run after this week's analysis completes. |
| 459 | |
| 460 | ### Immediate PRs Needed (Next Week) |
| 461 | 1. **#255:** Implement editorial_quality_gate and evidence_freshness_gate (manifests and guards check for these fields but they're never populated) |
| 462 | 2. **#261:** Implement same-day source artifact reuse in crawl (guard exists but feature missing) |
| 463 | 3. **#259:** Create operator guide and safe rerun playbook |
| 464 | 4. **#273:** Document model routing policy (decision memo only) |
| 465 | |
| 466 | ### Test Results & Validation |
| 467 | - **Test Suite:** 562/563 passing (1 fixture data update needed) |
| 468 | - **Safety Features Verified in Production:** |
| 469 | - No-AI blocking: ✅ Works |
| 470 | - Preservation: ✅ Works |
| 471 | - Publish sync: ✅ Works |
| 472 | - Manifest guards: ✅ Work |
| 473 | |
| 474 | ### Recommendation |
| 475 | ✅ **Close #250 and #251** — safety verdicts confirmed in production. |
| 476 | |
| 477 | ⚡ **Prioritize next-week PRs:** #255 (editorial/evidence gates) > #261 (same-day reuse) > #259 (operator docs) > #273 (model routing). |
| 478 | |
| 479 | --- |
| 480 | |
| 481 | ## Fry: Review Approval — Issue #250 |
| 482 | |
| 483 | **Date:** 2026-06-06T08:48:43.587+00:00 |
| 484 | **Verdict:** APPROVE |
| 485 | |
| 486 | **Reviewed Commit:** `3f78be6632eea9ffeeb99c5a1eed1efad4af1648` on branch `squad/250-preserve-good-analysis`. |
| 487 | |
| 488 | **Rationale:** |
| 489 | - Existing good weekly summaries are detected through markdown metadata plus prior candidate manifest provenance when available. |
| 490 | - Failed validation, no-AI, stale evidence, and lower-quality candidates become ineligible and choose `promotion.decision: preserve` when a good published summary exists. |
| 491 | - Preserve manifests record both `preserved_summary_path` and `rejected_candidate_path`; rejected candidate artifacts remain under `data/candidates/YYYY-WNN/<run-id>/`. |
| 492 | |
| 493 | **Tests Run:** 17 passed. Custom validation-failure preservation smoke test passed. Full suite: 602 passed, 1 unrelated existing failure. |
| 494 | |
| 495 | **Non-blocking Follow-up:** Refresh stale prediction fixture/test expectation so full suite is green again. |
| 496 | |
| 497 | --- |
| 498 | |
| 499 | ## Fry: Review Approval — Issue #251 |
| 500 | |
| 501 | **Date:** 2026-06-06T08:48:43.587+00:00 |
| 502 | **Verdict:** APPROVE |
| 503 | |
| 504 | **Commit Reviewed:** 18e521e |
| 505 | |
| 506 | **Rationale:** |
| 507 | - No-AI fallback candidates are blocked from default promotion, including over existing good AI-authored summaries. |
| 508 | - No-existing-article behavior stays fail-closed by default and only permits first publish with explicit `allow-no-ai-first-publish` plus quality gates. |
| 509 | - Force replacement requires explicit `force-replace` mode, actor, reason, fallback provenance, attempted AI paths, and emits manifest/audit data. |
| 510 | |
| 511 | **Validation:** `test_publish_manifest.py`, `test_promotion_guard.py`, and `test_pipeline.py` passed. Full suite: 606 passed, 1 failed (known unrelated fixture drift). |
| 512 | |
| 513 | **Non-blocking Follow-up:** Consider adding documented workflow-dispatch inputs for force replacement if operators are expected to use the escape hatch through GitHub Actions. |
| 514 | |
| 515 | --- |
| 516 | |
| 517 | ## Issue #255 — Manifest/Promotion Compatibility Decision Note |
| 518 | |
| 519 | **Date:** 2026-06-06 |
| 520 | |
| 521 | **Context:** Leela rejected the prior #255 revision because `publish_manifest.py create/assert-eligible` could approve `data/candidates/` manifests with `generated_at` and nested `candidate.summary_path`, while `promotion_guard.py` still required `data/staging/`, `run_started_at`, and `candidate_content_path`. |
| 522 | |
| 523 | **Decision:** |
| 524 | - Keep the current candidate manifest workflow intact and make the contract explicitly compatible in both directions. |
| 525 | - `publish_manifest.py` emits compatibility aliases alongside the existing nested manifest fields. |
| 526 | - `promotion_guard.py` accepts both `data/staging/` and `data/candidates/` manifest roots. |
| 527 | - `promotion_guard.py` normalizes `generated_at` as a run timestamp fallback and uses the candidate summary as the content fallback for legacy summary-only manifests. |
| 528 | - Gate-family checks remain fail-closed, and no-AI/degraded/rejected candidates remain blocked. |
| 529 | |
| 530 | **Verification:** Added regression tests proving an eligible manifest created and accepted by `publish_manifest assert-eligible` is accepted by `promotion_guard.promote_candidate()`, while a rejected/no-AI manifest is rejected by both without replacing existing published artifacts. Full suite passed. |
| 531 | |
| 532 | --- |
| 533 | |
| 534 | ## Leela: Issue Triage After Successful Run #27056632166 |
| 535 | |
| 536 | **Date:** 2026-06-06T08:38:45.537+00:00 |
| 537 | |
| 538 | **Context:** Run #27056632166 succeeded end-to-end; PRs #267, #268, #271, #272 merged (prediction schema repair, Copilot-only analysis fix, data sync). |
| 539 | |
| 540 | ### P0 Critical Safety Layer Issues (All Remain Open) |
| 541 | - **#250** (Preserve good weekly on failed rerun) — Blocking #254, needs implementation |
| 542 | - **#251** (Block no-AI fallback) — Blocking #254, needs implementation |
| 543 | - **#252** (Explicit safe rerun modes) — Blocking #254/#259, needs implementation |
| 544 | - **#253** (Immutable backups) — Blocking #254, needs implementation |
| 545 | - **#254** (Atomic weekly promotion) — Blocked by above four, cannot start yet |
| 546 | |
| 547 | ### P0 Quality & Preflight Gates |
| 548 | - **#255** (Strengthen publish gate) — Supports #254, not blocking, needs implementation |
| 549 | - **#256** (Preflight compaction) — Feeds #258 map/reduce, P1 priority |
| 550 | |
| 551 | ### P2 Analysis Architecture (Dry-Run Hold) |
| 552 | - **#258** (Map/reduce dry-run) — **REMAINS DRY-RUN ONLY** until P0 safety layer complete. Do not promote until #250/#251/#252/#253/#254/#255/#256/#257 gates pass. |
| 553 | |
| 554 | ### P1 Documentation & Evidence Tasks |
| 555 | - **#259** (Document safe rerun/restore) — Depends on #252/#261 implementation, deferred |
| 556 | - **#261** (Reuse same-day artifacts) — Supports #259/#258 evidence freshness |
| 557 | - **#273** (Model routing policy) — Research complete, writeup needed, can start immediately |
| 558 | |
| 559 | ### Recommended Work Order |
| 560 | |
| 561 | **Phase 1 (Next): P0 Safety Gates (Parallel Track)** |
| 562 | 1. #250, #251, #252, #253 — Implement in parallel; target all 4 complete within same sprint |
| 563 | |
| 564 | **Phase 2: Atomicity & Quality Gates** |
| 565 | 1. #254 — Start after Phase 1 complete |
| 566 | 2. #255, #256 — In parallel with #254 |
| 567 | |
| 568 | **Phase 3: Documentation & Evidence Freshness** |
| 569 | 1. #259 — After #252 implementation lands |
| 570 | 2. #261 — Parallel or after crawl metrics complete |
| 571 | 3. #273 — No blocking dependencies; start anytime |
| 572 | |
| 573 | **Phase 4: Analysis Innovation (Deferred)** |
| 574 | - #258 — Remains dry-run/tests-only until Phase 1-2 complete |
| 575 | |
| 576 | ### Key Sequencing Constraints |
| 577 | - ⛔ **#254 cannot start** until all of (#250, #251, #252, #253) are implemented and reviewed |
| 578 | - ⛔ **#258 map/reduce must stay dry-run** until P0 safety layer is solid |
| 579 | - ✓ **#273 (model routing)** has zero blocking dependencies and can start today |
| 580 | |
| 581 | |
| 582 | --- |
| 583 | |
| 584 | ## Operator Directive: NEVER bypass branch rulesets [2026-06-13] |
| 585 | |
| 586 | **By:** jmservera (via Copilot) |
| 587 | |
| 588 | **What:** All changes MUST go through branch + PR. No direct pushes to main. Agents must create a feature branch and open a PR, even for cleanup/docs/trivial changes. Never disable, bypass, or work around branch protection rulesets. |
| 589 | |
| 590 | **Why:** Operator directive — no exceptions. |