5.1 KiB
5.1 KiB
Task: Fix Coding history loading and quota errors
Identity
- Task ID: 20260831-fix-history-quota-errors-6c2a91e4
- Mode: Feature
- Branch: codex/20260831-fix-history-quota-errors-6c2a91e4-fix-history-quota-errors-6c2a91e4
- Worktree: /Users/inmanx/Documents/makelore-fix-history-quota-errors-6c2a91e4
- Base commit:
38f85f6b5e - Owner: codex
- Status: Ready for integration
Scope
- Restore access to the full persisted active-branch history of Makelore Code conversations after Pi compaction, while keeping history display bounded in the Renderer and preserving the user's scroll anchor when older content is prepended.
- Recognize the observed upstream
403 token_point_balance_exhaustedcontract as a non-retryable Token Point quota failure and show actionable, safe Chinese feedback instead of the generic处理失败summary. - Add focused Main/projector/Renderer regression coverage and run the required typecheck, lint, and production build verification.
Intent And Constraints
- Preserve Pi
0.84.2as the sole runtime and keep Pi session/wire shapes inside Electron Main. Renderer continues to consume product-neutral Snapshot/Patch data through the Host API. - Full visible history must not change the compacted model context or expose the private compaction summary. Accepted/uncertain mutations remain non-replayed.
- Quota classification must be narrow enough not to reinterpret unrelated
403,429, or Provider failures, and raw upstream text must not leak into Renderer state. - The ready-for-integration progress-message task overlaps the timeline source and test files but has no semantic conflict; keep changes localized to the history-window and scrolling behavior.
Outcome
- Pi session hydration now projects the complete active branch in chronological order instead of dropping entries before the latest compaction boundary. Compaction summaries remain private, and multiple durable compaction markers reconcile against live IDs from newest to newest.
- The Renderer still mounts only the latest 120 nodes initially, automatically
prepends earlier nodes in 100-node steps near the top, and offsets
scrollTopby the added height so the current reading position stays fixed. - The exact
403 token_point_balance_exhausted/词元点数余额不足response is classified as quota exhaustion, forwarded as non-retryable HTTP 402, and projected asCODING_PROVIDER_QUOTA_EXHAUSTEDwith the safe message词元点数余额不足,请充值后重试。. - Live failures and persisted Pi assistant failures share the same redacting classifier. Reopened conversations restore only the safe Provider notice; raw upstream request IDs are not copied into the public Snapshot.
- The collapsed process summary displays the actionable public failure message
for both live runs and reopened persisted failures instead of generic
处理失败.
Verification
pnpm exec vitest run tests/unit/pi-session-projector.test.ts tests/unit/coding-conversation-timeline.test.tsx tests/unit/ai-proxy-routes.test.ts tests/unit/pi-event-projector.test.ts- Passed: 4 files, 45 tests.
pnpm run typecheck- Passed.
pnpm run lint:check- Passed with 0 errors and 5 existing warnings in
src/pages/Home/index.tsxandsrc/pages/Makelore/index.tsx.
- Passed with 0 errors and 5 existing warnings in
pnpm test- Passed: 211 regular files / 1,730 tests plus the isolated pressure file / 1 test; 3 tests skipped.
pnpm run build:vite- Passed for Renderer, Electron Main, Preload, and release utility worker; existing Vite dynamic-import and chunk-size warnings remain.
node ./node_modules/@playwright/test/cli.js test tests/e2e/pi-coding-first-chat.spec.ts- Passed: 2 Electron tests, including persisted quota feedback, automatic older-history loading, and scroll-anchor preservation.
git diff --check- Passed.
Follow-ups
- Integration should account for the ready progress-message task because both
tasks intentionally touch
CodingConversationTimeline.tsxand its unit/E2E coverage; the edited concerns are separate.
Promotion Candidates
- Target canonical documents:
README.mdand the integrated current-state summary. - Proposal: state that Pi compaction changes model context but does not remove visible active-branch history, and that recognized Provider quota failures remain actionable after reopening a conversation.
- Evidence: focused projector/Renderer/proxy tests, the 1,731-test full unit run including pressure coverage, the production build, and the two focused Electron E2E scenarios all pass.
- Future impact: troubleshooting and future history work should preserve the distinction between Pi context retention and product-visible session history, and should reuse the redacted Provider-failure projection.
- Semantic conflicts: none known; the peer progress-message task overlaps the timeline files but not these semantics.
- Human confirmation required: no product-direction choice is known to be required, but the integration owner must decide whether this detail belongs in canonical user-facing documentation.