实现 Codex 风格上下文压缩时间线交互
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
# Task: Implement Codex-style context compaction interaction
|
||||
|
||||
## Identity
|
||||
|
||||
- Task ID: 20260814-codex-compaction-ux-74b3f2a1
|
||||
- Mode: Feature
|
||||
- Branch: codex/20260814-codex-compaction-ux-74b3f2a1-codex-compaction-ux
|
||||
- Worktree: D:\Datas\OthersProjects\makelore-codex-compaction-ux-74b3f2a1
|
||||
- Base commit: 953b0f491e44036bc8273fb29dd880e38defae24
|
||||
- Owner: codex
|
||||
- Status: Completed
|
||||
|
||||
## Scope
|
||||
|
||||
- Replace the transient top-of-transcript context-compaction notice in Makelore Code with Codex-style chronological timeline events.
|
||||
- Model manual and automatic compaction as project-scoped, per-session transcript state that survives completion and history hydration.
|
||||
- Preserve the existing composer, stop, queued-prompt, session-switching, OpenCode API, provider, and model-threshold behavior.
|
||||
- Add focused reducer, Store, Renderer, and Electron E2E coverage and synchronize README behavior documentation.
|
||||
|
||||
## Intent And Constraints
|
||||
|
||||
- Use the locally installed Codex Desktop 26.810.4967 interaction as the concrete reference: a muted inline activity item while running and a static item retained at the same chronological position when complete.
|
||||
- Keep one canonical compaction timeline source of truth; remove the parallel `compactingSessionIds` boolean after migration.
|
||||
- Keep UI event identity immutable while associating native Part/event identities separately for replay deduplication.
|
||||
- Correlate completion and failure using session generation, run token, and native identities so stale events cannot mutate a newer run.
|
||||
- `session.compacted` completes only the matching compaction item; it is not full run idle and must never release queued prompts early.
|
||||
- Historical completed items are static content; only a real-time running-to-completed transition may use a live region.
|
||||
- Keep changes surgical and inside the isolated owned worktree.
|
||||
|
||||
## Outcome
|
||||
|
||||
- Replaced the transient top notice with persistent, chronologically anchored compaction timeline items for both manual and automatic compaction.
|
||||
- Added a canonical per-session compaction state model with immutable UI identity, native Part/event association, history hydration, replay deduplication, and monotonic running-to-completed status.
|
||||
- Kept compaction observation separate from run idleness: `session.compacted` completes the matching item, while only real idle state releases queued prompts.
|
||||
- Added failure, abort, POST rejection, runtime-generation, stale-event, background hydration, scroll, accessibility, and multi-session handling.
|
||||
- Updated README behavior documentation and Electron E2E coverage.
|
||||
|
||||
## Verification
|
||||
|
||||
- Baseline before implementation: `pnpm test` — 156 files, 1691 tests passed.
|
||||
- Focused final tests: `pnpm exec vitest run tests/unit/opencode-session-state.test.ts tests/unit/opencode-store.test.ts tests/unit/opencode-chat-panel.test.tsx` — 3 files, 236 tests passed.
|
||||
- Full unit suite: `pnpm test` — 156 files, 1712 tests passed.
|
||||
- Type check: `pnpm run typecheck` — passed.
|
||||
- Lint: `pnpm run lint:check` — passed with 0 errors and 6 pre-existing warnings.
|
||||
- Production compile: `pnpm run build:vite` — passed; only existing chunk-size and dynamic/static import warnings remained.
|
||||
- Electron E2E: `pnpm exec playwright test tests/e2e/opencode-slash-commands.spec.ts` — 3 tests passed.
|
||||
- Whitespace validation: `git diff --check` — passed.
|
||||
- Final read-only Sol review: PASS after adding a regression guard against completed-to-running hydration downgrades.
|
||||
|
||||
## Follow-ups
|
||||
|
||||
- Non-blocking: when validating a future OpenCode runtime upgrade, run a real long-context smoke test to reconfirm the native compaction Part fields (`auto`, Part identity, and completion timing). The current E2E uses a controlled EventSource through the real Store/Renderer lifecycle rather than launching the OpenCode process.
|
||||
|
||||
## Promotion Candidates
|
||||
|
||||
- Target: README/current architecture documentation.
|
||||
Proposal: treat context compaction as a persistent per-session transcript event, and preserve the invariant that `session.compacted` is not equivalent to `session.idle`.
|
||||
Evidence: reducer, Store, Renderer, and Electron E2E coverage in this task; final Sol review PASS.
|
||||
Future impact: OpenCode runtime upgrades must preserve native Part/replay correlation and must not let compaction completion release the active run queue.
|
||||
Semantic conflict: none found against current project memory.
|
||||
Human confirmation: not required; the user explicitly approved implementing the Codex-referenced interaction.
|
||||
Reference in New Issue
Block a user