# Goal: P9.1 behavior-equivalent runtime foundation extraction > Stage: implementation-foundation > Started: 2026-08-13T01:31:53+00:00 > Task ID: `ABG-P9.1-RUNTIME-FOUNDATION` > Baseline: `e9fe1bcffd4364049e22dc8f697ad1ffe4611a4a; branch=agent/abg-p91-runtime-foundation; clean; prior product writes zero` > Frozen spec: `.agent-taskgraph/spec.md revision p9.1-spec-r2; docs/runtime/PHASE9_1_ARBITRARY_PARTY_FIRST_SESSION_CONTRACT.md revision p9.1-contract-r2` > Graph node: `.agent-taskgraph/graph.yaml#p91_runtime_foundation` > Independent contract: 不适用 > Context manifest: `context.md` > Context revision: `p91-runtime-foundation-r4` > Legal terminal: **ABG-P9.1-RUNTIME-FOUNDATION candidate ready** 或 **ABG-P9.1-RUNTIME-FOUNDATION redesign required: <最早失败边界>** ## Objective Behavior-equivalently extract the architect-defined P9.1 foundation from runtime/main.gd, keep one mutable source of truth, preserve the complete accepted P9.0R1-R10 surface, and leave stable disjoint APIs for later domain, UI and test workers. ## 图输入、输出与写入范围 - 直接依赖(needs):p91_spec_integration - 必须读取(consumes):p9.1-contract-r2, P9.0R10 fixed runtime source, exact accepted 22-script R10 regression manifest - 必须产出(produces):architect-defined foundation files and clean pushed foundation candidate - 唯一写入范围(writes):runtime/main.gd, runtime/domain/p9_1/contracts.gd, runtime/domain/p9_1/session_state.gd, runtime/domain/p9_1/session_service.gd, runtime/domain/p9_1/battle_fixture.gd, runtime/presentation/, runtime/ui/session_presenter.gd, runtime/ui/widgets.gd, runtime/compat/p9_0_root_facade.gd - 路由:PASS -> p91_domain_implementation;FAIL -> failed;最大尝试 2 ## 分配记录 - Role ref:`role:p91-runtime-foundation-developer` - 角色职责:Extract one authoritative runtime state, command, snapshot, clock, presenter and compatibility boundary without changing accepted P9.0 behavior - 角色生命周期:persistent - 派给:p91-runtime-foundation-developer - 分配理由:职责匹配 - 连续性:attempts 1-3 ended before product writes; attempt-4 is a clean redispatch from contract-r2 and source e9fe1bc - 工作区:`/Users/wusumac/Documents/game/tmp/aetherbound-guild-worktrees/p91-runtime-foundation`(分支:`agent/abg-p91-runtime-foundation`) - Runtime requested:`runtime=hapi; flavor=codex; model=gpt-5.6-sol; effort=xhigh; permission=yolo; visibility=visible` - Runtime observed:`runtime=hapi; flavor=codex; model=gpt-5.6-sol; effort=xhigh; permission=yolo; visibility=visible` - Runtime verification:`VERIFIED pre-redispatch; verification 41d0e0b0-a471-41b5-9450-2819583b58e6; message watermark seq 125` - Session evidence:`HAPI c70ab47f-b764-42a1-b4b5-2eab342e8b25; PID 31232; runtime-evidence.json` - Dispatch bootstrap:`dispatch.md` - Dispatch message:`SENT: dispatch:ABG-P9.1-RUNTIME-FOUNDATION:attempt-4 via HAPI c70ab47f after pre-redispatch verification 41d0e0b0` - Identity ACK:`VERIFIED: IDENTITY_READY dispatch_id=dispatch:ABG-P9.1-RUNTIME-FOUNDATION:attempt-4 role=role:p91-runtime-foundation-developer team_revision=rev-p9.1-1 goal=task:ABG-P9.1-RUNTIME-FOUNDATION context_revision=p91-runtime-foundation-r4` - 完整启动方式:派发预览批准后由所选 runtime 控制面生成 ## 报告协议 - 完成、失败或阻塞时通知 PMO,并引用任务号、legal terminal 和证据路径。 - worker 不修改 PMO 管理的 queue ledger、STATUS 或角色注册表。 ## 验收标准(证据门) - [ ] Introduce exactly one authoritative FirstSessionState and FirstSessionService with immutable snapshots and atomic command results - [ ] Extract battle clock, animation, audio, feedback, presenter and widgets without changing accepted values, timing, pixels or input behavior - [ ] Keep main.gd as a thin RuntimeShell/facade and add no P9.1-only gameplay branch - [ ] Leave old run_state.gd and old p9_1_* tests unchanged and excluded from the foundation pass claim - [ ] Run the exact 22 contract-listed R10 scripts serially with unique markers and strict diagnostics zero - [ ] Rerun the four named 844x390 presentation regressions and compare accepted behavior - [ ] Commit and push only the owned paths; worktree clean/upstream; no owned process remains ## Frozen(禁止触碰,明确列出) - Do not implement the six-pair P9.1 downstream gameplay matrix, new screens or new test expectations - Do not change assets, paid generation, product values, timing, copy, node names or accepted P9.0 assertions - Do not edit PMO TaskGraph files, checkpoint, ledger, packaging, devices, stores or release files ## Estimate foundation extraction 4-6h; exact regression and presentation gate 1-2h; confidence medium ## 完成时交付 - graph 节点约定的 produces - 验收证据与残余风险 ## Developer Completion - Legal terminal: `ABG-P9.1-RUNTIME-FOUNDATION candidate ready` - Candidate: `c33c3042b10a1079674859a3f37b6d1fe3140c77` - Evidence: `/tmp/abg-p91-foundation-final-candidate-22.aP23Ws` - Result: exact 22 scripts pass with strict diagnostics zero; four 844x390 groups / 30 frames match the activation baseline byte-for-byte; pure-domain contract passes; worktree is clean/upstream with no owned process. - Open gate: fresh independent Foundation review. This is not final P9.1 integration or Owner acceptance. ## Review Failure And Attempt 2 - Candidate `c33c304` is append-only rejected by reviewer HAPI `9f8ea165-362e-4907-8c67-8aa0ace32fbd`. - Earliest failed boundary: frozen P9.1 domain IDs must be `retain_loan | add_recruit`; the candidate's new domain API uses legacy `retain_item | recruit_rear`. - Bounded repair: change new P9.1 contracts/state/service/events to the frozen IDs. Preserve old R1-R10 behavior only through one-way translation inside `runtime/compat/p9_0_root_facade.gd` when legacy callers require it. New domain truth must never accept, store or emit the legacy IDs. - Re-run the pure-domain contract, exact 22 scripts and all four 844x390 / 30-frame comparisons from the repaired source, then commit/push a new candidate. Do not change content values, UI copy, assets, tests or PMO files. ### Attempt-2 Candidate - Candidate: `bd505d6188556b5d407bebe9769d1c99e74dc9c1` - Product delta after R1 FAIL: four authorized files only. - Evidence: `/tmp/abg-p91-foundation-id-repair-final.HQdpxC`. - Exact-ID gate: frozen IDs accepted/stored/emitted; legacy IDs rejected by the domain boundary; legacy leaks zero. - Exact 22 scripts and four 844x390 / 30-frame comparisons pass again; clean/upstream; no owned process. - Open gate: fresh R2 independent review. ## Final Independent Review Result - Fixed candidate `bd505d6` failed R5 at the earliest structural contract boundary. - One successful `open_new_session` command increments revision twice; expected exactly once. - R5 evidence: `/private/tmp/abg-p91-foundation-r5-evidence.UYsX7a/terminal.txt`, SHA-256 `ae6045c523036e2aeb075303980d8145cdba5961d5b54b8cae13d38f7e510945`. - This Goal exhausted its two product candidates. A new bounded successor Goal owns the atomicity repair; historical candidates remain append-only.