feat(coding): keep one ongoing conversation per delivered agent
This commit is contained in:
@@ -135,3 +135,13 @@ Main 接受时冻结项目、来源和版本,使用现有项目服务校验 Pi
|
||||
- 建议/讨论/问答共用联系人时间线,各自保留项目来源。
|
||||
|
||||
当前已接受决策保持不变。本提案不会把尚未实现的行为写成现状。
|
||||
|
||||
## 10. 实施结果(2026-09-28)
|
||||
|
||||
用户已批准实施和既有主动观察任务协调。单会话客户端已实现;具体数据、路由、验证和集成边界以[任务记录](../../30-worklog/tasks/20260928-agent-single-chat-27da516b.md)为准。
|
||||
|
||||
实际采用 `/api/coding/agent-conversations/:agentId` 系列接口;Main 原子保存轻量索引和独立轮文件,每页50轮,流事件仅传当前轮。云端源码协调结果显示线程同时绑定项目和Pi来源,故项目、Pi来源或版本改变都会切换内部线程;同段沿用现有Yuxi压缩,新段只携带有预算的公开历史。本机长历史可由只读工具按消息ID取回。
|
||||
|
||||
正文草稿、已读位置和旧记录已处理;滚动位置和已加载页的缓存只维持当前窗口生命周期。未进行跨设备同步或生产付费模型验收。旧原始记录全部保留,可从只读入口查看。
|
||||
|
||||
主动观察实现仍在另一任务独立审查中,尚未进入本分支。其“继续讨论”仍创建项目话题,必须在两项集成时改为同一聊天的幂等建议投递/定位;不能把接口协调记为组合功能已实现。单会话方向已经用户批准,共享规范的正式更新留给集成任务。
|
||||
|
||||
@@ -12,45 +12,63 @@
|
||||
|
||||
## Scope
|
||||
|
||||
- Source-grounded design for one ongoing conversation per user and delivered agent.
|
||||
- Cover UI, identity, per-turn project/version context, history, persistence, cloud threads and observer integration.
|
||||
- No product code changes, deployment, paid model calls, subagents, merge or cleanup.
|
||||
- User approved the proposed account + delivered-agent single ongoing chat and implementation.
|
||||
- Client store, per-turn scope/version, Host API, paged UI, legacy history, drafts, read receipts and focused regressions.
|
||||
- Coordination with the existing proactive-observer task was explicitly authorized. This task does not own its uncommitted implementation or its Reviewer.
|
||||
- No main merge, push, deployment, real paid model call, new subagent or worktree cleanup.
|
||||
|
||||
## Intent And Constraints
|
||||
|
||||
- Interpret user + agent as cross-project continuity; keep Pi conversations project-owned and tools scoped to each accepted question.
|
||||
- Stable delivered config identity, account isolation and student payer remain; no fixed teacher/friend roles.
|
||||
- Official isolated start succeeded after unowned dirty main correctly refused a claim. Existing foreign documents were untouched.
|
||||
- Planning Gate passed. All 128 peer task records were inspected. Observer implementation overlaps semantically; consultation-scope peer remains template/unknown. No peer code inspected or changed.
|
||||
- Design proposes revisions to accepted project-topic/version policy. No canonical promotion or implementation is claimed.
|
||||
- Concurrent Task Gate and Planning Gate Passed on initial design and implementation resume; official start/status confirmed this task's feature ownership.
|
||||
- Refreshed 128 peer records, read only their task records; consultation-scope client task is read-only diagnosis. Observer code remains in a separately owned worktree.
|
||||
- Stable delivered config ID, account isolation, student payer and three readonly tools remain. Pi/project files stay project-owned.
|
||||
- Every accepted question freezes project, Pi source and released version. Switching UI never changes an accepted read scope.
|
||||
- Existing main foreign documents and unrelated worktrees remained untouched. Only this task record/proposal are changed in project memory; canonical promotion remains integration work.
|
||||
|
||||
## Outcome
|
||||
|
||||
- Completed [single-conversation proposal](../../10-decisions/proposals/20260928-agent-single-chat-27da516b__single-conversation.md).
|
||||
- Confirmed topics currently bind project, version and cloud thread ID; proposed user-agent chat with separately frozen turn contexts and internal execution segments.
|
||||
- Specified paged history, per-turn events, idempotent migration retaining original files, draft/reference provenance and observer delivery.
|
||||
- Defined actual failure scenarios for implementation acceptance.
|
||||
- Product implementation has not started; cross-device synchronization is outside the proposed first increment.
|
||||
- Main stores one account-agent chat under userData/agent-conversations/<account>/<agent>. A small message index and separate atomic turn files avoid rewriting every historical answer.
|
||||
- First question ensures the chat; repeated request IDs are idempotent, including older pages. One active manual question per account-agent. Snapshot progress/completion updates by request ID.
|
||||
- Latest 50 turns initially; older history pages remain available. SSE sends the current turn and metadata. Renderer merges delayed pages without overwriting newer streamed replies, preserves reading position while switching agents, and keeps account-agent text drafts.
|
||||
- Removed student new-topic plus and normal topic dropdown for delivered agents. Current project/source are shown. Cross-project/Pi references block sending until removed or the source is reopened; old reply actions cannot target another Pi session.
|
||||
- Contacts retain distinct unread state; read position is persisted in Main. Last selected disabled agent can reopen readonly history. Loaded-page/scroll cache is window-local; durable messages and read receipts survive restart.
|
||||
- Next question uses the current released definition. Same project/Pi/version reuses its internal thread; changing any starts an internal segment carrying bounded public history. Old imported cloud questions retain original cloudRequestId for cancellation.
|
||||
- Readonly conversation tool can retrieve older completed chat messages by ID through the frozen index without loading all bodies each question; prior-project message text does not grant prior-project file access.
|
||||
- Legacy topics are imported only on proven account/config identity, deduplicated by project/topic/request origin, and original files are retained. Body-before-index interruption recovers without duplicate import, including retry in the same process. Missing project directories can be retried later. Historical project and source topics, including unassigned/friend records, remain readonly via the old-records endpoint.
|
||||
- Discussion state is per project inside the chat; imported old cards retain their turn snapshots and newest project card. Legacy originals remain separately viewable.
|
||||
- README updated for the implemented client behavior. Accepted teacher ADR/domain/architecture changes are proposed, not promoted.
|
||||
|
||||
## Verification
|
||||
|
||||
- Inspected committed DTO, Main store/service/cloud-runner, Host API, Renderer panel and companion at recorded base.
|
||||
- Read relevant positioning, teacher ADR, architecture/domain and evidence/reflection/commitment context.
|
||||
- Yuxi server internals and installed/cloud behavior were not verified in this design-only task.
|
||||
- No product tests/builds: product code unchanged. Task-aware check_doc_drift passed; working changes contain only this record and the task-owned proposal.
|
||||
- Relevant unit suite: 12 files, 365 tests passed. Includes Store/Service/actual HTTP + SSE/paging/legacy source archive/account isolation/concurrent duplicate acceptance/versions/Pi switching/frozen file roots/older message tool reads/import failure recovery/read receipts/UI delayed pages/old-record readonly/disabled history/independent agent drafts.
|
||||
- pnpm run typecheck: passed.
|
||||
- Focused ESLint over every changed TS/TSX file and new files: passed.
|
||||
- pnpm run build:vite: passed; existing chunk-size/dynamic-import/Browserslist warnings retained.
|
||||
- Real Electron test with deterministic Host fixtures: project consultations preserve student drafts and switch between work and chat without submitting advice, 1/1 passed. Screenshot manually inspected: topbar agents, one chat, no new-topic plus/select, project label, separate drafts, work tab preserved. Not a live cloud/model acceptance claim.
|
||||
- Expanded Main tsc: 66 diagnostics. Temporarily replayed original committed source inside this owned worktree under try/finally restoration; baseline also has the same 66 diagnostics (line positions normalized). No new diagnostics, but global Main typecheck is not clean.
|
||||
- Reproduced existing coding-teacher.test tool activity ID failure on original base: test expected parent run ID, existing implementation uses stable context/request ID. Corrected that assertion to the existing contract; the full related suite then passed.
|
||||
- No dependency lock/package change. Build output, local reports, runtimes and temporary checks are ignored and not committed.
|
||||
|
||||
## Coordination And Integration Dependency
|
||||
|
||||
- Authorized messages sent to existing thread 01a0dc9a-9b4e-7fa3-bb19-aea80abaaac4, task 20260928-agent-observer-design-9c41a872.
|
||||
- That task confirmed its Main suggestion contract in its own record: stable suggestion ID survives replacements; state.json is durably saved before advice delivery. Use projectId + suggestion.id for idempotent delivery; do not call sendConversation to invent a student message.
|
||||
- Actual manual APIs: GET /api/coding/agent-conversations/:agentId?before=...; POST /messages; /seen; /discussion; /save; /requests/:id/cancel; GET /events. service.conversation(agentId,before?) and service.sendConversation(agentId,input) own the unique chat.
|
||||
- Observer review was still in progress at this handoff; no observer code is in this branch. The combined integration MUST replace its discussObservation project-topic creation with inserting/opening this chat, plus delivery replay/read receipts. Its independent observation thread and Main project scheduler remain separate. Do not claim automatic advice has already been wired or combine branches without this adaptation and joint tests.
|
||||
- Observer coordinator source inspection confirmed Yuxi scope binds both project and Pi source, and native YuxiSummarizationMiddleware exists. This justified Pi-aware segment rotation; neither cloud deployment nor compression quality was independently exercised here.
|
||||
|
||||
## Follow-ups
|
||||
|
||||
- User may approve implementation or adjust the proposed cross-project semantics.
|
||||
- Before product edits, refresh observer/consultation-scope ownership and inspect actual Yuxi version, compaction and recovery contracts.
|
||||
- Implement focused regressions and Electron scenarios from the proposal, preserving cancellation and billing semantics.
|
||||
- Existing data-flow six-batch wording is stale relative to accepted protocol2 ADR; do not propagate it into new contracts.
|
||||
- User-requested main merge is not yet authorized for this implementation.
|
||||
- During integration reconcile observer suggestions as above, and promote the approved account-agent/per-turn semantics; retain unrelated docs.
|
||||
- Validate configured Yuxi deployment against current client; no real cloud/paid-model run occurred. Cross-device history synchronization is outside this increment.
|
||||
- Retained worktree belongs to this completed feature; no cleanup requested.
|
||||
|
||||
## Promotion Candidates
|
||||
|
||||
- Targets: ADR-2026-09-22-coding-teacher.md, system-overview.md, data-flow.md, business-rules.md, README.md.
|
||||
- Proposal: after implementation acceptance, use one account-agent conversation with per-turn project/version and unified observer messages.
|
||||
- Evidence: user's screenshot/request and verified source seams listed in proposal.
|
||||
- Future impact: history lifecycle, config refresh, unread/draft ownership, cloud context and project-bound actions.
|
||||
- Semantic conflicts: changes accepted topic-level project/version binding; concurrent observer and unknown consultation-scope ownership require coordination before coding.
|
||||
- Human confirmation: implementation/semantic acceptance required before promotion. Current result is a design proposal only.
|
||||
- Targets: ADR-2026-09-22-coding-teacher.md, system-overview.md, data-flow.md, business-rules.md and current state.
|
||||
- Proposal: replace visible project/version topic identity with account-agent chat; bind project/Pi/version to individual execution turns; account-agent drafts/read receipts, paged files/index, retained source archives.
|
||||
- Evidence: approved user request, implementation, 365 related tests, Electron UI and cloud request contract tests.
|
||||
- Future impact: history lifecycle, cloud scope rotation/summary, old-context actions, observation delivery.
|
||||
- Semantic conflicts: accepted project-topic/version policy is intentionally revised by user approval; observer project-topic creation must be adapted at joint integration.
|
||||
- Human confirmation: single-chat direction and implementation approved. Main merge/deployment require their own corresponding user request.
|
||||
|
||||
Reference in New Issue
Block a user