fix(cloud-agents): integrate Yuxi WeChat recovery state

This commit is contained in:
鲨鱼辣椒 committed 2026-10-14 00:05:24 +08:00
1 parent 70166d22b3
commit 979596f8f8
9 files changed
+896 -31

No files matched your search

@@ -0,0 +1,58 @@
# Task: 对接最新版Yuxi微信恢复状态
## Identity
- Task ID: 20261013-wechat-yuxi-adapter-9a7c32e1
- Mode: Feature
- Branch: codex/20261013-wechat-yuxi-adapter-9a7c32e1-wechat-yuxi-adapter
- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20261013-wechat-yuxi-adapter-9a7c32e1
- Base commit: 70166d22b3c4bebd76e3f565d32b122c2f1e2dee
- Owner: codex
- Status: Ready for Integration
## Scope
- Adapt the Makelore client to Yuxi d72aecf/ab05f82 while preserving the existing one-WeChat/one-Agent flow and public request contract. Block conflicting mutations during authoritative provider logout pending; retain and explicitly recover the original operation.
- Project current backend error codes into actionable messages and distinguish old requests that cannot safely replay from uncertain operations that can retry. Preserve original recovery evidence and all unrelated create/publish/key/knowledge behavior.
- Prevent a known disabled target Agent from being displayed as usable using the existing Agent catalog. Update focused unit and Electron contract/interaction tests, README and this record.
## Intent And Constraints
- User authorizes client integration and explicitly forbids changing Yuxi. Yuxi/Core/Adapter sources, schemas, deployment, real WeChat state and model calls remain untouched. No planning-with-files workflow is used.
- Concurrent Gate Passed: official check/start/status succeeded; task ID, feature mode, absolute worktree, branch and base match Identity. Fresh reviewer read all 53 peer records/159 Scope/Intent/Promotion sections. Existing channel/recovery tasks are ready and compatible; active navigation/knowledge/draft tasks are unrelated. One legacy child-language placeholder is unknown but has no channel dependency. The occupied dirty primary and canonical documents stay read-only.
- Project Context Loaded / Gate Passed: startup/memory/own record, positioning, current integrated snapshot, accepted personal-cloud and user-owned channel decisions, system/module/data-flow, domain/success, community boundary and evidence/reflection/commitment indexes loaded. Main owns network/auth and immutable original operations; Yuxi owns execution and internal five-condition Core logout guard. Current source supports explicit QR activation, pause-preserving reconnect, final readback, safe unavailable-target stopping and original-ID recovery.
- Latest Yuxi adds provider logout pending, durable route/logout intent and business schema 13. Core/Adapter compatibility, actual deployed versions, database migration and true WeChat/Worker/Redis acceptance are external release prerequisites. Ordinary-text Worker receive blocking and disabled-Agent server projection are backend limitations found in the preceding read-only assessment; this task does not repair backend code.
- Implementation: bound page/transport/recovery changes with independent file ownership; preserve generic recovery semantics; focused unit/type/lint/build checks then isolated Electron verification and fresh independent review. Save reviewable local commits, without primary merge, push, production changes or deleting any worktree.
## Outcome
- Client-only integration implemented against Yuxi `d72aecfa8932da24f2c89dadcc37cf69c485799d`. The existing one-WeChat/one-Agent flow, public API, authentication ownership and immutable original operations remain intact.
- `wechat_disconnect_pending` blocks all same-owner new management actions, including an already-open dialog and when no local recovery journal exists. Every new mutation first reads authoritative channel state; failed reads and concurrent pending observations prevent writes and operation-ID allocation. Refresh and explicit original-operation recovery remain available.
- Full paginated Agent metadata distinguishes a known disabled target from a usable channel and excludes disabled/unpublished targets from selection. Safe pause/unbind and switching to an available Agent remain possible.
- Main exposes actionable legacy/identity/target errors and rejects compound unbind success if the returned state remains pending/degraded/enabled, retaining the original journal. Recovery permanently blocks unsafe legacy replay; recoverable identity/target errors offer explicit readonly refresh, then separate original-record confirmation, without automatic replay or new IDs. Local reminder deletion does not cancel a server operation.
- Independent review found a recoverable-error UI lock and a timing-sensitive test helper. Both were corrected: state refresh restores explicit original-record confirmation; the helper waits for the actual enabled control rather than clicking during startup. Final source review passed with no remaining material findings.
- README is synchronized with the client behavior and external release prerequisites. No Yuxi/Core/Adapter source or schema changes, no primary adoption/merge/push, and no changes to the user's running app or real WeChat accounts. Isolated Electron fixture verification passed; the client result is ready for integration.
## Verification
- Exact package manager: `corepack pnpm` 10.33.4 in this owned worktree.
- Final relevant unit regression: `corepack pnpm exec vitest run tests/unit/cloud-agents-main.test.ts tests/unit/channel-accounts-page.test.tsx tests/unit/cloud-recovery.test.tsx tests/unit/cloud-channel-panel.test.tsx tests/unit/cloud-channel-conversations.test.tsx tests/unit/cloud-agents-page.test.tsx --maxWorkers=3`: 6 files / 248 tests passed. Covers owner-level pending locks, late state reads/open dialogs, failed preflight, disabled targets, strict unbind confirmation, original-ID recovery, dynamic attention refresh and no late recovery replay after unmount, with unrelated channel/conversation/Agent regression coverage.
- `corepack pnpm typecheck` and `corepack pnpm lint:check`: exit 0. Eight warnings are in unchanged CloudChat/CloudCosts/Home/Makelore files; changed source/test scoped ESLint is clean.
- `corepack pnpm run build:vite`: exit 0 for Renderer, Main, Preload and Utility. Existing Browserslist/chunk/import warnings remain; generated output is ignored and will not be committed.
- Independent read-only reviewer: source PASS; separately ran Main 111 + channel page 57 + recovery 24 = 192 tests passed and `git diff --check` passed. No backend, production account, model or runtime mutations were used for review.
- Final isolated Electron command: `/usr/local/bin/corepack pnpm exec playwright test tests/e2e/cloud-agent-channels.spec.ts --workers=1 --reporter=list`: 2/2 passed (8.7 s), after the final production build. Existing connect/switch/pause/unbind flow plus server pending with no local journal, same-owner lock, already-open dialog guard, disabled-target safe actions and legacy recovery/discard behavior passed. Fixture replaces Host API IPC and uses isolated user data; this is client acceptance, not real Yuxi/Core/WeChat acceptance.
- Seven desktop/compact screenshots were visually reviewed by the UI agent. Root independently inspected the disabled-target actions and legacy recovery screenshots; duplicate pending-receipt text was removed, then recovery 24/24, scoped ESLint, production build and both Electron scenarios passed again. Final legacy screenshot was checked after that build; no clipping, content overlap or false success. Screenshots remain ignored under `test-results/cloud-agent-channels-WeCha-c7840-rough-the-channel-workspace/`.
- Final independent source/spec/docs review and one-line message de-duplication review: PASS, no remaining material findings. Final source SHA256: Main `3275b5781195953c1f2eae0962d3ca55250d281ec1a187a6c49894340c09b5ce`, Channel page `b01cd4bf8c728afcfd3948bcea2572887e41416b106ebefbcc4094f30be5cc0e`, Recovery `d3c9cad5e31cef8d66a2a99f5db5750e5bf972d113fcd3e1fd5a9c94f68d97bf`; final Electron spec `839087eadd94559230e9466a35970d6338aeb6cb58f1ae99e183676f62c175f3`.
- Project-doc ownership drift check and final Git checks passed. Local result is committed on the owned feature branch; the worktree is retained for integration.
- Read-only Yuxi final check: HEAD remains `d72aecfa8932da24f2c89dadcc37cf69c485799d`; only the pre-existing foreign untracked assessment record is present, with no tracked source changes.
## Follow-ups
- Integrate the local client commit into the maintained client branch/runtime through the owning integration task. The primary checkout is occupied and has foreign changes; this task does not adopt or overwrite it.
- Before a production rollout, verify deployed Yuxi/Core/Node Adapter compatibility and business schema 13 / knowledge schema 2, then perform real WeChat/Worker/Redis acceptance. Existing backend three-party HTTP/PG probe records do not prove the external WeChat or model execution path. This task does not deploy or migrate the backend.
- Backend assessment limitations remain: an ordinary-text Worker handler waits for the run result before consuming later AgentBus input (including WeChat stop), and disabling an Agent can leave server channel availability stale until the backend projection is repaired. Client catalog compensation does not fix either backend mechanism. No backend change is included.
## Promotion Candidates
- Target: `.project-docs/30-worklog/current-state.md` and accepted personal-cloud channel architecture during serialized integration. Proposal: record client owner-level logout-pending lock, known-disabled target display, strict unbind readback and explicit original-record recovery behavior. Evidence: source diff and 248 passing focused unit tests, final build, isolated Electron 2/2 and independent review PASS. Future impact: subsequent channel changes must preserve immutable operation identity and distinguish server pending from completed logout. Semantic conflicts: no change to the accepted one-WeChat/one-Agent or server-owned identity/execution boundary. Human confirmation is not required for these facts; canonical writes remain reserved to the integration owner.
- Target: current release-readiness evidence in canonical project memory. Proposal: latest Yuxi source has schema/compatible Core prerequisites and known Worker/projection limitations; retain those as unverified live-release conditions, not a claim of real-WeChat completion. Evidence: read-only Yuxi `d72aecf` assessment and local client-only scope. Future impact: prevent a client fixture PASS from being mistaken for deployed backend acceptance. No semantic conflict with prior backend source work; production state must be verified independently.