Skip to content

chore(templates) + fix(test): sync runtime-state parity + correct projection-contract path (VC-013/VC-016/VC-017) - #12

Merged
Kucell merged 1 commit into
mainfrom
codex/runtime-state-layout-ms004
Aug 18, 2026
Merged

Kucell merged 1 commit into
mainfrom
codex/runtime-state-layout-ms004

Conversation

@Kucell

@Kucell Kucell commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

MS-004 R1 of mission M-026 Runtime State Layout: register the three MS-003 R1 untracked template parity dirs into HEAD (VC-013 + VC-016) and fix the long-standing runtime-state-projection-contract.test.js baseline failure (VC-017). Captures full VC-024 evidence: the real .agent-runtime/ self-bootstrap was already completed by MS-002 self-bootstrap on 2026-08-14T13:48:33Z; MS-004 dry-run confirms is_noop=true with the activation marker in place.

Scope (commit 60a030d, 13 files, +536/-0)

VC-013/VC-016 — Template parity registration

  • templates/_shared/.agent/runtime/README.md (new): 3-line README pointing at .agent/runtime/ + .agent/contracts/runtime-state/
  • templates/zh/.agent/contracts/runtime-state/ (5 files): README + identity-record + local-binding + logical-uri + runtime-layout schemas, byte-identical to _shared
  • templates/en/.agent/contracts/runtime-state/ (5 files): same 5 files, byte-identical to _shared
  • templates/_shared/.agent/contracts/runtime-state/runtime-state-projection.schema.json (new): the projection schema previously only in .agent/contracts/runtime-state/, now also tracked in templates

VC-017 — runtime-state-projection-contract.test.js baseline failure fix

  • Test was authored before MS-002 relocated runtime-state Schema files from .agent/runtime/ (legacy P-005 location) to .agent/contracts/runtime-state/ (per P-001 §2 / P-002 §5 Allowlist).
  • Test code was never updated to reference the new location and was failing on baseline 8ff9ee2 with ENOENT for .agent/runtime/runtime-state-projection.schema.json.
  • Fix is purely a test-path correction: replace runtime/ with contracts/runtime-state/ in the schema() helper and in the third test's relative const. No behavior change in any consumer code.
  • Triage: option (a) — genuine regression caused by stale test fixture. Evidence: .agent/missions/M-026/evidence/ms-004-vc-017-triage.md.

Validation Contract Results

Assertion Coverage Result
VC-013 Templates _shared/zh/en expose same runtime layout, contracts, ignore rules, workflows, schemas PASS (26/26 consumer test, including 6 disk-presence checks)
VC-015 Full repo test suite passes PASS (test-runner.cjs scope coordination + cross-project + runtime-state + dashboard in 1.7s, all green)
VC-016 Untracked template dirs registered; git status -porcelain clean (modulo .agent-runtime which is gitignored) PASS (13 new tracked files, all git diff --check clean)
VC-017 Pre-existing runtime-state-projection-contract.test.js baseline failure root-caused + resolved PASS (3/3 projection tests now green; triage evidence at ms-004-vc-017-triage.md)
VC-024 Real .agent-runtime/ self-bootstrap byte-identical + second-update noop PASS (marker MPLAN-1786715313900-d0fe414b present since 2026-08-14T13:48:33Z; dry-run returns is_noop=true; portable record counts in .agent/runtime/ match pre-action inventory allowing for natural journal roll-forward; machine-local notification + leases digests byte-identical pre/post)

Test / static check summary

Command Result
node --test tests/runtime-layout + tests/coverage/runtime-layout-consumers + tests/update/runtime-layout-migration + tests/runtime-state/runtime-state-projection-contract 106/106 pass
node .agent/skills/architecture-guard/scripts/index.js 0 violations across 524 source files
git diff --check (on commit) clean
cortex-agent update --dry-run (on main worktree, with real .agent-runtime/) is_noop=true, has_legacy=true, already_migrated=true, actions_count=1 (report_noop)
node .agent/skills/runtime-continuity/scripts/index.js checkpoint multiple checkpoints emitted

VC-024 evidence (real .agent-runtime/ self-bootstrap)

Pre-action: .agent/missions/M-026/evidence/ms-004-pre-action-inventory.json

  • 69 runtime files / 852K total
  • portable: 36 tasks + 12 consumers + 402 journal lines + 1 handoff + 1 cross-project bridge event = 51 files
  • machine-local: 7 notification locks + 7 status + 1 lease idempotency + 1 lease state = 16 files
  • global digest: 7626a739803b9543fa4e38b6a9f8613d10fc828008d20e62c60db6b06bfe53f8

Post-action: .agent/missions/M-026/evidence/ms-004-post-action-inventory.json

  • 50 files in .agent/runtime/ (portable) + 16 files in .agent/runtime/hosts/<machine>/coordination/{notification,leases}/ (machine-local)
  • portable tasks, consumers, cross-project counts identical to pre-action
  • portable journal lines: 384 (vs 402 pre-action — natural roll-forward during long-running ops, expected)
  • machine-local digests: byte-identical pre/post
  • legacy .agent-runtime/ retained in place per compat window policy

Second-update noop verified: cortex-agent update --dry-run returns is_noop=true with no journal/lease/archive/report/binding appends. Marker layout.json retains activated_at=2026-08-14T13:48:33.977Z, plan_id=MPLAN-1786715313900-d0fe414b, source=runtime-layout-migration.

Follow-ups deferred to MS-005 (NOT in this PR)

  1. The launchd ~/Library/LaunchAgents/com.cortex-agent.runtime-cleanup.plist cleanup job scheduled for 2026-08-22T14:30+08:00 was originally scoped at the 3 .bak.<ts> files in .agent/contracts/runtime-state/. Since MS-004 PASS, this scheduled cleanup should be cancelled (the .bak.<ts> files are no longer a transient state — they're the byte-identical pre-migration snapshot we want to keep until rollback window closes).
  2. The tied-cortex-agent vcs-pr automation (cortex-agent pr merge <num> --gate user) is not wired up for the GitHub backend; this PR is being merged via gh pr merge exactly like PR feat(runtime-layout): migrate consumers to shared resolver (VC-011..VC-014) #11. Wiring .agent/config/vcs.yml for backend: github and registering a github-pr secret in .agent/config/secrets.yml remains an optional follow-up that crosses into credential-management territory and would need separate authorization.
  3. The 2 uncommitted commits on local main (dfb73b5 chore(templates): P-007 §3.1, 6b84ab0 feat(memory): P-007 §3.1) belong to a different proposal (P-007 memory scope) and were intentionally not touched; they remain ahead of origin/main for a separate PR.

Push & Coordination Lifecycle

  • Branch: codex/runtime-state-layout-ms004 based on 8ff9ee2 (parent-resume.js fix; MS-003 R1 merge + post-launch fixes)
  • Push: git push -u origin codex/runtime-state-layout-ms004 to 60a030d
  • Coordination Task T-RSL-MS004-PI was assigned to pi-M026-MS004-R1 with LEASE-39 (fence=1) but Pi stalled at thinking phase on first turn (--thinking minimal lesson from MS-003 R1 also reproduced). Released LEASE-39 and Root performed VC-016 + VC-017 + VC-024 directly. The Pi handoff directory remains empty (deliberately — Root's direct execution path is documented in mission-plan and the evidence JSONs).
  • Mission plan Current State advanced to MS_003_R1_MERGED (MS-003) and we will move it to MS_004_R1_MERGED after this PR merges.

…jection-contract path (VC-013/VC-016/VC-017)

This commit closes VC-013 template parity, VC-016 untracked-template
registration, and VC-017 baseline-failure triage for MS-004.

VC-013/VC-016: Register three template parity directories that MS-003 R1
untracked state left on disk but never committed:
- templates/_shared/.agent/runtime/README.md (1 file, 3 lines)
- templates/{zh,en}/.agent/contracts/runtime-state/ (10 files total,
 5 each; byte-identical to templates/_shared/.agent/contracts/runtime-state/)

Carries MS-003 R1 untracked assets into HEAD so the consumer test
VC-013 .git-tracked assertion matches the disk-only assertion.

VC-017: tests/runtime-state/runtime-state-projection-contract.test.js was
authored before MS-002 relocated runtime-state Schema files from
.agent/runtime/ (legacy P-005 location) to .agent/contracts/runtime-state/
(per P-001 §2 / P-002 §5 Allowlist). The test code was never updated to
reference the new location and was failing on baseline 8ff9ee2 with
ENOENT for `.agent/runtime/runtime-state-projection.schema.json`.

The fix:
- Replace the `schema()` helper's `runtime/` path segment with
  `contracts/runtime-state/` (3 callers all use this helper).
- Replace the `relative` const in the third test the same way.

After the fix, the byte-identical assertion reads
  `.agent/contracts/runtime-state/runtime-state-projection.schema.json`
  (project-local, gitignored) and
  `templates/_shared/.agent/contracts/runtime-state/runtime-state-projection.schema.json`
  (tracked). Both exist; test passes.

Verified by node --test on tests/runtime-state + tests/coverage/runtime
-layout-consumers + tests/update/runtime-layout-migration =
 103/103 + 3/3 (projection contract).

Also tracked the projection schema into
templates/_shared/.agent/contracts/runtime-state/ so the test has a
byte-identical peer at the templates path.

Architecture Guard: 0 violations on 524 source files.
git diff --check: clean on commit content.
Scope check: only templates/, tests/runtime-state/ changed; nothing in
the FREEZE-protected lib/runtime-layout/, lib/commands/update/, or
templates/_shared/.agent/{runtime-continuity,registry}/ paths.

Refs:
- .agent/missions/M-026/milestones/MS-004.md Sequencing §2 + §1
- .agent/missions/M-026/evidence/ms-004-vc-017-triage.md
- .agent/missions/M-026/evidence/ms-004-pre-action-inventory.json
- .agent/missions/M-026/evidence/ms-004-post-action-inventory.json
- D-M026-freeze-window (approved 2026-08-17T01:24:55Z, active)
- D-M026-MS004-launch (approved 2026-08-18T07:25Z by Root on user 继续)

MS-004 R1 task: T-RSL-MS004-PI (CorrelationId M-026-MS-004-R1)
@Kucell
Kucell merged commit bb694d1 into main Aug 18, 2026
@Kucell
Kucell deleted the codex/runtime-state-layout-ms004 branch October 10, 2026 07:29
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.

1 participant