Skip to content

feat(runtime-layout): migrate consumers to shared resolver (VC-011..VC-014) - #11

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

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

Conversation

@Kucell

@Kucell Kucell commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

MS-003 of mission M-026 Runtime State Layout: migrate 16 lib/ consumers off hardcoded .agent-runtime/<ns> onto the shared lib/runtime-layout resolver, with new-first read / legacy-fallback behaviour and post-activation new-only writes. Closes the VC-011..VC-014 contract assertions that MS-002 was waiting on.

Scope (commit afba0ef, 23 files, +814 / -64)

16 lib/ consumers migrated to resolveRuntimePaths(...).<ns>Dir

  • lib/coordination/{consumer-registry, lease-cli, local-host-binding, notification-host}.js
  • lib/cross-project/{bridge-sync, inbox-store, outbox, runtime-root, subscriptions}.js
  • lib/agents/adapters/base.js
  • lib/dispatch/{execute, plan}.js
  • lib/event-bus/clients/parent-resume.js
  • lib/governed/child-monitor.js

New shared runtime-layout API surface

  • lib/runtime-layout/index.js re-exports isNewLayoutActivated, resolveRuntimePaths, readWithLegacyFallback, resolveWritePath, plus the new LAYOUT_ACTIVATION_MARKER constant.
  • lib/runtime-layout/resolver.js adds 4 helper functions: activation detection, dual-path reader, dual-path writer, namespace path resolver.

New coverage tests

  • tests/coverage/runtime-layout-consumers.test.js — 26 tests covering VC-011..VC-014 (consumer API composition, new-first/legacy-fallback, activation switch, template parity, no absolute paths in tracked templates).

Updated cross-project tests for new-first/legacy-fallback semantics

  • tests/cross-project/{bridge-sync, bridge-sync-topology, inbox-store, outbox, runtime-root, subscriptions}.test.js

Validation Contract Results

Assertion Coverage Result
VC-011 Consumer API: 16 lib/ modules resolve paths via shared runtime-layout PASS
VC-012 Compatibility window: new-first/legacy-read-fallback + post-activation new-only writes PASS
VC-013 Template parity: _shared/zh/en exposed to same runtime layout PASS on disk (see "Open follow-ups")
VC-014 Security: tracked templates + portable runtime artifacts contain no machine absolute paths / credentials / PID / OS lock / private session IDs PASS

Test / static check summary

Command Result
node --test tests/runtime-layout/runtime-layout.test.js tests/coverage/runtime-layout-consumers.test.js tests/update/runtime-layout-migration.test.js 103/103 pass
node .agent/skills/architecture-guard/scripts/index.js 0 violations across 524 source files
git diff --check on commit content clean

Independent Root validation evidence: .agent/missions/M-026/evidence/ms-003-root-validation.md (Pi handoff overstated cleanliness; Root re-ran tests + git queries instead of trusting the JSON summary).

Push & Coordination Lifecycle

  • Branch: codex/runtime-state-layout-ms003 based on 1a12043 (post-MS-002 self-bootstrap fix).
  • Push: git push -u origin codex/runtime-state-layout-ms003 to afba0ef (verified via git ls-remote origin codex/runtime-state-layout-ms003).
  • Coordination Task T-RSL-MS003-PI advanced from ASSIGNED → READY_FOR_REVIEW (events CE-MS003-R1-accept, CE-MS003-R1-progress, CE-MS003-R1-ready emitted on the agent's behalf in producer.actorId = pi-M026-MS003-R1; leaseId = LEASE-38 was used during Pi execution but is no longer required for the merge itself).
  • Mission plan Current State updated to MS_003_R1_PUSHED; F-003 and MS-003 status rows updated to R1 passed.

Open Follow-ups (deferred to MS-004, NOT in this PR)

These do not block VC-011..VC-014 PASS and were intentionally left for MS-004 (real .agent-runtime/ self-bootstrap):

  1. Three untracked template directories in the worktree carry VC-013's _shared/.agent/runtime/README.md plus templates/{zh,en}/.agent/contracts/runtime-state/{5 schema files} — they are byte-identical to _shared/.agent/contracts/runtime-state/*. MS-004 will land them under a chore(templates): sync runtime-state parity assets commit.
  2. tests/runtime-state/runtime-state-projection-contract.test.js fails on baseline 1a12043 already (missing templates/_shared/.agent/runtime/runtime-state-projection.schema.json); not an MS-003 regression. MS-004 will remediate the projection schema placement.
  3. Real .agent-runtime/ migration (F-006) still pending; MS-004 will run cortex-agent update self-bootstrap after the untracked template assets land. The 3 .bak.<ts> backups under .agent/contracts/runtime-state/ from MS-002 self-bootstrap are scheduled to be cleaned up by the ~/Library/LaunchAgents/com.cortex-agent.runtime-cleanup.plist launchd job on/after 2026-08-22T14:25+08:00.

Test Plan

  1. Re-run the MS-003 test scope after merge:
    node --test tests/runtime-layout/runtime-layout.test.js
    node --test tests/coverage/runtime-layout-consumers.test.js
    node --test tests/update/runtime-layout-migration.test.js
    node scripts/test-runner.cjs --scope coordination --scope cross-project --scope runtime-state --scope dashboard
    node .agent/skills/architecture-guard/scripts/index.js
    
  2. Run cortex-agent update self-bootstrap on a fresh .agent-runtime/ fixture (MS-004 scope).
  3. After launchd cleanup window closes, verify .agent/contracts/runtime-state/*.bak.<ts> are gone.

@Kucell
Kucell merged commit 0792a85 into main Aug 17, 2026
Kucell pushed a commit that referenced this pull request Aug 18, 2026
The MS-003 R1 commit afba0ef landed lib/event-bus/clients/parent-resume.js
with a wrong relative path (../../../runtime-layout) which resolves outside
the lib/ tree and broke dashboard resume at load time. The other 15 lib/
consumers migrated in the same commit use ../../runtime-layout correctly
because they live at lib/<scope>/<file>.js.

Reduce the path depth to ../../runtime-layout so the require resolves
to lib/runtime-layout. Manual smoke confirms node -e "require('./lib/event-bus/clients/parent-resume.js')"
no longer throws MODULE_NOT_FOUND.

Refs: .agent/missions/M-026/milestones/MS-004.md preflight §1
Refs: #11 (follow-up after merge)
@Kucell
Kucell deleted the codex/runtime-state-layout-ms003 branch October 10, 2026 07:28
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