Skip to content

Improvement: enforce the engine's own label contract - #897

Merged
StarshipSuperjam merged 9 commits into
mainfrom
claude/engine-template-656-labels
Aug 9, 2026
Merged

Improvement: enforce the engine's own label contract#897
StarshipSuperjam merged 9 commits into
mainfrom
claude/engine-template-656-labels

Conversation

@StarshipSuperjam

@StarshipSuperjam StarshipSuperjam commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Closes #656

A green mechanical check below shows this change conforms to the engine's rules — not that it is correct. What covers correctness is the behavioural steps in Review and your own read of the change; a green check is never a substitute for that. Your merge is the binding gate.

About those checks: only the one that runs when the change is proposed for merge can stop a risky merge — a check that ran while the change was still being written is early advice. Each check is itself proven against a deliberately broken example it must catch, so a passing check can't be one that quietly did nothing — but that proves the check works, not that this change is right. And a check that could not run leaves its area unverified.

Purpose

Make issue labels consistent by enforcing the engine's own label contract — the load-bearing engine label stops getting missed, and the GitHub-native kind labels are applied mechanically instead of by session discipline.

  • Grounding found the failure at ~50× the issue's estimate: 55 issues carried a phantom engine-domain label (a session took the descriptive phrase "the engine-domain label" literally — the canonical string is engine) and 54 more open issues had no domain label at all. All were invisible to the debt register, miscounted as the operator's own backlog on the boot card, and skipped the issue-body conformance gate.
  • The operator's rulings shaping this: no new/custom labels ever, but the four GitHub-native kind labels (bug, enhancement, documentation, question) should be applied, derived from the title's Kind: prefix — mechanically, so consistency doesn't depend on a session remembering.

Impact: engine-health issues now reliably enter the debt register, the boot counts, and the conformance gate, and every new issue gets its native kind label automatically.

Scope

One PR: the label contract written where sessions read, a settable urgency trailer, a truthful label description, a new title-derived kind-label applicator, and a one-time reconciliation of the live repo's labels.

  • The Explore-briefing issue-logging carve-out (modes.py) and the issue_author docstring now state the contract: an engine-health issue carries --label engine at creation, whoever asked — the literal string, never engine-domain; other issues get their native kind label from the engine; a session never mints a label.
  • render_engine_issue_body gains an optional urgency argument (telemetry's two classes only; default unrated) appending the same invisible severity marker telemetry writes — composed by the new single source telemetry.severity_trailer.
  • ENGINE_DOMAIN_LABEL_DESCRIPTION reworded subject-based ("About the engine's own health (not your product).") — session-filed engine-health issues are normal now, so "Opened by the engine" was wrong on authorship. bootstrap.py reads it live; the GitHub label was updated to match.
  • New issue_kind_label.py (pure native_label_for_title mapping + an on: issues CI applicator) and engine-issue-kind-label.yml; new shared issue_label_client.py that the conformance net now also builds on (one transport, not two copies).
  • One-time GitHub reconciliation, executed and verified this session (details in Review): 55 engine-domain issues re-mapped to engine, the phantom label deleted, 54 unlabelled issues swept to engine, 38 native kind labels backfilled with the same mapping function the applicator uses, and the live engine description updated.

Change profile — the shape of this pull request at a glance:

  • Size: 14 files changed, +856 / −114 lines (before review fixes; final +968 / −126).
  • Kinds of thing touched: 11 tools, 3 other files (not in the engine's map).
  • Where: .engine/tools, .engine/knowledge, .engine/provisioning, .github.
  • Shape: 9 commits on this branch — a standalone change.

This is a description, not a gate — it never blocks a merge. It is here so you can weigh the change by what it touches, not by its line count.

Impact: labels become consistent by construction — the kind axis mechanically, the engine axis by a contract every session now reads at boot.

Behaviors

A session can grade an issue's urgency at filing; every new or edited issue with a mappable title kind gets its native label applied server-side; a session reading its boot briefing learns the exact label strings to use.

  • render_engine_issue_body(urgency=…) appends the canonical severity marker last, recovered by telemetry.parse_severity — test_issue_author.py / test_telemetry.py; first real use: issue Improvement: give the boot-pack platform cap a margin canary so Tier-0 growth is caught before the dashboard sheds #899's body.
  • A new/edited issue titled with a mappable Kind: prefix gets bug/enhancement/documentation/question added; unmappable titles get none; a native label the repo owner deleted is skipped, never recreated — issue_kind_label.py demo + test_issue_kind_label.py (including the workflow-entrypoint fail contract).
  • The applicator's workflow travels to deployed repos and is CODEOWNER-owned — the FOUNDATION_INFRA membership assertions in test_issue_kind_label.py.

Out of scope

No new labels, no urgency backfill, and the engine axis stays contract-guided rather than mechanized.

  • The urgency triage of existing engine issues is deferred to a separate session (operator decision); this PR only makes urgency settable.
  • Whether an issue is about the engine's own health is a semantic judgment a title can't encode, so the engine label stays a written contract (briefing + docstring + the conformance net's reroute), not automation — only the kind axis is title-derivable.
  • The boot-pack margin hair-trigger this build uncovered is tracked as its own issue (Improvement: give the boot-pack platform cap a margin canary so Tier-0 growth is caught before the dashboard sheds #899), not patched here beyond fitting this change inside the budget.

Impact: these are deliberate boundaries agreed with the operator, not gaps.

Risk

No guardrail weakens. The real surfaces are a new issues: write workflow driven by an attacker-controllable title, and ~150 irreversible GitHub label mutations executed outside the diff.

  • modes.py is a guarded enforcement hook, but the edit is prose-only inside describe_explore_scope() — the weakening guard classifies it a soft disclosure (verified by tracing _HARD_EXACT and all directional detectors; engine-guard runs green, no acknowledgment needed) and the write-gate logic is untouched.
  • The workflow reads the title only from $GITHUB_EVENT_PATH inside Python — never interpolated into a shell line — and the label it applies is a fixed enum, never title text; it is apply-only (cannot mint or strip), additive, non-gating, and cannot self-retrigger. Verified independently by the security review pass.
  • The relabel was executed by an idempotent script that verified every engine-domain issue carried engine before the irreversible label delete; the full executed issue lists are recorded in Review. GitHub's per-issue timeline is the audit trail.
  • Boot-count shift, disclosed: the engine-health count rises by ~109 (55 re-mapped + 54 swept) and the operator's own-backlog line drops to 0 — expected, since everything open in this mechanic repo is engine-internal work; not a regression.

Impact: the residual risk is bounded to a decorative label being absent where a repo owner deleted it — disclosed in the run log, never an error.

Validation

The full engine test suite passes fresh (5,097 tests), the CI validate suite is green, and both demos self-check.

  • validate.py --suite CI: OK, no hard findings.
  • Full unittest discover in a fresh worktree at the submitted commit: 5,097 tests, OK — including the new fail-contract, import-order, mapping, and FOUNDATION_INFRA registration tests, and the boot-pack platform-cap test this change first broke and then fixed with margin.
  • issue_kind_label.py demo and issue_author.py demo: all self-checks OK, with genuinely reachable failure paths (a broken mapping exits non-zero).
  • Live post-relabel verification: 0 open issues lack engine; engine-domain no longer exists as a label; the plan's named spot-check (Delivery wave 1 — local delivery kernel: settle the spec, then break out the build #843) passes; the live engine description matches the code.

Impact: an approver can rely on the code paths being exercised and the repo state being verified, not just asserted.

Review

A thorough review ran: four cold review passes before building and five after, every finding resolved or tracked, with one post-review fix pass that was itself re-verified.

Nothing here is something you can run yourself — there's no settled description for this project yet.

Impact: the engine's own account of its review — your merge is the binding gate.

Files of interest

The issue-authoring/label seam, and the new applicator with its shared transport.

  • .engine/tools/issue_kind_label.py, .github/workflows/engine-issue-kind-label.yml — the new mechanism.
  • .engine/tools/issue_label_client.py, .engine/tools/issue_conformance_ci.py — the shared label transport and its first two consumers.
  • .engine/tools/telemetry.py, .engine/tools/issue_author.py — the severity-trailer single source and the urgency argument.
  • .engine/tools/modes.py — the label contract in the boot briefing (prose only; the write-gate is untouched).

Impact: these determine how every engine issue is labelled at creation and kept consistent after.

AI involvement

Claude Code (Claude Opus 4.8 and Claude Fable 5) planned, built, reviewed, and executed this change end to end; the operator made every scoping decision and holds the merge.

  • AI-driven: the grounding that uncovered the engine-domain drift and its root cause (a naming trap in the engine's own vocabulary), the design (single-source severity trailer, the separate sibling-workflow boundary, the shared label client, skip-if-absent), the boot-pack budget diagnosis, and all nine cold review passes.
  • Operator-decided: reconcile-and-delete the phantom label; sweep all unlabelled issues to engine; apply kind labels by semantic kind; make the forward rule mechanical; build the urgency hook now; skip-if-absent over provisioning the natives; defer the urgency triage; review depth thorough.

Impact: AI judgment is load-bearing on design and review; every irreversible act traces to a recorded operator decision, and the merge is the operator's.

StarshipSuperjam and others added 8 commits August 8, 2026 22:50
…ne label description

Add telemetry.severity_trailer as the single composer of the <!-- engine-severity --> marker, and give
issue_author.render_engine_issue_body an optional urgency arg that appends it (function-local telemetry
import keeps issue_author an import-leaf, so no telemetry<->issue_author cycle). Reword the engine label
description from authorship-based to subject-based, since session-filed engine-health issues are now normal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the per-Issue label operations (ensure/add/remove + the injectable transport + DegradedWriteError) out
of issue_conformance_ci into a shared issue_label_client, and add label_exists for a skip-if-absent caller.
The conformance client now inherits it and keeps only its comment operations, so a transport fix reaches
every on:issues backstop instead of one copy. No behaviour change (DegradedWriteError re-exported).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add issue_kind_label.py (native_label_for_title + an on:issues applicator) and its workflow: on every issue
opened/edited it derives the fitting native label (bug/enhancement/documentation/question) from the title's
Kind: prefix and applies it. Apply-only — it SKIPS a native label the repo owner deleted, never minting one,
so it stays a pure producer of pre-existing labels (keeps the control-plane label law intact). Reads the title
from the event JSON in Python (never a shell-interpolated argument); the label is a fixed enum, never raw
title text. Registered in FOUNDATION_INFRA so it travels on upgrade and is CODEOWNER-owned, with a companion
test asserting that membership (no generic check catches its omission).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extend the Explore-briefing issue-logging carve-out (modes.py) and the issue_author docstring with which
label to apply at creation: an engine-health Issue carries --label engine (the literal string is 'engine',
never 'engine-domain' or a look-alike a descriptive phrase might suggest — a look-alike is read by nothing,
so the Issue drops out of the debt register); other issues get the GitHub-native kind label the applicator
adds from the title, and a session never mints a new label. Closes the naming-trap that produced ~53
mislabelled issues.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ew label tools

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The boot pack sits within ~100 chars of the platform cap's dashboard-shed boundary, and the label-contract
paragraph added ~600 pinned chars — enough that any small environmental line (an unmerged-branch notice, suite
state) shed the status dashboard and failed the platform-cap test. Rewrite the whole Explore-scope copy
compactly: same content and every fidelity-pinned phrase, 930 chars tighter than before the paragraph landed,
so the dashboard survives with margin even on a working branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Restore the two load-bearing clauses the budget compaction dropped (the title's Kind: prefix syntax; apply
the engine label whoever asked) within the measured pack headroom; pin _run()'s fail contract with the same
TestRunFailContract shape the conformance net carries; pin both telemetry/issue_author import orders in fresh
interpreters; name 'urgency' (the caller's argument) in the bad-urgency error; render each workflow log action
as a sentence so 'absent' reads as a deliberate skip, never a fault. Regenerate the derived catalogs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@StarshipSuperjam
StarshipSuperjam merged commit 6840b01 into main Aug 9, 2026
9 checks passed
@StarshipSuperjam
StarshipSuperjam deleted the claude/engine-template-656-labels branch August 9, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvement: make issue/PR labels consistent — enforce the engine's own label contract

1 participant