ADHOC-2026-09-22-T01: statehub register renders {CREDENTIAL_ROUTING} into AGENTS.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 7184@bnt-lap001
Assistant-Session: 4b436ae2-b17c-4b40-8754-200b161b26e4
This commit is contained in:
tegwick 2026-09-22 07:58:55 +02:00
parent fafaced426
commit 19450d7618
3 changed files with 54 additions and 1 deletions

View file

@ -451,7 +451,12 @@ def write_registration_files(
agents_path = project_path / "AGENTS.md"
if force or not agents_path.exists():
agents_template = (RULES_TEMPLATES_DIR / "agents-codex.template").read_text()
agents = _replace_many(agents_template, values)
credential_routing = _replace_many(
(RULES_TEMPLATES_DIR / "credential-routing.template").read_text(), values
)
agents = _replace_many(
agents_template, {**values, "{CREDENTIAL_ROUTING}": credential_routing}
)
agents_path.write_text(_ensure_trailing_newline(agents))
written.append(agents_path)

View file

@ -2,6 +2,7 @@ from __future__ import annotations
import argparse
import json
import re
import sys
import tomllib
from pathlib import Path
@ -100,6 +101,10 @@ def test_write_registration_files_primes_codex_repo(tmp_path: Path):
assert "!.claude/rules/" in (tmp_path / ".gitignore").read_text()
assert (tmp_path / "INTENT.md").read_text() == "# INTENT\n\nDemo service intent.\n"
assert "**Repo slug:** demo-service" in (tmp_path / "AGENTS.md").read_text()
agents_md = (tmp_path / "AGENTS.md").read_text()
assert "{CREDENTIAL_ROUTING}" not in agents_md
assert "warden route find" in agents_md
assert not re.search(r"\{[A-Z_]+\}", agents_md)
assert "Run the demo service." in (tmp_path / "SCOPE.md").read_text()
workplan = (tmp_path / "workplans" / "DEMO-WP-0001-statehub-bootstrap.md").read_text()
assert "id: DEMO-WP-0001" in workplan

View file

@ -0,0 +1,43 @@
---
id: STATE-WP-ADHOC-2026-09-22
type: workplan
title: "Ad hoc fixes — 2026-09-22"
domain: infotech
repo: state-hub
status: finished
owner: claude-code
topic_slug: state-hub
created: "2026-09-22"
updated: "2026-09-22"
---
## Fill the {CREDENTIAL_ROUTING} placeholder in statehub register
```task
id: STATE-WP-ADHOC-2026-09-22-T01
status: done
priority: low
```
Reported by canned-prompts (State Hub message
`7b7daa15-78db-4530-aaed-914108245d4c`): `statehub register` wrote
`agents-codex.template` into AGENTS.md without substituting
`{CREDENTIAL_ROUTING}`, leaving the literal token in every repo registered
through that path. `scripts/update_agent_instruction_files.py` and
`scripts/propagate_credential_routing.py` already rendered it; only
`write_registration_files` in `statehub_register.py` did not.
Completed 2026-09-22. `write_registration_files` now renders
`credential-routing.template` with the same values and substitutes it.
`test_write_registration_files_primes_codex_repo` asserts no unresolved
`{UPPER_CASE}` token remains and that the credential section is present
(`26 passed`).
Residual (not state-hub's files): 18 sibling repos still carry the literal
token in AGENTS.md (binky-control, coulomb-social, facetted-interfaces,
fluid-telegram, glas-harness, ground-game, hall-of-helix, kings-guard,
pr-hall-of-helix, ops-mason, qonto-assistant, prj-canon-federation,
rapp-postgres, resource-control, rein-openweights, rein-aharness,
tenant-engine, test-driver). Regenerating with
`scripts/update_agent_instruction_files.py` fixes them in each repo's own
session.