Repository navigation
refactor(agent): consolidate chat and thread domains - #856
Conversation
|
|
@chen-ran 回应这三点。按本轮约定,图直接放在评论里,不再修改 spec。 1.
|
| PR | main 当前冲突 |
与 #856 冲突 | 判断 |
|---|---|---|---|
| #854 Provider OAuth | 0 | 0 | 独立,可任意顺序 |
| #849 ACP replacement hooks | 0 | 3 | 中风险;冲突集中在迁移后的 agent/application,建议先合 #849,再把 #856 rebase 一次并复验 ACP hooks |
| #839 UI showcase | 1 | 1 | 冲突来自它自身的 packages/ui gitlink,#856 不改 UI submodule,语义独立 |
| #834 RuntimeRouter tests | 0 | 0 | 独立,可任意顺序 |
| #801 session-runtime backend | 0 | 40 | 高风险;它修改的 sessionruntime、conversation/flow、message 等正是 #856 的搬迁目标 |
| #802 Web runtime cutover | 0 | 45 | 高风险;与 #801 同一 stack |
| #830 ChatView sync | 1 | 57 | 高风险;明确叠在 #801/#802 上,且新增文件需要迁移到 application/runtime/chat 新路径 |
| #716 pipeline parity | 10 | 84 | 很高;同时改 flow、pipeline、message、session,且当前已与 main 有存量冲突 |
| #717 context/compaction | 51 | 127 | 很高;叠在 #716 上,且大量新增文件落在本 PR 已重命名的目录 |
没有 schema、REST/SSE/WS、protobuf 或 Go module 层面的硬前置依赖;这里主要是源码集成顺序问题。
最省总返工量的顺序是:
- 先落体量小且 ready 的 fix(acp): hide and reject unsupported retry/edit #849;
- 若 runtime stack 准备近期合并,则按 feat(runtime): integrate distributed session runtime #801 -> feat(web): observe canonical session runtime state #802 -> feat(web): chatview sync-layer refactor — single writer + stable row identity #830 落地;
- 若 context stack 准备近期合并,则按 feat(context): compaction summary parity for discuss and pipeline chat #716 -> feat(compaction): dependable zero-config default compaction #717 落地;
- 最后统一 rebase refactor(agent): consolidate chat and thread domains #856,一次完成目录映射和行为复验。
但 #830、#717 仍是 Draft,不应该无限期阻塞 #856。如果这两个 stack 短期不会落地,另一条明确可执行的路线是先合 #856,然后由对应 stack 在 rebase 时按新边界迁移;这会把冲突成本留给后合并的分支。无论选哪条路线,都不建议把这些高冲突分支与 #856 直接机械 merge 后解决,因为很多冲突是“新增文件应该归到哪个新 package”的语义冲突,不只是路径冲突。
|
大体上我赞同这个pr的方向,我觉得
|
480799f to
e97629c
Compare
|
已按 review 意见把剩余边界和兼容性补齐。下面是这次实际落地的耦合清单、 四条耦合已显式拆开
|
…tion Mechanical layer: accepted directory-rename relocations (conversation/flow -> agent/application, contextfrag -> agent/context/ fragment, historyfrag -> agent/context/history, compaction -> agent/ context/compaction, contextlimit -> agent/context/limit, pipeline -> chat/timeline, acpagent -> agent/runtime/acp, conversation -> agent/turn, message -> chat/message, session -> chat/thread), moved the 17 restack files left at the old internal/agent root into runtime/native, and swept import paths/identifiers (Resolver->Service, req.SessionID->ThreadID, conversation aliases) across 109+ files. Semantic resolutions: - application/service.go: restack's resolve() semantics under felinics#856 naming; kept felinics#847 ForkContextSourceMessageIDs and felinics#808/felinics#845 workspace-target notice as unions; ResolveRunConfigResult regains ContextBudgetMaxTokens. - prepareRunConfig: query materialization stays OWNED by the context view (ContextQueryMaterialized contract) — main's eager append-to-Messages block was not adopted; hook texts + system sections restored. - service_acp: union of restack's ContextView ACP sections/lifecycle/ budget with upstream felinics#811 attachments, felinics#821 reasoning effort and leading-user cleanup; busy-turn gate ordered before attachment resolution; persistACPRound keeps the lifecycle parameter. - continuation/user-input/tool-approval: resumeAgentSession abstraction kept, workspace-target threading added (ctx + ChatRequest); stage-1 budget-trim signals ported into service_continuation.go. - Broke two illegal layer edges introduced by relocation: turn no longer imports chat/timeline (forwardedFromValue inlined) and agent/context/ fragment no longer imports turn (kind literals inlined); moved DiscussContextBuilder/DiscussContextInput from chat/timeline into contextview to satisfy the timeline-only-depends-on-turn arch guard. - cmd/internal/core/providers.go now wires ContextViewApplier and LoopReselectMode (previously silently unwired in composition); discuss path gained ContextBudgetMaxTokens/lifecycle/tool-exchange threading with stale ContextSourceFrags cleared before pumpDiscussNative. - Known gap carried forward: the discuss ContextView builder cannot attach at the turn.Service transport boundary (RC/TR richness is flattened before the command); discuss ACP keeps the designed fallback prompt. - sqlc/swagger/sdk regenerated; deltas vs main are restack's net additions (context lifecycle queries/API/types, messages session_mode columns).
Summary
internal/agent.internal/chat/{event,message,thread,timeline,view}packages.turn.Serviceas the Channel-to-Agent boundary.Compatibility
go.workis introduced.session_id.SessionIDadapter.Validation
go test ./...go test -race ./internal/agent/application -run 'TestStartTurnInitializesIdempotencyRegistryConcurrently|TestStartTurnStreamsEvents|TestStartTurnRejectsDuplicateIdempotencyKey'mise run lint:gopnpm exec eslint . --ignore-pattern '.claude/worktrees/**'mise x sqlc@1.31.1 -- sqlc generatemise run swagger-generatemise run sdk-generate