docs(coding): integrate packaged Pi runtime fix

This commit is contained in:
2026-09-01 11:23:54 +08:00
parent 96402551f4
commit 42ea83c0cb
5 changed files with 65 additions and 68 deletions

View File

@@ -4,6 +4,18 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
## Integrated Through
- Packaged Pi Agent Server resolver fix source `7df245af5a04f62be48980831ff41987ba686009`
from task `20260901-local-runtime-unavailable-8b42c7f1` is integrated by task
`20260901-integrate-local-runtime-fix-9c4e2a71` through merge
`96402551f46d875ba3db0a2f625397aba2f332fb`. Electron Main now starts only the
shared Agent Server with Node's `import.meta.resolve` parent-URL capability enabled,
so the unchanged server script resolves `@earendil-works/pi-ai` from the explicit
packaged `pi-runtime` root instead of the sibling `resources/resources` directory.
A production-shaped sibling-layout test reproduces the installed failure before the
fix and initializes successfully through Electron Node after it; Pi remains pinned at
`0.84.2`, and no bundle layout, Provider, Renderer, or recovery contract changed.
The currently installed application predates this source integration; a rebuilt and
verified Windows artifact plus first-Conversation acceptance remain pending.
- Native Web Search client tickets MLW-01 through MLW-03 are integrated by source
coordinator `20260831-web-search-client-integration-7d2f5b94` and promoted to local
`main` by task `20260901-web-search-client-main-merge-5a9d3b82` from reviewed

View File

@@ -0,0 +1,51 @@
# Task: Integrate local runtime unavailable fix
## Identity
- Task ID: 20260901-integrate-local-runtime-fix-9c4e2a71
- Mode: Integration
- Branch: codex/20260901-integrate-local-runtime-fix-9c4e2a71-integrate-local-runtime-fix
- Worktree: D:\Datas\OthersProjects\makelore-worktrees\integrate-local-runtime-fix-9c4e2a71
- Base commit: 7f0e9310a7f394249fab3cadc5c82d70f91cbfeb
- Owner: codex
- Status: Ready for Integration
## Scope
- Integrate verified source commit `7df245a` for the packaged Pi Agent Server resolver failure onto the exact local `main` base.
- Promote the accepted source evidence into canonical current state, evidence, and the existing Windows Pi artifact commitment without changing ADR-006.
- Re-run the relevant product checks on the merged tree, commit the integration result, and fast-forward local `main` only when its worktree ownership is released.
## Intent And Constraints
- Preserve Pi `0.84.2` as the sole production runtime and keep Agent Server/runtime ownership in Electron Main.
- Do not change the Pi runtime bundle layout, dependency versions, Renderer/Provider contracts, recovery behavior, or add a compatibility fallback.
- Treat the currently installed application as pre-fix until a rebuilt artifact passes the existing publish/runtime/artifact/final proof and installed first-Conversation acceptance.
- Do not modify or release the separately owned `main` worktree while task `20260831-makelore-web-search-client-inspection-6b4d2e81` retains ownership.
## Outcome
- Verified source commit `7df245af5a04f62be48980831ff41987ba686009` contains only the packaged Agent Server launch fix, the production-shaped real-process regression, and its feature task record.
- Merged the source branch without conflicts as `96402551f46d875ba3db0a2f625397aba2f332fb` on the isolated integration branch.
- Omitted the duplicate source-owned task record from the promotion tip while preserving it unchanged on source commit `7df245af5a04f62be48980831ff41987ba686009`; the promoted tree therefore contains only the product fix, regression test, canonical memory, and this integration task's own record relative to `main`.
- Promoted the accepted evidence into `current-state.md`, `evidence-index.md`, and the existing Windows Pi artifact commitment. ADR-006 remains unchanged because runtime ownership, topology, version, and public contracts did not change.
- Prepared a verified fast-forward candidate for local `main`. Actual `main` promotion remains a separate ownership-gated step because task `20260831-makelore-web-search-client-inspection-6b4d2e81` still owns that worktree.
## Verification
- Source range inspection: exactly one source commit and three expected files relative to `main`; no unrelated source or project-memory change was present.
- Merge result: Git `ort` merge completed without conflicts.
- Integration focused tests: 4 files / 24 tests passed, including the production-shaped sibling-layout Agent Server startup through Electron Node.
- `pnpm run typecheck`: passed.
- `pnpm run lint:check`: passed with 0 errors and 5 pre-existing unrelated React warnings.
- `pnpm run build:vite`: passed for Renderer, Electron Main, Preload, and utility worker with existing bundle warnings only.
- The source task's full-suite evidence remains 215 files / 1,761 tests passed and 2 conditional skips; integration changed only canonical Markdown after the conflict-free source merge, so the full suite was not redundantly rerun.
## Follow-ups
- Release the completed `main` worktree owner only through the non-force task-context command, claim `main` with a separate integration task, and fast-forward it to this verified integration tip.
- Rebuild and install the Windows artifact, run the publish/runtime/artifact/final packaged proof, and confirm a first Coding Conversation no longer shows the runtime-unavailable projection.
## Promotion Candidates
- None. The source candidate was accepted and promoted by this integration task without semantic conflict.

View File

@@ -1,67 +0,0 @@
# Task: Diagnose local programming runtime unavailable
## Identity
- Task ID: 20260901-local-runtime-unavailable-8b42c7f1
- Mode: Feature
- Branch: codex/20260901-local-runtime-unavailable-8b42c7f1-local-runtime-unavailable-8b42c7f1
- Worktree: D:\Datas\OthersProjects\makelore-worktrees\local-runtime-unavailable-8b42c7f1
- Base commit: 7f0e9310a7f394249fab3cadc5c82d70f91cbfeb
- Owner: codex
- Status: Ready for Integration
## Scope
- Reproduce the current Makelore Code state that renders `本地编程运行时暂时不可用。` and identify the first failing Renderer, Host API, Pi runtime, packaging, or Provider boundary.
- Build a deterministic, agent-runnable feedback loop for the exact visible symptom before ranking or testing root-cause hypotheses.
- Correlate current source and focused tests with privacy-safe local runtime evidence where available.
- Implement the user-authorized minimal product fix for the confirmed packaged-layout Pi AI ESM resolution failure.
- Add a focused regression at the installed sibling-resource-layout seam, then verify the original process path plus the repository's required checks.
## Intent And Constraints
- Treat the visible sentence as a generic safe projection, not as proof of a Pi process failure.
- Preserve ADR-006: Pi `0.84.2` remains the sole production runtime; do not add an OpenCode fallback, dual runtime, compatibility layer, or automatic replay.
- Keep Renderer access behind `/api/coding/*`; runtime, Provider credentials, recovery, and raw diagnostics remain Electron Main-owned.
- Redact credentials, headers, prompts, session content, account identifiers, and complete user project paths from reported evidence.
- Distinguish confirmed facts, evidence-supported inferences, and unverified assumptions. The historical Host-token startup defect is a regression lead, not an assumed cause.
- Keep package resolution anchored to the explicit Main-owned `runtimeRoot`; development and packaged layouts must both continue to work without hard-coded layout branches or a compatibility layer.
- Work only in this isolated task worktree and do not modify peer worktrees or the occupied local `main` worktree.
## Outcome
- Confirmed that the installed Makelore application reaches the generic `CODING_RUNTIME_UNAVAILABLE` projection only after the Pi worker fails during `open`.
- The installed Agent Server imports `@earendil-works/pi-ai` with `import.meta.resolve(specifier, runtimePackageUrl)`. In the embedded Node.js `v24.18.1` process, the second `parentURL` argument is not honored unless `--experimental-import-meta-resolve` is enabled, so resolution starts beside `resources/resources/pi-agent-server.mjs` instead of the sibling `resources/pi-runtime/node_modules` tree.
- The dependency is present and healthy: the installed Agent Server matches repository source byte-for-byte, both `@earendil-works/pi-coding-agent` and `@earendil-works/pi-ai` are version `0.84.2`, and the expected ESM export exists.
- Reproduced the installed startup failure twice with the exact executable, script, runtime root, working directory, and environment shape. Both attempts exited with code `1` and `ERR_MODULE_NOT_FOUND` before producing protocol output.
- A one-variable differential adding `--experimental-import-meta-resolve` made the same process exit cleanly without the module error. Importing the verified absolute `pi-runtime/node_modules/@earendil-works/pi-ai/dist/index.js` URL also succeeded without the experimental flag.
- Added `--experimental-import-meta-resolve` only to the Main-owned Agent Server child process. This activates the existing `runtimePackageUrl` parent argument and preserves standard ESM package resolution across both the development layout and packaged `pi-runtime` closure.
- Added a real-process regression that places `pi-agent-server.mjs` under the installed `resources/resources` sibling layout, exposes the real Pi runtime and Pi AI package through a temporary production-shaped root, and starts it with the project's Electron executable.
- The regression failed before the fix with the same `ERR_MODULE_NOT_FOUND` / `PI_RPC_EXITED` chain and passed after the fix. No runtime bundle layout, dependency version, Provider behavior, Renderer contract, installed application file, user data, or peer task content was changed.
## Verification
- Current startup-log signal loop: found the missing `@earendil-works/pi-ai` module plus two `PI_WORKER_STOPPED` / `open_failure` events; verdict `RED` as expected for the reported failure.
- Exact installed-process loop: two independent launches reproduced `ExitCode=1`, `ModuleNotFound=true`, `MissingPiAi=true`, and zero protocol bytes within five seconds.
- Resolver differential: the same installed process with only `--experimental-import-meta-resolve` added produced no resolver error.
- Absolute-path differential: importing the fixed runtime-root ESM entry through `pathToFileURL(...)` succeeded in the same embedded Node.js process without the experimental flag.
- Artifact comparison: installed `pi-agent-server.mjs` equals repository source; installed Pi package versions and exports match the expected `0.84.2` runtime closure.
- The existing real-process unit test was inspected and does not cover this boundary because it runs the server from the repository layout, where ancestor lookup can reach the root `node_modules`; the installed sibling `resources/resources` and `resources/pi-runtime` layout is not exercised.
- Red regression: `pnpm exec vitest run tests/unit/pi-agent-server-process-real.test.ts -t "boots from the packaged sibling resource layout" --maxWorkers=1` failed at `pi-agent-server.mjs:22` with `ERR_MODULE_NOT_FOUND` and `PI_RPC_EXITED` before the product change.
- Green regression: the same command passed against Electron Node after the Agent Server launch flag was added.
- Focused verification: 4 relevant test files, 24 tests passed, covering Agent Server behavior, composition paths, Pi runtime bundling, and product artifact rules.
- Existing real-process behavior: both tests in `pi-agent-server-process-real.test.ts` passed, including two logical Conversation threads, process reuse, invalidation, and restart.
- Full unit suite: 215 test files passed; 1,761 tests passed and 2 existing conditional tests were skipped.
- `pnpm run typecheck`: passed. Final changed-file ESLint: passed.
- `pnpm run lint:check`: passed with 0 errors and 5 pre-existing unrelated React warnings.
- `pnpm run build:vite`: passed for Renderer, Electron Main, Preload, and utility worker; only existing bundle/chunk warnings were emitted.
- `git diff --check`: passed; no debug instrumentation or generated artifact is tracked.
## Follow-ups
- The currently installed application predates this source change. After integration, rebuild the Windows artifact, run `verify:artifact:win`, `verify:artifact:pi`, and the final packaged Pi proof, then install it before performing the first-conversation UI acceptance.
- When the pinned Electron/Node runtime is upgraded, retain the packaged-layout regression; remove the launch flag only after the new embedded Node accepts the `import.meta.resolve` parent argument without it.
## Promotion Candidates
- Target: `current-state` and the Pi release evidence index. Proposal: require an Electron Node Agent Server initialization proof from the installed sibling resource layout, not only source-tree process tests. Evidence: the new layout test reproduced the exact installed `ERR_MODULE_NOT_FOUND` before the fix and passed after enabling the resolver parent URL; 24 focused tests, the full unit suite, typecheck, lint, and production build passed. Future impact: prevents source-root ancestor `node_modules` from masking final-artifact ESM resolution regressions. Semantic conflicts: none with ADR-006 or the existing Pi closure requirement. Human confirmation: not required to integrate the evidence rule; final package installation/release remains an operator gate.