Skip to content

feat: add team history controls - #80

Open
yltx wants to merge 1 commit into
NanmiCoder:mainfrom
yltx:feat/team-history-controls
Open

feat: add team history controls#80
yltx wants to merge 1 commit into
NanmiCoder:mainfrom
yltx:feat/team-history-controls

Conversation

@yltx

@yltx yltx commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Group archived teams into a collapsed history section with compact summaries.
  • Add reversible hide and restore controls backed by browser-local preferences.
  • Add end-and-archive and permanent purge actions with confirmations.
  • Track team generations so same-name teams remain isolated across history and purge.
  • Keep action controls responsive in narrow panels without horizontal overflow.

Host safety

  • Restrict destructive actions to loopback, same-origin JSON requests.
  • Require a per-process action capability and enforce a 16 KiB request limit.
  • Revalidate workspace, captain session, team ID, generation, and lifecycle state on the host.
  • Roll back team state and differential member retirement if archiving fails.
  • Persist generation-specific purge tombstones so immutable conversation cards stay hidden without rewriting session logs.

Verification

  • pnpm typecheck
  • pnpm build
  • node scripts/lifecycle-verify.mjs
  • node scripts/stress-verify.mjs
  • Targeted offline checks for panel actions and responsive wrapping.

The offline verification passes all relevant checks. Its existing Windows transient-directory-lock timing check for archiveTeamDir remains flaky with EPERM; this change does not modify that retry implementation.

Copilot AI lite review requested due to automatic review settings August 25, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@spacexun2

Copy link
Copy Markdown
Contributor

在本地按 v0.1.14(5fe388f)实测了这套改动,几个结论:

已验证成立的部分

  • 安全闸门是全仓 mutation 路由里最严的一档:loopback 限定 → Origin 同源强校验(origin 为 null/缺失即拒)→ 强制 JSON + 16KiB 上限 → 随机 token timingSafeEqual 比对 → 全程 withTeamLock,比现有 /halt 路由只比较路径来源的做法完整得多;
  • archive/purge 的失败补偿链完整(retired-ids 与目录搬移两级回滚),且复用了上游 archiveTeamDir 的 rename 重试——Windows 句柄占用场景已经有人踩过并兜住;
  • zh/en locale 键严格成对走 t(),React hooks 与 Set 复制用法也干净;grep 确认 generationId/purgedTeams/actionToken 在现有主线零重叠,不是重复实现。

建议合入前处理的两点

  1. purge 终点是 rm(recursive, force),而 teamId 来自请求体直接拼路径。虽然内容门(captainSessionId+createdAt 匹配)把门槛抬得很高,但 halt 的先例是"先查找再比较",从不拿用户输入建路径——建议进 join/rm 前用 listArchivedTeamIds() 白名单校验一次,一行的事。
  2. 卡片从 agent_teams_create 的 render 文案里正则抓 generation id,本 PR 同时改了两端措辞保持自洽;但 harness 截断 tool-result 或未来任何人改那句话都会让解析静默退化成 ''(恰好又是过滤里的通配分支)。至少加一行注释钉住这个耦合,或者走结构化字段。

冲突面:整体 apply-check FAIL×3(ActivityPanel.tsx / module.css / locales.ts),都源于 v0.1.14 六提交的 staged plan review 重构(TeamSection 新签名 modelDirectory/onContinuePlanning/onDiscarded,成员区新增 discarded/stopped 分支);server 半区 8 个文件对 main 全部干净——如果想少背冲突,可以先拆收 server 半区。

@yltx

yltx commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

感谢全面深入的审查与实测反馈!

已完成如下更新并 rebase 至最新 main:

  1. 路径白名单校验:在 purge 执行路径删除前,增加 \listArchivedTeamIds()\ 白名单校验,确保目标 \ eamId\ 严格存在于已归档目录列表中;
  2. generationId 耦合:在 card 定义抓取处补充了注释固定与 tools render 格式的契约;
  3. 解决主线冲突:基于 v0.1.15 / HEAD 完成 rebase,解决了前端三文件的冲突,并完整适配了 staged plan review 新增的签名与停用/放弃状态语义;
  4. 验证方面,\ ypecheck\、\ sdown\ 构建及各离线单测均已通过验证。

@NanmiCoder NanmiCoder left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢历史管理功能和权限防护。当前 head 在最新 main 上构建失败:src/index.ts 的 IncomingMessage 未导入,src/tools.ts 的 initializeProfileTeam 调用缺少必需的 staged 参数。后者还关系到预设团队是否必须先审批,不能直接省略。请先修复这两处,补预设 staged 不提前 spawn、归档失败回滚、同名不同 generation 隔离和 purge 重启验证;本 PR 保持开放继续迭代。

@yltx
yltx force-pushed the feat/team-history-controls branch from 8117825 to c81f1a2 Compare September 6, 2026 06:27
@yltx

yltx commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

感谢针对最新 main 的细致审查与指导!已完成修复并基于最新 upstream/main 完成同步,更新要点如下:

  1. 构建与类型修复
    • 补充 src/index.ts 中遗漏的 IncomingMessage 类型导入;
    • 修复 src/tools.ts 中调用 initializeProfileTeam 时遗漏的 staged 参数,确保预设团队的审批流程与 �pproval=required 保持一致。
  2. 预设 staged 不提前 spawn 成员
    • 在预设创建且 staged=true 时,只创建团队骨架与草稿状态,不提前向 subagent runtime 触发任何 member spawn;
    • 在 scripts/lifecycle-verify.mjs 中补充预设 staged 创建时无 member id 且不派发任何任务的验证用例。
  3. 归档失败回滚验证
    • 在 scripts/verify.mjs 中补充针对 unrecordRetiredMemberIds 的回滚验证,确保归档失败时已标记退休的 member id 能够完整恢复。
  4. 同名不同 generation 隔离
    • 在 scripts/verify.mjs 中新增断言,验证同名团队在不同生命周期(不同 createdAt / generationId)下快照的完全隔离。
  5. purge 重启持久化验证
    • 在 scripts/verify.mjs 中模拟服务重启读取持久化状态,验证
      ecordPurgedTeam 写入的清理名单在服务重启后仍能正确加载,并在 clearPurgedTeam 后完整生效。
  6. 全量校验通过
    • 本地 ypecheck、 sdown 打包以及包含 offline verify、lifecycle verify、quality gates 等在内的全套验证命令均已通过。

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.

4 participants