docs: record agent server lifecycle integration

This commit is contained in:
2026-09-01 14:42:39 +08:00
parent c2137c9f3f
commit 143aaec3d6
3 changed files with 71 additions and 53 deletions

View File

@@ -4,6 +4,19 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
## Integrated Through
- Agent Server background-sleep race fix source
`12d7588b3ebd4d192c2e14ae285d4f6ddebeeb42` from task
`20260901-agent-received-stall-8b6d4c21` is merged into local `main` as
`c2137c9f3f2e05441064cc90bfeed115363ac04e` by task
`20260901-integrate-agent-stall-4f2c8a91`. Background sleep now rechecks
active Coding work after asynchronous worker cleanup before stopping the shared
Agent Server, and a server start racing an in-flight stop waits for that stop and
creates one fresh process. This closes the confirmed lifecycle windows that can
leave a locally accepted prompt optimistic with no live Agent Server or Pi session
write; accepted/uncertain prompts are still never auto-replayed. Source tests and
a real Electron-Node Agent Server race test pass. The currently installed binary
predates this integration; a rebuilt/reinstalled Windows package and repetition of
the reported interaction remain pending release evidence.
- Works-provisioned model-reasoning capability source
`ae7936174208a1d13cdfd260d5c6f2b70b450b60` from task
`20260901-server-model-capabilities-9e31b6c4` is merged into local `main` as

View File

@@ -1,53 +0,0 @@
# Task: Diagnose local Agent received-message stall
## Identity
- Task ID: 20260901-agent-received-stall-8b6d4c21
- Mode: Feature
- Branch: codex/20260901-agent-received-stall-8b6d4c21-agent-received-stall
- Worktree: D:\Datas\OthersProjects\makelore-worktrees\agent-received-stall-8b6d4c21
- Base commit: 850947c092892cb647c4191b6d8bbf37a763e1ad
- Owner: codex
- Status: Ready for Integration
## Scope
- Diagnose the installed-app state where a prompt is acknowledged locally but remains optimistic indefinitely.
- Fix the background-sleep versus Agent Server start race without replaying accepted prompts.
- Add focused regression coverage for both lifecycle race windows.
## Intent And Constraints
- Preserve the single shared Pi Agent Server and per-conversation logical thread architecture.
- Background sleep must not stop work that begins while idle worker cleanup is in flight.
- A start racing an already-started stop must wait for the stop and then create a fresh server process.
- Do not auto-replay an accepted or uncertain prompt.
## Outcome
- Confirmed installed-state evidence: the accepted UI state was newer than the latest Pi session write, and no Agent Server process remained live, so the prompt had not reached Provider generation.
- Confirmed regression: `PiAgentServerProcess.start()` returned immediately when the old child still existed during an in-flight stop; after that stop completed, no server remained. The real-process race test failed before the fix and passed afterward.
- Confirmed regression: composition checked for active work only before asynchronous background cleanup, then stopped the shared Agent Server even when a new run began during cleanup. The composition race test failed before the fix and passed afterward.
- Fixed both lifecycle windows: background sleep rechecks active work after worker cleanup, and a start racing a stop waits for that stop before creating a fresh server.
- The installed-app symptom maps directly to these two confirmed races, although the exact renderer/Main interleaving of the reported occurrence was not captured live.
- Accepted and uncertain prompts are still never auto-replayed.
## Verification
- Installed-state red loop: accepted screenshot timestamp is newer than the latest Pi session write while no Agent Server process is live.
- Red phase: the two focused race tests both failed against the original implementation.
- `pnpm exec vitest run tests/unit/pi-agent-server-process-real.test.ts tests/unit/coding-composition-background-sleep.test.ts --maxWorkers=1` — 2 files, 4 tests passed.
- `pnpm exec vitest run tests/unit/background-lifecycle.test.ts tests/unit/pi-background-lifecycle.test.ts tests/unit/pi-agent-server-process-real.test.ts tests/unit/coding-composition-background-sleep.test.ts --maxWorkers=1` — 4 files, 9 tests passed.
- `pnpm run typecheck` — passed.
- `pnpm run lint:check` — passed with 5 pre-existing warnings and no errors.
- `pnpm test` — 216 files passed; 1,764 tests passed and 2 skipped.
- `pnpm run build:vite` — Renderer, Main, Preload, and utility production builds passed.
- Existing Electron E2E fixtures mock prompt acceptance and do not exercise the real Main-owned Agent Server lifecycle; the real-process regression test is the relevant product-path coverage.
## Follow-ups
- Integrate the feature commit into `main`, then produce/reinstall a Windows package before validating the original installed-app reproduction; the currently installed binary does not contain this source fix.
## Promotion Candidates
- None. The change enforces existing background-lease and single-Agent-Server architecture rather than changing canonical product behavior.

View File

@@ -0,0 +1,58 @@
# Task: Integrate Agent Server sleep restart fix
## Identity
- Task ID: 20260901-integrate-agent-stall-4f2c8a91
- Mode: Integration
- Branch: main
- Worktree: D:\Datas\OthersProjects\makelore
- Base commit: 738eda14300b18beff826d87e0e043317ec5bb7d
- Owner: codex
- Status: Completed
## Scope
- Merge exact feature commit `12d7588c` into local `main`.
- Preserve the already-integrated model-reasoning capability behavior.
- Record the integration in canonical current state without changing Pi, Provider, packaging, or replay contracts.
## Intent And Constraints
- Pi `0.84.2` remains the sole Coding runtime and one Main-owned Agent Server remains the parent topology.
- Background sleep must not stop work that begins during cleanup, and start racing stop must create one fresh server after stop settles.
- Accepted and uncertain prompts must never be replayed automatically.
- Stop on any merge conflict or semantic conflict; do not choose by merge order.
- Do not package, install, deploy, push, or change dependencies in this integration task.
## Plan
1. Verify the exact source commit and a conflict-free merge tree against current `main`.
2. Merge the source branch with an explicit merge commit.
3. Record the integrated behavior and remaining installed-package gate in canonical current state.
4. Run focused lifecycle tests, typecheck, lint, production build, and documentation drift checks.
5. Commit integration memory, complete the task, and release ownership from a clean worktree.
## Outcome
- Verified source commit `12d7588b3ebd4d192c2e14ae285d4f6ddebeeb42` and conflict-free merge tree `63750df00cda0da00304725b6f0a8c17dd5e09b0` against current `main`.
- Merged the exact source into local `main` as `c2137c9f3f2e05441064cc90bfeed115363ac04e` without conflict.
- Preserved the already-integrated model-reasoning capability changes and the Pi `0.84.2` single-Agent-Server architecture.
- Recorded the background-sleep recheck and serialized stop/start behavior in canonical current state.
- No package, installation, deployment, push, dependency, Provider, or replay-contract change was performed.
## Verification
- `git merge-tree --write-tree HEAD 12d7588` returned conflict-free tree `63750df00cda0da00304725b6f0a8c17dd5e09b0` before merge.
- Merged-main focused lifecycle run: 4 files / 9 tests passed.
- `pnpm run typecheck`: passed.
- `pnpm run lint:check`: zero errors and the repository's existing five warnings.
- `pnpm test`: 216 files passed; 1,780 tests passed and 2 skipped.
- `pnpm run build:vite`: Renderer, Electron Main, Preload, and utility production builds passed with existing build warnings only.
## Follow-ups
- Build, verify, and reinstall a Windows package from integrated `main`, then repeat the reported prompt-after-idle interaction. The currently installed application still contains the old lifecycle code.
## Promotion Candidates
- Resolved: recorded the exact source and merge commits, lifecycle behavior, no-replay invariant, and remaining installed-package gate in `.project-docs/30-worklog/current-state.md`. No ADR or architecture rewrite was needed because the fix enforces ADR-006.