merge: 集成 Codex 风格上下文压缩交互

This commit is contained in:
2026-08-15 08:51:02 +08:00
18 changed files with 2029 additions and 80 deletions

View File

@@ -4,6 +4,7 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
## Integrated Through
- `fd9b5b46a913c515e94e4e26f185d43866c2581f`: Codex-style persistent AI Programming context-compaction timeline and run-lifecycle separation.
- `22378efcee07e7fb80b651e65e3202f1a1dfea1d`: AI Canvas bidirectional Agent WebSocket commands, idempotent transport fallback, and Quote-based generation-task recovery.
- `aba5cae286807093cf4ef643fe9f498050985c31`: Robot / AI hardware module, Main-owned Works Square proxy, and cross-repository wire contract.
- `86ece3a` / `4dde8f3`:客户端登录七天滑动续期及集成提交。
@@ -24,12 +25,13 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
AI 绘画的一个 Workspace 可包含多条 Conversation。消息、Brief、Quote 和 `turnRevision` 随 Conversation 隔离;生成任务和资产保持 Workspace 级共享。图片 Brief 支持文生图,以及从当前项目已完成作品或本地上传中选择一张参考图继续生成;视频复用同一选择器绑定首帧。两条路径都通过现有 Workspace Asset 契约提交一个真实 Asset ID。每条 Conversation 使用服务端持久 Agent Gateway Session连接正常时命令、Run 与设计事件共用双向 WebSocket只有发送、断连或 ACK 超时等传输故障才以同一 `client_command_id` 回退 REST结构化业务错误不重复提交且未知上游文本由 Main 脱敏。确认生成会按 Quote 对账 Workspace 任务;任务已经落库但 Run 随后失败时仍恢复任务列表,内部对账失败不覆盖当前 UI 错误,同时 Conversation 写入继续受 Workspace-load 与 Conversation-selection generation 保护。
AI 编程首次发送在新建 OpenCode session 已知为空时不再等待冗余历史读取prompt 可直接进入 Host API普通历史会话仍刷新消息。Main AI proxy 只把明确的上游分组饱和投影为当前 OpenCode 的终止状态,配额耗尽保持独立终止态,通用限速继续保留 `429`
AI 编程首次发送在新建 OpenCode session 已知为空时不再等待冗余历史读取prompt 可直接进入 Host API普通历史会话仍刷新消息。Main AI proxy 只把明确的上游分组饱和投影为当前 OpenCode 的终止状态,配额耗尽保持独立终止态,通用限速继续保留 `429`上下文压缩以每个 Session 的持久时间线事件呈现:自动与手动压缩使用不同文案,运行态原位弱化显示,完成后静态保留并可从历史恢复;`session.compacted` 只完成对应事件,只有真实 idle 才结束 run 和释放排队消息。
Updater 仍由 Electron Main 选择目标 feed、记录原始诊断并保持失败语义。正式稳定源缺少对应平台 manifest 时设置页只显示一条简洁中文提示并允许重试不把缺包误报为已是最新版也不向普通界面暴露堆栈、URL、路径或错误码签名产物发布和真实升级安装仍属于外部 Release Gate。
## Recently Completed
- 2026-08-15AI 编程上下文压缩改为 Codex 风格的会话内时间线事件;手动与自动压缩原位展示并持久保留,历史回放去重且状态只允许从 running 单调进入 completed压缩完成不再冒充整个 run idle。
- 2026-08-14: AI Canvas Agent 命令与流式事件改为共用双向 Conversation WebSocket并保留仅面向传输故障的幂等 REST 回退;结构化 Gateway 错误不重试且未知文本脱敏;确认生成按 Quote 恢复已落库任务,切换 Conversation 后仍同步 Workspace 任务且不覆盖新会话状态或错误。
- 2026-08-13: Integrated the enabled `Makelore Robot` top-level module at `/ai-hardware`. Renderer uses typed safe DTOs while Electron Main owns Works Square authentication, idempotency identities, ETag/If-Match forwarding, response projection, limits, timeouts, and credential recovery. Robot and Canvas routes no longer initialize AI Programming projects/providers. No production deployment or real activation-code smoke is claimed.
- 2026-08-08合并登录续期和一键发布发布成功后保存精确 app/version/review 映射Renderer 不接触 Token、ZIP 或本地路径。
@@ -72,9 +74,10 @@ Updater 仍由 Electron Main 选择目标 feed、记录原始诊断并保持失
- 服务端持久 Conversation Session 不由客户端在注销或退出时删除Main 只关闭本地流、清除本机缓存并撤销本地凭据。
- 客户端对最终构建字节的 loopback 检查没有可信 receipt且不复刻生产 opaque-origin服务端必须独立重算 source/built/contract、校验不可变 Release人工审核仍不可绕过。如未来需要不可绕过的 runtime gate必须引入可信 verifier 并绑定精确构建产物。
- AI proxy 的明确饱和 `429 → 400` 是与当前 OpenCode 重试契约匹配的内部投影;升级 OpenCode 或上游饱和错误文案变化时必须复核。不得把通用 `429` 或仅含 `rate_limit_exceeded` 的响应误分类为终止饱和。
- AI 编程压缩事件必须按 Session、run token、runtime generation 与 native Part/event identity 关联;`session.compacted` 不等于 `session.idle`,历史 hydration 不得把 completed 降回 running失败或中止必须清理本 run 的未完成事件。
- AI 绘画单图选择器仍精确匹配 quick reply `从作品列表选择图片`,用途再从当前 Brief medium 推断;本地化或协议文案变化可能破坏入口。扩展更多素材输入前应升级为结构化 action/purpose。
- Updater 源码错误提示不能代替发布正式签名产物;稳定 feed 缺 manifest 必须保持失败Renderer 不得展示原始堆栈、URL、路径或错误码。升级链只有在旧版本完成发现、下载、重启和安装 smoke 后才可视为生产就绪。
## Last Updated
2026-08-14
2026-08-15

View File

@@ -12,6 +12,7 @@
## Scope
- On 2026-08-15, resume the existing Integration owner to merge reviewed source commit `fd9b5b46a913c515e94e4e26f185d43866c2581f` for the Codex-style AI Programming context-compaction timeline into local `main` and promote its accepted lifecycle facts.
- On 2026-08-14, resume the existing Integration owner to merge reviewed AI Canvas source commit `22378efcee07e7fb80b651e65e3202f1a1dfea1d` into local `main` and promote its accepted project-memory candidates.
- Resume the existing integration owner to fast-forward the completed Robot / AI hardware source commit into local `main` after verifying the current remote `main` tip.
- Fetch the authoritative remote `main`, inspect all commits not present in the
@@ -37,6 +38,7 @@
- Push only after the merge result is clean, verified, and independently
reviewed. Never use `--force`.
- The 2026-08-14 user request authorizes the local `main` merge only. It does not expand this resumption into a remote push; the existing authentication blocker remains a separate follow-up.
- The 2026-08-15 context-compaction request likewise authorizes only a local `main` merge. It does not authorize a remote push or changing the existing OpenCode/model compaction threshold.
## Project Context Loaded
@@ -93,6 +95,15 @@ Gate result:
- Read the source task, ADR-001, canonical AI Canvas architecture/domain memory, and all registry-owned peer task Scope / Intent / Promotion Candidate sections. The source preserves Workspace-owned tasks and Conversation-owned state; no semantic conflict requires human resolution.
- Gate result: Passed for the local AI Canvas merge. Remote push remains outside this resumption.
### 2026-08-15 Context Compaction Integration Resume
- Reused the existing Integration owner because it still exclusively owns `main` and the repository integration lock; `task_context.py touch` refreshed the reservation.
- Verified the main worktree was clean at `953b0f491e44036bc8273fb29dd880e38defae24`, with local `main` two commits ahead of the locally tracked `origin/main`.
- Source task `20260814-codex-compaction-ux-74b3f2a1` was `ready_for_integration`, its final Sol review returned PASS, and source commit `fd9b5b46a913c515e94e4e26f185d43866c2581f` is exactly one direct descendant of current `main`.
- Read the active integration record, source task outcome/verification/promotion candidate, canonical AI Programming architecture/current-state memory, and every registered peer task Scope / Intent / Promotion Candidate section.
- The related threshold and UI-audit tasks agree with the source: automatic compaction remains OpenCode/model-limit-owned, while this source changes only the persistent Renderer interaction and run lifecycle. No semantic conflict requires human resolution.
- Gate result: Passed for the local context-compaction merge. Remote push remains outside this resumption.
## Plan
1. Fetch `origin/main` and verify local `main`, the remote tip, and reviewed AI Canvas source commit topology.
@@ -101,6 +112,14 @@ Gate result:
4. Re-run focused/full checks, production build, project-document gates, and independent Sol review.
5. Commit the verified local merge; do not push unless the user separately requests it and authentication is available.
### 2026-08-15 Context Compaction Integration Plan
1. Form the already verified feature worktree into a dedicated source commit without changing its reviewed files.
2. Merge the direct child into local `main` with a normal no-ff merge and preserve source history.
3. Promote the per-session persistent compaction timeline and `session.compacted != session.idle` invariant into canonical current-state, architecture, evidence, and upgrade commitments.
4. Re-run focused/full unit checks, typecheck, lint, production build, Electron E2E, document drift, and whitespace checks on the merged tree.
5. Obtain an independent read-only Sol PASS/FAIL review, record the result, and keep remote push outside this request.
## Outcome
- On 2026-08-13, resumed this integration task for the user's local-main merge request. `git fetch origin main --prune` succeeded and confirmed `origin/main=22add3f01f2b7cb6318495e8294db006f6f18abf`.
@@ -164,6 +183,9 @@ Gate result:
- The first independent AI Canvas merge review returned `FAIL` on two integration gaps and one safety subfinding: stale confirmation task-refresh errors could overwrite a newer Conversation error, top-level structured WebSocket command errors lacked focused coverage, and unknown Gateway messages could expose upstream details. Confirmation reconciliation now uses an internal task refresh without UI-error side effects; explicit user refreshes retain their error behavior. Matching WebSocket errors are tested as non-retryable, and unknown codes project a fixed Chinese fallback instead of the server message.
- The second independent Sol review returned `PASS` with no blocking findings after those corrections. The verified no-ff merge is ready to commit with `88f9ee8` as first parent and `22378ef` as second parent.
- This resumption intentionally does not push. The previous remote authentication follow-up remains unchanged and does not block completion of the user's requested local merge.
- On 2026-08-15, formed the reviewed context-compaction implementation into source commit `fd9b5b46a913c515e94e4e26f185d43866c2581f`; its parent is exactly current local `main` (`953b0f4`) and the source worktree is clean.
- Started a normal `--no-ff --no-commit` merge of `fd9b5b4` into local `main`; Git reported no textual conflicts. The source task record remains unchanged on `fd9b5b4` and its feature branch and is excluded from the `main` result to preserve task-document ownership boundaries.
- Promoted the accepted compaction facts into canonical current-state, module map, data flow, evidence, and upgrade commitments: compaction is a persistent per-session transcript event, completed status is monotonic, and `session.compacted` cannot end the run or release queued prompts.
## Verification
@@ -200,6 +222,13 @@ Gate result:
- Final post-review `pnpm run build:vite` — Renderer, Electron Main, and Preload passed; only the existing mixed-import and chunk-size warnings remain.
- Second independent final review — `PASS`; it re-ran 4 files / 102 tests plus typecheck, found no unmerged entries or unstaged changes, and confirmed the previous state-isolation, structured-error coverage, and redaction findings are closed.
- Final project-document ownership drift, structure checks, and staged/unstaged whitespace checks — passed before the merge commit.
- 2026-08-15 context-compaction focused selection — 3 files / 236 tests passed on the merged `main` tree.
- 2026-08-15 `pnpm test` — 156 files / 1712 tests passed on the merged `main` tree.
- 2026-08-15 `pnpm run typecheck` — passed.
- 2026-08-15 `pnpm run lint:check` — passed with 0 errors and the same 6 existing warnings outside the merge paths.
- 2026-08-15 `pnpm run build:vite` — Renderer, Electron Main, and Preload production builds passed; only existing chunk-size and mixed-import warnings remain.
- 2026-08-15 Electron E2E selection — `tests/e2e/opencode-slash-commands.spec.ts` passed 3/3, including the manual compaction running-to-completed timeline transition.
- 2026-08-15 staged/unstaged whitespace checks and project-document structure passed; task-aware drift passed after retaining the source task record only on the feature branch.
## Follow-ups
@@ -215,7 +244,8 @@ Gate result:
- Authenticate `git.nianxx.cn` through the local Git credential manager or an
authorized SSH key, then resume this same task to push and verify remote tip
equality. Do not paste a personal access token into the task conversation.
- When bundled OpenCode or the model context profile changes, run a real long-context compaction smoke to reconfirm native Part fields and event ordering; the current Electron E2E uses a controlled EventSource through the real Store/Renderer lifecycle rather than launching OpenCode.
## Promotion Candidates
- None recorded.
- The context-compaction source candidate was promoted into current state, module map, data flow, evidence, and upgrade commitments. No unresolved candidate remains for this local merge.