docs: integrate session settlement recovery

This commit is contained in:
inman
2026-09-02 11:18:35 +08:00
parent e76a1e113e
commit dcc186877a
5 changed files with 93 additions and 74 deletions

View File

@@ -4,6 +4,16 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
## Integrated Through
- Coding terminal-settlement source `f1fd13a` from task
`20260901-fix-session-settlement-a47d2e91` is integrated through merge
`e76a1e1` by task `20260902-integrate-session-settlement-6e41c8b2`.
Normal prompt completion still uses authoritative `agent_settled`; when that
handshake is missing after Pi has terminalized, Main probes only the accepted
target thread after a bounded 30-second grace period. Exact idle evidence
hydrates the persisted final assistant response and releases ownership once;
contradictory state becomes an explicit target-only protocol failure. Accepted
or uncertain mutations are never replayed, and sibling Conversations remain
available.
- Plugin-navigation sources `b3f4166` and `e237941` from task
`20260831-consolidate-plugin-navigation-3d9a6c71` are integrated through
merge `a278ca3`. Coding history/quota source `d523b72` from task
@@ -241,6 +251,12 @@ Robot 绑定设备默认先显示“引导配网 / 已有激活码”路径选
## Recently Completed
- 2026-09-02: Integrated bounded recovery for a missing Pi prompt settlement.
A final persisted assistant response can no longer leave the Composer permanently
processing merely because `agent_settled` was lost: Main waits for the normal
handshake, then uses exact target-thread idle evidence to hydrate and settle once,
or emits a safe target-only protocol failure. Focused runtime/process tests,
typecheck, and the Vite/Electron production build passed on the integrated tree.
- 2026-09-01: Integrated the consolidated Plugin Services navigation, complete
active-branch Coding history with scroll-anchor preservation, narrow Token Point
quota feedback, and stable first-line process previews. Combined typecheck,
@@ -330,4 +346,4 @@ Robot 绑定设备默认先显示“引导配网 / 已有激活码”路径选
## Last Updated
2026-09-01
2026-09-02

View File

@@ -1,72 +0,0 @@
# Task: Fix stuck Coding session settlement
## Identity
- Task ID: 20260901-fix-session-settlement-a47d2e91
- Mode: Feature
- Branch: codex/20260901-fix-session-settlement-a47d2e91-fix-session-settlement
- Worktree: /Users/inmanx/Documents/makelore-fix-session-settlement-a47d2e91
- Base commit: 8062b45103be45ae036167d3e9890c3ca9ba3e80
- Owner: codex
- Status: Ready for integration
## Scope
- Harden the shared Pi Agent Server/Main terminal handshake so a prompt cannot remain
visibly processing after Pi has produced its terminal assistant response.
- Preserve authoritative `agent_settled` semantics during normal retries, follow-ups,
compaction, and queued work; add a bounded, evidence-based terminal fallback only for
a logically idle target thread.
- Add focused regression coverage for post-accept prompt failure and missing/delayed
settlement, including exactly-once release of target run ownership.
## Intent And Constraints
- Do not automatically replay any accepted or uncertain Coding mutation.
- Do not settle directly on `message_end`; Pi may still retry, compact, or process a
queued continuation after that event.
- Keep Pi wire/state Main-private and preserve per-Conversation generation isolation,
run permits, background leases, and sibling Conversation availability.
- A user-visible wait must end in finite time as completed only when target runtime
state proves idle; otherwise it must converge to an explicit safe failure.
- Do not touch or terminate the currently running app/processes from the diagnostic
task while implementing this isolated source fix.
## Outcome
- Confirmed the visible indefinite wait was a missing terminal-handshake failure:
Pi had already persisted a final assistant message, but Main never received an
effective `agent_settled`, so run ownership and the processing timer remained live.
- The Agent Server now reports prompt failures that happen after RPC acceptance as a
private target-thread error instead of swallowing the rejected prompt promise.
- Main now probes only the accepted target thread's authoritative runtime state. Exact
idle evidence settles a missing handshake and hydrates the persisted final response;
contradictory terminal state converges to an explicit target-only protocol failure
after a bounded 30-second grace period.
- Preserved normal `agent_settled` authority, retry/compaction/queued-work semantics,
exactly-once cleanup, sibling Conversation availability, and the no-replay rule for
accepted or uncertain mutations.
## Verification
- Focused Pi/runtime unit and real-process integration tests: 68 passed across 8 files.
- Full unit suite: 1,732 passed and 3 skipped (including the pressure project).
- `pnpm run typecheck`: passed.
- Targeted ESLint for all changed source/test files: passed.
- `pnpm run lint:check`: passed with 0 errors and 5 pre-existing unrelated warnings.
- `pnpm run build:vite`: passed for Renderer, Main, Preload, and utility bundles; only
existing Browserslist/import/chunk-size warnings remained.
- `git diff --check`: passed.
- Electron E2E was not run: the repository has no shared fixture that can inject a
dropped Pi settlement handshake, and the task intentionally did not stop or restart
the user's currently running application.
## Follow-ups
- Integrate this feature branch, then restart/rebuild the desktop app so the currently
running process loads the corrected Agent Server and Main runtime code.
## Promotion Candidates
- None. This restores the existing ADR-006 terminal-settlement contract and does not
introduce a new product or architecture decision.

View File

@@ -0,0 +1,74 @@
# Task: Integrate stuck session settlement fix
## Identity
- Task ID: 20260902-integrate-session-settlement-6e41c8b2
- Mode: Integration
- Branch: main
- Worktree: /Users/inmanx/Documents/makelore
- Base commit: dedbc85014e0c7e656464c9b3af26f9f4882bd04
- Owner: codex
- Status: Completed
## Scope
- Integrate source commit `f1fd13a` from task
`20260901-fix-session-settlement-a47d2e91` into local `main`.
- Promote the verified missing-settlement recovery behavior into the integrated
project snapshot without changing the accepted ADR-006 runtime boundary.
- Re-run focused runtime tests, typecheck, and the Renderer/Main/Preload build on
the integrated tree, then confirm the development desktop process reloads.
## Intent And Constraints
- Preserve normal `agent_settled` authority, per-Conversation generation isolation,
exactly-once ownership cleanup, and sibling availability.
- Do not replay an accepted or uncertain Coding mutation and do not settle an
ordinary prompt solely because `message_end` was observed.
- Permit bounded fallback completion only from exact target-thread idle evidence;
contradictory terminal state must converge to a target-only protocol failure.
- Keep Pi wire/runtime state private to Electron Main and make no unrelated product,
protocol, authentication, provider, or project-data change.
## Outcome
- Committed the completed read-only live-stall diagnosis on `main` as `dedbc85`
and released its prior feature-task ownership cleanly.
- Merged source fix `f1fd13a` into `main` without conflicts as merge `e76a1e1`.
- Kept the source task record read-only on its feature branch; `main` contains the
integration task record and canonical promoted facts rather than a mutable copy
of another task's owned record.
- Promoted the bounded missing-settlement recovery into `current-state.md`, the
evidence index, and `README.md`; ADR-006 remains unchanged because the fix
restores its existing authority, isolation, and no-replay contract.
- Restarted the development desktop application from the integrated tree. The
new Electron Main process is listening on the Host API and the Renderer returns
HTTP 200 with the settlement-probe implementation present in the built bundle.
## Verification
- Source task evidence: 68 focused tests passed across 8 files; 1,732 full unit
tests passed and 3 skipped; typecheck, targeted/full lint, Vite build, and
`git diff --check` passed.
- Integrated tree: `vitest run tests/unit/pi-worker-pool.test.ts
tests/unit/pi-agent-server-process-real.test.ts --maxWorkers=2` passed 26 tests
across 2 files.
- Integrated tree: `pnpm run typecheck` passed.
- Integrated tree: `pnpm run build:vite` passed for Renderer, Main, Preload, and
utility bundles; only pre-existing Browserslist/import/chunk-size warnings
remained.
- Restart smoke: Renderer `http://localhost:5173/` returned HTTP 200; Electron
process `87870` listens on `127.0.0.1:13210`; the built Main bundle contains the
settlement-probe implementation.
- `check_project_docs.py`, task-aware `check_doc_drift.py`, `git diff --check`,
and the final Git cleanliness check passed.
## Follow-ups
- No additional code follow-up is required for this local integration. A future
packaged release should retain the existing Pi final-artifact and cross-platform
release gates.
## Promotion Candidates
- None recorded.