Skip to content

sync: taiji 定制版同步最新基线 8d810b99e(LegionCard 样式统一 + 群聊 P0 修复) - #2262

Open
1688mengdie wants to merge 401 commits into
GCWing:mainfrom
1688mengdie:custom/taiji-unofficial
Open

sync: taiji 定制版同步最新基线 8d810b99e(LegionCard 样式统一 + 群聊 P0 修复)#2262
1688mengdie wants to merge 401 commits into
GCWing:mainfrom
1688mengdie:custom/taiji-unofficial

Conversation

@1688mengdie

Copy link
Copy Markdown

同步内容

taiji 定制版(custom/taiji-unofficial)同步最新基线 \8d810b99e\(相对上次合并基线 aa98261 前进,含上游合流 9b05dd0)。

本 PR 新增关键提交

  • \8d810b99e\ feat(UI): unify LegionCard style with CoreAgentCard surface
  • \2ba9a7ecd\ fix(P0): group chat auto-creates Claw session for missing member
  • \5b9999431\ fix(CI): gate local_download_name_key test import to platforms that use it
  • 上游合流 9b05dd0(centralize default feature ownership)+ dmg branding + harmonyos fixes

验证

  • 前端 type-check:web → 0 error
  • 前端 vitest → 3381 tests 全绿
  • cargo check bitfun-core/cli/desktop(--jobs 4)→ 0 error
  • cargo test bitfun-core → 144 passed 0 failed

t added 30 commits August 13, 2026 23:15
Runtime crash: 'The plugin for MapSet has not been loaded into Immer'
when creating a group chat. groupChatStore keeps rooms/members/messages
in Map (contract §2.2); immer needs enableMapSet() to draft-change
Maps. test/setup.ts already enabled it for vitest, so tests were green
while the production entry (main.tsx) never called it.

Fix: call enableMapSet() once at the top of main.tsx before any store
loads (import order guarantees it runs first; global single call).
Verified: type-check 0e, eslint 0e, groupChatStore 7 tests + flow_chat
store 163 tests green.
主人定标 2026-08-13: Task 异步最终输出像 SessionMessage 一样直接回传
(不用手动查 SessionHistory). P-19 semantics revised: notification turn
carries the full final text, but remains the single delivery channel
(SubagentTurnCompleted event keeps output_text=None - no dual-feed).

- New coordinator helper background_subagent_follow_up_message(session_id,
  agent_type, full_text): notice + full text; BACKGROUND_FOLLOW_UP_TEXT_LIMIT
  (16k chars) truncation guard with SessionHistory pointer; None falls back
  to the plain notice.
- scheduler branch + direct branch in start_background_subagent keep
  sr.text (was dropped as (status, _)) and pass it into the notice.
- task/execution.rs background ACP success branch: output_text =
  notice + result.response (was notice only); removed now-unused
  acp_background_result_notice.
- Tests updated: minimal-metadata assertion -> full-text single-source
  (coordinator) / full-reply single-source (task execution); 211 related
  tests green (task 93 + scheduler 56 + execution_engine 58 + background 4).
…oot)

群聊重设计 W1 数据归属全局化(方案 v1.1 §二 + §九):
- PathManager 新增 group_chats_root() = ~/.bitfun/group-chats/(唯一权威根)
- 存储解析统一:group_chat_tool / scheduler 回执 / session_api 命令层三处
  全部收敛到全局根,消除「房间在群主 workspace / 回执找成员 workspace」双轨
- RemoteRouted→WorkspaceAgnostic:12 群聊命令声明更新 + 策略测试同步
  (workspace_agnostic + global_root 断言);GroupChatWorkspaceScope 语义
  = 只解析当前上下文用于成员会话解析
- 旧数据迁移工具 migrate_legacy_group_chats():扫 projects/*/group-chats/
  → 全局根;冲突 room_id 重命名(-migrated-<sha256 前 8> + 改写 meta roomId);
  迁移后对账(房间数/message 数)+ 记录落盘 + 重建 index;幂等
- 新增 3 迁移测试(真实路径形状):全局迁移 / 冲突重命名 / 幂等

验证:cargo check 0e0w(core product-full + desktop);群聊 39 测试 +
策略 13 测试全绿;fmt 干净。前端无改动(pnpm 不需要)。
…inactive presets)

群聊重设计 W2 成员来源单一化(方案 v1.1 §一 + §五.2):
- 前端候选列表改真实 Claw 会话 ∪ assistant 预设:MainNav 加载
  listSessions 过滤 agentType==Claw(sessionId = 真实 session_id)∪
  assistant 预设(无会话标 inactive「未激活」badge);废弃
  assistantId || workspace.id 旧映射
- 共享类型 AddableAssistant(flow-chat.ts);CreateDialog/MemberPicker/
  GroupChatPane 全部改用 + 未激活 badge 渲染(zh-CN/en-US/zh-TW 文案)
- 后端 resolve_assistant_workspace 补强:增加 assistant_id 索引查询
  (get_assistant_workspaces 过滤)作为第二优先——顺序:注册表 id 精确
  → assistant_id 索引 → legacy 目录 → 清晰报错
- 三形态断言矩阵新测试:8-hex / local_UUID / 无 assistantId 全过

验证:cargo check 0e0w(core product-full);群聊 40 测试全绿;
前端 type-check 0e + eslint 0e + 1756 vitest 全绿;fmt 干净。
P2-1 白名单校验:ensure_claw_member_sessions 第 4 步自动建会话前新增
ensure_known_assistant()——member_id 必须在 assistant 预设集(注册表
assistant workspace ∪ legacy 目录)内才自动建;白名单外直接报
'unknown assistant'(取消后端自动兜底所有缺失成员)。新增测试
group_chat_unknown_assistant_is_rejected_not_auto_created。

P2-2 预设 sessionId 消除三义:前端 groupChatAvailableAssistants 预设
一律用 workspace.id(稳定唯一标识)当 sessionId,后端
resolve_assistant_workspace 按注册表 id → assistant_id 索引 → legacy
三级解析映射真实会话;不再用 assistantId(8-hex,可能 ≠ workspace.id)
当 sessionId。

验证:cargo check 0e0w;群聊 41 测试全绿(含新增白名单测试);
pnpm type-check 0e + eslint 0e;fmt 干净。
…nt combo

群聊重设计 W3 写锁策略(方案 v1.1 §三)验证补全:
- group_chat_cross_process_lock_contention_retries_and_succeeds:
  spawn 子进程持 SessionWriteLock(跨进程 OS 文件锁)→ 主进程
  create_claw_session_with_retry 遇 InUse → 重试 100ms×3 → 子进程
  释放 → 重试成功(不报裸 SessionInUse);group_chat_lock_contention_
  child_holds_writer 子进程持锁逻辑(复用 session_write_lock_contracts
  模式,env flag 门控)
- group_chat_concurrent_create_room_with_member_lock_contention:并发
  组合清单——子进程持成员会话锁(模拟另一进程写 metadata)→ 主进程
  建群链路(ensure+tag)→ 重试化解或可读错误,全程无裸 SessionInUse

验证:cargo check 0e0w;群聊 44 测试全绿(含 3 新 W3 测试);fmt 干净。
… init)

群聊重设计 W4 前端初始化契约(方案 v1.1 §四):
- main.tsx 顶部「全局插件启用清单」注释块正式化(enableMapSet 登记;
  任何全局插件/初始化必须登记,新增时同步 test/setup.ts)
- test/setup.ts 新增 assertGlobalPluginInitializationConsistency():
  读 main.tsx 源码核对两端 enableMapSet 一致(防生产/测试分叉复发
  ——081cbb536 教训:setup 启用但生产缺失导致运行时崩)
- groupChatStore workspacePath 显式初始化:store 创建时从
  workspaceManager.getState().currentWorkspace?.rootPath 读取(显式
  启动流程),不再依赖组件 useEffect 首次注入;组件只响应变更

验证:pnpm type-check 0e + eslint 0e0w + vitest 205 files / 1756 tests
全绿(含一致性断言 + groupChatStore 7 测试);无后端改动。
…回修正)

assertGlobalPluginInitializationConsistency 改为双端源码核对:
- setup 端也 readFileSync(setup.ts) + includes('enableMapSet()')(检测
  调用存在性,非 typeof——import 后 typeof 恒 function 形同虚设)
- main 端同法;两端都查调用存在性
- 抽纯函数 detectMapSetDivergence(mainSource, setupSource)(可测);
  反向分支(main 启用 setup 未启用)可达非死代码
- 新增 setup.consistency.test.ts 4 测试:两端一致(null)/ 双未启用
  / 正向分支(setup 启 main 未)/ 反向分支(main 启 setup 未)

验证:pnpm type-check 0e + eslint 0e0w + vitest 1760 全绿(含 4 新)。
…lert)

群聊重设计 W5 回执可靠性(方案 v1.1 §七):
- scheduler.rs handle_agent_reply 群聊 hook:ingest_reply 从 best-effort
  升级——失败重试 1 次(跨进程/瞬时错误可自愈)+ GROUP_CHAT_INGEST_FAILURES
  AtomicUsize 错误计数(可观测)+ 仍失败明确告警(cumulative_failures +
  group_id 可排查);正常 reply 转发不受影响(ingest 失败不阻断)
- 新增跨 workspace 回执可达性测试
  ingest_reply_reaches_room_across_workspaces_via_global_root:群主 A /
  成员 B 两 workspace 上下文都解析全局根(W1 收敛),B 回执 ingest → A
  读回 Replied + 回复正文落盘(全链路闭环,真实形状)

验证:cargo check 0e0w;群聊 45 测试全绿(含跨 workspace 新测试);
fmt 干净。
36 CJK source candidate lines introduced by W2-W5 group-chat rework fail
the i18n CJK audit (line-level Han script scan, comments included).
Rewrite all to English (ASCII) comments - pure comment change, no i18n keys:

- MainNav.tsx (11): W2 member-source unification + P2-2 comments
- main.tsx (9): W4 global plugin checklist block
- test/setup.ts (7): W4 consistency assertion comments
- flow-chat.ts (5): AddableAssistant doc block
- groupChatStore.ts (3): W4 explicit init comment
- GroupChatCreateDialog.tsx (1): availableAssistants doc

Verified: node scripts/i18n-audit.mjs -> Passed 0 warning; pnpm type-check
0e; eslint 0e0w; vitest 1760 green.
Pre-existing theme-color audit violation exposed after the i18n fix:
FALLBACK_VAR_CONTRACTS is empty, so any var(--x, fallback) is an
uncontracted reference. Both --legion-page-gradient and --legion-chip-
gradient are always injected by the tsx inline style (getCardGradient
always returns a valid value), so the fallback parameter is dead.

Fix (aligns with 8f7dc18 root-cause treatment): drop the fallback
parameter from both var() usages.
- :25 background: var(--legion-page-gradient)
- :109 background: var(--legion-chip-gradient)

Verified: node scripts/audit-theme-colors.mjs -> uncontracted=0 exit 0;
pnpm type-check 0e; eslint 0e0w; vitest agents green.
W2 group-chat introduced the inactiveBadge DOM part (data-bf-part=
inactiveBadge in GroupChatCreateDialog.tsx:129 and GroupChatMemberPicker
.tsx:125) but the appearance descriptors never registered it - the
C-4 contract audit reported unknown part x2 (third pre-existing issue
exposed layer by layer: i18n -> theme -> appearance).

Fix: add { id: 'inactiveBadge' } to both descriptors, fully aligned with
the component usage points.

Verified: node scripts/audit-appearance-contracts.mjs -> passed (280
surfaces, 3580 DOM contracts); full frontend audit family green (i18n
0w + theme uncontracted=0 + appearance passed); pnpm type-check 0e;
eslint 0e0w; vitest green.
Owner report (P0, 2026-08-14): a newly created group chat does not show
in the frontend list. Root cause candidates A (workspace context loads
asynchronously, effectiveWorkspacePath empty on first mount) and B (room
created while the section is folded - no remount triggers the list load).

Candidate A is already covered by the section effect dependency array
(effectiveWorkspacePath changes re-run loadRooms); added a regression
test with a delayed workspace context (real path shape, no tempdir).

Candidate B fixed: createRoom now re-syncs the room list via
group_chat_list after a successful create (best-effort, never fails the
create). The section subscribes to the store rooms Map, so the new room
is guaranteed visible even when the list section is not remounted.

Tests: GroupChatsSection 7 tests (incl. delayed workspace + reactive
rooms), groupChatStore 8 tests (createRoom now asserts the list
re-sync), GroupChatCreateDialog + wiring green. i18n/theme/appearance
audits 0 violations. type-check 0e.
…global root on startup

Spawned off the startup critical path in native_pre_tauri. Idempotent: existing rooms in the global root are skipped, duplicate room_ids are conflict-renamed (never overwritten), and a per-run migration record is written to the global root. Non-blocking: a migration failure only logs a warning and must never block app launch, so the first group_chat_list after startup sees the migrated rooms.
Sync upstream 5 commits: 0af90e6, 073f270, e017814, 3be32a0, 7d8fc2c (harmonyos MVVM refactor + DMG background + build script). No conflicts; local R-GC/R-AR customization intact.
群聊 v3 普通会话模型(R-GC-01~12):
- 旧 group_chat 工具/存储/契约移除(GroupChatTool/Router/Store/Config、
  group_chat_layout/membership/store、12 组桌面 Tauri 命令、前端群聊 UI)
- 新群聊 = 普通会话模型:GroupRoomTool 9 action
  (create/invite/remove/send/history/list/fork/member_status/delete)+
  group_room_aliases 别名注册,复用 coordinator/session 机制
- 群聊 9 工具默认可见(shared_coding_mode_tools / subagent_default_tools)、
  tool-provider-groups AgentControl 分组、materialization 注册、registry 清单
- 边界规则 local-customization-symbols 同步(仅保留 GroupChatActor 主人标识)
- 协调器/scheduler 群聊相关清理(reply ingest、queue_limit 注入移除)

异步回复全文化(R-AR-01~07):
- coordinator:SubagentTurnCompleted 事件 output_text 由 None 改为 Some(全文),
  与通知 turn 同源组装(同一 background_subagent_follow_up_message,防双路)
- scheduler:deliver_background_result 通道复用全文组装源,运行中 turn 注入
  完整最终回复(16k 护栏截断),查重键改为 (session_id, agent_type) 元组
- execution_engine / agent-runtime:coalesce 与注入缓冲按 dedupKey 键合并
- frontend_projection:SubagentTurnCompleted 投影 outputText 全文

注:scheduler.rs / coordinator.rs 两链改动交织(同一 import hunk 内
两链符号、测试区交织),拆分会产生中间态编译失败,故合并为单 commit。
Sync upstream dsh (DeepSeek Harness) plugin adapter series. Resolve conflicts per four-principles: plugin_runtime.rs (upstream multi-file refactor + local user/runtime dir), manager.rs (both tests kept).
群聊 v3 前端链四连:
- R-GC-13 入口:NavPanel 群聊区块 + CreateGroupChatDialog(复用 Modal/Input/Checkbox,listSessions 过滤 Claw,走 ToolAPI.executeTool camelCase 禁裸 invoke)
- R-GC-14 视图:GroupChatView(复用 ModernFlowChatContainer 气泡 + ChatInput + senderBadge,缩进错位 --group-self/--group-other)+ SessionScene isGroupChat 接线 + FlowChatStore.markSessionAsGroupChat
- R-GC-15 成员+fork:成员列表 + invite/remove/fork(fork 成功 createSession+markSessionAsGroupChat+openMainSession 跳转子群)+ 2 dialog appearance surface
- R-GC-16 验证:全量 vitest 3419 全绿 + tsc 0e + 三连门禁(i18n/theme/appearance)+ core-boundaries 122
- 连带修复:R-GC-13 i18n key 断链 + zh-TW 18 key + CJK 注释全清(R-7)+ appearance 注册(R-11)
- 实测修复:CreateGroupChatDialog.scss tokens 引用 5层→4层 + GroupChatView.scss 4层→3层(主人 dev 实测 vite sass 报错)
工具轮黑洞防御链(P0 积分止损):
- R-MR-01:DEFAULT_MAX_ROUNDS 200→50(types.rs:2203 + 定标注释)
- R-MR-02/05b:连续工具轮预算 20 + 搜索专用 3(round_executor + execution_engine)
- R-MR-07:ai.thresholds.execution.* 配置域(max_rounds=50/consecutive_tool_rounds=20/consecutive_search_rounds=3/duplicate_tool_calls=5/no_progress_results=5/tool_calls_per_turn=30/empty_input_guard=true)+ 前端 ThresholdsConfig execution 区 + i18n 三语
- R-MR-10:消息重复闸门(messages_sequence_fingerprint + is_duplicate_message_fingerprint 窗口3 + 主循环闸门 duplicate_messages break 0请求 + 本地合成 final response + duplicate_message_enabled/window 配置)
- R-MR-11:读取/搜索重复拦截(REPEATED_READ_TOOL_NAMES 6 工具 + 指纹归一化 + RepeatedReadSessionState 连续计数 + 本地拦截零请求 + 交叉引用重置 + 碎片化/小文件<200行提示 + repeated_read_enabled/limit/small_file_line_threshold 配置)
- R-MR-12:单子代理续接熔断(频率门限 60/h + 24h turn 300 + 24h token 3000万 + ai.thresholds.subagent.* 5键 + session_end_cleanup 清 ledger + 熔断明确错误提示)
- R-MR-15:压缩阈值调低(ai.thresholds.compression.* + compression_trigger_budget output_reserve+ratio,60万前触发)

测试:execution 133/0 + duplicate_message 8/8 + repeated_read 6/6 + tool_pipeline 55/55 + config 45/45 + coordinator 熔断 8/8 + subagent 13 零回归。check 0e0w。
空请求积分黑洞修复:
- R-FE-01:feishu 入口空文本拦截(双守卫 + 6 测试)——空 content 不发请求不计费
- R-FE-02:共享层治本(command_router parse_command 空输入 → BotCommand::Empty + dispatch 兜底 + handle_chat/execute_forwarded_turn 空 content 不构造/不提交)+ weixin/telegram 入口双保险守卫

remote_connect::bot 43 测试全绿,check 0e0w。
…(CI 修复)

CI Frontend Build eslint 步骤失败:GroupChatView.tsx :568/:579 使用 GroupMemberPickerDialog/GroupForkDialog 但定义在 :607+ 之后,@typescript-eslint/no-use-before-define(variables:true)命中 ×2。
最小改动:两组件 const React.FC → function 声明(配置 functions:false 豁免),内部逻辑零改动。
验证:全量 eslint --max-warnings=0 0e0w + tsc 0e + 群聊 vitest 13/13 + cargo check 0e0w。
主人 dev 实测反馈修复:
- R-GC-17 建群 workspace 双端兜底:后端 resolve_create_workspace 三优先级(入参→context.workspace_root→default_assistant_workspace_dir)+ 前端 workspace: workspacePath||undefined + MainNav fallback workspace + 对话框去条件渲染
- R-GC-18 建群后 UI 空白:GroupChatView.scss 编译产物误提交(扁平 CSS + 死 sourceMappingURL)→ 重写真 SCSS 源码(全布局类)
- R-GC-19 Claw 成员识别失败(回归):成员源按当前项目 workspace 过滤但 Claw 在 assistant workspace → 复用旧版 W2 union(real Claw ∪ assistant presets inactive 标记)+ useRef 防死循环 + MainNav 传 assistantWorkspacesList + 3 locale inactiveBadge
- R-GC-20 UI 定标:邀请/裂变改 IconButton(component-library 现成)+ UserPlus/GitBranch(lucide)右上图标,复用零手搓

验证:tsc 0e + vitest 15/15(CreateGroupChatDialog 6 + GroupChatView 9)+ group_room 20/20 + check 0e0w + i18n/appearance/theme 三连绿
主人 dev 实测 vite 报「Can't find stylesheet to import」:GroupChatView.scss:12 @use '../../../../component-library/styles/tokens.scss'(4 级)→ 实际 tokens 在 src/web-ui/src/component-library/styles/tokens,同目录兄弟文件(AgentsScene.scss:1)为 3 级无后缀。
修正为 @use '../../../component-library/styles/tokens'(3 级 + 去 .scss,与兄弟文件对齐)。
验证:vite dev 实测编译过(无 SCSS 错误)+ sass 编译过 + tsc 0e + vitest 15/15。
沉淀:SCSS @use 路径改动必须 dev 实测(vitest 走别名/transform 掩盖真实路径错误,同款坑第二次)。
t added 30 commits August 17, 2026 22:43
…unified new-team panel, wire cancel (P0-1/P0-2/P1-5/P1-6)
Sync GCWing/BitFun main (96cffb9) into local main.
Resolved 8 conflicts: Cargo.lock, SettingsScene.tsx, EventHandlerModule.ts, ToolEventModule.ts, namespaceRegistry.ts, settings.json x3.
Kept local customizations (UI-04 ACP idle recovery, B1 model-round defense, aiThresholds settings) + upstream usage-statistics + runtime projection repair.
… confirm, explicit rename save/cancel, unified new-team panel, appearance parts, docs (S-85)
…ut + action ordering + danger styling + CQO composer unification (S-85)
- P2-1: drop dead lsp branch in normalizeSettingsTab, remove duplicate
  session-config remap in SettingsScene (single normalize source)
- P2-2: scope AIModelConfig provider search/filter derivations to the
  provider-selection branch; main model list no longer recomputes them
- P2-3: add New-workflow header action to WorkflowClawScene gallery,
  routing to the agents workflow orchestration scene
- P2-4: unify editor back label on agentsOverview.backToOverview across
  CreateLegionPage and CreateAgentPage

Adds regression tests (settings deep-link, provider derivation scope,
workflow create entry, unified back label) and i18n keys for the new
workflow create action.
…-request hardening (CQO 94/100, P0/P1 zero)
…session_message_tool/agent_api (fix r15, CQO 94/100)
…heduler/session_message_tool/agent_api (fix r15, CQO 94/100)"

This reverts commit e330586, reversing
changes made to 535de33.
…resolution (fix r12, CQO 92/100)"

This reverts commit cb650b4, reversing
changes made to e330586.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant