Compare commits

..
Author SHA1 Message Date
weichenandCursor 5e5bc1f03b docs(agents): require feature branches off dev for all work
Align AGENTS, Cursor rule, PROJECT, README, templates, and CURRENT with
strategy A: no direct commits on dev/test/main; all work branches from dev.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:44:39 +00:00
weichenandCursor 8ff4d338d5 docs(ops): remove .doc root stubs and archive completed research
Delete 15 redirect stubs now that canonical paths exist under audit/
and remediation/. Move completed ops/research to archive, fix internal
links, and remove untracked duplicate test-report workspace artifacts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:36:23 +00:00
weichenandCursor f3392face9 docs(archive): relocate superpowers, workflow, and test assets
Move docs/superpowers to archive/design/superpowers with stubs;
archive workflow rules to PROJECT SSOT; separate test-report assets.
Update Go doc path references.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:31:30 +00:00
weichenandCursor 43c972d0ad docs(agents): multi-agent rules, templates, and tool entrypoints
Rewrite AGENTS.md with taxonomy, worktree, and integration slot rules;
add FEATURE-MATRIX-driven CURRENT; tool stubs; session-close checklist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:31:27 +00:00
weichenandCursor 33b1b8be62 docs(ops): scaffold doc taxonomy and relocate audit/remediation
Establish .doc/{status,audit,remediation,archive} structure with README
maps, migrate 15 root audit/remediation docs, and add redirect stubs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:31:24 +00:00
weichenandCursor 3596109424 docs(ops): 勾选 pi-agent provider 修复提交证据
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:39:07 +00:00
weichenandCursor 8f3aa0f0c1 fix(agent): 将 pi-agent 默认模型对齐为 MiniMax-M2.7-highspeed
根因是 Go 默认 provider 误为 cc-switch-kimi-for-coding,且 app 容器未注入 PI_AGENT_*,导致 runner 收到未知 provider。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:39:01 +00:00
weichenandCursor ac7419e0fc fix(deploy): main 环境注入生产密钥并完成本地冒烟验收
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 23:51:56 +00:00
weichenandCursor b4bc0c2af3 docs(audit): 以 gap-matrix 与 ops 对齐 Codex 再审计结论
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:55:51 +00:00
weichenandCursor 505c4193fd fix(ops): HTTP 超时、env status 只读;test/dev 镜像重建 schema 25
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:55:21 +00:00
weichenandCursor 91985a23c6 fix: 闭环 Go 质量门禁(鉴权富化/V0.5/vet/health/KB gate/记忆轮询)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:54:19 +00:00
weichenandCursor 1fb7393763 chore(ops): 新增退休非正式工作流定义脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:53:00 +00:00
weichenandCursor b13ced641a feat(db): 同步种子用户与项目序列避免冷启动主键冲突
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:52:30 +00:00
weichenandCursor d82021e9b2 fix(api): 任务同步与SSE入口补齐项目成员鉴权
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:52:27 +00:00
weichenandCursor 31fe607e64 docs(ops): 建立通用 AGENTS 手册与本仓 PROJECT/CLAUDE 入口
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:51:58 +00:00
weichen eb5634a06e test(governance): 补跑 product_manager PG+PI 全链路并通过
抽取 runPiAgentGovernanceE2E 共用 harness,新增 system_reqs 真实 Agent 验收并更新测试报告。
2026-09-12 16:19:14 +00:00
weichen 63a5e2849f docs(test): 更新 gap matrix MISSING-04 为 PASS 2026-09-12 15:40:24 +00:00
weichen f4cb9176e7 test(governance): PI Agent PG 全链路实测通过并固化运行条件
修复 runner 鉴权与 data/dev 工作区挂载,使用正式 main 工作流完成 intake→批准→推进。
2026-09-12 15:40:13 +00:00
weichen 51ac51235e feat(projectcontext): bizdev 注入项目对话并完成 PG 治理 E2E
新增 ctxmgr 项目对话采集并接入 PM/TE BuildSnapshot;PG 测试统一 TEST_DATABASE_URL 并使用三正式工作流 key。
2026-09-12 15:16:02 +00:00
weichenandClaude Sonnet 5 203f1c8a82 docs(audit): comprehensive project code review and remediation plan
Complete audit and remediation documentation for Chat-Agent-System:

- 2026-09-12-AUDIT-INDEX.md: Document index and quick navigation guide
- 2026-09-12-audit-summary-report.md: Overall project assessment (5.7/10)
  - 12 identified defects (3 critical, 4 high, 5 medium)
  - 3 incomplete features
  - Risk assessment and remediation timeline (61h total)

- 2026-09-12-comprehensive-audit-and-remediation-plan.md: Detailed analysis
  - BUG-01 to BUG-12: Root cause, code locations, impact
  - MISSING-01 to MISSING-04: New feature design
  - Phase A/B/C remediation strategy

- 2026-09-12-remediation-tasks-and-acceptance-checklist.md: Executable tasks
  - 15 detailed tasks with code snippets and test cases
  - 61 hours total effort (Phase A:15h, B:26h, C:20h)

- 2026-09-12-quick-reference-guide.md: Fast lookup and diagnostics
  - Symptom → root cause → solution matrix
  - Code hotspot map and common Q&A

Key findings:
- Project 70% complete, needs immediate remediation
- 3 critical bugs affecting project lifecycle, security, data consistency
- 0% E2E test coverage
- 88 test definitions polluting development database

Recommendation: Start Phase A immediately (critical fixes), complete all remediation within one week.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-12 15:12:30 +00:00
weichen bb138475e3 fix(governance): 统一文档访问判定与上下文快照排除计数
补齐 DocumentAccessDecider HTTP 409、projectcontext 私有对话排除统计,并更新整改 gap matrix 与测试报告。
2026-09-12 15:10:23 +00:00
weichenandCursor e197e3f69a fix(frontend): skip hash anchor navigation until session is validated
Avoid chat day fetches with empty session_id on the login page when a stale URL hash is present.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:39:01 +00:00
weichenandCursor 94ee09c9f2 docs(workflow): record three-workflow governance remediation and test report
Archive the strict governance design notes and validation report for the 2026-09-12 remediation cycle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:49 +00:00
weichenandCursor edd3a57b8a test(workflow): add governance regression and activation PG coverage
Cover public auth config, catalog policy, official main workflow activation on Postgres, and conn-busy metadata writeback fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:47 +00:00
weichenandCursor 7ecb121314 fix(frontend): gate data fetches until session validated and improve workflow UX
Prevent login-page 401 noise by deferring project/chat API calls until auth is confirmed, use public-config for registration policy, and add client-side duty assignment checks before saving workflow plans.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:45 +00:00
weichenandCursor 812fa6ecdf feat(api): add workflow catalog routes and public auth config endpoint
Expose governance APIs for workflow selection/termination and allow login pages to read registration policy without admin credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:43 +00:00
weichenandCursor 9ef217cb4b feat(service): enforce three-workflow governance and instance lifecycle
Wire catalog policy, v2 manifests, stage access, activation metadata fixes, and coordinator instance advance around frozen workflow snapshots.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:41 +00:00
weichenandCursor 8862fc31f9 feat(db): add workflow schema v2 and catalog governance migrations
Introduce catalog governance tables and extend workflow schema v2 so only the three official workflows are selectable at runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:38 +00:00
weichenandCursor 899a0e65e6 feat(authz): implement six-phase permissions, settings and workflow v2
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 32s
Close P0 auth gaps for lineage/runs, stage ABAC fail-closed, and
project:create; add IAM migrations 00021-23, me settings APIs, schema v2
manifests, orchestrator skeleton, and gate A regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 12:06:53 +00:00
weichenandCursor bb3f3a1b93 docs(test): record pi-agent E2E v5 PASS after env sync fix
Full lifecycle passed in 714s with MiniMax token, RUNNER_AUTH_TOKEN, and shared KB connected.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:51:07 +00:00
weichenandCursor 182d9d7757 docs(config): align .env.example with dual-env compose layout
Document CONTEXT_DB/SYSTEM_DB aliases, pi-agent secrets sync to configs/.env.dev, and compose vs host Go variable scope.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:36:10 +00:00
weichenandCursor 5c0235e269 docs(test): record pi-agent E2E v3 failure at 60m step timeout
V0.1 step_01_organize exceeded AgentTimeout after KB and timeout passthrough fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:28:05 +00:00
weichenandCursor 47c5b52c21 fix(squad): propagate AgentTimeout to pi-agent step execution
E2E v2 still hit 30min runner timeout because runOneStep ignored ExecuteOptions.Timeout; inject shared KB config in pi-agent E2E test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 10:24:45 +00:00
weichenandCursor be07346275 fix(test): extend pi-agent E2E AgentTimeout to 60m for stage runs.
CI / go-vet-and-short-test (push) Failing after 2s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 44s
V0.1 workflow steps exceeded the default 30m pi-agent /v1/run deadline; align test config with production AGENT_TIMEOUT and runner env vars.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:50:37 +00:00
weichenandCursor fca1ddc297 docs(test): record pi-agent E2E failure at V0.1 stage timeout.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 36s
Document 33min run with dialogue steps passing and workflow ExecuteStage failing on pi-agent /v1/run deadline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:47:50 +00:00
weichenandCursor 9ad4f2b622 chore(ops): add test env smoke script and document test soak pass.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 30s
Provide git-push-dev helper, DEP-001 smoke checks for test compose, and update E2E/soak test report.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:42:45 +00:00
weichenandCursor e829dd6074 fix(db): enable test env cold-start migrations on empty database.
Use pgvector image with extensions-only init, seed legacy users before project/chat fixtures, and align test compose with goose-only schema bootstrap.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:42:45 +00:00
weichenandCursor 12122d06b5 docs(test): update report with successful push and dev soak.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 1s
CI / web (push) Failing after 34s
Record Gitea token push, restarted dev server ready checks, and 60s soak pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:25:21 +00:00
weichenandCursor cf9ad06b13 docs(test): report PG fix, CI short suite, and soak/E2E progress.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 1m20s
Document seed user reactivation, full short test pass, readiness soak, and blocked git push pending credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:14:07 +00:00
weichenandCursor e47dae04f0 fix(test): stabilize PG seed users and CI short test suite.
Reactivate dev seed users after auth PG tests, use unique session tokens, fix import guard and coordinator assertions, and skip flaky E2E in short mode; add pg_restore CI drill job.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:14:02 +00:00
weichenandCursor 48ab158672 docs(test): archive QA-001 backup drill and penetration test report.
CI / go-vet-and-short-test (push) Failing after 19m20s
CI / web (push) Failing after 3m25s
Record template MIME, CI gate, backup/RPO drill, and security negative case results per test report standard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor a4df9b966d test(security): add automated penetration negative test matrix.
Cover anonymous admin/task access, body limits, MIME rejection, strict readiness, and CORS allowlist without legacy test principals.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor 07ce332a31 chore(ops): add system DB backup and restore drill scripts.
Support dev/test/main pg_dump backups with RPO manifest metadata and a restore drill that validates dump integrity and migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor 546de528aa ci: add QA-001 gate with go vet, short tests, and migration check.
Run migration gate against CI Postgres and add web npm test/build jobs on dev/test/main pushes and PRs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor 3fcb096fc6 feat(upload): reuse MIME validator for workflow template uploads.
Centralize template extension, magic-byte, and HTML/script rejection in upload.ValidateTemplate so admin template POST matches project asset hardening.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:17 +00:00
weichenandCursor d85f80204a feat(ops): compose runner auth, upload MIME validation, and test soak
Wire RUNNER_AUTH_TOKEN through dev/test/main Compose, validate uploads
with extension whitelist and content sniffing, add readiness soak script
and short PG loop test, and require runner token in prod when URL is set.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:51:10 +00:00
weichenandCursor e416b67a45 feat(taskrun): resume interrupted runs and harden P1 security gaps
Add confirm-gated resume API with resumable flag, Phase 5 finalize fault
and rolling-restart replay tests, Mermaid strict mode, request body limits,
and optional Runner Bearer auth between app and pi-agent.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:49:23 +00:00
weichenandCursor b3e529e444 feat(taskrun): add worker lease/heartbeat and Phase 5 fault injection tests
Introduce goose v20 lease columns with heartbeat loops so only expired
leases are marked interrupted on restart; add PG tests for concurrent
stage advance, active lease survival, and backup migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:46:05 +00:00
weichenandCursor b7cd24b267 feat(taskrun): persist runs/events and fix finalize-before-done ordering
Add goose v19 task_runs/task_run_events tables with PG store for restart
replay, orphan interruption on startup, strict /ready checks, and strip
client work_dir from chat/SSE paths per P0 path sandbox requirements.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 06:07:31 +00:00
weichenandCursor f24a759d1e fix(projectworkflow): generate UTF-8 safe project codes for Chinese names
Truncate project codes by rune instead of byte to prevent invalid PostgreSQL UTF-8 sequences from mixed CJK and ASCII slugs.

test(server): add PG pi-agent governance E2E and Phase 5 acceptance matrix

Cover Chinese HTTP project create, pi-agent intake after workflow activate, authz negatives, activate idempotency, and migration version gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:58:04 +00:00
weichenandCursor 76426d0420 docs(test): fix report structure for blended ABAC and PG chain cases
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:52:05 +00:00
weichenandCursor d123f41738 feat(abac): filter blended squad context and add PG governance E2E
Route BuildBlendedSquadContext through stage access gate, and add PG integration test covering activate, doc approval hook, notifications, ABAC, and stage advance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:51:58 +00:00
weichenandCursor b78f1faa56 docs(test): add pi-agent E2E and bizdev ABAC acceptance report
Record real pi-agent lifecycle run (676s PASS) and stage access gate unit test results per delivery checklist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:46:19 +00:00
weichenandCursor 686d39ec62 fix(e2e): authenticate multi-role docgov steps in pi-agent lifecycle test
Align seeded user IDs and use per-role Bearer tokens so review reject/approve actions run as the assigned reviewer instead of the legacy fallback principal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:34:50 +00:00
weichenandCursor dff1d60c48 feat(abac): gate bizdev agent context by workflow stage duties
Inject stage access gate into bizdev service so task execution, project context reads, and prior docs respect live workflow ABAC.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:27:25 +00:00
weichenandCursor 3f0bb28072 test(e2e): extend pi-agent lifecycle timeout to 1h
Allow long-running ad-hoc pi-agent steps by raising the HTTP client limit and documenting the 1h go test invocation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:27:25 +00:00
weichenandCursor b48e0082c2 feat(notification): add 24h stage advance reminder and confirm on advance.
Poll pending requests every 15 minutes, emit deduplicated escalation notifications, and close requests when creator confirms stage advance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:26:30 +00:00
weichenandCursor 23872ab704 feat(abac): enforce stage access on chat, search and SSE streams.
Tag messages with stage_key metadata, block sends for unauthorized roles, and filter history/search/case results by allowed stages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:20:31 +00:00
weichenandCursor a484c808d3 feat(web): poll stage ready notifications to refresh advance banner.
Poll project notifications every 15s and reload readiness when stage_ready_to_advance arrives.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor b41bfade53 feat(api): wire document approval hook and project notifications API.
Register workflow approval callback on server start and expose GET /projects/{id}/notifications.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 8b7c4dfcc6 feat(projectinstance): refresh stage readiness after document approval.
Sync doc task status on approve and evaluate whether to emit stage advance readiness; chain docgov hooks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 6fb28aabb7 feat(notification): emit deduplicated stage ready to advance events.
Write outbox row and creator notification when a stage first becomes advance-ready.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 00b0bb6882 feat(db): add outbox, notifications and stage advance request tables.
Support transactional stage.ready_to_advance events with dedupe by stage instance and config revision.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 5ec4951f9b feat(abac): restrict workflow document access by active stage duties.
Resolve stage access from live instance assignments and filter document list/content for non-assigned roles.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:10:47 +00:00
weichenandCursor 0a8baab272 test(db): add PG integration test for activation and stage advance.
Verify migration 00017 and full plan→preview→activate→advance chain against dev Postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:10:45 +00:00
weichenandCursor 25f2917a46 feat(service): add stage gate readiness and creator-confirmed advance.
Evaluate required document approvals before stage transition, expose readiness/advance APIs, show StageAdvanceBanner in the UI, and keep legacy workflow switch for explicit initial_workflow_key projects.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:06:55 +00:00
weichenandCursor 8c2c8d4c4f docs(test): add Phase 3 project workflow governance test report.
Document planning-mode creation, plan/preview/activate unit results, and API regression outcomes for the instance governance MVP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 3fca0f1aca feat(web): add project workflow settings wizard and replace free switcher.
Topbar shows configure/view workflow actions under governance mode with a multi-step ProjectSettingsModal for plan, duty assignment, and confirmed activation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 8ef408ba58 feat(api): expose project settings endpoints and block legacy workflow switching.
Add settings/plan/preview/activate routes and reject active-workflow toggles when governance instances or planning projects require configured activation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 9ba3d51a53 feat(service): implement project workflow plan, preview, and activation flow.
New projectinstance package validates three-duty separation, issues confirmation tokens, and activates immutable workflow instances; new projects start in planning mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor caa98d8722 feat(db): add project workflow instance tables for Phase 3 governance.
Introduce planning/active lifecycle, instance snapshots, duty assignments, and activation confirmation tokens with single-live-instance constraints.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 28628ae141 docs(test): Phase 2 workflow designer test report and plan
Archive validator/publish test results and document Phase 2 MVP scope
boundaries ahead of Phase 3 project activation work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor d025d13c87 feat(web): add admin workflows and template library tab
Admin console can list workflow definitions, validate/publish draft versions,
and view bootstrap template assets from the server API.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor 79ce1eb56f feat(api): add admin workflow and template management endpoints
Expose draft/validate/publish/retire workflow APIs and template upload/list
routes wired to workflowdef service with DBCatalog refresh on publish.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor 7951b0f0b5 feat(db): add workflow definitions, versions, and template asset tables
Introduce Phase 2 IAM-adjacent schema for versioned workflow definitions,
template assets/versions, and workflow_defs permissions seed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor a9828c6f26 test(docs): Phase 1 completion gates, PG integration tests, and report
Add disabled-user 401, admin roles/sessions handler tests, optional PG store
integration, cross-project 403 fixture, and update the Phase 1 test report to
reflect completion status.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:48:00 +00:00
weichenandCursor d59246a274 feat(web): fail-closed capabilities and admin roles from server API
Stop persisting roles to localStorage as authority; AdminSettingsModal reads
and writes role matrices via /api/v1/admin/roles; hasPermission denies when
capabilities are not loaded from /auth/me.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:48:00 +00:00
weichenandCursor 39ab0ca1e4 feat(authz): complete Phase 1 admin roles, sessions, and unified admin gate
Add roles CRUD backed by system_roles tables, session list/revoke APIs,
capabilities fallback for memory mode, and route all admin checks through
AuthorizationService instead of hardcoded role-admin checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:47:57 +00:00
weichen 51e431e9b0 test(docs): Phase 1 IAM authz tests and test report
Extend P0 and auth/me handler tests for members endpoint and capabilities; archive Phase 1 test report under .doc/test-reports/.
2026-09-12 01:45:41 +00:00
weichen 774a767c0c feat(web): wire project members CRUD to REST API
Add projectMembers client and role adapter; sync members from server on login and modal open; persist add/update/remove via /api/v1/projects/{id}/members.
2026-09-12 01:45:41 +00:00
weichen ca9b371699 feat(web): consume server capabilities for RBAC decisions
Fetch and cache capabilities from /auth/me on login and session restore; hasPermission prefers server capabilities over local role definitions.
2026-09-12 01:39:36 +00:00
weichen 0285c8670f feat(authz): add AuthorizationService, capabilities API, and project members CRUD
Wire authz service into server, expose capabilities on /auth/me, and add project member management routes with owner/admin gates.
2026-09-12 01:39:33 +00:00
weichen f97ed2dd98 feat(auth): persist sessions and accounts via PostgresAuthStore
Add PgStore with hashed token sessions, IAM bootstrap, and store factory wiring; remove in-memory token map and allow_dev_switch from login payload.
2026-09-12 01:39:31 +00:00
weichen bc37debc31 feat(db): add IAM core migration for users, sessions, and RBAC
Introduce goose migration 00015 to extend users with IAM columns and seed system roles/permissions for Phase 1 authorization.
2026-09-12 01:39:29 +00:00
weichen 77d3da116f docs: add Phase 1 IAM and authorization implementation plan
Define the database, PostgresAuthStore, AuthorizationService, and frontend
capabilities workstream after Phase 0 security止血 is complete.
2026-09-12 01:01:20 +00:00
weichen 8341168271 test(docs): extend Phase 0 security gates and archive test report
Add P0 negative tests, prod bundle forbidden-string scan, and the Phase 0
security止血 acceptance report with PASS results.
2026-09-12 01:00:58 +00:00
weichen b600c9d518 fix(auth): restrict demo seed users to dev/test environments
Main no longer creates fixed-password demo accounts and legacy anonymous
fallback is limited to explicit dev/test in-memory fixtures.
2026-09-12 01:00:58 +00:00
weichen 00ec89a6b3 fix(security): add CORS allowlist and enforce principal on chat handlers
Replace wildcard CORS with configured origins and bind chat/task user
identity to the authenticated principal instead of request body fields.
2026-09-12 01:00:58 +00:00
weichen 867f55f1e9 fix(web): remove identity simulation and stop sending X-User-ID
Product UI no longer switches sessions locally; API clients attach Bearer
tokens only and LocalAuthClient stays test-only outside the prod bundle.
2026-09-12 01:00:58 +00:00
weichen e82b6242c7 docs: add production governance plan and Phase 0 authz matrix
Freeze terminology and document the API resource-action matrix before
security止血 changes land in application code.
2026-09-12 01:00:58 +00:00
weichen 82917799e8 docs(test): archive P0 remediation test report 2026-09-11 16:04:56 +00:00
weichen 2772c9e526 feat(security): complete P0 release blocking remediation
Unify auth middleware and remove X-User-ID trust, add project_members
authorization, sandbox workspaces via resolver, and admin-only reconcile
by run_id. Introduce goose migrations with startup schema gate, fail closed
when DB unavailable outside explicit ALLOW_IN_MEMORY, bundle web/dist in
app Dockerfile, and remove frontend pseudo-login fallback.
2026-09-11 16:04:53 +00:00
WeiCHENandCursor 8abf190e75 chore(deploy): 三环境 Compose 构建真实 app 镜像并补齐法规库运维
将 dev/test/main 的 app 服务从占位容器改为 Dockerfile 多阶段构建,增加 healthcheck 与 .regulations 只读挂载;新增法规库备份/恢复脚本并同步 env-service 目录初始化与 gitignore。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 19:53:24 +08:00
WeiCHENandCursor 28faa4932d fix(agent): Chat Agent 全链路 P0-P5 整改
封堵鉴权旁路与导出 IDOR,DocGov 改服务端身份;对话层 PendingAction 接真实 docgov/taskrun;修复流式租约假死与会话级任务流;加固配置/doc_id/NULL;补齐 slog 与测试;前端 ErrorBoundary 与受控文档重试。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 18:22:45 +08:00
WeiCHENandCursor ba249a56c8 chore: fix backfill script import and run projection for ws_intake
Remove unused import so backfill can repair run_1789111889557885000
chat message and workflow_runs for project 56 intake workspace.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:53:21 +08:00
WeiCHENandCursor 60433f2a6b feat(web): sync workflow docs from server and persist task artifact in chat
Pass doc_id on task runs, merge server deliverable state by task_key,
fetch controlled document content when opening non-template docs, and
map metadata.artifact after refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:46:53 +08:00
WeiCHENandCursor bcfb9f415b feat(api): add workflow document list, content read, and backfill script
Expose project controlled documents from DocGov, serve authenticated
output.md content by doc_id, and add idempotent backfill for run_1789111889557885000.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:46:53 +08:00
WeiCHENandCursor 6e489733ec feat(agent): unify async task FinalizeTaskRun projection to chat and runs
Extend taskrun executors to return full TaskRunResult, finalize assistant
placeholder content with artifact metadata, and map quality_failed terminal
state instead of metadata-only updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:46:49 +08:00
WeiCHENandCursor edb6aa9e96 docs(test): add longtask P0 observer and materials test report
Archive automated regression results for stream materials, observer disconnect,
project asset upload, and ResolveMaterials assembly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:17 +08:00
WeiCHENandCursor 8e966db056 feat(web): asset upload, task run observer, and session lineage on tasks
Upload binary attachments as project assets, subscribe by run_id after refresh,
and pass session_id/project_id through long-task requests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:16 +08:00
WeiCHENandCursor 63cc8ab1da feat(api): observer task runs decoupled from SSE lifecycle
Add POST/GET/POST cancel task run APIs, background worker with event replay,
workspace reconcile, runner child cancel, and chat message metadata updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:15 +08:00
WeiCHENandCursor 463f7d5ea5 feat(agent): project asset upload and squad materials assembly
Register uploads via CAS, resolve project asset pools into task materials
with server-side extraction, and propagate asset_id through the bizdev/squad chain.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:15 +08:00
WeiCHENandCursor 7d2f86bdc4 fix(api): pass materials through task/stage stream handlers
Stream SSE path now forwards Materials to ExecuteTask/ExecuteStage, and
TestTaskStream_MaterialsInjection targets the real /tasks/run/stream endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:11 +08:00
WeiCHENandCursor 0c9c0928ec feat(web): wire project list and create to server API
Login syncs projects from GET /api/v1/projects; create project uses POST with server-assigned id while preserving local sessions and templates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:28:01 +08:00
WeiCHENandCursor 4473115273 fix(web): align workbench user ids with auth seed
Unify MOCK_USERS with backend auth (admin id=1), merge session identity on login, and migrate demo seeds/tests to id 2/3/4 for 张工/李/王.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:23:31 +08:00
WeiCHENandCursor 0fc16af9a3 fix(web): keep draft when send preflight fails
Return accepted/error from handleSendMessage, clear InputArea only on success, and surface thinking/streaming feedback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:23:28 +08:00
WeiCHENandCursor 78ad01b2da fix(web): add secure-context-safe clientTurnId helper
Provide RFC 4122 v4 fallback via getRandomValues for LAN HTTP pages where randomUUID is unavailable.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:23:25 +08:00
WeiCHEN d084056638 feat(task): inject uploaded documents into task materials and enable LAN host access
- backend: add Materials field to TaskRunRequestDTO and forward to ExecuteTask
- backend: add TestTaskStream_MaterialsInjection test case in taskstream_test.go
- web: serialize materials in buildTaskRequest and add unit test
- web: improve isSameMessage identity comparison in messageIdentity.ts
- web: configure host: '0.0.0.0' in vite.config.ts for LAN collaboration access
2026-09-11 13:22:02 +08:00
WeiCHENandCursor 78b340fd35 docs(test): chat turn idempotency automated test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 2c98839b91 refactor(web): stop persisting full message list to localStorage
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 29cbd5a6ad feat(web): isolate stream runtime by session and turn
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 0dbfc32603 feat(web): send stable client_turn_id and resume turns after disconnect
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 1438af18f7 feat(api): gate chat stream on chat_turns with session serial execution
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:18:16 +08:00
WeiCHENandCursor 9202ca7bf3 feat(db): add chat_turns idempotency table
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:18:16 +08:00
WeiCHENandCursor 636e2c0cb4 fix(web): guard chat window fetch races on session switch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:17:00 +08:00
WeiCHENandCursor 35aafa288d test(web): cover real temp vs server message identity
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:16:42 +08:00
WeiCHENandCursor f431414e29 fix(web): merge live and history by serverId and clientTurnId
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:16:42 +08:00
WeiCHENandCursor 69d8f2f50d feat(api): return user_message_id in SSE turn_ack and done
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:16:42 +08:00
WeiCHENandCursor d0e0b05bc8 fix(web): disable chat stream auto-retry without idempotency
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:15:25 +08:00
WeiCHENandCursor f4da2f179f docs(spec): chat turn idempotency and session isolation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:15:07 +08:00
WeiCHENandCursor 8c8fa4721a chore(db): add ten-project chat seed migration and generator script
Provide SQL migration and Python helper to import review demo sessions
and seed messages from tenProjectsSeed.json into Postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:35 +08:00
WeiCHENandCursor 13e58814d7 feat(web): improve chat attachments, unread marks, and session UX
Support richer attachment payloads in input area, local read-id cache for
unread badges, and expand private-shared and chronology test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:34 +08:00
WeiCHENandCursor 79f86e2671 feat(web): align project templates with official reference skeletons
Replace ad-hoc markdown stubs with reference-system template baselines,
free-text device type input, and add template quality regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:34 +08:00
WeiCHENandCursor 2c58e2d17c fix(workflow): reconcile version conflicts in review mode and UI retry
Auto-adopt current workflow selection version in review/demo backend
paths, and retry frontend workflow switch after refreshing project version.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:33 +08:00
WeiCHENandCursor a865b68e36 fix(ctxmgr): normalize dismissed_unread_ids for Postgres array insert
Ensure nil dismissed ID slices serialize as empty bigint arrays and
preallocate compressDismissed output to avoid NULL write failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:31 +08:00
WeiCHEN acedc2b0ba feat(doc-preview): 上传文档多格式在线预览 + IndexedDB 持久化恢复
## 新增功能
- 支持用户上传的 Word(.docx)、PDF、Excel(.xlsx/.csv)、PPT(.pptx)、
  图像(png/jpg/svg/webp等)、纯文本/代码文件的在线高保真预览
- 预览与受控工作流文档严格隔离:上传文档走 FilePreviewPanel,
  工作流/对话入库文档继续走 BlockRenderer,互不干扰

## 核心 Bug 修复
- 修复页面刷新后上传文件无法预览/下载的根本问题
  - 根因:File 对象无法 JSON 序列化,刷新后内存引用丢失
  - 方案:新增 fileStore.ts,使用 IndexedDB 持久化文件二进制内容
  - App 启动时自动 restoreFileRawToDeliverables() 从 IndexedDB 恢复 fileRaw
  - 上传时 saveFile() 同步写入 IndexedDB(fire-and-forget)

## 下载按钮修复
- 优先从内存 File 对象动态创建 blob URL,避免依赖已 revoke 的旧 URL
- 文件内容不可用时按钮禁用并显示 tooltip 说明

## 存储层改进
- saveDeliverables() 序列化前剔除 fileRaw(不可持久化)和 blob: URL
  避免 localStorage 保存损坏的空对象

## 新增文件
- web/src/data/fileStore.ts — IndexedDB 封装(saveFile/getFile/restore)
- web/src/components/doc/preview/FilePreviewPanel.tsx — 预览面板主组件
- web/src/components/doc/preview/renderers/DocxViewer.tsx — Word 预览
- web/src/components/doc/preview/renderers/PdfViewer.tsx  — PDF 预览
- web/src/components/doc/preview/renderers/ExcelViewer.tsx — Excel 预览
- web/src/components/doc/preview/renderers/PptViewer.tsx  — PPT 预览
- web/src/components/doc/preview/renderers/ImageViewer.tsx — 图像预览
- web/src/components/doc/preview/renderers/TextViewer.tsx  — 文本预览
- web/src/tests/file-preview.test.ts — 预览功能单元测试
2026-09-11 12:58:50 +08:00
WeiCHENandCursor 5ec5fca070 feat(intent): Phase 5 V2 shadow gray flags and IntentPlan execution
Add env-based feature flags (intent_v2_shadow/decision, multi_intent,
workflow_intents), V1/V2 shadow diff reporting, expectation_plus_new plan
building, ranked-frame L2 conflict gate, and coordinator sequential query
plan execution with confirm-step deferral.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:59:16 +08:00
WeiCHENandCursor 7ae8d5f22c feat(intent): Phase 4 run control, subtypes, and limited IntentPlan
Add RUN_STATUS_QUERY/RUN_RESUME/RUN_RESTART with matcher and coordinator
handlers; write QUERY_PROGRESS/SUPPLEMENT_INFO subtypes to V2 frame; support
safe query+query multi-intent plans via IntentPlan dual-write.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:56:24 +08:00
WeiCHENandCursor e3c62fbc57 feat(intent): Phase 3 workflow/help intents and coordinator handlers
Add SWITCH/TRIGGER/QUERY workflow, doc status, help and unsupported intents
with ActionSpec registry entries, NL matchers, L2 handlers with creator-only
switch gate, router routes, and capability-aware AvailableActions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:54:24 +08:00
WeiCHENandCursor cbe9f8c43a feat(intent): add V2 frame, ActionSpec registry, and legacy dual-write
Introduce IntentFrameV2 with goal/object/relation/evidence, register all 21
legacy intents in ActionSpec registry, and dual-write intent_frame_v2 alongside
TopIntent without changing Router/Coordinator routing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:50:56 +08:00
WeiCHENandCursor 7efe0ba5bd fix(intent): Phase 0+1 P0 safety gates for recognition and coordination
Add golden-v1 hard-negative suite, shadow observability fields, query/command
negation gates for high-risk writes, AllowAffirmative enforcement, candidate
conflict clarification, and coordinator clarify-before-ambiguous ordering.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:49:20 +08:00
WeiCHEN 8f08a8dbe1 fix(chat): resolve intent recognition, workflow auth, and message ordering 2026-09-11 10:34:47 +08:00
WeiCHEN c72bcc8ab0 feat(project): implement modal-based project creation, creator-led member assignment, and exited-member read-only retention 2026-09-11 10:10:33 +08:00
WeiCHEN af003a3bb9 refactor(dialogue): implement task dispatch notifications and consecutive assistant messages with confirmation cards 2026-09-11 09:52:11 +08:00
WeiCHEN 82d7fe1cdc refactor(dialogue): naturalize multi-role conversations, close chat sessions with assistant response, and set URS to project shared 2026-09-11 09:42:58 +08:00
WeiCHEN 4a4f2592b8 fix(doc): resolve URS viewing and private-to-shared workflow in document pane for 10 review projects 2026-09-11 09:26:03 +08:00
WeiCHEN f3337b7bf9 feat(chat): add URS requirement document upload dialogues with attachments and phase events for all 10 projects 2026-09-11 09:03:54 +08:00
WeiCHEN 42f5b3da19 feat(chat): mount interactive review, approval, and verification confirmation cards in multi-role dialogues 2026-09-11 08:35:27 +08:00
WeiCHEN 92572138f7 fix(frontend): align MockDocumentMeta markdown property and guard nullish input in markdownToBlockAST 2026-09-11 00:58:00 +08:00
WeiCHEN 0d3cc6a6ce feat(review): seed 10 real medical device projects with dual workflows, multi-role dialogues and fix account-switch chat isolation 2026-09-11 00:47:23 +08:00
WeiCHEN dc12bc5794 fix(workflow): fix 405/404/403 errors on workflow switcher by updating CORS, 5201 demo permissions and server restart 2026-09-11 00:13:06 +08:00
WeiCHEN a51d5fcd6d chore(release): Phase 7 全链路验收报告、测试修复与发布基线归档 2026-09-10 23:57:40 +08:00
WeiCHEN 443a09d5b4 feat(workflow): Phase 6 前端项目多工作流切换器、前置依赖横幅与文档血缘失效提醒 2026-09-10 23:56:35 +08:00
WeiCHEN e9238c0ab1 feat(workflow): Phase 5 智能测试经理工作流、前置强依赖校验与文档血缘级联失效 2026-09-10 23:51:59 +08:00
WeiCHEN 9d33b1c804 feat(workflow): Phase 4 智能产品经理工作流、系统需求规格书与质量门禁 2026-09-10 23:48:40 +08:00
WeiCHEN 0961e180a3 feat(workflow): Phase 3 Coordinator 上下文、动作路由与工作流运行 API 集成 2026-09-10 23:41:24 +08:00
WeiCHEN 7c899605ea feat(workflow): Phase 1 & 2 数据库迁移、项目创建人权威化与多工作流控制面 2026-09-10 23:35:44 +08:00
WeiCHEN 484ed80377 docs(workflow): Phase 0 基线确认、架构决策记录(ADR)与契约冻结 2026-09-10 23:20:17 +08:00
WeiCHEN 4962cefdae feat(export): 实现单次智能体回复导出、私密文档保存与隐私防泄露全套闭环 (Phase 0 - Phase 2)
- Phase 0: 实现服务端回复导出策略矩阵引擎 (replyexport.EvaluatePolicy)、数据库迁移 (2026-09-11-message-export-policy.sql)、SSE done 事件挂载与能力探测 API
- Phase 1: 构建前端 ReplyDocumentIR 语法树解析与渲染管道,支持 Markdown / DOCX 文件下载及带格式富文本剪贴板复制
- Phase 2: 实现私密自由文档 (freeform_documents) 领域服务、PostgreSQL 乐观锁版本管理、ACL 隐私隔离、一键共享与右侧栏编辑联动
- 专项修复:
  1. 修复后台 API 路由注册并加入双向拉取同步,确保私密保存实时进入我的私密列表
  2. 实现轻量回复专属 DOCX 生成与静默下载逻辑 (downloadDocxReply)
  3. 将 LaTeX 公式转为标准 MathML 矢量标记,支持粘贴到 Microsoft Word / WPS 自动识别为原生公式
2026-09-10 23:04:04 +08:00
WeiCHEN 779c6c7f04 test(chat): add session turn_intent metadata assertion and chip category navigation tests 2026-09-10 16:10:53 +08:00
WeiCHEN 2c0c6a0348 feat(category): implement recategorize backfill engine and fallback mapping (Spec §3.4-3.5 A4-A5) 2026-09-10 15:56:53 +08:00
WeiCHEN 5a83b9fa44 feat(chat): 完成分类锚点坞(CategoryDock)与双轨制未读重构 (含方案A轮次归一化与起始位置居中) 2026-09-10 15:44:05 +08:00
WeiCHEN 76dae2dc3f fix(nav): 修复点击项目会话时因 URL hash 监听重放导致被强制回弹选中第一个项目的 bug 2026-09-10 14:33:48 +08:00
WeiCHEN 709fadcef2 feat(history): 完成 Phase P3 虚拟滚动、聊天记录导出与协同未读提醒
- 虚拟滚动:接入 @tanstack/react-virtual,封装 useVirtualMessages 动态测高与 overscan 预渲染,迁移 anchorNavigator 锚点定位与 SSR 兼容降级
- 聊天记录导出:基于既有 docx 与 xlsx 依赖实现 chatExporter 与 ChatExportModal,新增服务端 /api/v1/chat/export/messages 支持按条件导出
- 协同未读标记:新增 useUnreadMarks 30s 轮询与服务端 /api/v1/chat/unread 接口,日历格与工具栏支持橙色未读徽标提示
- 测试与验证:新增 chat_unread_and_export_api_test.go,前端全量 126 项单元/组件测试及生产打包 100% 通过
2026-09-10 14:25:13 +08:00
WeiCHEN de015d694a feat(history): 实现三模历史搜索、每日智能协同摘要与时间轴侧栏 (Phase P2) 2026-09-10 13:53:07 +08:00
WeiCHEN ad57685665 feat(history): 实现多级历史导航、分类筛选、日历联动与消息双向引用 (Phase P1)
- 后端核心与 API:
  - 实现 ChatCategoryStat 结构体与 ListChatCategories 统计引擎 (Postgres + In-Memory 内存降级双轨)
  - 注册 GET /api/v1/chat/categories 聚合接口
  - 增强 GetChatDayMessages 支持自动根据 anchor_id 逆查 day_key,实现免猜测跨日检索
- 前端锚点导航引擎:
  - 实现 anchorNavigator 模块 (快路径 DOM scrollIntoView + 1.8s 发光脉冲、慢路径跨日拉取、深链 Hash 解析)
  - 编写 anchorNavigator.test.ts 单元测试并 100% 通过
- 分类过滤与轻量月历:
  - 实现 CategoryFilterBar 水平分类筛选栏 (8 类业务标签,暗淡/高亮模式)
  - 实现 HistoryCalendar 零依赖原生悬浮月历组件 (热度点与消息数,jumpToDate 快速定位)
- 消息引用与双向追溯:
  - 消息气泡悬浮“引用”入口,点击提取发言人与摘要至输入框
  - 实现 QuoteChip 待发引用标签与 QuoteCard 已发引用卡片
  - 引用卡片点击直连锚点定位,快慢路径自动回溯
2026-09-10 13:40:44 +08:00
WeiCHEN 2ece0ce882 feat(history): 实现超长对话历史按日归档与滑动窗口 (Phase P0) 2026-09-10 13:24:32 +08:00
WeiCHEN cf966dcf77 feat(prompt+cache): implement 10-section prompt template, true KB regulation recall, behavior rules and multi-level caching (P4) 2026-09-10 11:52:40 +08:00
WeiCHEN b75a06cc1a feat(coordinator): implement determinism-first query rewrite with ellipsis completion and pronoun resolution (P3) 2026-09-10 11:46:27 +08:00
WeiCHEN 2c3e303561 feat(ctxmgr): implement chat memory vectorization, privacy dual-gate retrieval and memory composer (P2) 2026-09-10 11:38:36 +08:00
WeiCHEN 30bfc1fd2f feat(ctxmgr): implement sliding window, rolling summarizer and DST task state (P1) 2026-09-10 11:19:08 +08:00
WeiCHEN 6a88ceb94d feat(chat): wire multi-turn dialogue broken links (G1/G2/G3/G9) with session restore 2026-09-10 11:05:14 +08:00
WeiCHEN 143d94ffdf docs(design): add multi-turn dialogue optimization system design (report 03) 2026-09-10 11:05:12 +08:00
WeiCHEN 747cd39e97 feat(core): update backend coordinator, docgov lease, squad workflow and web governance integration 2026-09-10 09:38:35 +08:00
WeiCHEN d40de5fe61 fix(web): wire ALL_MOCK_DOCUMENTS and project deliverables to fix document switching 2026-09-10 09:37:53 +08:00
WeiCHEN 8362802d37 feat(scripts): add launch.sh to detect-and-restart dev stack (compose, backend, web) 2026-09-09 20:46:49 +08:00
WeiCHEN 7feabff181 fix(web): render step_failed phase as failed strip node with retry reset 2026-09-09 20:25:07 +08:00
WeiCHEN 82aa6ab322 docs(test): archive long-task phase live/resume UX real-agent report 2026-09-09 19:22:13 +08:00
WeiCHEN 99e0d4a412 fix(web): distinguish recovery action styles for long-task failures 2026-09-09 18:49:36 +08:00
WeiCHEN 873e6d0a83 feat(web): drive long tasks from SSE with live phases and continue/restart recovery 2026-09-09 18:48:26 +08:00
WeiCHEN 1d81d6acf1 feat(web): add task SSE client and live phase-event mapper 2026-09-09 18:41:02 +08:00
WeiCHEN 7c1383768f test(server): task stream transient injection, classification and resume integration tests 2026-09-09 18:35:51 +08:00
WeiCHEN 0b846e132a feat(api): task stream request-id, resume mode and workspace-aware error classification 2026-09-09 18:27:29 +08:00
WeiCHEN 870d0462c4 docs(spec): add long-task phase live/resume UX P2 spec and plan 2026-09-09 18:19:53 +08:00
WeiCHEN 1e7cb67ab4 docs(spec): archive chat wait-error-retry UX spec and implementation plan 2026-09-09 18:10:12 +08:00
WeiCHENandCursor 0c7d974ae2 fix(web): escape HTML in chat markdown rendering
Prevent self-XSS when chat bubbles render user/LLM markdown via
dangerouslySetInnerHTML by escaping raw HTML after math/code
extraction and sanitizing link href schemes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:48:12 +08:00
WeiCHENandCursor a964899f51 docs(test): strengthen chat wait-error-retry report with web E2E evidence
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:41:02 +08:00
WeiCHENandCursor 4aa839c5d1 docs(test): archive chat wait-state error-retry UX real-agent report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:23:31 +08:00
WeiCHENandCursor 56fb3180c2 fix(web): scope Task 5 App.tsx to SSE wiring only
- Rebased App.tsx on the last clean Task-4 parent (5aa8129) and re-applied
  only Task-5's SSE plumbing: streamAbortRef, isStreamingActive,
  buildNetworkErrorInfo, runStreamAttempt, handleErrorAction,
  handleStopStreaming, and the InputArea/MessageStream wiring.
- Removed the unscoped WIP that had been folded into b2cf863 (NeuroPulse
  demo data/session-privacy/docgov-lease/cardActionPolicy imports that do
  not exist in git, causing b2cf863 to fail to build in isolation).
- Real-backend path now appends the pending placeholder and calls
  runStreamAttempt immediately; the artificial setTimeout(600) is only
  used for the mock keyword-shortcut demo branches (unchanged from 5aa8129),
  gated by precomputed predicates so it never wraps the SSE call.
- Preserved 5aa8129's mock keyword shortcuts (生成文档/驳回/修改/通过等) verbatim.
- No silent success-template fallback re-introduced.
- P1 error actions remain filtered to retry-only; auto-retry transient
  attempts stay capped at 2 with 1s/2s backoff via AbortController.
- Bloated WIP App.tsx backed up to .superpowers/sdd/App.tsx.wip-backup
  for later use by whichever task owns NeuroPulse/session-privacy/docgov
  lease work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:07:44 +08:00
WeiCHENandCursor b2cf8637a3 feat(web): drive chat bubbles from SSE with auto-retry and stop
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:47:52 +08:00
WeiCHENandCursor 5aa812943c feat(web): render chat wait-state and structured error actions in bubbles
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:36:49 +08:00
WeiCHENandCursor 6d32fc68f3 fix(web): drop out-of-scope ProjectSession.userId from Task 3
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:32:31 +08:00
WeiCHENandCursor 357aab3ba7 feat(web): add chat SSE client and transient auto-retry helpers
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:30:48 +08:00
WeiCHENandCursor ccc485a670 fix(agent): scope Task 2 to SSE phases/errors without dialogue_llm leak
- untrack internal/coordinator/dialogue_llm.go (kept on disk untracked as local WIP for a future dialogue-LLM commit with its own tests; it depends on engine.go fields (dialogueBackend, ReplySource) not yet committed)
- slim internal/chat/session.go back to Task 2 scope relative to bfa6889: keep EmitErrorInfo(stream.ClassifyError(...)) for intent+coordination errors and the dialogue_generating EmitPhase before ProcessIntent; drop sync.Mutex/mu, ChatResponse.ReplySource, preference/RecentDialogue injection block, and collectRecentDialogue helper (unrelated WIP for the dialogue-LLM feature)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:25:35 +08:00
WeiCHENandCursor 8f29d84908 feat(agent): emit dialogue phases and classified SSE errors with request id
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:16:25 +08:00
WeiCHENandCursor bfa68892ac fix(stream): avoid dial substring false-positive in ClassifyError
Remove "dial" from networkHints to stop "dialogue" misclassification;
extend workspace/resumable and EmitErrorInfo test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:09:39 +08:00
WeiCHENandCursor f385515ad3 feat(stream): add structured ErrorInfo and error classification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:08:04 +08:00
WeiCHENandCursor a8701bc08c fix(web): redesign auth and settings UI using system design tokens and high-fidelity styles
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:40:40 +08:00
WeiCHENandCursor 1c7320b1c4 docs(test): archive auth and dual settings test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:32:15 +08:00
WeiCHENandCursor f38572c0af feat(web): integrate auth guards, dual settings and dev switcher
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:31:06 +08:00
WeiCHENandCursor 28e7f3af14 feat(web): implement dedicated AdminSettingsModal for role-admin
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:26:41 +08:00
WeiCHENandCursor fc95ef6fed feat(web): implement dedicated UserSettingsModal
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:24:47 +08:00
WeiCHENandCursor 2c61a08bcf feat(web): add LoginView and FirstLoginPasswordModal components
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:23:49 +08:00
WeiCHENandCursor eb522e7285 feat(web): add frontend auth types and api client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:20:33 +08:00
WeiCHENandCursor d548f773bc feat(api): add auth and admin management endpoints
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:19:04 +08:00
WeiCHENandCursor f7bc32798b feat(auth): add auth data models, config and store engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:17:03 +08:00
WeiCHENandCursor cf9c8415b4 docs(plan): add auth and dual settings implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:15:18 +08:00
WeiCHENandCursor 169631c54b docs(spec): add auth and dual settings design specification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:14:23 +08:00
WeiCHENandCursor 372d241601 test(rbac): archive dynamic roles and doc visibility rbac test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:41:04 +08:00
WeiCHENandCursor 909448e5ea feat(web): wire rbac permission enforcement into left rail and rights modal
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:40:22 +08:00
WeiCHENandCursor e1071f74e1 feat(web): add doc visibility override modal and badges in deck drawer
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:36:55 +08:00
WeiCHENandCursor fa2d0e9837 feat(web): upgrade settings modal with dynamic roles CRUD and permission matrix
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:33:41 +08:00
WeiCHENandCursor d1202038d8 feat(rbac): implement permission evaluation engine and unit test suite
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:31:50 +08:00
WeiCHENandCursor 6287731885 feat(rbac): define rbac data contracts and extend deliverable and user types
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:30:39 +08:00
WeiCHENandCursor a7eef6f63b docs(plan): add dynamic roles and doc visibility rbac implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:29:36 +08:00
WeiCHENandCursor 3d75471dc2 docs(spec): add dynamic roles and doc visibility rbac design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:27:17 +08:00
WeiCHENandCursor 2745e89ed3 test(engine): add integration tests and archive test report for project template cloning
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:42:15 +08:00
WeiCHENandCursor b56ca45ad4 feat(web): wire project isolation and template cloning on project creation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:41:05 +08:00
WeiCHENandCursor 061789e5d7 feat(web): add template status badges to deck drawer and tab bar
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:38:06 +08:00
WeiCHENandCursor a527f4dcd4 fix(engine): 修复 DOCX 公式因 undefined 虚根在 Word 中丢失的缺陷
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:37:28 +08:00
WeiCHENandCursor 29efa0d348 feat(engine): add project template cloning factory and unit tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:36:02 +08:00
WeiCHENandCursor a3daabf4d9 refactor(types): extend deliverable item with projectId and isTemplateOnly
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:35:04 +08:00
WeiCHENandCursor 0cf23df338 docs(plan): add project init template cloning implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:31:07 +08:00
WeiCHENandCursor 23cf8c3a1e docs(spec): add project init template cloning design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:28:54 +08:00
WeiCHENandCursor 50f95c61ed docs(test): 补充 Canvas Tainted 缺陷排查与修复验证记录
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:25:50 +08:00
WeiCHENandCursor 3c6b4baa2a test(engine): 增加 cleanSvgForCanvas 净化与防污染单元测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:25:33 +08:00
WeiCHENandCursor 345cd54fb9 fix(engine): 修复 Mermaid 导出时的 Canvas Tainted 污染与 toBlob 异常
- 配置 Mermaid flowchart.htmlLabels 为 false,禁用 foreignObject 嵌入式 HTML 标签
- 实现 cleanSvgForCanvas 深度净化 SVG,剥离 @import 与将 foreignObject 转为原生 SVG <text>
- 替换异步 toBlob/FileReader 为同步 toDataURL + atob,并在 img.onload 中增加安全沙箱 try/catch 兜底

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:25:30 +08:00
WeiCHENandCursor c517b4a25b docs(test): 归档 DOCX 原生公式、Mermaid 与排版优化测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:17:09 +08:00
WeiCHENandCursor c4f30eb26f test(engine): 增加 DOCX 行内 OMML 复合解析与公式转换单元测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:17:05 +08:00
WeiCHENandCursor dd67aacf49 feat(engine): 实现 DOCX 原生 OMML 数学公式、Mermaid 高清渲染与出版级公文排版
- 集成 mathml2omml 与 KaTeX,实现展示级公式 (<m:oMathPara>) 与行内公式 (<m:oMath>) 的微软原生矢量公式渲染
- 实现 svgToPngData 将 Mermaid 矢量图光栅化为 2.5x 视网膜清晰度的 PNG 图片嵌入 Word
- 重构公文抬头、4列受控签署栏、出版级三线表、keepNext 防孤行与带分割线的受控页眉页脚

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:17:01 +08:00
WeiCHENandCursor 3d6df3feb7 fix(cli): adapt default stage by role and add scanner error checking
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 19:15:34 +08:00
WeiCHENandCursor e1864905c8 docs(test): archive test report for dialogue-driven content and hierarchical intent system
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 19:05:59 +08:00
WeiCHENandCursor 776333e1ec feat(web): integrate interactive cards into chat stream and wire docgov actions
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:58:21 +08:00
WeiCHENandCursor 649290bbba fix(web): add 60s grace period undo, executing banner and ttl safeguards to interactive card
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:45:10 +08:00
WeiCHENandCursor 1c62be6e49 feat(web): build interactive card component with lifecycle and idempotency
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:33:36 +08:00
WeiCHENandCursor 6e4fe22bfb fix(coordinator): chain expectation for card confirmation and add ttl lifecycle cleanup
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:22:13 +08:00
WeiCHENandCursor 73b50926e4 docs(test): 归档 DOCX/XLSX 导出与会话隔离持久化测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:59 +08:00
WeiCHENandCursor 275b4ebd63 test(workbench): 增加 DOCX/XLSX 导出与会话隔离单元测试
- 验证 DOCX 二进制 Buffer 生成、TextRun 解析与 Blob 输出
- 验证 XLSX 多表提取、自适应列宽与工作簿 Sheet 命名规范
- 验证 sess-001 与 sess-002 对话隔离及动态追加互不串线

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:56 +08:00
WeiCHENandCursor 7e8f0cd4f7 feat(ui): 顶栏综合导出下拉选择器与 App 消息隔离及存储打通
- SlimTabBar: 增加导出格式气泡下拉菜单,支持一键导出 Word DOCX、Excel XLSX、Markdown MD
- App: MessageStream 严格根据 activeSessionId 过滤消息流,杜绝多项目会话串线
- App: 新建项目自动注入独立引导语,全流程与 storage 自动双向同步

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:51 +08:00
WeiCHENandCursor 9fc45ab3e3 feat(storage): 实现多项目会话隔离与 localStorage 全局刷新持久化
- 预设 sess-001 (4K内窥镜) 与 sess-002 (掌上超声) 独立初始消息流
- safeGetItem/safeSetItem 包装器防御性存取 sessions, activeSessionId, messages, deliverables
- 确保页面刷新后用户发送的所有内容、回复及即时生成的私密文档零丢失

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:47 +08:00
WeiCHENandCursor 58623605bc feat(engine): 实现 DOCX 与 XLSX 客户端原生渲染导出引擎
- 引入 docx 与 xlsx 依赖,纯前端无损编译 Block AST 交付物
- buildDocxModel: 自动生成两行四列受控签署栏、多级编号标题、Markdown富文本、医疗标准三线表、Cambria Math公式与动态页眉页脚
- buildXlsxWorkbook: 自动提取文档概览与全部数据表格,生成带自适应列宽的 Excel 工作簿并支持直接下载

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:43 +08:00
WeiCHENandCursor c1c299b4ab feat(coordinator): implement docgov gates, semantic anchoring and interactive card dispatch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:07:56 +08:00
WeiCHENandCursor a7ee616afc feat(ui): 升级顶栏为极简级联面包屑架构,自适应 320px 极窄视窗
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:56:30 +08:00
WeiCHENandCursor 473fe7ec76 fix(intent): address review findings for hierarchical intent funnel and security guards
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:53:39 +08:00
WeiCHENandCursor 8a8582056c feat(intent): implement 4-stage hierarchical intent funnel and slot extraction
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:42:57 +08:00
WeiCHENandCursor 003a899785 fix(doc): 完善文档系统各层级标题、图表公式与有序列表自动编号引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:41:59 +08:00
WeiCHENandCursor 5dc58322aa feat(intent): add interactive card payload and extended intent contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:31:52 +08:00
WeiCHENandCursor 8aa0698dfb docs(plan): add implementation plan for dialogue-driven content synthesis and hierarchical intent funnel
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:27:00 +08:00
WeiCHENandCursor db238a467a docs(spec): add specification for dialogue-driven content synthesis and hierarchical intent funnel
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:01:27 +08:00
WeiCHENandCursor dcc06502b4 test(doc): 完善三分类隐私隔离与流转单元测试并归档全量测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:50:17 +08:00
WeiCHENandCursor 8967f2b48b feat(ui): 实现三分类Tab分段切换、全景大盘分区与一键共享/取消共享闭环
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:50:11 +08:00
WeiCHENandCursor 3206304a57 fix(chore): 修正.gitignore根目录data规则并纳入前端mockDocuments
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:50:06 +08:00
WeiCHENandCursor a95b92da31 feat(types): 升级交付物数据契约支持工作流/共享/私密三分类与创作者属性
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:40 +08:00
WeiCHENandCursor 7bbfddccd4 fix(layout): 修复边栏拖拽位移累加并实现1:1光标捕获绝对跟随
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:36 +08:00
WeiCHENandCursor 59c3e83606 feat(ui): 修复模态背景穿透、公式/富文本Markdown解析并集成右键快捷菜单
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:30 +08:00
WeiCHENandCursor 904696ad10 docs(spec): 归档三层交付物分类治理与多用户隐私/共享设计规范与实施计划
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:25 +08:00
WeiCHENandCursor 6d3bbd9496 chore(web): update package-lock.json with tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:53:12 +08:00
WeiCHENandCursor 988a8e5462 docs(test): add three-column workbench and block document engine test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:52:47 +08:00
WeiCHENandCursor b80a6863c7 feat(server): integrate web spa static assets hosting and route fallback
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:51:50 +08:00
WeiCHENandCursor 916bddc04f feat(web): complete in-place block editing, reviewer comments, and role governance loop
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:50:48 +08:00
WeiCHENandCursor 267b8c89a5 feat(web): implement 36px slim tabs, deck drawer, and block views with medical styling
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:47:57 +08:00
WeiCHENandCursor 171b42510e feat(web): implement agent chat stream with thinking pulse indicator and case cards
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:46:08 +08:00
WeiCHENandCursor 1ed455ab73 feat(web): implement responsive three-column shell with resizable rails and theme switch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:44:54 +08:00
WeiCHENandCursor 4d9dfbb027 feat(web): implement markdown block ast converters and auto-numbering engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:43:21 +08:00
WeiCHENandCursor 915b35232c feat(web): define block ast, workbench session, and docgov types
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:41:30 +08:00
WeiCHENandCursor 952c73e9a5 feat(web): initialize react 19 vite typescript scaffold and token design system
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:40:51 +08:00
WeiCHENandCursor 19461e594a docs(plan): add three-column modern workbench and block document engine implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:37:35 +08:00
WeiCHENandCursor 46741bcf13 docs(spec): refine right rail with 36px slim tabs and deck panel drawer
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:36:39 +08:00
WeiCHENandCursor 0b62403b8b docs(spec): add three-column modern workbench and block document engine specification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:34:12 +08:00
WeiCHENandCursor a695334ac6 docs(test): 归档历史多轮会话持久化与标杆案例语义推荐标准化实测报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:01:52 +08:00
WeiCHENandCursor 1ec53b76d8 feat(cli): 终端自推荐标杆案例渲染与全业务链 E2E 端到端回归实操
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:00:59 +08:00
WeiCHENandCursor 7416a9fb35 feat(server): 新增会话列表、多轮历史消息查询与标杆案例语义检索 RESTful API
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:44:05 +08:00
WeiCHENandCursor f111fb19ae feat(coordinator): 在贴身业务参谋决策锦囊中注入相似标杆案例自推荐
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:43:08 +08:00
WeiCHENandCursor 0f1f0c6713 feat(ctxmgr): 增加已批准受控文档自动切片向量化与标杆案例语义检索
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:39:59 +08:00
WeiCHENandCursor e6aab19b89 feat(ctxmgr): 增加历史多轮会话列表查询、消息拉取与会话重构引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:37:36 +08:00
WeiCHENandCursor d92e3dee42 feat(ctxmgr): 增加离线确定性高维嵌入生成器与向量字面量工具
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:34:44 +08:00
WeiCHENandCursor 316ec475ed docs(plan): 编制历史多轮对话持久化与标杆案例语义检索实施计划
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:33:25 +08:00
WeiCHENandCursor dd36da4aa7 docs(spec): 编写历史多轮对话持久化与已批准交付物标杆案例语义检索设计规范
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:31:39 +08:00
WeiCHENandCursor 86d9e31c00 docs(test): 归档全业务链成熟度端到端贯通与受控文档治理实操测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:19 +08:00
WeiCHENandCursor 3abc6a5921 test(bizdev): 新增全业务链成熟度螺旋推进(V0.1->V0.5->V1.0)端到端贯通测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:15 +08:00
WeiCHENandCursor b273b33095 feat(cli): 升级 bizdev-cli 阶段执行器支持流式进度与文档治理拦截
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:11 +08:00
WeiCHENandCursor 72737e3565 feat(bizdev): 贯通跨阶段事实黑板自动传承与里程碑决策记录
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:07 +08:00
WeiCHENandCursor 5a1a75870d feat(ctxmgr): 支持跨阶段项目事实黑板与成熟度状态持久化
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:04 +08:00
WeiCHENandCursor 275c3ca157 docs(test): archive 2026-09-08 HTTP API and SSE context integration test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:37 +08:00
WeiCHENandCursor c1e2575e0a test(api): add e2e integration tests for claimed document SSE and docgov RESTful APIs
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:31 +08:00
WeiCHENandCursor 8ff574c08b feat(api): add RESTful endpoints and SSE streams for context and docgov lifecycle
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:26 +08:00
WeiCHENandCursor 1c6dd6cfb8 feat(service): emit governance interception and progress summary on claimed documents
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:20 +08:00
WeiCHENandCursor b5d29e11cd feat(stream): add governance event and lightweight progress summary protocol
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:13 +08:00
WeiCHENandCursor ac0b6d412e test(docgov): 增加编制审核批准全流程自动化测试与测试报告归档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 12:01:58 +08:00
WeiCHENandCursor c533523755 feat(agent): 将文档治理生命周期与认领拦截挂钩至BizDev服务与CLI工具链
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 12:01:49 +08:00
WeiCHENandCursor 2ca662ba72 feat(service): 实现文档编制审核批准生命周期、权限控制与认领闭环引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:48:59 +08:00
WeiCHENandCursor 42fff9dfdb feat(db): 增加受控文档编制审核批准生命周期与认领治理Schema
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:46:33 +08:00
WeiCHENandCursor 400f5a6764 docs(test): 归档多级上下文管理与记忆衰减引擎真实Agent实测报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:21:26 +08:00
WeiCHENandCursor e88a47db6d feat(agent): 增强上下文沙箱指引、搜索过滤与CLI用户ID上下文透传
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:21:18 +08:00
WeiCHENandCursor 67e52ffd42 feat(agent): 实现混合上下文装配引擎(Context Blender)与智能体小队沙箱对接
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:23:28 +08:00
WeiCHENandCursor 73e053e8e0 feat(service): 实现单用户/项目多级上下文模型、时间衰减与用户习惯偏好管理
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:18:31 +08:00
WeiCHENandCursor 00c36083f4 feat(storage): 实现CAS物理文件寻址与向量切片防爆炸去重引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:16:14 +08:00
WeiCHENandCursor 38aac97d24 feat(db): 部署专属记忆与多级上下文数据库容器与pgvector初始化Schema
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:13:54 +08:00
WeiCHENandCursor caf07388e0 docs(test): 归档流式传输服务与按需呈现交互规范测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:33:50 +08:00
WeiCHENandCursor e938c99468 test(api): 补充SSE流式长连接端到端自动化测试套件
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:33:03 +08:00
WeiCHENandCursor 856269a965 feat(cli): 终端支持动态阶段状态流式输出与低认知负荷摘要呈现
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:19:41 +08:00
WeiCHENandCursor dce8431b82 feat(api): 实现HTTP服务骨架与Server-Sent Events流式交互接口
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:17:37 +08:00
WeiCHENandCursor f43d3687c1 feat(agent): 在小队编排与任务生命周期中打通阶段性状态与摘要流式通知
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:14:58 +08:00
WeiCHENandCursor 8289443e45 feat(service): 建立多层级流式事件发射模型与Context穿透引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:09:41 +08:00
WeiCHENandCursor 3bdd6dd043 docs(test): 归档多领域知识中枢与专属法规知识库解耦集成测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:56:26 +08:00
WeiCHENandCursor 79b03ad916 feat(agent): 配置法规可行性评估报告专属三阶段智能体工作流
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:56:24 +08:00
WeiCHENandCursor 566bfa8611 feat(agent): 智能体小队工作区动态法规检索与上下文注入
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:47:21 +08:00
WeiCHENandCursor d43822b8d5 feat(service): 实现嵌入式多领域知识中枢与Hybrid RRF检索引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:46:22 +08:00
WeiCHENandCursor 0f21060bce feat(db): 启动本项目专属知识库容器并完成法规数据无损迁移与解耦
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:40:23 +08:00
WeiCHENandCursor d8a7254c1b docs(report): 补充归档真实Agent全流程业务测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:46 +08:00
WeiCHENandCursor ac243112a4 docs(report): 归档智能体小队自适应规划真实后端集成测试报告与设计方案
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:41 +08:00
WeiCHENandCursor 80b35ac069 test(chat): 添加基于真实Agent工作区的多轮人机交互E2E测试用例
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:37 +08:00
WeiCHENandCursor f181529195 feat(intent): 增强目标市场槽位意图匹配与上下文兼容推断
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:35 +08:00
WeiCHENandCursor 4737316d26 feat(squad): 优化质量门禁章节规范化匹配与审核专员预置草稿流转
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:32 +08:00
WeiCHENandCursor 889e775f01 feat(squad): 打通成果物基准假设附录挂载、协调层自适应回显与CLI非标文档执行
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:30:13 +08:00
WeiCHENandCursor af2d3b09d4 docs(rules): enforce real agent execution standard for delivery verification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:27:46 +08:00
WeiCHENandCursor abd0893e12 feat(squad): 实现单步评估器StepEvaluator与工作流动态加步、跳步及基准假设推断
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:27:06 +08:00
WeiCHENandCursor 37664ad7c8 feat(squad): 实现自适应任务规划器AdaptivePlanner支持固定流微调与非标文档自治拆解
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:22:50 +08:00
WeiCHENandCursor 0737a6780c feat(squad): 实现角色资产中心RoleRegistry支持8大标准角色与临时专员派生
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:20:56 +08:00
WeiCHENandCursor 486fbf1977 feat(squad): 增强领域核心模型支持角色来源、自适应步骤与黑板基准假设
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:19:57 +08:00
WeiCHENandCursor 8a2c537445 docs(test): establish test report standards and generate three-branch intent framework report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:16:04 +08:00
WeiCHENandCursor 2456141f67 feat(cli): add three-branch interaction feedback and comprehensive verification test cases
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:54 +08:00
WeiCHENandCursor a0a9b03e28 feat(chat): integrate non-blocking pending expectation and topic preemption in session
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:51 +08:00
WeiCHENandCursor 017b53d634 feat(coordinator): refactor advisor persona and assemble next expectation drafts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:48 +08:00
WeiCHENandCursor d3251dee0b feat(intent): implement three-branch flexible intent resolution and expectation contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:45 +08:00
WeiCHENandCursor 3a15143fa7 feat(coordinator): 增强工作区阶段元数据持久化与上下文自动关联
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:38:59 +08:00
WeiCHENandCursor b1484a7a9b feat(cli): CLI支持-chat交互式对话REPL与单次自然语言指令调度
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:51 +08:00
WeiCHENandCursor bd33d9645e feat(chat): 封装L1会话管理器打通自然语言多轮人机交互闭环
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:47 +08:00
WeiCHENandCursor 70c96f2f3d feat(coordinator): 实现L2统一上下文组装器与意图校验调度引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:43 +08:00
WeiCHENandCursor d0ca8bed54 feat(intent): 定义核心意图契约并实现基于上下文约束的规则意图识别器
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:39 +08:00
WeiCHENandCursor e2759394ca docs(system): 纳管系统架构设计与演进规划文档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:21 +08:00
WeiCHENandCursor 7346fcae64 feat(cli): CLI支持成熟度阶段执行与业务参谋锦囊可视化
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:10 +08:00
WeiCHENandCursor 6502d35e50 feat(bizdev): 实现成熟度三阶段编排与AdvisorBriefing双轨交付
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:05 +08:00
WeiCHENandCursor 9030cb9dd1 feat(squad): 修复stub字段覆盖并增强质量门禁闭环与锚点提取
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:01 +08:00
WeiCHENandCursor 003d99ab67 test(squad): add comprehensive tests for workspace, context, workflow, quality gate, and cli
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:59 +08:00
WeiCHENandCursor 63e4af2db5 feat(cli): upgrade bizdev-cli with dynamic inspection, step manipulation, and manifest display
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:55 +08:00
WeiCHENandCursor da9c63debe feat(service): integrate squad service and ports into bizdev domain service
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:51 +08:00
WeiCHENandCursor 14ef73677e feat(quality): implement 3-tier quality gate, manifest auditing, and quote backfill
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:47 +08:00
WeiCHENandCursor 0f17f74cc2 feat(workflow): implement dynamic workflow driver with sub-workspace isolation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:42 +08:00
WeiCHENandCursor d0c6559dd6 feat(context): implement self-describing context system with authority guide
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:39 +08:00
WeiCHENandCursor b0142ab026 feat(squad): define workspace directory metadata models and engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:35 +08:00
WeiCHENandCursor cd39a52dce feat(agent): ensure clean container and isolate workspace artifacts strictly to host volume
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:51:50 +08:00
WeiCHENandCursor 953a99ab83 docs(env): update environment configuration template with MiniMax and Tavily pool
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:45 +08:00
WeiCHENandCursor 4929b1842c chore(docker): integrate pi-agent service in dev, test, and main compose files
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:39 +08:00
WeiCHENandCursor 38406f5e0b test(agent): add Tavily pool rotation and PiAgent remote runner tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:35 +08:00
WeiCHENandCursor ab26e5d161 feat(agent): support PI_AGENT_RUNNER_URL remote execution in PiAgentBackend
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:31 +08:00
WeiCHENandCursor fabdb51e65 feat(agent): add pi-agent container assets with dynamic MiniMax config and HTTP runner
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:27 +08:00
WeiCHENandCursor 1edf5f60ab feat(agent): add Tavily search extension with API key pool and auto-rotation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:23 +08:00
WeiCHENandCursor 02f04f3851 fix(agent): pass absolute workDir and parse bridge JSON response
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:15:16 +08:00
WeiCHENandCursor 840541794a fix(all): resolve whole-branch review findings on Excel labels, persona forwarding, and error handling
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:00:40 +08:00
WeiCHENandCursor 8dc315b690 feat(cli): add bizdev-cli runner tool and integration tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:47:28 +08:00
WeiCHENandCursor ad18561da6 fix(service): populate Excel pricing cells and verify attachment readback parity
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:44:55 +08:00
WeiCHENandCursor 7a41b4f5be fix(service): backfill CDO quote markdown table from excel summary and align workspace
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:41:29 +08:00
WeiCHENandCursor d97098371d feat(service): implement bizdev service with independent task drivers
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:38:55 +08:00
WeiCHENandCursor 8c000f0b2d chore(tools): add package.json for cursor-bridge and pi-bridge
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:37:44 +08:00
WeiCHENandCursor a7d30a2c7a feat(agent): implement cursor-cli, pi-agent, and stub backend adapters
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:36:15 +08:00
WeiCHENandCursor b3026d3c5b feat(quote): implement CDO quote Excel calculation and fill engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:34:01 +08:00
WeiCHENandCursor 543babf621 feat(template): add self-describing templates and agent personas
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:30:52 +08:00
WeiCHENandCursor 6f44916bfb feat(kb): add regulation knowledge base client with snapshot materialization
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:27:51 +08:00
WeiCHENandCursor 40a25f9bd0 chore(config): initialize go module and configuration loader
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:25:45 +08:00
WeiCHENandCursor 76e6acaff4 docs(plan): add bizdev squad and templates implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:23:34 +08:00
WeiCHENandCursor b14fc71922 chore(config): add .env.example with cursor, pi-agent, and kb variables
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:16:10 +08:00
WeiCHENandCursor 4c97de4f8e docs(spec): add business docking squad and templates design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:15:47 +08:00
WeiCHENandCursor d78c6e4fa6 chore(rules): 配置 Cursor 持久化规则以约束三分支模型与环境隔离规范
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:27 +08:00
WeiCHENandCursor dd7675eb89 feat(scripts): 增加多环境一键启停管理与分支工作流辅助脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:25 +08:00
WeiCHENandCursor 4ce8275a8a feat(env): 增加开发/测试/主分支三套独立服务与共享知识库编排及配置
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:22 +08:00
WeiCHENandCursor 6478742d44 feat(db): 增加共享知识库与隔离系统数据库初始化脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:19 +08:00
WeiCHENandCursor d27b0ad5ad docs: 建立仓库基础架构、三分支规范与环境运行文档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:56:53 +08:00
1267 changed files with 4304 additions and 146541 deletions
-1
View File
@@ -42,7 +42,6 @@
| 架构设计 | [system-design/README.md](system-design/README.md) |
| 测试报告 | [test-reports/](test-reports/) |
| 历史功能设计 | [archive/design/superpowers/](archive/design/superpowers/) |
| Herdr 角色、审批与备援 | [ops/2026-09-13-herdr-agent-roster.md](ops/2026-09-13-herdr-agent-roster.md) |
---
@@ -1,25 +0,0 @@
# ADR:文档 Version / Revision 边界与决策门
## 状态
已接受(2026-09-13,用户确认 DOCREV 整改实施计划)
## 背景
受控文档此前只有当前 `output.md` 与 SHA,无法表达「智能体基线 + 后续人工修改」的业务版本语义;自由文档每次保存 +1 的 `current_version_id` 与本需求冲突。
## 决策
1. **版本边界**:模板或一次成功提交的智能体/智能体小队产物开启 `Version`;人工每次服务端成功保存只增加该 Version 内的 `Revision`,不增加面向用户的版本号。
2. **high/critical 候选**:风险达到 `high` 或 `critical` 的 agent candidate,必须经编制负责人二次确认后才能 `CommitAgentVersion`。
3. **首发范围**:Wave 1–5 仅覆盖受控文档;自由文档统一读模型与 UI 语义切换放在 Wave 6。
4. **根表指针列**:统一 `ledger_*` / `head_*` 前缀;禁止与 `freeform_documents.current_version_id`(00008 每-save+1 legacy)同名承载新语义;旧列迁移时改名为 `legacy_version_id`。
5. **Goose**:从 **00028** 起递增;不得硬占用并行分支可能冲突的旧号。
6. **保留策略**:受控文档随项目/法规保留;自由文档默认 365 天可配置,禁止静默硬删。
7. **发布 blocker**:方案评审与 Wave 落地阶段不擅自写入 gap-matrix;纳入发布范围后再新增行。
## 后果
- 实施必须按 Wave 0→6 顺序;禁止先上前端颜色标记再补快照事实源。
- `document_records.version` / `content_sha256` 在兼容期由 ledger 同事务投影,稳定后退役。
- 详细表结构、API、状态机见 [../system-design/document-revision-management.md](../system-design/document-revision-management.md)。
@@ -1,62 +0,0 @@
# ADR:以纵向绞杀方式实施模块化单体解耦
## 状态
提议(2026-09-14;架构与实施计划已修订,等待用户确认后进入首个实现里程碑)
## 背景
`internal/server`、`internal/bizdev`、共享 `UserProjectContext`、工作区路径和多表写入形成隐式耦合。
历史受控正文 404/409、刷新后投影缺失和任务终态不完整说明,单纯搬包不会修复事实源、事务与恢复边界。
## 决策
1. **保持模块化单体**:不拆微服务;进程内调用使用窄端口,跨进程可靠性只用于持久事件和 FAV。
2. **纵向绞杀**:先在现有包边界插入端口和适配器,迁完一条业务链并验证后再移动或重命名包;禁止“先全量搬包、以后再接口化”。
3. **契约分层**:外部 API DTO 归 `server/api`;持久 schema、公共事件和稳定共享词汇进入按领域划分的 contracts;一对一内部接口由消费者拥有。
4. **命令与事务同属一个应用用例**:一个业务命令只有一个事务 owner;跨表属主通过同一不透明事务作用域协作,业务状态、账本、当前指针、staging 和 outbox 原子提交。
5. **单一写者不等于单独事务**:表属主控制 SQL 和不变量;应用 UnitOfWork 控制跨属主提交边界。属主端口不得私自嵌套提交。
6. **并发正确性以数据库为准**:用户编辑使用乐观版本/ETag;状态转换使用行锁和条件更新;项目级不变量可使用事务级 advisory lock;进程内 mutex 只能优化,不能作为多副本正确性依据。
7. **锁顺序固定**:同一事务按 project/workflow instance → document record → document version/snapshot → task run → outbox/staging 的顺序取锁;事务内禁止 LLM、对象存储、网络调用和长文件 I/O。
8. **可靠事件采用 transactional outbox**:事件按至少一次投递设计,具有稳定 ID、schema version、环境/项目范围、聚合序号、因果链和幂等键;逐消费者记录 delivery、重试、租约和死信。
9. **工作区是可清理投影**:跨模块只传不可伪造 Workspace ID 和受限 artifact key;物理路径只在 workspace/squadrun 适配器内解析和校验。
10. **最终成果进入 FAV**:PostgreSQL 保存业务关系和授权,FAV 只保存已确认终态的精确 payload、manifest、回执和删除状态,workspace 不承担最终成果事实源。
11. **授权逐动作校验**:认证适配器构造不可由请求覆盖的 Principal;HTTP、CLI、后台订阅者和恢复流程都按 action/resource/current state fail closed。
12. **先完成文档可靠性试点**:只有受控正文刷新、重启、并发提交、投影缺失降级和授权负例通过后,才批准 chat、squad、编排层和传输层扩展。
13. **迁移采用 expand/migrate/contract**:允许新增 Goose migration;不得修改已发布迁移;回滚只保证回到最近的兼容阶段,不能任意独立 revert 早期依赖。
14. **协议改造独立立项**:统一错误信封和 PI Runner `result.json` 不作为核心模块解耦前置条件;它们使用独立兼容与 E2E 验收。
## 并发与失败语义
- 普通聚合状态转换默认 `READ COMMITTED` + 明确行锁/条件更新;涉及跨聚合唯一不变量时才使用 Serializable,并对 `40001`/`40P01` 重跑完整事务。
- outbox worker 使用小批次 `FOR UPDATE SKIP LOCKED` 认领,处理发生在事务外;完成、续租和失败回填使用 fencing token 防止过期 worker 覆盖新 owner。
- 每个写命令必须同时有 idempotency key、expected version 或两者;相同 key 不同 payload 返回 typed conflict。
- 锁等待、事务时长、重试次数、队列积压和死信必须可观测;超过预算时失败返回,不无限等待。
## 授权与恢复语义
- Principal 至少携带 actor、环境、认证来源和请求关联 ID;项目、会话、文档、阶段与 duty 从数据库权威关系重新解析。
- 持久事件中的 actor 只用于审计,不能替代订阅者对当前资源状态的授权检查。
- FAV 降级读取要求运行库授权图完整;授权图缺失时禁止面向用户返回内容。
- 恢复只允许进入 scratch identity;promotion 需要系统管理员与数据责任人确认,并通过各属主端口提交,禁止恢复 CLI 直写运行表。
## 后果
- 首个实现里程碑的改动面小于原 Wave 1–6,但会先增加 UnitOfWork、事件投递和授权基础设施。
- “单表唯一写者”检查改为生产 SQL 写权限检查,并允许 migration、测试和经批准运维脚本存在表名。
- `feature/final-artifact-vault` 是候选依赖,不直接假定可合入;必须先按当前 dev 重放测试、迁移和权限审计。
- 包物理移动、错误信封、SSE 和 PI Runner 协议可延后,不阻塞文档一致性整改。
## 替代方案
- **一次性横向搬包**:拒绝。冲突面大,不能先证明用户故障减少。
- **仅增加 arch-check**:拒绝。门禁不能替代事务、锁和授权契约。
- **拆微服务**:拒绝。当前问题是模块边界和数据一致性,不需要引入分布式事务与跨服务部署成本。
- **继续把 workspace 作为恢复来源**:拒绝。工作区属于可清理计算现场,不能成为最终事实源。
## 相关文档
- [模块解耦架构](../system-design/2026-09-14-module-decoupling-architecture.md)
- [模块解耦整改与重构计划](../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- [方案复核](../audit/2026-09-14-module-decoupling-plan-review.md)
- [文档版本边界 ADR](./2026-09-13-document-version-boundary.md)
@@ -1,30 +0,0 @@
---
title: "事件连续性采用 consumer checkpoint + 首事件 bootstrap"
status: accepted
created: 2026-09-15
updated: 2026-09-15
---
# ADR:事件连续性采用 consumer checkpoint + 首事件 bootstrap
## 状态
接受(E0A)。在独立 FAV 审计或明确的无缺口 event sequence 迁移完成前不得改为 gap blocking。
## 背景
`event_envelopes` 已有 `UNIQUE (aggregate_type, aggregate_id, aggregate_version)`。受控文档的首次持久事件常常从较高 `aggregate_version`(账本 version_no)开始,中间版本从未发事件。若把领域版本号当成无缺口事件序号并在缺号时等待,会永久阻塞 delivery。MemoryBus 的 `TestGapDoesNotSkipVersion` 只是 characterization,不得搬到 PostgreSQL dispatcher。
## 决策
1. Track E 选择 **consumer checkpoint + 首事件 bootstrap**。
2. 每个 `(consumer, aggregate_type, aggregate_id)` 记录已成功处理的 `event_id` 与可选 `aggregate_version`。该 aggregate 上的第一件 **safe** 事件即为 bootstrap,不要求 version=1。
3. 同一版本多个不同类型事件:当前唯一约束禁止。E0A 审计后保持该约束;需要同版本多事件时另立 additive 迁移,把序号改到独立 `event_seq`,不在本 ADR 启用。
4. **禁止** 在 dispatcher 启用 gap wait / `ErrGapWait` 阻塞,直到另有 ADR 选择独立无缺口 event sequence 且完成回填。
5. 未知 schema、project 0、错误 environment、未知 consumer 的记录进入 inventory,不得 live claim。
## 后果
- E0B checkpoint 表随 dispatcher migration 增加。
- Projection 以 `document_id + source_snapshot_id + digest` no-replace,不依赖连续 version。
- poison 事件 quarantine 后不静默跳号;其他 aggregate 继续。
@@ -1,85 +0,0 @@
# ADR:纯软件工作流 key 与领域边界(SWBOOT-00)
## 状态
已接受(2026-09-16)
## 背景
工作流引擎已声明 `non_medical_software` 产品域,但正式目录、创建入口与模板仍以医疗器械三工作流(`main` / `product_manager` / `test_manager`)为硬编码白名单。继续复用医疗 manifest 会造成临床/注册/CDO 语义污染;直接改写既有三 key 会破坏已激活医疗实例。
详细设计见 [software-project-bootstrap-workflow](../system-design/2026-09-14-software-project-bootstrap-workflow.md)。
## 决策
### 1. 新增正式可选工作流 key
| key | 定位 | 默认产品域 | 可重复实例 |
|-----|------|------------|------------|
| `software_bootstrap` | 一次性建立项目事实、需求、架构、风险、路线与验证基线 | `non_medical_software` | 否(默认一次;终止后可重建并保留旧证据) |
| `software_delivery` | 按里程碑/发布重复交付,承接 change brief → 证据 → 验证 → 发布 → 复盘 | `non_medical_software` | 是 |
医疗三 key **保持不变**,仍为正式可选;不得在其 published hash 上替换为软件语义。
### 2. 目录策略:published + selectable,而非“仅三 key”
项目可选工作流 = 已发布 (`latest_published_version > 0`) ∩ `project_selectable=true` ∩ 策略白名单。
白名单扩展为:
```text
main | product_manager | test_manager | software_bootstrap | software_delivery
```
固定文档数量校验 **仅** 继续约束医疗三 key;软件工作流按 manifest 自身完整性校验,不强制医疗文档数。
### 3. 领域与合规分离
- `product_domain=non_medical_software` 只说明非医疗器械,不关闭鉴权/审计/安全基线。
- `compliance_profile` / `governance_profile` / `execution_mode` / `team_mode` 为项目级独立字段。
- 首期默认:`governance=standard`,`compliance=internal_control+security_baseline`,`execution_mode=docs_only`。
- `controlled_patch` 在 SWBOOT-10 受控执行器就绪前 **不可真正启用**;仅保留 allowlist stub。
### 4. 串联而非回环
```text
software_bootstrap(完成 + 创建者确认)
→ 仅建议 software_delivery
→ 创建者确认后新建 planning/激活实例
```
bootstrap 完成不得自动创建或激活 delivery。
### 5. Solo 审批策略(契约)
- `collaborative`:独立三权(author/reviewer/approver 不同人)。
- `solo`:`creator_acknowledgement`;页面与审计持续标注“未独立评审”。
- `controlled` 或要求独立审查的 compliance profile:**禁止 solo**。
### 6. 错误码(首期)
| code | 含义 |
|------|------|
| `ERR_WORKFLOW_NOT_SELECTABLE` | key 不在正式可选白名单或未 published |
| `ERR_DOMAIN_INCOMPATIBLE` | 工作流与项目 `product_domain` / `project_type` 不兼容 |
| `ERR_COMPLIANCE_PROFILE` | 合规配置非法或与治理冲突(如 controlled+solo) |
| `ERR_EXECUTION_MODE_DISABLED` | 请求 `controlled_patch` 但受控执行器未启用 |
| `ERR_REPO_PATH_NOT_ALLOWLISTED` | 仓库路径不在管理员 allowlist(SWBOOT-10 stub) |
| `ERR_CREATION_PREVIEW_STALE` | creation token / plan_hash 过期或不匹配(409) |
### 7. 运行时权威不变
继续遵守 [workflow-runtime-authority](./2026-09-12-workflow-runtime-authority.md):任务只能从冻结 `doc_task_instance` 启动;禁止客户端 `task_key`/duty/stage 旁路。
## 后果
- Bootstrap seed 与 catalog API 必须同时暴露软件两 key,且按 `product_domain` 过滤时不把医疗默认话术塞进软件项目。
- 项目表 additive 增加 `project_type_key` / `compliance_profile_key` 等字段;旧项目不自动分类为医疗或软件。
- SWBOOT-10 仅落地 allowlist stub:任何真实 patch/merge/push 必须 fail closed,直到独立 Epic 验收。
- 医疗三工作流黄金用例与固定文档数门禁保持回归基线。
## 关联
- 实施任务:`.doc/ops/short-term/2026-09-16-software-project-bootstrap.md`
- Backlog:`.doc/ops/long-term/2026-09-14-software-project-bootstrap-implementation.md`
- 验收清单:`.doc/ops/checklists/2026-09-14-software-project-bootstrap-acceptance.md`
@@ -1,54 +0,0 @@
---
title: "刷新后对话正文消失问题定位与整改方案"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: codex
branch: dev
worktree: "-"
mutex: chat
---
# 刷新后对话正文消失问题定位与整改方案
## 目标
定位页面刷新后对话正文不显示、但锚点与过滤计数仍存在的根因,并形成可执行、可验证的整改方案。
## 范围
- 前端对话状态、会话恢复、消息窗口、锚点与类别过滤的数据来源
- 后端会话/消息持久化与历史读取 API
- 当前 dev 运行态的只读接口与数据一致性验证
- 审计记录、整改方案与验收标准
## 非目标
- 本轮不修改业务代码
- 不执行破坏性数据修复
- 不把 stub 或仅内存态结果作为最终验收
## 步骤
1. [x] 复核刷新前后前端状态初始化和会话选择链路
2. [x] 核对历史消息 API、存储字段及运行态返回
3. [x] 解释正文、锚点和过滤计数数据源为何分叉
4. [x] 输出 audit 与 remediation 文档并回链
## 验收标准
- [x] 根因有源码、接口或运行态证据支撑
- [x] 明确影响范围、触发条件与风险等级
- [x] 整改方案覆盖实现、回归测试、数据兼容和验收
## 相关链接
- Checklist: 待整改实施时建立
- Handoff: [chat-history-refresh-diagnosis](../../ops/handoffs/2026-09-13-chat-history-refresh-diagnosis.md)
- Test report: 待整改实施并验收后建立
## 证据 / 备注
- 用户实测:新对话能正常生成文档;刷新后历史对话正文消失,但右侧锚点与顶部过滤仍显示对应消息数量。
- Audit: [../../audit/2026-09-13-chat-history-refresh-disappears.md](../../audit/2026-09-13-chat-history-refresh-disappears.md)
- Remediation: [../../remediation/2026-09-13-chat-history-refresh-remediation.md](../../remediation/2026-09-13-chat-history-refresh-remediation.md)
@@ -1,58 +0,0 @@
---
title: "修复对话刷新恢复与授权统计不一致"
status: done
created: 2026-09-13
updated: 2026-09-15
owner: Cursor
branch: fix/chat-history-refresh
worktree: ".worktrees/fix-chat-history-refresh"
mutex: chat
---
# 修复对话刷新恢复与授权统计不一致
## 目标
按整改方案修复消息作用域写入、历史兼容、读取授权和前端恢复态,并完成真实 PostgreSQL 与 PI 文档生成后的刷新验收。
## 范围
- 消息和 task run 的不可变工作流实例/阶段作用域
- 会话 owner 与阶段可见性的统一服务端策略
- 窗口、日期、分类、搜索、摘要、未读、导出、锚点的同集查询
- 现有消息 dry-run/backfill
- 前端窗口错误态和用户隔离缓存
- 自动化与真实 PI E2E 证据
## 非目标
- 不放宽现有阶段可见性规则
- 不用前端缓存替代服务端持久化
- 不对无法唯一归属的历史消息盲目回填当前阶段
## 步骤
1. [x] 先补可稳定复现本缺陷的 PG 集成与前端恢复测试
2. [x] 实现统一消息作用域解析与写入
3. [x] 实现统一会话/消息授权查询及统计同集
4. [x] 实现历史 dry-run/backfill 与对账
5. [x] 完善前端恢复状态及用户隔离缓存
6. [x] 执行全量门禁、真实 PI 闲聊刷新 E2E 和双用户负例(编制任务激活链 save 400 未纳入本轮)
## 验收标准
- [x] [整改方案](../../remediation/2026-09-13-chat-history-refresh-remediation.md) 的验收项(除真实 PI E2E)有证据
- [x] `CHAT-HISTORY-REFRESH` 在 gap-matrix 中由 FAIL 更新为 PASS
- [x] 测试报告归档并回链
## 相关链接
- Checklist: 实施开始时复制模板建立
- Handoff: [../handoffs/2026-09-13-chat-history-refresh-diagnosis.md](../handoffs/2026-09-13-chat-history-refresh-diagnosis.md)
- Test report: [../../test-reports/2026-09-13-chat-history-refresh-test-report.md](../../test-reports/2026-09-13-chat-history-refresh-test-report.md)
## 证据 / 备注
- Audit: [../../audit/2026-09-13-chat-history-refresh-disappears.md](../../audit/2026-09-13-chat-history-refresh-disappears.md)
- Remediation: [../../remediation/2026-09-13-chat-history-refresh-remediation.md](../../remediation/2026-09-13-chat-history-refresh-remediation.md)
- Live: [../../test-reports/assets/2026-09-15-chat-history-refresh-live/live.json](../../test-reports/assets/2026-09-15-chat-history-refresh-live/live.json)(项目 6252,window=categories=2,guest 403)
@@ -1,59 +0,0 @@
---
title: "修复查询误触发写任务与任务状态刷新退化"
status: done
created: 2026-09-13
updated: 2026-09-15
owner: Cursor
branch: docs/conversation-intent-dual-tab
worktree: "-"
mutex: intent
---
# 修复查询误触发写任务与任务状态刷新退化
## 目标
修复只读查询误启动文档、刷新丢失任务卡片能力及文档编辑状态不可见,并建立诊断数据隔离门禁。
## 范围
- 模板任务动作识别及负例测试
- 任务错误/进度/恢复上下文持久化与历史重建
- 文档租约/运行态的 UI 展示和重复启动前置拦截
- 隔离 fixture 验收与真实 PI 刷新 E2E
## 非目标
- 未经项目创建者确认,不软删除已污染消息或删除误启动产物
- 不放宽文档租约与工作流权限规则
## 步骤
1. [x] 核对真实会话、任务运行、事件和文档租约证据
2. [x] 补只读意图与刷新恢复失败测试
3. [x] 收紧写任务动作识别并修复 busy 错误分型
4. [x] 实现任务/租约状态刷新恢复与统一提示
5. [x] 实现命名文档的服务端鉴权只读总结(“总结”不止是不写入)
6. [x] 执行前端、Go、PG 与真实 PI 双标签页验收
- [x] Go、前端、构建、dev 重建与真实 PI 只读总结
- [x] 服务端 busy 预检不创建 run,并持久化无重试状态卡
- [x] 浏览器刷新恢复与双标签页 busy 可见性(项目 6275;禁止项目 143)
## 验收标准
- [x] [整改方案](../../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md) 全部验收项有证据
- [x] `CHAT-INTENT-STATE` 由 FAIL 更新为 PASS
- [x] test-report 归档并回链
## 相关链接
- Checklist: 本任务验收标准
- Handoff: [../../ops/handoffs/2026-09-15-conversation-intent-dual-tab.md](../../ops/handoffs/2026-09-15-conversation-intent-dual-tab.md)
- Test report: [../../test-reports/2026-09-13-conversation-intent-runtime-state-test-report.md](../../test-reports/2026-09-13-conversation-intent-runtime-state-test-report.md)
## 证据 / 备注
- Audit: [../../audit/2026-09-13-conversation-intent-runtime-state.md](../../audit/2026-09-13-conversation-intent-runtime-state.md)
- Remediation: [../../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md](../../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md)
- 双标签活验:项目 **6275** / `sess-p6275-u10` / `run_1789452602295343365`;产物 `.doc/test-reports/assets/2026-09-15-conversation-intent-dual-tab/`
- 未改写项目 143,未删除 `sess-p143-u9` 探针
@@ -1,47 +0,0 @@
---
title: "当前受控文档指示语优先于领域关键词路由"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-active-doc-routing
worktree: "-"
mutex: docgov
---
# 当前受控文档指示语优先于领域关键词路由
## 目标
用户说「当前受控文档/当前文档/本文件/这份文档」且已选中服务端注册的 `doc_proj*` 时,任务 payload 为该文档 `taskKey`+`docId`;UI-05 提示须为 `intake` + `doc_proj6109_intake`。
## 范围
- `web/src/engine/templateMatch.ts` + App 发送/重试链
- 单测与边界;服务端 mismatch 复核(不信任客户端 doc_id 改 task)
- 文档:audit / gap-matrix / CURRENT
## 非目标
- 不改弱 E2E UI-05 断言;不操作容器;不触碰/提交 test-report assets
- 生产 `templateMatch.ts` 不导出用例编号/E2E 专属提示词;测试提示词留在 test 文件
## 步骤
1. [x] 认领 CURRENT;写 audit/short-term
2. [x] 指示语钉住 active 受控文档;显式点名可切换;只读不启动;模板槽不钉
3. [x] App 传入 activeDoc;payload 用一致 taskKey/docId
4. [x] 单测 + 门禁 + 原子提交
## 验收标准
- [x] UI-05 原文 + active intake → `intake` / `doc_proj6109_intake`
- [x] 只读「查看当前受控文档」不启动任务
- [x] 显式点名另一交付物可切换;模板-only 不钉住
- [x] 服务端 task_key 与已注册 doc 不一致仍拒绝
- [x] `go vet` / `go test -short` / web 242+27 / build / `git diff --check`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-active-doc-routing.md](../../audit/2026-09-13-document-revision-active-doc-routing.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05-active-doc-routing-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05-active-doc-routing-failure)
@@ -1,55 +0,0 @@
---
title: "职责单元格精确断言"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-duty-cell-assertion
worktree: "-"
mutex: document-revision-duty-cell-assertion
---
# 职责单元格精确断言
## 目标
堵住第16轮 UI-13a:权限矩阵已打开,整行 `innerText` 含全部 select option,误命中「编制负责人」。改为读控件 value/badge,且 USER_B 必须精确 `reviewer`,不得接受 viewer 降级。
## 范围
- `web/src/lib/dutyCellAssertion.ts` 与单测
- `UserProjectRightsModal` 职责控件可访问语义
- `web/e2e/document-revision-runtime.spec.ts` UI-13a
- audit / remediation / CURRENT
## 非目标
- 不放宽 reviewer 只读;不删双击/无编辑提示检查
- 不碰证据;不合 dest;不启停容器;不 E2E;不 push
## 步骤
1. [x] 从 `dev@dd5671e` 开分支并登记 mutex
2. [x] 精确角色解析 + option 文案不得误判测试
3. [x] 产品控件 data-* + UI-13a 接线
4. [x] `npm test` + `npm run build` 并原子提交
5. [x] 独立审查收紧:只接受 reviewer;viewer 与 canAssignLead=true 拒绝
## 验收标准
- [x] select/badge 必须精确 `reviewer`;viewer/author/approver 拒绝
- [x] 整行 option 文案不得推断职责
- [x] select 必须不可配置且 disabled
- [ ] 现场 UI-13a(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-duty-cell-assertion.md](../../audit/2026-09-13-document-revision-duty-cell-assertion.md)
- Remediation: [../../remediation/2026-09-13-document-revision-duty-cell-assertion.md](../../remediation/2026-09-13-document-revision-duty-cell-assertion.md)
## 证据 / 备注
- mutex:`document-revision-duty-cell-assertion`(新 mutex)
- 基线:`dev@dd5671e`
- 验证(收紧后):`npx tsx --test src/lib/dutyCellAssertion.test.ts` PASS(6);`cd web && npm test` PASS;`npm run build` PASS
- **未跑真实 UI-13a,不得标 done**;**不得 merge / 启停容器 / E2E / push**
@@ -1,51 +0,0 @@
---
title: "E2E:给真实文档块加稳定寻址并修正 UI-06/13b"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-block-selector
worktree: "-"
mutex: document-revision-block-selector
---
# E2E:给真实文档块加稳定寻址并修正 UI-06/13b
## 目标
第六轮 UI-06 首错:`pure` 模式下块 wrapper 无 `data-overlay-kind`、正文也不是 `p`/`h1`。为每个真实 `DocumentBlock` wrapper 增加与 overlay 无关的稳定 DOM 标识;E2E 只在 `active-document-pane` 内定位该标识。不改视觉/权限/双击行为。不得将本任务标 `done`。
## 范围
- `web/src/lib/documentBlockDom.ts` + 契约单测
- `web/src/components/doc/BlockRenderer.tsx`
- `web/e2e/document-revision-runtime.spec.ts`(`openFirstPaneEditorAndFill`;UI-06/13b 复用,UI-13a 同步)
- 文档:audit / CURRENT
## 非目标
- 不改编辑/权限/overlay 视觉
- 不降低已有断言;不伪造、不直接打 API
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-block-selector`);前序 reject-routing 保持 in_progress
2. [x] 真实块 wrapper 增加 `data-testid=document-block` + block id
3. [x] E2E 仅在 active pane 内按该标识双击
4. [x] 契约单测:pure 模式也有块标识,且不依赖 `data-overlay-kind`
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 块标识与 overlay 无关;带 block id
- [x] `openFirstPaneEditorAndFill` 不使用 overlay/`p`/`h1`/`h2`
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-06/13b PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-block-selector.md](../../audit/2026-09-13-document-revision-block-selector.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-block-selector-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-block-selector-failure)
- 前序: [2026-09-13-document-revision-e2e-reject-routing.md](./2026-09-13-document-revision-e2e-reject-routing.md)
@@ -1,51 +0,0 @@
---
title: "E2E:纯净阅读按 document-block 取样 overlay"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-overlay-selector
worktree: "-"
mutex: document-revision-overlay-selector
---
# E2E:纯净阅读按 document-block 取样 overlay
## 目标
第八轮 UI-07 首错:pure 模式用 `[data-overlay-kind],[class*=block]` 找不到真实块。在 `active-document-pane` 内对全部 `document-block` 取样真实样式/hunk;manual/all 不保证两两不同。不得将本任务标 `done`。
## 范围
- `web/e2e/document-revision-runtime.spec.ts`(UI-07 取样;UI-10 历史自动关闭;UI-16 text 选择器)
- `web/src/features/documentRevision/overlayMode.test.ts`(同一 human hunk 不保证 pairwise)
- 文档:audit / CURRENT
## 非目标
- 不新建 policy 抽象;不改 overlay 视觉/业务
- 不人为换块制造 manual≠all
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-overlay-selector`)
2. [x] UI-07 在 pane `document-block` 上取样
3. [x] 按 checklist 校正三模式断言
4. [x] UI-10 按抽屉自动关闭比较
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 禁止 `[class*=block]` / 全页 overlay 取样
- [x] 纯净阅读必须无装饰;人工/全部必须有真实 hunk 装饰
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-07/08/09 PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-overlay-selector.md](../../audit/2026-09-13-document-revision-overlay-selector.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-pure-selector-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-pure-selector-failure)
- Checklist: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
- 前序: [2026-09-13-document-revision-e2e-save-selector.md](./2026-09-13-document-revision-e2e-save-selector.md)
@@ -1,46 +0,0 @@
---
title: "E2E:等 overlay CSS transition 结束后再取样"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-overlay-transition
worktree: "-"
mutex: document-revision-overlay-transition
---
# E2E:等 overlay CSS transition 结束后再取样
## 目标
第九轮 UI-07 首错:`data-overlay-kind` 已空,但采样落在 200ms transition 中间帧。用 Playwright 轮询 computed style 直到稳定且达到无装饰目标后再取样。不得将本任务标 `done`。
## 范围
- `web/e2e/document-revision-runtime.spec.ts`(pure/manual/all 均等样式 settle)
- 文档:audit / CURRENT
## 非目标
- 不禁用产品 `transition`;不固定极短 sleep;不放宽纯净无装饰断言
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX;不合 `dev`
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-overlay-transition`)
2. [x] `expect.poll` 连续两帧相同且达到 mode 目标后再采样
3. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 纯净阅读仍要求透明底 + `box-shadow:none` + 无 overlay-kind
- [x] manual/all 也等 transition 完成
- [x] web tests + `tsc`/build + `git diff --check` + Go 门禁
- [ ] 真实 UI-07/08/09 PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-overlay-transition.md](../../audit/2026-09-13-document-revision-overlay-transition.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-css-transition-sampling-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-css-transition-sampling-failure)
- 前序: [2026-09-13-document-revision-e2e-overlay-selector.md](./2026-09-13-document-revision-e2e-overlay-selector.md)
@@ -1,49 +0,0 @@
---
title: "E2E:待确认报告必须真实打开再确认/拒绝"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-pending-flow
worktree: "-"
mutex: pending-report-ui
---
# E2E:待确认报告必须真实打开再确认/拒绝
## 目标
第四轮 UI-05a 首错修复:验收脚本按真实用户路径关闭首轮报告、打开「待确认报告」,在面板内断言 high(critical 允许)与 pending 动作后再确认/拒绝。不改产品业务逻辑。
## 范围
- `web/e2e/document-revision-runtime.spec.ts` UI-04 / UI-05a / UI-05b
- 文档:audit / CURRENT 认领(mutex `pending-report-ui`;与 reject-routing 的 `document-revision-runtime-ui` 分开,避免虚报 done)
## 非目标
- 不改 `ChangeReportPanel` / Toolbar / decision API
- 不降低已有业务断言或超时;不伪造、不直接打 API
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT;写 audit/short-term
2. [x] UI-04 用弹窗内「关闭」并断言 dialog 消失
3. [x] UI-05a 点击「待确认报告」,断言 risk/pending-actions/确认提交后确认
4. [x] UI-05b 新 pending 后同样打开面板,断言 pending-actions/拒绝后再拒绝
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] UI-04 不再使用无效 Escape
- [x] UI-05a/05b 不靠全局 count 代替打开待确认报告
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-05a/05b PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-pending-report-selection.md](../../audit/2026-09-13-document-revision-pending-report-selection.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05a-pending-report-selection-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05a-pending-report-selection-failure)
- Checklist: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
@@ -1,62 +0,0 @@
---
title: "E2E:UI-05b 钉住 intake 并收紧 UI-10/12/13/14"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-reject-routing
worktree: "-"
mutex: document-revision-runtime-ui
---
# E2E:UI-05b 钉住 intake 并收紧 UI-10/12/13/14
## 目标
第五轮 UI-05b 首错修复:拒绝用例 prompt 必须带「当前受控文档《用户初始需求收集表》」,并在本轮 `POST /tasks/runs` 上严格断言 `task_key==='intake'` 且 `doc_id===controlledDocId`。同步收紧 UI-10/12/13/14 真实用户路径。本轮追加产品修复:权威文档职责 + 打开时基线 ETag。
## 范围
- `internal/docgov/project_docs.go`(summary 职责投影)
- `web/src` 职责字段、`resolveCurrentDocRole`、hydrate/PATCH ETag
- `web/e2e/document-revision-runtime.spec.ts`(UI-13b 真实竞争)
- 文档:audit / remediation / CURRENT(mutex `document-revision-runtime-ui`)
## 非目标
- 不降低已有业务断言或超时;不伪造、不直接打 API
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT;前序 pending-flow 保持 in_progress,mutex 改为 `pending-report-ui`(仅 UI-05a 实战 PASS,UI-05b 尚未拒绝,不得虚报 done)
2. [x] UI-05b prompt + tasks/runs 契约断言 + 真实打开拒绝
3. [x] UI-10 历史 dialog 内选 A/B 比较并关闭;UI-12 项目不可见;UI-13 拆成审核人只读 + 双 A 冲突;UI-14 同时锁 v/r
4. [x] 仅修 05a/05b/10 遗留弹窗对 UI-06 的确切遮挡
5. [x] 产品修复:权威职责 + viewer fail-closed + hydrate 基线 ETag
6. [x] UI-13b:A1 保存前 A2 编辑器已打开并填入文本;两窗口同一 r/etag
7. [x] 审查补强:controlled 缺 ETag fail-closed;viewer 只读批注;服务端零 id 不按 name 提权
8. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] UI-05b 发送前等待 POST `/api/v1/tasks/runs`,`task_key`/`doc_id` 不符即 FAIL
- [x] UI-10 不点全局工具条「比较」
- [x] UI-12 不接受「项目可见但只查 marker」
- [x] UI-13a/13b 结果分别记录;B 不作正文编辑者
- [x] B/陌生人不会变 author;A 仍 author(Go + 前端单测)
- [x] stale hydrate ETag 用于 PATCH(不能用最新 ETag 掩盖冲突)
- [x] controlled 缺打开时 ETag 不得 PATCH 0:0;hydrate 5xx 进加载失败屏障
- [x] viewer 无新增批注入口
- [x] 服务端受控 duty id=0 不按 name 提权
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-05b+ 后段及 UI-13a/13b PASS 后才可将本任务标 `done`
## 相关链接
- Audit (05b 路由): [../../audit/2026-09-13-document-revision-e2e-reject-routing.md](../../audit/2026-09-13-document-revision-e2e-reject-routing.md)
- Audit (职责/ETag): [../../audit/2026-09-13-document-revision-duty-etag-overwrite.md](../../audit/2026-09-13-document-revision-duty-etag-overwrite.md)
- Remediation: [../../remediation/2026-09-13-document-revision-duty-etag-overwrite.md](../../remediation/2026-09-13-document-revision-duty-etag-overwrite.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05b-reject-routing-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05b-reject-routing-failure)
- 前序: [2026-09-13-document-revision-e2e-pending-flow.md](./2026-09-13-document-revision-e2e-pending-flow.md)
@@ -1,51 +0,0 @@
---
title: "E2E:块编辑 dialog 内精确保存"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-save-selector
worktree: "-"
mutex: document-revision-save-selector
---
# E2E:块编辑 dialog 内精确保存
## 目标
第七轮 UI-06 首错:双击已打开编辑器,但全页模糊「保存」点到聊天私密库按钮,未 PATCH。给 `BlockEditorModal` 可访问 dialog + 稳定 aria-label;保存只在该 dialog 内 `exact: true` 点「保存修改」。不得将本任务标 `done`。
## 范围
- `web/src/lib/blockEditorDialog.ts` + 契约单测
- `web/src/components/doc/BlockEditorModal.tsx`
- `web/e2e/document-revision-runtime.spec.ts`(UI-06/13b 复用;UI-13a dialog=0)
- 文档:audit / CURRENT
## 非目标
- 不改视觉/保存业务
- 不降低已有断言
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-save-selector`)
2. [x] dialog `role` + `aria-label=编辑受控块`
3. [x] E2E 在 dialog 内精确点「保存修改」
4. [x] UI-13a 断言编辑 dialog 不出现
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 契约单测钉住 dialog label 与 exact 保存文案
- [x] 禁止全页 `/保存/`
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-06/13b PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-save-selector.md](../../audit/2026-09-13-document-revision-save-selector.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-save-selector-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-save-selector-failure)
- 前序: [2026-09-13-document-revision-e2e-block-selector.md](./2026-09-13-document-revision-e2e-block-selector.md)
@@ -1,61 +0,0 @@
---
title: "编辑弹窗 hydration 竞态修复"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-editor-hydration-race
worktree: "-"
mutex: document-revision-editor-hydration-race
---
# 编辑弹窗 hydration 竞态修复
## 目标
堵住第十二轮 UI-06:编辑弹窗打开期间后台 hydration 换块 ID,保存静默关窗且不发 PATCH。用户编辑期间与 PATCH 成功后,迟到 hydration 不得覆盖基线;找不到块 fail-closed。
## 范围
- `web/src/lib/controlledDocHydrate.ts`:`fetchRevisionState` 保留 `head_block_map`,hydrate 后 `applyHeadBlockMap`
- `web/src/lib/editorHydrationGate.ts` 与单测(迟到响应不得覆盖 PATCH 成功正文)
- `web/src/lib/blockSavePolicy.ts` 与单测(stale-id / doc 绑定 / 切文档 fail-closed)
- `web/src/lib/saveControlledBlockEdit.ts`:App 真实调用的 PATCH 编排(可注入 patch API)
- `web/src/App.tsx`:`editorSession`、关窗续跑、切文档 fail-closed
- audit / remediation / CURRENT 认领
## 非目标
- 不修改、移动、删除或提交 `.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/`
- 不合 `dev`、不 push、不启动/重建 Docker
- 不运行或伪造真实 UI/E2E;不得声称 UI-06 已通过
- 不改 FEATURE-MATRIX 完成度;不削弱 ETag/409
## 步骤
1. [x] 从 `dev@4c465d2` 开 `fix/document-revision-editor-hydration-race`,mutex 不与现有 in_progress 冲突
2. [x] 定位全部会在弹窗打开期间替换 AST 的路径(effect / 选文档 / 重试;lease 改 deliverables 触发 effect)
3. [x] hydrate 对齐 `head_block_map` + generation token / 编辑门闩 + stale-id fail-closed
4. [x] 单测:同 map ID 稳定、缺 map 仍随机、deferred hydrate、stale id、迟到 hydrate、PATCH ETag、409
5. [x] `web` npm test / build(首轮)
6. [x] 独立审查补强:真实 PATCH 编排测试、editorDocId 绑定、关窗续跑、切文档 fail-closed
7. [ ] 真实 UI-06 重跑(本轮不做)
## 验收标准
- [x] 编辑中不因后台 hydration 换 ID 而静默丢稿(逻辑门闩 + 单测)
- [x] 找不到目标块保留编辑器并提示
- [ ] 现场 r0→r1(未跑 E2E,保持未勾选)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-editor-hydration-race.md](../../audit/2026-09-13-document-revision-editor-hydration-race.md)
- Remediation: [../../remediation/2026-09-13-document-revision-editor-hydration-race.md](../../remediation/2026-09-13-document-revision-editor-hydration-race.md)
- 失败证据(勿提交): `.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-r-bump-noop-failure/`
## 证据 / 备注
- mutex:`document-revision-editor-hydration-race`(新 mutex,未占用 `document-revision-save-selector` 等 in_progress 行)
- 基线:`dev@4c465d2`
- 验证:补强后全量 `npm test` + `npm run build` 通过;`saveControlledBlockEdit` 断言一次 PATCH
- **未跑真实 UI-06,不得标 done**
@@ -1,54 +0,0 @@
---
title: "UI-11 快速完成观测契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-fast-completion-observation
worktree: "-"
mutex: document-revision-fast-completion-observation
---
# UI-11 快速完成观测契约
## 目标
堵住第14轮 UI-11:助手已 `completed`,验收脚本仍硬等处理中 60s,把成功终态误判为失败。只改测试契约,不降真实性。
## 范围
- `web/src/lib/squadCompletionObservation.ts` 与单测
- `web/e2e/document-revision-runtime.spec.ts` 的 `waitForSquadCompletion`
- audit / remediation / CURRENT
## 非目标
- 不改产品运行时、不放宽上传/对应关系/终态/无错误
- 不碰证据目录;不合 dest;不启动/重启容器;不 E2E;不 push
- 不把 stub 或伪造页面当验收
## 步骤
1. [x] 从 `dev@339e871` 开分支并登记 mutex
2. [x] 观测谓词 + 直接 completed / 经历 inflight 测试
3. [x] 接线 `waitForSquadCompletion`,保留 UI-11 上传断言
4. [x] 跑相关单测并原子提交
## 验收标准
- [x] 已 completed 直接接受,不要求 inflight
- [x] 经历 inflight 再到终态仍接受
- [x] 错误终态与错位消息拒绝
- [ ] 现场 UI-11(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-fast-completion-observation.md](../../audit/2026-09-13-document-revision-fast-completion-observation.md)
- Remediation: [../../remediation/2026-09-13-document-revision-fast-completion-observation.md](../../remediation/2026-09-13-document-revision-fast-completion-observation.md)
## 证据 / 备注
- mutex:`document-revision-fast-completion-observation`(新 mutex)
- 基线:`dev@339e871`
- 验证:`npx tsx --test src/lib/squadCompletionObservation.test.ts` PASS;`cd web && npm test` PASS(306 + 29)
- **未跑真实 UI-11,不得标 done**;**不得 merge / rebuild / E2E / push**
@@ -1,61 +0,0 @@
---
title: "文档修改、版本差异与智能体变更说明设计"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Codex
branch: feature/document-revision-management
worktree: "-"
mutex: docgov
---
# 文档修改、版本差异与智能体变更说明设计
## 目标
基于当前 DocGov、任务、块编辑器与通知实现,形成一套可直接评审和拆分实施的文档修改管理方案,覆盖人工修改标记、智能体/小队修改归属、版本边界、任意版本比较、AI 变更说明及负责人通知。
## 范围
- 交叉核对现有文档数据模型、保存链路、Agent 产物落盘、前端块编辑器、权限和通知机制。
- 明确定义“智能体基线 + 后续人工修改”的工作副本与正式版本语义。
- 设计数据模型、事务边界、API、前端交互、通知、权限、迁移兼容及验收矩阵。
- 产出 audit、system-design、remediation 文档并同步文档索引与 FEATURE-MATRIX。
## 非目标
- 本任务不修改业务代码、数据库迁移或运行环境。
- 本任务不执行共享容器重建、真实 PI E2E 或合入 `dev`。
- 本任务不替用户决定版本保留周期、强监管电子签名策略等产品决策;方案给出推荐默认值和决策点。
## 步骤
1. [x] 完成当前实现与既有设计的证据核对。
2. [x] 形成领域模型、版本状态机与一致性边界设计。
3. [x] 形成前端展示、API、权限、通知与验收设计。
4. [x] 形成分波次整改方案和实施任务拆分。
5. [x] 更新文档索引、FEATURE-MATRIX、CURRENT 并执行文档质量检查。
## 验收标准
- [ ] 方案能逐条映射用户提出的版本边界与显示规则。
- [ ] 能区分用户、单智能体、智能体小队及系统迁移等修改主体。
- [ ] 并发、失败恢复、权限、审计、通知去重和大文档性能均有确定性方案。
- [ ] API、表结构、UI 状态、迁移顺序与测试用例足以供开发直接拆单。
- [ ] 仅产生方案文档变更,无业务代码和环境变更。
## 相关链接
- Audit: `../../audit/2026-09-13-document-revision-management-gap-analysis.md`
- System design: `../../system-design/document-revision-management.md`
- Remediation: `../../remediation/2026-09-13-document-revision-management-implementation-plan.md`
- Test report: 实施阶段补充
## 证据 / 备注
- 用户评审通过前保持 `in_progress`;本轮交付的是可评审方案,不代表能力已实现。
- 2026-09-13:`git diff --check` PASS;新增文档及新增链接均可解析。
- 索引文件中另有 3 个与本任务无关的既有失效链接(两个历史 `.tmp` 目录、一个 `architecture-design.md` 相对路径),本任务未扩大范围修改。
- 2026-09-13:独立复审(Cline)通过,结论待用户最终拍板:①三项决策(智能体/模板开 Version、high/critical 强制编制负责人二次确认、首发只覆盖受控文档)均确认可行,理由与既有 `document_change_proposals` 认领授权机制一致;②抽查 DOCREV-01~09 全部 9 项源码证据属实(含 `bizdev/service.go:499-502` 通用提案文案、`:694-705` 忽略错误写哈希、`handlers.go:1027` 客户端 holder 直通、`BlockEditorModal.tsx:104` 硬编码“张工”、`saveDocumentContent` 无调用者、Goose 基线 00027);③补强 2 处设计缺口——根表指针列与既有 `freeform_documents.current_version_id` 同名冲突(改为 `ledger_*` 命名并明确旧列退役)、状态机把文档生命周期误并入版本状态(已拆为正交状态图);同步修订 system-design §4/§6.7、remediation §3/§5.2/§5.7。
- 2026-09-13:用户确认 DOCREV 实施计划选项 1;设计任务归档,进入 Wave 0。
@@ -1,57 +0,0 @@
---
title: "文档账本 PG ID 与计数器重映射"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-pg-id-remap
worktree: "-"
mutex: document-revision
---
# 文档账本 PG ID 与计数器重映射
## 目标
堵住 schema31-round19:首次生成 PG 已写入 snapshot/version/candidate,但 `CommitAgentVersion` 因内存 map 误删 baseline 而 `not found`。
## 范围
- `internal/docrevision` ID 分配、adopt、PG persist
- 确定性单测 + 隔离 PG 回归
- audit / remediation / CURRENT / FEATURE-MATRIX / gap-matrix
## 非目标
- 本任务编码阶段不 merge / 不启停容器 / 不 push;Round20 验收见运行时 UI 报告
- 不删不改证据目录
- 不忽略 `ErrNotFound`,不伪造基线/报告
## 步骤
1. [x] 从 `dev@fa6a033` 开分支并登记 mutex
2. [x] 独立验证 openTemplate 不推进 counter + 无条件 delete 误删
3. [x] 统一 helper + 全路径 adopt
4. [x] `gofmt` / `go vet` / `go test -short` / 相关包测试
5. [x] 原子提交
## 验收标准
- [x] 占用 ID 不覆盖;adopt 只删同一对象
- [x] 高序列首次生成:自动提交、V2、candidate committed、baseline 未丢、重启 hydration
- [x] 现场 UI-03:Round20 项目 6159 首次生成 V2/r0,任务 `run_1789343479579646533` 成功(相对 6158 candidate id=175 / output snapshot 250 的 not found)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-pg-id-remap.md](../../audit/2026-09-13-document-revision-pg-id-remap.md)
- Remediation: [../../remediation/2026-09-13-document-revision-pg-id-remap.md](../../remediation/2026-09-13-document-revision-pg-id-remap.md)
- Checklist: [../checklists/2026-09-13-document-revision-pg-id-remap.md](checklists/2026-09-13-document-revision-pg-id-remap.md)
- Handoff: [../handoffs/2026-09-13-document-revision-pg-id-remap.md](handoffs/2026-09-13-document-revision-pg-id-remap.md)
## 证据 / 备注
- 基线:`dev@fa6a033`
- 验证:`gofmt`/`go vet` PASS;`go test -short ./...` PASS;隔离临时库 `HighSequenceFirstGen` PASS(拒绝 `agent_system_dev`,测完 DROP)
- 失败归档(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema31-round19-ui03-advisor-briefing-docrevision-not-found/`
- 验收:Round20 UI-03 PASS,见 [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- 工程修复已合入 `dev@b258ab8`
@@ -1,56 +0,0 @@
---
title: "post-restart 期望正文须为最终持久 marker"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-post-restart-final-snippet
worktree: "-"
mutex: document-revision-post-restart-final-snippet
---
# post-restart 期望正文须为最终持久 marker
## 目标
第二次 post-restart 已恢复 login/项目/文档/`revision-state` 200/`V3`/`r2`/正文,但 `phase-state.bodySnippet` 仍是 UI-06 marker,断言旧文失败。UI-13b A1 成功保存后须把最终持久正文写入 phase-state;不得放宽 post body 断言。
## 范围
- `web/src/lib/durableBodySnippet.ts` 纯函数契约
- UI-06 / UI-13b / UI-15-pre 同步 `latestDurableBodySnippet` → `phase-state.bodySnippet`
- audit / checklist / handoff / CURRENT
## 非目标
- 不改生产业务代码、不重跑真实 UI、不动容器、不 merge、不 push
- 不改删 assets
- 不改删历史失败 assets;不声称全仓 `production_ready=yes`
## 步骤
1. [x] 从 `dev@eb85b8a` 认领分支并登记 mutex
2. [x] 成功修订覆盖旧 snippet;冲突失败稿不成为期望正文
3. [x] UI-13b 完成后与 UI-15-pre 写入最终 marker
4. [x] `npm test` / `npm run build`
5. [x] 原子提交
6. [x] Round20 `UI_PHASE=post-restart` PASS(V3/r2 / `A1-win-mu0gwiez`)
## 验收标准
- [x] 契约测试:A1 覆盖 UI06;A2 conflict 不覆盖 A1
- [x] post-restart 仍断言 `st.bodySnippet` 可见
- [x] 真实 UI-15 post-restart:Round20 1 passed / 18 skipped;页面恢复 V3/r2/正文
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-post-restart-final-snippet.md](../../audit/2026-09-13-document-revision-post-restart-final-snippet.md)
- Checklist: [../checklists/2026-09-13-document-revision-post-restart-final-snippet.md](checklists/2026-09-13-document-revision-post-restart-final-snippet.md)
- Handoff: [../handoffs/2026-09-13-document-revision-post-restart-final-snippet.md](handoffs/2026-09-13-document-revision-post-restart-final-snippet.md)
## 证据 / 备注
- 基线:`dev@eb85b8a`
- 失败归档(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema31-postrestart-stale-body-snippet-failure/`(当时 `bodySnippet=UI06-mu0eq020`)
- Round20 `phase-state`:`versionText=V3` `revisionText=r2` `bodySnippet=A1-win-mu0gwiez`
- 报告:[../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
@@ -1,59 +0,0 @@
---
title: "post-restart 项目名 selector 与阶段产物隔离"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-post-restart-selector
worktree: "-"
mutex: document-revision-post-restart-selector
---
# post-restart 项目名 selector 与阶段产物隔离
## 目标
第18轮 main 18 PASS 后,post-restart 在页面已恢复项目时因项目名同时出现在顶栏与侧栏而 strict violation。改为 banner 内唯一 exact 断言,点击仍走可见项目入口;Playwright output/report 与结果 JSON 按 `UI_PHASE` 分离(main 仍用 `ui-acceptance-results.json`)。
## 范围
- `web/e2e/document-revision-runtime.spec.ts` post-restart 项目恢复断言
- `web/src/lib/currentProjectRestore.ts` 与契约测试
- `web/playwright.config.ts` + `playwrightPhaseArtifacts` 按阶段分目录
- audit / checklist / handoff / CURRENT
## 非目标
- 不改业务逻辑、不重跑真实 UI、不动容器、不 merge、不 push
- 不改删 `.doc/test-reports/assets/` 证据
- 不声称 post-restart / UI-15 通过
## 步骤
1. [x] 从 `dev@b824948` 认领分支并登记 mutex
2. [x] 项目入口 click + banner exact 断言;禁 `.first()` 弱化
3. [x] `UI_PHASE` 分离 `playwright-output-*` / `playwright-report-*`
4. [x] 结果 JSON:main 保持 `ui-acceptance-results.json`;post-restart 写 `ui-acceptance-results-post-restart.json`
5. [x] `npm test` / `npm run build`
6. [x] 原子提交
7. [ ] 占槽后重跑 post-restart(本轮不做)
## 验收标准
- [x] 页面级 `getByText(项目名)` 在 2 命中时契约判定失败
- [x] 入口为 complementary exact title;当前项目为 banner exact text
- [x] main / post-restart 产物目录不同
- [x] post-restart `recordPass` 不覆盖 main 的 `ui-acceptance-results.json`
- [ ] 真实 UI-15 post-restart(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-post-restart-selector.md](../../audit/2026-09-13-document-revision-post-restart-selector.md)
- Checklist: [../checklists/2026-09-13-document-revision-post-restart-selector.md](checklists/2026-09-13-document-revision-post-restart-selector.md)
- Handoff: [../handoffs/2026-09-13-document-revision-post-restart-selector.md](handoffs/2026-09-13-document-revision-post-restart-selector.md)
## 证据 / 备注
- 基线:`dev@b824948`
- 失败归档(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema31-postrestart-project-title-selector-failure/`
- **未跑真实 post-restart,不得标 done**
@@ -1,62 +0,0 @@
---
title: "prelim_design 缺 output.md 产物契约修复"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-pi-runner-module
worktree: "-"
mutex: document-revision-prelim-output
---
# prelim_design 缺 output.md 产物契约修复
## 目标
第11轮 UI-11:202 + `prelim_design` 已正确,但 `step_01_draft` 缺真实 `output.md`。embed 官方模板、归一化 runner 路径、缺产物 fail-closed;对「进程 0 + settled failure / 缺产物」的**瞬时**失败做有界全新 step 重试。不得标 `done`。
## 范围
- `internal/template` embed + loader
- `internal/agent` 路径映射、目标强制、瞬时/永久分类、`Result.Retryable`
- `internal/squad` `runOneStep` 有界全新 invocation
- `deploy/pi-agent/runner.mjs` + `settle-policy.mjs`
- `deploy/pi-agent/Dockerfile` 必须 COPY runner 的全部相对 import 到 `/app`
- `deploy/app/Dockerfile` `COPY templates` / `COPY configs` 到 `/app`;`.dockerignore` 放行官方 markdown
- Docker build context / `/app/templates/docs` 读路径实测(不执行 env-service 重建)
- 文档:audit / remediation / CURRENT
## 非目标
- 不伪造 `output.md`;不执行截断 `write` 参数;不改 E2E prompt;不放宽缺失校验
- 不触碰/提交证据目录;不执行 env-service 重建/重启;本轮不重跑 E2E
- 不改 FEATURE-MATRIX;不合 `dev`;不 push
- 不对永久缺失(干净 settle 后无产物、`prompt_empty`、治理)无限重试
## 步骤
1. [x] 从 `dev@2a58674` 开 `fix/document-revision-prelim-output` 并认领 mutex
2. [x] 定位:stub 模板 + `agent_settled` 假成功 + 只认精确 `output.md` 键
3. [x] embed / 映射 / runner fail-closed + 单测 + 门禁
4. [x] 纳入现场时序:write 已流出但 `terminated`;SDK retry 1–3 Connection error;`auto_retry_end success=false`;仍 `agent_settled`;trace `success=true`
5. [x] settle-policy + Go 分类 + `runOneStep` 有界全新重试 + 单测
6. [x] `.dockerignore` 放行 `templates/**/*.md`;Docker context 实测 `/app/templates/docs/prelim_design.md`
7. [x] 本次写入的目标不覆盖、不再调用;backend 明确失败仍 FAIL(不把文件存在当成功);上一轮残留不当成功
8. [x] `dev@55a4f39` 重建后 runner `ERR_MODULE_NOT_FOUND settle-policy.mjs`:Dockerfile COPY 齐相对模块 + COPY 契约测试
9. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [ ] 无盘模板时 `prelim_design` 仍为官方「系统初步设计方案」
- [ ] 绝对/`./`/重复子目录 `rel_path` 能落到目标文件
- [ ] `ok:true` 但无非空目标 → 失败,不发明正文
- [x] 瞬时 settled failure → 最多一次全新 step;永久缺失不重试;耗尽 fail-closed
- [x] pi-agent 镜像 COPY 含 runner 全部相对 import(含 `settle-policy.mjs`)
- [ ] intake 工作流单测仍绿
- [ ] 真实 UI-11 PASS 后才可标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-prelim-output.md](../../audit/2026-09-13-document-revision-prelim-output.md)
- Remediation: [../../remediation/2026-09-13-document-revision-prelim-output.md](../../remediation/2026-09-13-document-revision-prelim-output.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-prelim-design-missing-output-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-prelim-design-missing-output-failure)
@@ -1,46 +0,0 @@
---
title: "质量门禁:行动计划表状态「待续」窄豁免"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-quality-context
worktree: "-"
mutex: docgov
---
# 质量门禁:行动计划表状态「待续」窄豁免
## 目标
结构化行动计划表中独立状态单元格「待续」不再误报;正文/标题/列表/普通表中的「待续」仍 FAIL。禁词表不得删除「待续」。
## 范围
- `internal/squad/quality_gate.go` 窄 Markdown 表结构识别
- 敌意单测 + 既有自检豁免 / 投影 / repair 隔离不回归
- 文档:audit / gap-matrix / CURRENT / FEATURE-MATRIX
## 非目标
- 不删除「待续」禁词;不放宽普通正文/任意同行表格
- 不触碰 assets / E2E;不操作容器
## 步骤
1. [x] 认领 CURRENT;写 audit/short-term
2. [x] 仅豁免行动计划表「阶段/状态/进度」列独立单元格(去粗体精确等于「待续」+ 表头列索引对齐 + 实质行动 + 负责/触发完整)
3. [x] 敌意用例:正文「后续章节待续」、`| 内容 | 待续 |`、待续说明、残行/空动作、负责方/触发=待续仍 FAIL;列重排仅状态列可 PASS
4. [x] 门禁 + 原子提交
## 验收标准
- [x] 现场同构行动表 PASS,且不触发 repair
- [x] 敌意上下文仍记录 `待续`
- [x] `ProhibitedPhrases` 仍含「待续」
- [x] targeted / `go vet` / `go test -short` / `go test -race ./internal/taskrun` / web test+build / `git diff --check`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-quality-status-false-positive.md](../../audit/2026-09-13-document-revision-quality-status-false-positive.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui03-quality-status-false-positive](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui03-quality-status-false-positive)
@@ -1,57 +0,0 @@
---
title: "质量修复子工作区契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-quality-repair-workspace-contract
worktree: "-"
mutex: document-revision-quality-repair-workspace-contract
---
# 质量修复子工作区契约
## 目标
堵住第13轮 UI-03:repair 步 TASK 引导 `../../output.md`,模型越界改根文件,本地目标缺失导致 `quality_failed` 停在 70。门禁判定保持,修复契约改为本地快照 + containment。
## 范围
- `internal/squad/repair_workspace.go` 与单测
- `EnsureQualityOrRepair` / `buildSubWorkspaces` snapshot 布局
- audit / remediation / CURRENT
## 非目标
- 不放宽必填章节;不把越界根文件当成功;不隐藏 `quality_failed`
- 不改默认步骤的 `../../` context 导航
- 不碰证据目录;不合 dev;不 rebuild Docker;不 E2E;不 push
## 步骤
1. [x] 从 `dev@8b1a531` 开分支并登记 mutex
2. [x] 快照契约 + containment + 测试
3. [x] 独立审查 fail-open:`runErr` / containment 不得提升;restore 失败硬返回;创建/删除计入 mutation
4. [x] gofmt / vet / `go test -short ./...` / `-race` squad+agent / settle-policy.test.mjs / `git diff --check`
5. [ ] 真实 UI-03(本轮不做)
## 验收标准
- [x] 仅 `runErr==nil` ∧ 无 containment ∧ `TrustedLocalDeliverable=true` 才覆盖根并重验
- [x] 越界(含创建/删除受保护父级)恢复后不提升,报告 FAIL
- [x] backend 失败/超时即使留下本地目标也不提升
- [x] restore 失败立即返回,可测策略能断言错误传播
- [ ] 现场 UI-03(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-quality-repair-workspace-contract.md](../../audit/2026-09-13-document-revision-quality-repair-workspace-contract.md)
- Remediation: [../../remediation/2026-09-13-document-revision-quality-repair-workspace-contract.md](../../remediation/2026-09-13-document-revision-quality-repair-workspace-contract.md)
## 证据 / 备注
- mutex:`document-revision-quality-repair-workspace-contract`(新 mutex,不与现有 in_progress 冲突)
- 基线:`dev@8b1a531`
- 验证(fail-closed 追加):`gofmt` / `go vet ./...` / `go test -short ./...` / `go test -short -race ./internal/squad/ ./internal/agent/` / `node --test deploy/pi-agent/settle-policy.test.mjs` / `git diff --check` PASS
- 保护范围仅 `output.md` / `template.md` / `blackboard.json`;其它父级文件是剩余风险
- **未跑真实 UI-03,不得标 done**;**不得 merge / rebuild / E2E / push**
@@ -1,68 +0,0 @@
---
title: "项目 reviewer 同步到受控文档职责"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-reviewer-duty-sync
worktree: "-"
mutex: document-revision-reviewer-duty-sync
---
# 项目 reviewer 同步到受控文档职责
## 目标
堵住第17轮 UI-13a:UI-01 已把 USER_B 设为 reviewer,但 `doc_proj6145_intake` 矩阵为 viewer。项目创建时的 reviewer 必须成为后续每份受控文档的权威 `reviewerId`。
## 范围
- `project_members.document_duty` 迁移与成员 upsert
- 任务生成/账本创建解析项目职责;禁止硬编码 2/3
- 已有文档缺失/非成员占位的服务端自愈
- 前端立项 persist `document_duty` + 职责互斥
- audit / remediation / CURRENT
## 非目标
- 不 merge、不启停/重建容器、不跑/声称真实 UI E2E、不 push
- 不删不改证据目录
- 不向用户索要 token;不提交账号密码
## 步骤
1. [x] 从 `dev@639969f` 开分支并登记 mutex
2. [x] RED/GREEN:解析、自愈、成员 duty、前端映射
3. [x] `gofmt` / `go vet` / `go test -short` / 相关 `-race` / `npm test` / `npm run build`
4. [x] 原子提交
5. [x] 独立审查收紧(暂不合入):Heal 以 assigned 为权威;成员变更带 duty 并同步文档;缺 role 不降 owner;写权精确断言;迁移多 owner 确定回填;并发 upsert PG 用例;自愈失败不假成功
6. [x] 最后一轮:移出成员 sync + 前端刷新;空 assigned 只清失效 holder;显式 revoke 再 heal;账本创建失败不成功
7. [x] 补充审查:lock + 读旧/冲突 holder + 成员写 + 精确清槽同事务;提交后 heal;失败仍 `ERR_DUTY_SYNC`
8. [x] Heal 与成员写共用 `pg_advisory_xact_lock(project_id)`;解析与文档读写同事务;确定性并发 PG 证明旧 reviewer 不复活
## 验收标准
- [x] A=author、B=reviewer、C=none;第二文档继承;重复执行幂等;旧文档缺失回填
- [x] 服务端写操作仍按权限拒绝
- [x] 前端不按名字提升
- [ ] 现场 UI-13a(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-reviewer-duty-sync.md](../../audit/2026-09-13-document-revision-reviewer-duty-sync.md)
- Remediation: [../../remediation/2026-09-13-document-revision-reviewer-duty-sync.md](../../remediation/2026-09-13-document-revision-reviewer-duty-sync.md)
- Checklist: [../checklists/2026-09-13-document-revision-reviewer-duty-sync.md](checklists/2026-09-13-document-revision-reviewer-duty-sync.md)
- Handoff: [../handoffs/2026-09-13-document-revision-reviewer-duty-sync.md](handoffs/2026-09-13-document-revision-reviewer-duty-sync.md)
## 证据 / 备注
- mutex:`document-revision-reviewer-duty-sync`(新 mutex,不占用已有 in_progress)
- 基线:`dev@639969f`
- 证据(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui13a-reviewer-duty-sync-failure/`
- 验证(原子清槽轮):`gofmt`/`go vet` PASS;`go test -short ./...` PASS;相关 `-race` PASS;`npm test`/`build` PASS;隔离 PG PASS
- 原子性:成员写与 `HealProjectDocuments` 均先 `pg_advisory_xact_lock(project_id)`,再在同一事务内读成员/文档并更新;旧 heal 不能在转移提交后把 reviewer A 写回
- PG 集成已写 heal/空 assigned/多 owner 回填/并发 upsert;`-short` 或无 `TEST_DATABASE_URL` 时跳过
- 隔离跑法:`scripts/run-isolated-duty-sync-pg-tests.sh`(`TEST_DATABASE_URL` 或 `PG_ADMIN_URL` 建临时库)。拒绝 `agent_system_dev`
- 本轮已在已运行的 context Postgres 上 `CREATE DATABASE agent_duty_sync_itest_*`,串行跑通后 `DROP`;未 `env-service`、未动共享库数据
- **兼容**:旧二进制不读 `document_duty` 仍可运行;新代码在 assigned 为空时不臆造 reviewer。6145 的 B 仍是空 duty,须再走成员 API
- **未跑真实 UI-13a,不得标 done**;**不得 merge / 启停容器 / E2E / push**
@@ -1,107 +0,0 @@
---
title: "文档版本账本运行时整改"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-runtime-ui03
worktree: "-"
mutex: docgov
---
# 文档版本账本运行时整改
## 目标
消除 revision-state 404、重启丢账本、人工保存无效、overlay 无效;接通首轮/二轮可见确定性 change report;PATCH 权限→账本→投影顺序正确;停在 fix 分支待集成。
## 范围
- `internal/docrevision` PG hydrate/persist + bootstrap + `MaterializeAgentOutput`
- `internal/server` 授权、PATCH 顺序、orphan 不静默建账
- `internal/bizdev` 小队成功走 Materialize(禁止仅 OpenTemplate)
- `cmd/document-revision-backfill` gofmt
- `web` 保存链路与 overlay 三模式
- 工程测试 + 扩展 UI 验收计划(分栏)
## 非目标
- 不占 CURRENT 集成槽、不 `env-service rebuild`、不 push、不 merge `dev`
- 不伪造 PI 叙事 change report;不把 fallback 说成完整 PI 分析
- 不把 stub 输出写入最终用户验收报告
## 步骤
1. [x] 审计 / 整改 / 本任务 + CURRENT 认领
2. [x] 分支 `fix/document-revision-runtime`
3. [x] PG store + bootstrap + backfill
4. [x] Handler / agent / 前端
5. [x] 首轮报告 Materialize + PATCH 顺序 + 单测
6. [x] gofmt + UI checklist 扩展 + 文档证据
7. [x] 分层 commit,输出哈希与剩余 blocker(不 merge/push)
## 验收标准
- [x] 工程门禁与 UI 实战计划分栏
- [x] Round20 真实 UI **PASS**(见 [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md))
- [x] 剩余开放:PI 叙事仍为 fallback;orphan 禁止假 V1(UI-16 验证已注册路径);不可用假数据掩盖
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-runtime-404.md](../../audit/2026-09-13-document-revision-runtime-404.md)
- Remediation: [../../remediation/2026-09-13-document-revision-runtime-remediation.md](../../remediation/2026-09-13-document-revision-runtime-remediation.md)
- Checklist/UI: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
## 证据 / 备注
### 工程门禁(非 UI 验收)
```text
gofmt -l cmd/document-revision-backfill/main.go internal/docrevision/risk.go
go vet ./...
go test -short ./...
cd web && npm test && npm run build
```
本轮门禁(2026-09-13 10:11 UTC 独立复跑):`go vet ./...` PASS;`go test -short ./... -count=1` PASS(含 Materialize 首/二轮 change_report_id、PATCH 顺序、Materialize 失败透出、Assert 先职责后租约、SaveDocumentContent 审计、pending 事实源不越权、同步/异步待确认文案、完成活动仅 committed、pending 活动标明待确认、MarkProposalApplied 失败显式可重试);`web npm test` 199+27 PASS;`npm run build` PASS。使用 dev PostgreSQL(schema 28)执行 `TestPGPersistSurvivesNewServiceInstance` PASS,证明新 Service 实例可恢复账本。上述均为工程门禁,不能替代 UI 验收。
UI-01 目录同步补丁门禁(2026-09-13):`node --test adminUserDirectorySync.test.ts` 3 PASS;`web npm test` 219+27 PASS;`npm run build` PASS;`go vet ./...` + `go test -short ./...` PASS。未提交 `web/e2e/*` 与 `test-reports/assets/`。
UI-01/02 访问与成员落库门禁(2026-09-13):`go test ./internal/projectinstance -short` PASS;`TEST_DATABASE_URL=… go test ./internal/projectinstance -run TestPG_GoverningAccess` PASS;`TEST_DATABASE_URL=… go test ./internal/server -run TestChatProjectAccess` PASS;`go vet ./...` + `go test -short ./...`;`web npm test` + `npm run build`。未提交 e2e/assets。
复核补强(同日):
- A:`MaterializeAgentOutput` 错误写入 `TaskRunResult.Success=false` + `ErrorReason`,不再空白忽略
- B:cand 非空且 report invalid/unassessed 时禁止自动提交(候选标 needs_confirmation)
- C:`AssertHumanCanEdit` 先职责/生命周期再租约;受控投影改 `SaveDocumentContent` 保留 author_last_edited/审计;失败 `DOCUMENT_PROJECTION_FAILED` 可幂等重试
- D:ChangeReportPanel 完整展示风险条目/项目影响/文档影响建议/开放问题;加载失败显式错误
- E:revision-state 暴露 `pending_candidate_id` / `pending_change_report_id` / `pending_risk_level` + `can_decide_pending`;工具条「待确认报告」确认/拒绝调 decision API(不绕过确认)
- F:**高风险事实源门禁**:Materialize 后仅 committed 才 MarkDocumentContentUpdated / MarkProposalApplied;`needs_confirmation` 立即 `ProjectOutputMarkdown` 恢复 ledger head,候选仅留 immutable blob;decision=commit 投影后再 Mark;decision=reject 保持旧 head;投影失败显式错误
- G:**对话可见状态**:`TaskRunResult` 带 `pending_agent_candidate_id` / report / risk;`RequiresAuthorApproval` 可复用但用 `PendingProposal` vs `PendingAgentCandidateID` 区分 DocGov 提案;terminal=`pending_author_confirmation`;同步 coordinator 与异步 `CompletionSummary` 显示「文档候选已生成,待编制人确认」+ artifact 元数据;确认并投影后才「已完成」
- H:**活动与提案收口**:`RecordActivity(完成交付物)` 仅在 committed 投影成功后;pending 记「候选待编制人确认」;落盘/投影失败不记完成。`MarkProposalApplied` 失败返回显式错误(bizdev / `DOCUMENT_GOVERNANCE_FAILED`)可重试
- I:**阶段链防传播**:`ExecuteStage` 遇 `PendingAgentCandidateID` 立即停阶段(Success=false + 待确认文案),SubArtifacts 保留候选,**不**吸收 ExtractedData / PriorDoc;确认后由用户重新发起阶段
- J:**前端历史映射**:`pending_author_confirmation` 显式映射为气泡状态(不再默认 completed);刷新窗口显示「待编制人确认」标签
- K:**决策幂等收口**:`CommitAgentVersion` 已 committed 且 expected hashes 一致时返回当前 state(可继续投影/MarkProposalApplied);已 committed 禁止 reject。`MarkProposalApplied` 先写 DB 再改内存;已 applied 幂等(包内 Propose+Decide 验证)。decision 失败 hint 指向同决策重试;**不**暴露内存补种 helper(避免内存/DB 分叉)
- L:**Playwright 骨架**:`web` 增加 `@playwright/test` + `playwright.config.ts` + `e2e/document-revision-runtime.spec.ts`(`RUN_UI_ACCEPTANCE=1` 才跑;无 mock/route/API/DB fixture)
- M:**上传注册事实源**:发送前 `await registerUploadAttachments` → `POST /api/v1/freeform-documents`(`client_key` 幂等);失败 UI 显式错误且不发消息、不生成本地 `doc-upload` orphan;成功使用 `doc-free-*` 写入 deliverable/fileStore 并挂 toolbar
- N:**Auth 契约映射(UI-00 实战)**:Go `UserAccount` 为 snake_case;前端在 API 边界 `mapUserAccount`/`mapLoginResult`/`mapMeResult` 统一转 camelCase(login/me/admin users/create/role/status);`BootstrapAdminFromConfig` 的 `UpdateUserRole` 错误不再静默。详见 [../../audit/2026-09-13-auth-useraccount-snake-case-mapping.md](../../audit/2026-09-13-auth-useraccount-snake-case-mapping.md)
- O:**全局用户目录同步(UI-01 实战)**:管理员创建/角色/状态成功后必须经 `syncAdminUserDirectories` 调用父级 `onRefreshUsers`(禁止死 prop / 静默 catch);同浏览器立项候选可立即看到新账号。跨设备/清缓存缺口见 audit 残留风险,**不**下放 admin users API。详见 [../../audit/2026-09-13-admin-user-directory-sync-ui01.md](../../audit/2026-09-13-admin-user-directory-sync-ui01.md)
- P:**无 live 访问 + chat 项目门禁 + 立项成员落库(UI-01/02)**:`GetGoverningInstanceForAccess` 区分从未激活 vs completed/terminated;chat/chatStream 先 `RequireProjectAccess` 再 stage(SSE 拒绝不得先 200);`createProject` 后持久化非创建者成员。详见 [../../audit/2026-09-13-workflow-access-chat-members-ui01-02.md](../../audit/2026-09-13-workflow-access-chat-members-ui01-02.md)
- Q:**立项确认双击竞态**:`handleCreateProjectConfirm` 加同步 in-flight `useRef` 锁 + `createProjectBootstrapIdRef`(取代 state);`createProjectSubmitting`/`submitPhase` 驱动 Modal「立项中/同步成员中」、禁用确认与关闭;失败可串行幂等重试,成功清 bootstrap。证据:`createProjectSubmitGuard.test.ts`
- R:**UI-02 任务作用域契约**:`ResolveMessageScopeForTask` 三态(preactivation / live stage / closed→Err);handler 无 live 创建 202 非 409;E2E UI-02 以 `POST /api/v1/tasks/runs` 2xx 为硬门禁(409/连接异常 FAIL)。证据:`message_scope_test.go`、`TestCreateTaskRun_PreActivationAcceptedNot409`、`document-revision-runtime.spec.ts` UI-02
- S:**UI-03 客户端同步 + 任务幂等(本分支)**:`templateMatch` intake 标记优先;任务终态后 `postTaskDeliverableSync` merge `doc_proj*`;goose `00030` 放行 `pending_author_confirmation` + `idempotency_key` 部分唯一;`ClaimRun` 先占键再写 chat;FE reconnect 同 run 订阅。审计:[../../audit/2026-09-13-controlled-doc-client-sync-ui03.md](../../audit/2026-09-13-controlled-doc-client-sync-ui03.md)。门禁:`go test -short ./internal/taskrun ./internal/server`;`web npm test` 232+27;`npm run build`。**schema30 真实现卷迁移合入前独立验证**;真实 UI-03 待占槽重跑。
### 用户 UI 实战验收
Round20 **PASS**。见 [checklist](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md) 与 [test-report](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)。项目 6159;UI-03 V2/r0;终态 V3/r2;post-restart 恢复最终正文 `A1-win-mu0gwiez`。
### Blockers
- **DOCREV-RT-PI-NARRATIVE**(仍开放):真实 PI 业务叙事摘要/风险解释未替代确定性 fallback;Round20 已可见 fallback 字段,不得宣称为完整 PI
- **DOCREV-RT-UPLOAD-ORPHAN**(约束仍在,UI-16 PASS):仅 IndexedDB、无服务端正文 → 禁止假 V1
- **DOCREV-RT-UI-E2E**:**PASS**(Round20)
- **DOCREV-RT-SCHEMA30-VOLUME**:goose 00030 对既有重复卷的迁移仍属合入前独立验证残留
- **DOCREV-RT-USER-DIR-CROSS-DEVICE**:跨设备/新浏览器可能仍缺成员候选(本轮同浏览器未暴露)
### Commits(历史)
- `7ea686e` … `ec8a45a`(见 git log);本轮追加见会话结束提交号
@@ -1,55 +0,0 @@
---
title: "UI-11 点名优先路由 + PATCH 请求级释租"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-second-doc-routing-lease
worktree: "-"
mutex: document-revision-second-doc-routing-lease
---
# UI-11 点名优先路由 + PATCH 请求级释租
## 目标
第十轮 UI-11 首错:否定句「需求」压过「系统设计输入」,且 PATCH 残留 human lease 使小队 DOC_BUSY。点名优先 + 请求级 defer 释租 + E2E 202 门闩。不得将本任务标 `done`。
## 范围
- `web/src/engine/templateMatch.ts` + 单测
- `internal/server/document_revision_handlers.go` + `document_revision_patch_order_test.go`
- `web/e2e/document-revision-runtime.spec.ts` UI-11 waiter
- 文档:audit / remediation / CURRENT
## 非目标
- 不改 E2E prompt;不改 `SaveDocumentContent` 内部释租
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX;不合 `dev`;不 push
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-second-doc-routing-lease`)
2. [x] 点名优先 +「系统设计输入」别名 + 单测
3. [x] PATCH 已授权后 defer 释租(成功 / 409 / 投影失败)+ 服务端测试
4. [x] UI-11 send 前 `tasks/runs` waiter,断言 202 后再 wait completion
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] UI-11 原文 / 混合句 → `prelim_design`;当前文档钉住、UI-05 pin、首轮摸底仍 intake
- [x] PATCH 后无 human lease,squad 可获取
- [x] UI-11 非 202 即 fail;`requireInflight` 拒绝同步 busy
- [ ] 真实 UI-11 PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-second-doc-routing-lease.md](../../audit/2026-09-13-document-revision-second-doc-routing-lease.md)
- Remediation: [../../remediation/2026-09-13-document-revision-second-doc-routing-lease.md](../../remediation/2026-09-13-document-revision-second-doc-routing-lease.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-second-doc-routing-human-lease-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-second-doc-routing-human-lease-failure)
## 证据 / 备注
- Prompt 别名「系统设计输入」≠ 卡片标题。真实 UI / 模板 / squad 标题均为「系统初步设计方案」。
- UI-11 打开第二份文档必须用已注册 `doc_proj{n}_prelim_design`(`data-doc-id`),禁止 `/设计输入|系统设计/`:既匹配不到真实标题,也容易误命中其他设计类文案或同标题模板槽。
@@ -1,57 +0,0 @@
---
title: "任务 SSE 幂等 + 质量门禁自污染与 auto_repair 产品契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-sse-idempotency
worktree: "-"
mutex: docgov
---
# 任务 SSE 幂等 + 质量门禁自污染与 auto_repair 产品契约
## 目标
1. 同 turn 在 SSE 断线重连时返回既有 run 202、不重复聊天、不误 409 DOC_BUSY;长任务 events SSE 不被 120s WriteTimeout 切断;前端 EOF 按 after_seq 重订阅同一 run。
2. 受控文档小队任务质量门禁:**服务端启用修复预算**;否定性自检引用不误报;`quality_failed` UI 保持失败且不激活未过门禁稿。
## 范围
- SSE/幂等:`task_run_handlers`、SSE write deadline、FE subscribe 重连
- 质量 A–D:`repairBudgetForSquadTask`、`quality_gate` 语境检测、prompt 去原词、Materialize/`TerminalStatus`、FE `quality_failed`、单测
- 证据:`data/dev/workspaces/bizdev/intake_1789308825666278807`(output.md:204;events seq10)
## 非目标
- 不改全局 HTTP 超时为「无超时」;不 rebuild Docker;不 push/merge;不删证据 assets
## 步骤
1. [x] 从 `dev` 开 `fix/document-revision-sse-idempotency`;CURRENT 认领
2. [x] 幂等先查 + 属主校验
3. [x] SSE write deadline + heartbeat
4. [x] FE subscribe 重连
5. [x] A 服务端修复预算产品契约
6. [x] B 门禁否定/元语境 + prompt 去原词
7. [x] C quality_failed UI/Materialize 契约
8. [x] D 真实问题单测 + 门禁回归
9. [x] E 质量失败在 SetDocumentWorkDir/Materialize 前短路(无正式投影副作用)
10. [x] 豁免收窄为同行 meta+否定紧邻/引号;handlers 阶段请求字段边界单测锁定
11. [x] ExecuteStage 质量失败停链:不吸收事实、不追加 PriorDoc
12. [x] 小队 AutoRepair/Success 语义恢复;受控修复仅在 bizdev docRec 与 HTTP 边界强制
13. [x] 补强:quality projection / 阶段停链 / 非受控不强制 repair 单测;全量 Go+Web 门禁 PASS
## 验收标准
- [x] 同 turn + 活跃租约 → 同 run 202、仅一对消息;不同 turn → 仍 409
- [x] SSE 心跳/写期限可测;FE EOF/after_seq 单测
- [x] TaskKey 任务 AutoRepair=false 仍有 DefaultMaxRepairRounds;L204 自检引用不误报;真敷衍仍 FAIL
- [x] quality_failed ≠ completed;Materialize 跳过未过门禁稿
- [x] `go test -short ./...`、`go vet`、`npm test`/`build`、`git diff --check`
## 相关链接
- Audit SSE: [../../audit/2026-09-13-document-revision-sse-idempotency.md](../../audit/2026-09-13-document-revision-sse-idempotency.md)
- Audit 质量: [../../audit/2026-09-13-document-revision-quality-gate-self-pollution.md](../../audit/2026-09-13-document-revision-quality-gate-self-pollution.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/)
@@ -1,49 +0,0 @@
---
title: "DOCREV Wave 0:契约冻结"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Cursor
branch: feature/document-revision-management
worktree: "-"
mutex: docgov
---
# DOCREV Wave 0:契约冻结
## 目标
冻结 Version/Revision/Snapshot/Candidate/Report 契约、黄金 diff fixture、前后端类型与先红契约测试。
## 范围
- ADR 决策门落盘
- `internal/docrevision` 契约类型、schema、testdata、契约测试
- `web/src/features/documentRevision/types.ts`
## 非目标
- 不写生产写路径;不跑容器重建;不合入 `dev`
## 步骤
1. [ ] 写入 ADR 与决策门
2. [ ] 实现契约类型、change-report schema、黄金 fixture
3. [ ] 契约测试先红后绿(随 Wave 1 内核实现变绿)
4. [ ] 前端 types 对齐
## 验收标准
- [ ] ADR 已接受且与实施计划冻结表一致
- [ ] 黄金 diff 覆盖中文段落/表格/列表/Mermaid/移动块/no-op
- [ ] 契约测试可独立运行
## 相关链接
- ADR: `../../adr/2026-09-13-document-version-boundary.md`
- Design: `../../system-design/document-revision-management.md`
- Remediation: `../../remediation/2026-09-13-document-revision-management-implementation-plan.md`
## 证据 / 备注
实施中。
@@ -1,45 +0,0 @@
---
title: "DOCREV Wave 1–6:ledger 实施"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Cursor
branch: feature/document-revision-management
worktree: "-"
mutex: docgov
---
# DOCREV Wave 1–6:ledger 实施
## 目标
在 feature 分支交付快照内核、人工 PATCH、Agent candidate、比较 UI、通知与自由文档兼容。
## 范围
- Goose 00028、`internal/docrevision`、HTTP API、前端工具条、bizdev/freedoc/notification 接线
## 非目标
- 本任务不占集成槽位合入 `dev`;真实 PI 全链路补录另开集成窗口
## 步骤
1. [x] Wave 0 契约与 ADR
2. [x] Wave 1 迁移与内核
3. [x] Wave 2 人工编辑 API/UI
4. [x] Wave 3 Agent candidate/commit
5. [x] Wave 4 比较 UI
6. [x] Wave 5 通知
7. [x] Wave 6 自由文档兼容
## 验收标准
- [x] `go test -short ./internal/docrevision/...` PASS
- [x] 相关包回归 PASS
- [ ] 真实 PI + Playwright 双用户(集成槽位)
## 相关链接
- Test report: `../../test-reports/2026-09-13-document-revision-management-test-report.md`
- ADR: `../../adr/2026-09-13-document-version-boundary.md`
@@ -1,52 +0,0 @@
---
title: "受控文档分类导航契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-workflow-category-navigation
worktree: "-"
mutex: document-revision-workflow-category-navigation
---
# 受控文档分类导航契约
## 目标
堵住第15轮 UI-13a:UI-11 后停在「我的私密」,未切「流程受控」就展开文档菜单,找不到 `doc_proj*_intake`。只改验收导航,不降真实性。
## 范围
- `web/src/lib/workflowCategoryNavigation.ts` 与单测
- `web/e2e/document-revision-runtime.spec.ts` 三个 opener
- audit / remediation / CURRENT
## 非目标
- 不改产品分类状态机;不用 API/内存规避 UI
- 不碰证据;不合 dest;不启停容器;不 E2E;不 push
## 步骤
1. [x] 从 `dev@48a4dcb` 开分支并登记 mutex
2. [x] 导航谓词 + private→workflow / 缺失 fail-closed 测试
3. [x] 三个 opener 先真实切分类
4. [x] `npm test` + `npm run build` 并原子提交
## 验收标准
- [x] 从私密分类可恢复到精确受控文档
- [x] 目标缺失 fail-closed
- [ ] 现场 UI-13a(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-workflow-category-navigation.md](../../audit/2026-09-13-document-revision-workflow-category-navigation.md)
- Remediation: [../../remediation/2026-09-13-document-revision-workflow-category-navigation.md](../../remediation/2026-09-13-document-revision-workflow-category-navigation.md)
## 证据 / 备注
- mutex:`document-revision-workflow-category-navigation`(新 mutex)
- 基线:`dev@48a4dcb`
- 验证:`npx tsx --test src/lib/workflowCategoryNavigation.test.ts` PASS;`cd web && npm test` PASS(309 + 29);`npm run build` PASS
- **未跑真实 UI-13a,不得标 done**;**不得 merge / 启停容器 / E2E / push**
@@ -1,22 +0,0 @@
# Git 历史史诗重组执行记录
**日期**: 2026-09-13
**status**: done
## 结果
- 358 线性 commit → 14 史诗 × (`feature/*`|`fix/*` + `merge --no-ff`) + 1 root anchor = **373 commit**
- `git diff backup/pre-rewrite-2026-09-13 dev` 为空
- `go test -short ./...` PASS
- 旧历史:`dev-old-linear`、`backup/pre-rewrite-2026-09-13`
## 产物
- [`scripts/history-epic-manifest.tsv`](../../../scripts/history-epic-manifest.tsv)
- [`scripts/rewrite-history-epics.sh`](../../../scripts/rewrite-history-epics.sh)
- [`scripts/generate-commit-rewrite-map.py`](../../../scripts/generate-commit-rewrite-map.py)
- [`reference/commit-rewrite-map-2026-09-13.md`](../reference/commit-rewrite-map-2026-09-13.md)
## 远端
- `origin/dev|test|main` force-with-lease 同步至重组后 HEAD
@@ -1,62 +0,0 @@
---
title: "Herdr Agent 角色、备援与自动审批治理"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Codex
branch: feature/herdr-agent-governance
worktree: .worktrees/feature-herdr-agent-governance
mutex: ops-governance
---
# Herdr Agent 角色、备援与自动审批治理
## 目标
建立可审计的 Herdr Agent 能力分工、额度保护、故障接管和免人工工具审批入口,并明确 Herdr PI 与产品容器 PI Agent Runner 不是同一执行体。
## 范围
- 持久化主责、备份顺序、任务泳道和接管条件。
- 为已安装的 Claude、Codex、Cursor、Antigravity、PI、Kimi、Cline CLI 提供统一启动入口。
- 自动审批仍受仓库、worktree、mutex、集成槽和破坏性操作红线约束。
- 提供保守的自动派发:只向同工作目录、空闲的规范命名实例投递;明确失败时降级,超时停止重复投递。
## 非目标
- 不重启或接管当前正在执行 DOCREV/CHAT/INTENT 的实例。
- 不修改容器内 PI Agent Runner 的模型、凭证、配置或运行状态。
- 不操作共享 Docker 或推送远端。
- 不将删库、强推、密钥读取/外传等不可逆动作纳入无条件许可。
## 步骤
1. [x] 盘点 Herdr 0.9.0、在线实例、集成状态、CLI 版本和审批参数。
2. [x] 写入项目级角色与备援 SSOT,并在 AGENTS/PROJECT 建立入口。
3. [x] 实现统一自动审批启动脚本和保守派发脚本。
4. [x] 完成静态检查、脚本 dry-run 与路由验收。
5. [x] 更新任务状态、提交 feature 分支并合入 `dev`。
## 验收标准
- [x] 每种当前可调用 CLI 都有明确角色、主备关系和自动审批启动参数。
- [x] Codex/Claude 的高成本推理与 Cursor/Flash 模型的实施负载分离。
- [x] 明确禁止因 timeout/unknown 状态盲目重复派发。
- [x] Herdr PI 与产品容器 PI 在名称、职责和动作上不会混淆。
- [x] 启动和派发脚本通过 `bash -n`,dry-run 不启动实例、不执行任务。
## 相关链接
- Agent roster: [../../ops/2026-09-13-herdr-agent-roster.md](../../ops/2026-09-13-herdr-agent-roster.md)
- Handoff: [../../ops/handoffs/2026-09-13-herdr-agent-governance.md](../../ops/handoffs/2026-09-13-herdr-agent-governance.md)
- Test report: 本任务文“证据 / 备注”
## 证据 / 备注
- `herdr status`: client/server 0.9.0,protocol 22,兼容。
- `herdr integration status`: Claude/Codex/Cursor/Antigravity/PI/Kimi integration current;Cline CLI 3.0.61 可调用。
- CLI 版本:Claude 2.1.270、Codex 0.154.0、Cursor 2026.09.10、Antigravity 1.2.2、PI 0.85.1、Kimi 0.41.0、Cline 3.0.61。
- `bash -n scripts/herdr-agent-start.sh scripts/herdr-agent-dispatch.sh`: PASS。
- 七种启动 profile dry-run:PASS;未启动或重启实例。
- 七条 lane `--explain`:PASS。
- 非法标准名:exit 2;无在线标准实例:逐级跳过并 exit 69,未误投任务。
@@ -1,37 +0,0 @@
---
title: "受控文档正文修复真实 UI 实战验收"
status: done
owner: verifier_antigravity
branch: fix/controlled-content-ui-acceptance
mutex: document-content-ui-acceptance
created: 2026-09-14
updated: 2026-09-14
---
# 目标
仅通过真实浏览器页面操作,验证项目 143 历史文档恢复,并以真实产品 PI Agent Runner / 智能体小队完成新项目文档全链路。API、数据库和 stub 不能替代 UI 验收结果。
# 范围
- 项目 143:登录、打开正文、30 秒空闲、双击编辑保存、三种变更视图、刷新与重新登录持久化。(clean-run3 已全部 PASS)
- 新项目:从 UI 创建,真实对话触发工作流/小队生成文档,再次对话触发修改;页面查看助手回复、文档正文、版本账本、影响、风险、开放问题。(full-chain-final UI-00..UI-16 全部 18 项 PASS)
- 冲突与权限:双页面并发编辑、审核人/无关用户访问边界均通过;宿主容器重启后 post-restart 复验通过。
- Ubuntu Server 浏览器:统一使用 Playwright 官方 `mcr.microsoft.com/playwright:v1.63.0-noble` 容器。
# 红线
- 不用 API 直建用户、项目、会话、文档或测试数据。
- 不注入/伪造 assistant 消息、文档、账本、change report 或通过结果。
- 所有通过项必须有页面可见证据;失败如实记录为 FAIL。
- 测试账号凭证只读本机既有 secrets/phase 文件,不输出、不提交。
# 阶段判据与进展
- [x] 项目 143 页面正文可见且无 content/revision 404(UI-143-01..06 全 PASS,产物在 `clean-run3/`)。
- [x] 人工编辑、视图切换、刷新/重登持久化通过(项目 143 回归)。
- [x] 新项目真实 PI/小队链路及文档影响风险报告页面可见(UI-00..05b 通过,首轮 toolbar V2/r0,UI-05 pending 保持 V2,UI-05a 确认后晋升 V3,UI-05b 拒绝后保持 V3)。
- [x] UI-06 硬刷新正文保留通过(合入 08bf615 修复后 1.1 秒内秒级通过)。
- [x] 并发、权限、重启前凭据生成有真实 UI 判定(UI-12/13a/13b/15/16 全 PASS)。
- [x] 容器重启后恢复核验通过(UI-15 post-restart 2.8 秒秒级通过,V3/r2 与标记完好呈现,目标 404=0)。
- [x] 测试报告落盘至 `.doc/test-reports/2026-09-14-controlled-content-ui-acceptance.md`。
@@ -1,42 +0,0 @@
---
title: "运行时 UI 证据计数与 race 秒数纠错"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-evidence-count
worktree: "-"
mutex: document-revision-evidence-count
---
# 运行时 UI 证据计数与 race 秒数纠错
## 目标
把顶层截图写成 21(20 main/pre + 1 post),并把全包 race 写成 `FAIL 109.279s`,不与 21 条 results 混淆。
## 范围
- 最终报告、UI checklist、CURRENT
- 本短任务登记后即关闭
## 非目标
- 不改业务代码、assets、容器,不 push
- 不改 UI PASS 判定,不提交 secrets
## 步骤
1. [x] 从 `dev@5d79da6` 开 `fix/document-revision-evidence-count` 并登记
2. [x] 截图 21 = 20 main/pre + 1 post;race `FAIL 109.279s`
3. [x] `git diff --check`;只提交文档
## 验收标准
- [x] 报告/清单不再把 20 张截图与 21 条 JSON 混写
- [x] 全包 race 不再写成 `ok ... 110.723s`
- [x] assets 未 stage
## 相关链接
- Test report: [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
@@ -1,45 +0,0 @@
---
title: "文档账本运行时 UI 最终报告收口"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: feature/document-revision-runtime-ui-final-report
worktree: "-"
mutex: document-revision-runtime-ui
---
# 文档账本运行时 UI 最终报告收口
## 目标
在 `dev@b258ab8` 上只写文档,把 Round20 真实 UI 验收收口为 test-report,并释放运行时集成槽。
## 范围
- `.doc/test-reports/2026-09-14-document-revision-runtime-ui-test-report.md`
- management report、UI checklist、runtime / PG-id 文档、FEATURE-MATRIX、gap-matrix、CURRENT
## 非目标
- 不改业务代码、不跑容器、不 push、不提交 assets
- 不引用 `phase-secrets.local.json` 内容
- 不把全仓标 `production_ready=yes`
## 步骤
1. [x] 从 `dev@b258ab8` 开 `feature/document-revision-runtime-ui-final-report`
2. [x] 按 results JSON 写 Input/Actual/Verdict/Duration
3. [x] 同步任务文档并释放集成槽
4. [x] 原子 docs commit
## 验收标准
- [x] 运行时范围 PASS/done
- [x] `production_ready` 仍为 no;`CHAT-INTENT` 保留
- [x] 历史失败资产未改删
## 相关链接
- Test report: [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- Checklist: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
@@ -1,47 +0,0 @@
---
title: "文档账本运行时会话关闭归档"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: feature/document-revision-session-close
worktree: "-"
mutex: document-revision-session-close
---
# 文档账本运行时会话关闭归档
## 目标
按 AGENTS 会话关闭清单:把已 done 的 document-revision short-term / checklist / handoff 迁入 archive,并修好相对链接。
## 范围
- `.doc/ops/short-term/*document-revision*`
- 4 个专项 checklist + runtime-ui-acceptance
- 4 个 document-revision handoff
- `.doc` 内因移动失效的相对链接
- 本任务完成后一并归档
## 非目标
- 不改业务代码、assets、容器,不 push
- 不改 `production_ready=no`、fallback / race 结论
- 不改非 document-revision 任务
## 步骤
1. [x] 从 `dev@4bf8b6d` 开 `feature/document-revision-session-close` 并登记
2. [x] short-term / checklist / handoff 标 done 后 `git mv` 入 archive
3. [x] 扫描并重写失效相对链接;`git diff --check`
## 验收标准
- [x] CURRENT 焦点仅非 DOCREV;槽位 idle
- [x] 本次移动文件的相对 Markdown 链接可解析
- [x] assets 未 stage
## 相关链接
- Test report: [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- CURRENT: [CURRENT](../../ops/CURRENT.md)
@@ -1,61 +0,0 @@
---
title: "可靠事件与 FAV 集成 M2–M3"
status: cancelled
created: 2026-09-14
updated: 2026-09-15
owner: TBD
branch: refactor/durable-event-fav-integration
worktree: "-"
mutex: event-delivery
---
# 可靠事件与 FAV 集成 M2–M3
> 2026-09-15:本任务把 durable event 与未审计 FAV 绑成同一关闭条件,且步骤状态已与 U8/U9 后续交付漂移。任务停止使用;持久事件由 [Track E](../../ops/short-term/2026-09-15-durable-event-track-e.md) 接续,FAV subscriber 继续走独立审计,不把本条已勾选步骤视为生产 dispatcher 验收。
## 目标
完成 U5–U9,使投影、通知、RunManifest 和最终成果在多 worker、崩溃、重放和 workspace 清理后仍可恢复且不越权。
## 范围
- opaque workspace capability、lease 和 fencing。
- durable outbox、逐消费者 delivery/inbox、重试和 dead letter。
- 审计并集成 `feature/final-artifact-vault` 的适用实现。
- taskrun finalize、RunManifest 持久化、FAV coverage 和迁移 corpus。
## 非目标
- 不盲目整分支 cherry-pick FAV。
- 不启用跨授权图的 vault 读取。
- 不自动销毁 dev/main 数据。
- 不执行 U10–U12。
## 步骤
1. [x] 读取 M1 test report,确认继续 M2 的 go/no-go 已通过。
2. [x] 重新分配 Goose 序号并审计 U6/FAV schema 组合。
3. [x] 实现 U5–U6,多 app/worker 和 crash matrix 先通过。
4. [x] 逐文件审计 FAV 分支,按 U7 边界迁移合格实现。
5. [ ] 实现 U8,收敛 taskrun terminal finalize 与 RunManifest。
6. [ ] 实现 U9 的 checkpoint backfill、corpus、quarantine 和 cleanup gates。
7. [ ] 完成真实 PI、浏览器、workspace 清理、scratch recovery 和 rebuild 演练。
## 验收标准
- [ ] 多订阅者有独立 delivery,失败者不阻塞其他订阅者。
- [ ] worker crash/retry/replay 不造成重复可见副作用。
- [ ] workspace 清空后,verified 最终文档/回复仍可定位并校验。
- [ ] 授权图缺失、跨项目、tombstone、坏 digest 和 stale fencing 全部拒绝。
- [ ] clean/oldest/previous/hazard/import/reload/rollback/artifact recovery 八轨有独立证据。
- [ ] 任何数据销毁仍需完整备份、corpus、FAV coverage 和用户批准。
## 相关链接
- Checklist: [../checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Handoff: 实施时创建
- Test report: 实施后按 M2、M3 分开创建
- Plan: [../../remediation/2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
## 证据 / 备注
本任务依赖 M1,不得与 M1 同时修改 docgov/docrevision 的事务主链。
@@ -1,81 +0,0 @@
---
title: "治理鉴权升级:职责-动作严格对应 + 未激活拦截 + 关闭创建直通"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: implementer_cursor
branch: fix/governance-action-level-authz
worktree: ".worktrees/fix-governance-action-level-authz"
mutex: workflow
---
# 治理鉴权升级:职责-动作严格对应 + 未激活拦截 + 关闭创建直通
## 目标
采纳 [MVP 治理规则评审](../../ops/research/2026-09-14-mvp-governance-rules-review.md) 修正版原则:**允许零治理创建与普通对话;禁止零治理激活与执行文档任务(审批流动作)**。文档动作按职责鉴权,创建者不隐式越权,`initial_workflow_key` 不再直通 active。
## 决策记录(已定,不再开放)
- **A(用户拍板 2026-09-14)**:`DutyModeNone` 文档 = 不走人工审批但**可生成**(创建者触发,维持已实施 D4);「不可发起任务」收窄为不可发起**审批流动作**(submit/review/approve)。
- **B(按评审建议采纳)**:pre-activation 保留 202 契约——`POST /tasks/runs` 仍 202 创建 run,但置 blocked 状态、不启动小队、不取文档租约,chat 流内返回自然语言治理提示。
- **C(按评审建议采纳)**:移除 `isCreator` 对 full 文档的隐式全通行;`view` 豁免阶段收窄(项目访问成员可查看);创建者保留:配置成员/职责 + none 文档生成触发。
- **D(按评审建议采纳)**:关闭 `initial_workflow_key` 直通 active(仅挂载目录);后端/前端 types 字段废弃标注;E2E legacy 用例语义更新;dev 库 81 个 planning+with_wf 异态项目**只审计分类,不改库**。
## 采纳版职责-动作矩阵
| 动作 | full 文档 | none 文档 | 未激活(gov==nil) |
|------|-----------|-----------|--------------------|
| view | 项目访问成员 | 项目访问成员 | 项目访问成员 |
| run(首次生成/重生成) | 编制负责人 | **创建者**(无审批链) | 202 + blocked 状态,chat 内提示,不启小队/不取租约 |
| edit/submit(编辑/提交审核) | 编制负责人 | 拒绝(无审批链) | 拒绝 |
| review(审核/退回) | 审核负责人 | 拒绝 | 拒绝 |
| approve(批准/拒绝批准) | 批准负责人 | 拒绝 | 拒绝 |
| 配置成员/文档职责 | 创建者 | 创建者 | 创建者(planning 期配置正是本阶段语义) |
退回后形成「待编制人修订」;审核人不得直接启动重编(由编制负责人发起修订)。
## 范围
- `internal/projectinstance/document_access.go`(动作-职责映射、creator 例外移除、gov==nil 未激活拦截)
- `internal/projectinstance/stage_access.go`(view 豁免语义;`docTaskDutyForUser` 拆分为按职责判定)
- `internal/projectinstance/message_scope.go` + taskrun/chat handler(blocked 状态 + 自然语言提示)
- `internal/projectworkflow/service.go`(关闭 `initial_workflow_key` 直通)+ `types.go` 前后端字段废弃
- 受影响单测重写(`access_governing_pg_test.go` creator 断言、`TestCreateTaskRun_PreActivationAcceptedNot409` 语义细化)与 E2E legacy 用例
## 非目标
- 不改三权互斥与 DutyMode 校验(Wave 2 已完成)
- 不做运行中动态补配职责 / 按文档单独激活(冻结语义维持,激活页提示「留空文档不参与、不可补配」)
- 不做成员 role 枚举演进(MVP 维持创建者=项目管理员;role 演进留 backlog)
- 不改 dev 库存量数据(仅审计)
## 步骤
1. [x] 评审落盘 + 决策 A–D 收敛 + 本任务登记(Wave 5 已合入本地 `dev@19f6df5`,G0 已开工)
2. [x] G1 后端:`CheckDocTaskAccess` 动作-职责映射 + creator 例外移除(保留 none 生成触发)+ gov==nil 未激活拦截(202 契约保留);重写受影响单测
3. [x] G2 关闭 `initial_workflow_key` 直通 + 前后端字段废弃 + E2E legacy 用例更新
4. [x] G3 前端:chat 治理拦截自然语言提示、按钮级职责禁用、激活确认页冻结提示补强
5. [x] G4 dev 库 planning+with_wf 异态审计分类(只读报告,现测 83 条均为测试夹具)
6. [x] G5 集成验证 + 测试报告归档(新项目全链路:零治理创建→对话→配置→激活→职责动作负例)
## 验收标准
- [x] full 文档 API 负例:author 不可 review/approve;reviewer 不可 run/edit/submit;approver 不可 run/edit/review;creator 不可任一审批动作(view 除外)
- [x] none 文档:创建者可触发生成;submit/review/approve 全拒
- [x] 未激活项目编制类输入:消息正常显示、run 202 且 blocked、无小队/租约、chat 内明确治理提示文案(页面用「请编制用户初始需求收集表」命中任务 API)
- [x] `POST /projects` 带 `initial_workflow_key`:不再置 active,工作流目录仍自动挂载
- [x] `go vet ./...`、`go test -short ./...`、`cd web && npm test && npm run build` 全绿
- [x] 异态审计报告与测试报告归档并回链
## 相关链接
- Research(评审与决策记录): [2026-09-14-mvp-governance-rules-review.md](../../ops/research/2026-09-14-mvp-governance-rules-review.md)
- 前序 Remediation(已实施 Wave 1–4): [2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md](../../remediation/2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md)
- 202 契约来源: [2026-09-13-workflow-access-chat-members-ui01-02.md](../../audit/2026-09-13-workflow-access-chat-members-ui01-02.md)
## 证据 / 备注
- Wave 5 已合入本地 `dev@19f6df5`;本任务 worktree 已从该 `dev` 创建,mutex `workflow` 进入 `in_progress`。
- G4 只读复测:141 active / 209 planning;**83** 个 planning 带非空 `active_workflow_key`,全部为 `PROJ_MGR_*`/`TEST_PROJ_*` 夹具。见 [audit](../../audit/2026-09-14-planning-with-workflow-key-anomaly.md)。
- G5 验收:[2026-09-14-governance-action-level-authz-test-report.md](../../test-reports/2026-09-14-governance-action-level-authz-test-report.md)。
@@ -1,55 +0,0 @@
---
title: "模块解耦架构与重构计划修订"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Codex
branch: feature/module-decoupling-remediation
worktree: .worktrees/feature/module-decoupling-remediation
mutex: architecture-docs
---
# 模块解耦架构与重构计划修订
## 目标
把模块解耦方案修订为可以分段实施、验证和回滚的架构与重构计划,补齐事务、并发互斥、授权、可靠事件、FAV、数据迁移和真实页面验收。
## 范围
- 修订模块化单体架构设计与 ADR。
- 新增详细整改与重构计划。
- 建立首个文档可靠性纵向试点及后续里程碑任务。
- 更新 CURRENT、FEATURE-MATRIX 和相关索引。
## 非目标
- 本任务不修改业务代码、数据库迁移或部署配置。
- 本任务不合并 `feature/final-artifact-vault`,只定义其集成依赖和边界。
- 本任务不执行共享容器验证,也不占用集成槽位。
## 步骤
1. [x] 对照当前源码、已接受 ADR、FAV 分支和外部权威资料复核原方案。
2. [x] 修订架构设计与 ADR。
3. [x] 编写详细整改计划、里程碑任务和验收清单。
4. [x] 更新协作 SSOT 与索引并完成文档一致性检查。
## 验收标准
- [x] 计划明确事务所有权、锁顺序、事件投递语义、授权主体和恢复边界。
- [x] 首个独立交付边界直接覆盖受控文档刷新、重启、投影缺失和授权负例。
- [x] 每个后续里程碑有依赖、文件范围、并发风险、测试矩阵、停走门和回滚边界。
- [x] FAV、迁移语料库和完整备份的职责不重叠,工作区不再承担最终成果事实源。
## 相关链接
- Checklist: [../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Handoff: 不需要;实现阶段使用两个 planned short-term 接续
- Test report: 本任务仅产出计划,不生成业务验收报告
## 证据 / 备注
- 原方案位于主工作区未跟踪文件;本任务在独立 worktree 重建并修订,未覆盖原工作区。
- `feature/final-artifact-vault` 已有实现与测试证据,但尚未合入本任务基线,实施前必须重新审计分支差异。
- 文档校验:本地相对链接、R/KTD/U ID 唯一性、Mermaid fence 和 `git diff --check` 均通过。
@@ -1,48 +0,0 @@
---
title: "项目 143 受控文档正文 404 现场诊断"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Codex
branch: fix/project143-controlled-content-404-diagnosis
worktree: "-"
mutex: docgov-content-diagnosis
---
# 项目 143 受控文档正文 404 现场诊断
## 目标
定位已登录用户打开项目 143 时 `doc_proj143_intake` 正文接口返回 404 的当前根因,并形成可复核的整改边界。
## 范围
- 对照当前 dev 源码、数据库、工作区文件与既有真实 UI 证据。
- 分析服务端 404 条件、前端 hydration 与重复请求条件。
- 形成审计记录和整改建议;本轮不修改业务代码。
## 非目标
- 不恢复或覆盖用户文档数据。
- 不以 API 探针或伪造数据替代后续真实浏览器验收。
- 不继续纯软件项目自举方案实施。
## 步骤
1. [x] 核对项目 143 的项目、文档记录、账本与工作区事实源。
2. [x] 核对正文 handler 的 404 分支和前端 hydration 重试条件。
3. [x] 记录根因、影响范围、整改顺序和验收要求。
## 验收标准
- [x] 404 的直接原因与数据/代码证据相互印证。
- [x] 明确区分历史项目数据缺口、当前能力回归和前端错误放大。
- [x] 不宣称未执行的浏览器或真实 PI 结果。
## 相关链接
- Audit: [../../audit/2026-09-14-project143-controlled-content-404.md](../../audit/2026-09-14-project143-controlled-content-404.md)
## 证据 / 备注
结论:文件存在;raw/canonical 哈希因 5 处 Markdown 双空格硬换行产生 10-byte 差异。该空格具有渲染语义,须保全原文修复。详见 Audit 与 Remediation。
@@ -1,51 +0,0 @@
---
title: "纯软件项目自举工作流方案"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Codex
branch: feature/software-project-bootstrap-plan
worktree: "-"
mutex: workflow-design
---
# 纯软件项目自举工作流方案
## 目标
基于当前 Agent-System 的真实能力,设计一套可创建、可配置、可冻结、可执行、可验收的纯软件项目自举工作流,并明确复用智能体小队、文档模板、权限与阶段门禁的实施路线。
## 范围
- 当前项目创建、工作流、阶段、文档、智能体小队和 UI 能力盘点
- 纯软件项目的创建选项、阶段模型、交付物、门禁、角色与小队设计
- 从最小可用版本到完整自举闭环的实施拆分、数据迁移、API/UI 与验收计划
## 非目标
- 本轮不修改 Go、React、数据库迁移、模板或智能体配置
- 不把医疗器械合规要求默认带入纯软件项目
- 不宣称尚未实现的方案已经可用
## 步骤
1. [x] 盘点当前实现与可复用能力
2. [x] 完成详细系统设计和创建向导设计
3. [x] 给出分阶段实施与真实验收计划
4. [x] 更新 FEATURE-MATRIX、CURRENT 并完成文档校验
## 验收标准
- [x] 方案覆盖工作流、文档、智能体小队、角色权限、项目创建选项、状态机、API/UI、迁移和验收
- [x] 清楚区分已实现、可复用、需新增和暂缓项
- [x] 自举机制有边界、有人工确认点且不会让智能体自行修改治理规则
## 相关链接
- Research: [../../ops/research/2026-09-14-software-project-bootstrap-current-state.md](../../ops/research/2026-09-14-software-project-bootstrap-current-state.md)
- Design: [../../system-design/2026-09-14-software-project-bootstrap-workflow.md](../../system-design/2026-09-14-software-project-bootstrap-workflow.md)
- Checklist: [../../ops/checklists/2026-09-14-software-project-bootstrap-acceptance.md](../../ops/checklists/2026-09-14-software-project-bootstrap-acceptance.md)
## 证据 / 备注
本轮为设计任务;所有当前态结论已回链源码、迁移或现有测试报告。主方案 599 行,验收计划 207 行;`git diff --check` 通过,相关文档 84 条相对链接校验无坏链。未运行产品功能测试,验收清单全部保持 `NOT RUN`。
@@ -1,40 +0,0 @@
---
title: "Vite 允许 FRP Host(frp-mix.com)"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/vite-frp-allowed-hosts
worktree: "-"
mutex: web-devserver
---
# Vite 允许 FRP Host(frp-mix.com)
## 目标
通过 FRP 映射访问 `:3100` 时,Vite 不再拦截 `Host: frp-mix.com`。
## 范围
- `web/vite.config.ts`:`server.allowedHosts` 增加 `.frp-mix.com`
## 非目标
- 不改生产 nginx / 反向代理配置
- 不放开全部任意 Host(保持显式白名单)
## 步骤
1. [x] 在 `fix/vite-frp-allowed-hosts` 上改 `allowedHosts`
2. [x] 重启本地 Vite `:3100`
## 验收标准
- [x] 通过 `frp-mix.com`(FRP→3100)可打开开发页,不再出现 `Blocked request. This host is not allowed`
## 相关链接
- Checklist: —
- Handoff: —
- Test report: —
@@ -1,71 +0,0 @@
---
title: "workflow-plan 409 冻结态守卫 + 文档职责可选治理"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: implementer_cursor
branch: fix/workflow-plan-409-frozen-and-optional-duties
worktree: ".worktrees/fix-workflow-plan-409-frozen-and-optional-duties"
mutex: workflow
---
# workflow-plan 409 冻结态守卫 + 文档职责可选治理
## 目标
已激活项目的设置页进入明确的冻结只读态;非必需且允许裁剪的文档可选择“不纳入人工审批”,部分职责、必需文档空职责、非成员职责和零治理激活由服务端拒绝;门禁、权限、快照与页面语义保持一致。
## 范围
- `web/src/components/project/ProjectSettingsModal.tsx`:frozen 视图、逐文档审批开关、内联/sticky 错误、并发恢复。
- `web/src/api/projectSettings.ts`:保留 status/code/message/issues 的 typed error。
- `internal/projectinstance/validator.go`:统一 DutyMode、工作流定义约束、结构与成员校验。
- `internal/projectinstance/service.go`:保存/预览/激活重复复核 active members。
- `internal/projectinstance/gate.go`、`stage_access.go`、`document_access.go`:none/full/disabled 一致语义。
- `internal/projectinstance/store.go`、`internal/workflow/runtime/orchestrator.go`:快照清理、零 assignment rows、零职责运行时契约。
- 激活预览统计与相应前后端测试。
## 非目标
- 不修改项目 143 的现有工作流配置,不在验收中终止项目 143。
- 不支持部分指派或自动补齐职责。
- 不允许项目配置降低工作流定义中必需/阻断文档的治理要求。
- 不把“无需人工审批”文档改成无版本、无审计的非受控文档。
- 不迁移历史 active 实例;冻结快照继续作为历史 SSOT。
## 步骤
1. [x] 定位项目 143 的 409 `PLAN_FROZEN` 根因并落盘 audit。
2. [x] 完成方案审核:补齐定义优先、零治理拦截、成员有效性、权限、快照清理和真实 UI 边界。
2b. [x] 用户批准最终方案,开工登记(Wave 0)
3. [x] Wave 1:typed API error + frozen 独立只读视图 + sticky/可访问错误 + 两标签竞态恢复。
4. [x] Wave 2:DutyMode、强制/可选任务策略、partial/成员/零治理校验、服务端规范化。
5. [x] Wave 3:门禁、readiness、阶段/文档访问、运行时和预览统计统一。
6. [x] Wave 4:前端逐文档“纳入人工审批”开关及 full/none/partial 交互测试。
7. [x] Wave 5:合 dev、rebuild、真实浏览器设置页矩阵;项目 143 只读回归;归档 test report。真实 PI 生成/审批长链路未跑,见报告。
## 验收标准
- [x] active 项目设置无编辑控件,页面显示冻结原因、工作流/阶段/职责快照和受控终止影响入口。
- [x] 允许裁剪的非必需文档 full/none 均合法;partial 精确拒绝。
- [x] 必需/阻断/不可裁剪文档全空被服务端拒绝(单测 + 定义优先)。
- [x] 保存和激活均拒绝非 active project member;预览后成员退出也 fail closed(单测)。
- [x] 所有文档 none 时可走预览拒绝「至少一份纳入人工审批」(页面 C)。
- [ ] none 文档仍生成和入账本、项目成员只读可见、创建者可生成/编辑,但无 review/approve 且不阻塞阶段(**本轮未跑真实 PI,单测已覆盖门禁/权限**)。
- [x] disabled/none 的冻结快照、plan hash 和 assignment rows 不残留旧职责(Wave 3 单测)。
- [x] 两标签陈旧保存的 409 在当前视口可见、草稿保留并转 frozen。
- [x] 设置页真实 UI 用例有截图证据并回链;生成/审批长链路另立项。
## 相关链接
- Audit: [2026-09-14-workflow-plan-409-frozen-and-optional-duties.md](../../audit/2026-09-14-workflow-plan-409-frozen-and-optional-duties.md)
- Remediation: [2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md](../../remediation/2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md)
- Test report: [2026-09-14-workflow-plan-409-frozen-and-optional-duties-test-report.md](../../test-reports/2026-09-14-workflow-plan-409-frozen-and-optional-duties-test-report.md)
## 证据 / 备注
- dev 项目 143:`lifecycle_status=active`、`active_workflow_key=main`、实例 89 active;409 与三名职责人选择内容无关。
- 当前 `parseError` 已读取后端 message;前端改造重点是 typed error、冻结态切换和视口内呈现。
- 当前职责校验只检查正数/互异,数据库只外键到 users;项目成员有效性必须补服务端校验。
- 当前终止实现会取消运行任务、关闭实例并退回 planning;关闭实例访问 fail closed,因此项目 143 不能作为终止测试对象。
- 方案已迁移至基于最新 dev 的 `fix/workflow-plan-409-frozen-and-optional-duties` 独立 worktree;用户已批准实施。
@@ -1,63 +0,0 @@
---
title: "M5/M6 组合根与传输门禁 U11–U12"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/app-composition-u11-u12
worktree: "-"
mutex: app
---
# M5/M6 组合根与传输门禁 U11–U12
## 目标
按整改计划四个子切片完成组合根、文档通知闭包迁出、stageflow 用例、UserProjectContext CAS;再收口 SSE 编码与已清零规则的 arch-check block。用户已明确授权继续 U11/U12(推翻 U10 报告的停止扩面)。
## 范围
- U11a:`internal/app` 唯一 composition root;幂等 Start/Stop
- U11b:文档 `OnOutbox` 通知迁到 `internal/app/docnotify`
- U11c:`internal/app/stageflow` 拥有 ExecuteTask / ExecuteStage
- U11d:`ContextUpdate` 版本 CAS,禁止跨模块字段级直改
- U12:SSE 中性 frame 编码;`import`/`event` 转 block;不改错误信封与 PI Runner 协议
## 非目标
- 不碰 `intent` 包行为(编码阶段 mutex 仍由 Codex 占用;合入后浏览器门另开 handoff)
- 不整支 merge `feature/final-artifact-vault`;不启用 `FAV_DEGRADED_READ`
- 不终止或改写项目 143
- 不删除未到期的 sql_write/path 例外(U3/U5 残留)
- 不在 worktree 内 `env-service`
## 步骤
1. [x] 认领 CURRENT + 本任务
2. [x] U11a composition root
3. [x] U11b docnotify
4. [x] U11c stageflow
5. [x] U11d ContextUpdate
6. [x] U12 SSE + arch-check block_kinds
7. [x] 短测 / 目标包 race / 报告
8. [x] 占槽 `--no-ff` 合入 `dev` + 主仓 `dev rebuild`
## 验收标准
- [x] 重复 Start 不重复注册 subscriber;Stop 后再 Start worker 仍在
- [x] server 生产代码不再赋值 `OnOutbox`
- [x] HTTP 与 CLI 走同一 stageflow 用例
- [x] ContextUpdate 并发 stale version 不丢更新赢家
- [x] `arch-check --mode block` 对已清零的 import/event 通过
- [x] 测试报告回链 U11/U12
- [x] 合入后 `/health` `/ready` schema 38、`pi-agent`、新镜像 digest
## 相关链接
- Checklist: [../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Plan: [../../remediation/2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- Test report: [../../test-reports/2026-09-15-app-composition-u11-u12-test-report.md](../../test-reports/2026-09-15-app-composition-u11-u12-test-report.md)
## 证据 / 备注
用户口头授权:「继续解耦到 U11、U12」。合入 `dev@bf59cce`。rebuild 镜像 `sha256:a8e3e940f01111c4298c67947ae9f4cd6105f13cf58134672f4a87daa19e27ab`。health/ready:`.doc/test-reports/assets/2026-09-15-app-composition-u11-u12/rebuild-health-ready.txt`。
@@ -1,45 +0,0 @@
---
title: "D4 bizdev locator 最终移除"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/bizdev-locator-removal
worktree: "-"
mutex: bizdev
---
# D4 bizdev locator 最终移除
## 目标
删除 bizdev 上 8 个 locator getter;组合根一次性 Snapshot 后由 Runtime/Server 持有端口。
## 范围
- `Pool` `DocGov` `DocRevision` `ContextManager` `CAS` `ProjectWorkflow` `FreeformDoc` `KB`
- Runtime / Server 字段
- archtest 禁止把 getter 加回去
- 调用方迁移
## 非目标
- 不删 SchemaVersion / DatabaseReady
- 不切事件 live
- 不实现 Track P
## 步骤
1. [x] Snapshot + Runtime 端口
2. [x] 迁移 server/cmd/tests
3. [x] 同批删除 8 getter
4. [x] 报告合入
## 验收标准
- [x] 生产无 8 个 getter
- [x] [S1 报告](../../test-reports/2026-09-15-bizdev-locator-removal-test-report.md)
## 相关链接
- Phase 2 D4
@@ -1,39 +0,0 @@
---
title: "D7b chat 编排剩余批次"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/chatflow-orchestration-boundary
worktree: "-"
mutex: chat
---
# D7b chat 编排剩余批次
## 目标
`internal/chat` 生产代码不再 import bizdev;任务请求走 stageflow 类型别名。
## 范围
- action_executor 去掉 Bizdev 字段
- 收紧 chat import allowlist
- 表征测试保留
## 非目标
- 不搬空测试 import
- 不把 taskrun 签名从 bizdev 别名拷成独立结构
- 不切事件 live
## 步骤
1. [x] action_executor 改 stageflow 类型
2. [x] 收紧 yaml
3. [x] 报告合入
## 验收标准
- [x] chat 生产无 bizdev import
- [x] [S4b 报告](../../test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md)
@@ -1,59 +0,0 @@
---
title: "U10 chatlog/contextasm 原地端口化"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/chatlog-contextasm-u10
worktree: "-"
mutex: chat
---
# U10 chatlog/contextasm 原地端口化
## 目标
在不物理拆包的前提下,为对话读取与 prompt 装配建立带 Principal 的消费者端口,使正文、分类、计数、导出、摘要和恢复使用同一授权可见集合。
## 范围
- `internal/app/chatflow` ChatLog / ContextAssembler 端口
- ctxmgr 表所有权不变;adapter 内做可见性过滤
- server 历史读取 handler 改走 ChatLog;忽略 query/body 中的 user_id 身份
- 会话 restore / 记忆召回只注入允许集合
- 不碰 `intent` mutex,不物理搬到 `chatlog`/`contextasm` 包
## 非目标
- U11–U12
- 整支 merge `feature/final-artifact-vault`
- 启用 `FAV_DEGRADED_READ`
- 纯搬包
## 步骤
1. [x] 核实 `chat` mutex:`fix/chat-history-refresh` 已是 `dev` 祖先;剩余真实 PI 刷新与 U10 同批收口
2. [x] 从最新 `dev` 开 `feature/chatlog-contextasm-u10` 并登记 CURRENT
3. [x] 定义 chatflow 端口与 ctxmgr adapter
4. [x] 迁移 window/day/stats/search/unread/export/digest/history/restore/memory
5. [x] 合同测试:同集计数、非 owner 403、restore/digest 不放大不可见消息
6. [x] 验收报告;最后一句 **停止扩面**
## 验收标准
- [x] 刷新前后同一授权集合的正文与分类计数一致(adapter 合同测试)
- [x] 跨用户负例 fail closed(guest 非 owner)
- [x] context assembly / digest 只使用允许集合
- [x] 真实 PI 闲聊刷新 E2E 证据(与对话刷新活验同批;编制任务链 save 400 未纳入停走)
- [x] 未物理拆包;DTO 转换为 0,拆包收益不成立
## 相关链接
- Checklist: [../checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Plan: [../../remediation/2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- Chat refresh: [../../test-reports/2026-09-13-chat-history-refresh-test-report.md](../../test-reports/2026-09-13-chat-history-refresh-test-report.md)
- Test report: [../../test-reports/2026-09-15-chatlog-contextasm-u10-test-report.md](../../test-reports/2026-09-15-chatlog-contextasm-u10-test-report.md)
## 证据 / 备注
U9 最后一句 **继续 U10** 只批准进入 M4。禁止 U11–U12。`intent` 认领仍 `in_progress`,本单元不改意图分类。活验项目 6252 / `sess-p6252-u10`;产物 `.doc/test-reports/assets/2026-09-15-chat-history-refresh-live/live.json`。未占槽 rebuild。
@@ -1,59 +0,0 @@
---
title: "M3 U9 存量回填、migration corpus 与数据生命周期"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/dataset-lifecycle-u9
worktree: "-"
mutex: dataset
---
# M3 U9 存量回填、migration corpus 与数据生命周期
## 目标
只保留可解释的演示/回归数据,并持续验证旧数据迁移、重载和受控恢复。backfill 可暂停续跑,异常进 quarantine;八条轨道可重复;销毁默认 fail closed。
## 范围
- dataset registry(pinned / demo / regression / migration_baseline / ephemeral / quarantine)
- checkpoint 分批 backfill:只枚举 snapshot、approved/commit event、completed chat turn
- SKIP LOCKED 多 worker;禁止扫描 workspace
- 销毁门禁:FAV coverage + 完整备份 restore + corpus + 精确 manifest + 双人批准 + quarantine 观察窗
- restore 拒绝共享 env DSN;只允许 scratch
- 八轨:clean / oldest-supported / previous / hazard / import / reload / rollback / artifact recovery
## 非目标
- U10–U12;不碰 `chat` / `intent` mutex
- 不整支 merge `feature/final-artifact-vault`;不启用 `FAV_DEGRADED_READ`
- 不修改历史 Goose;不销毁 `agent_system_dev/test/main`
- 不终止或改写项目 143;worktree 内禁止 `env-service`
## 步骤
1. [x] CURRENT 认领 `mutex=dataset`;从 `dev` 开 `feature/dataset-lifecycle-u9`
2. [x] Goose 00038 + `module-boundaries.yaml`
3. [x] `internal/artifactvault/backfill.go` + `internal/dataset` + `cmd/dataset`
4. [x] 硬化 `scripts/restore-system-db-drill.sh`
5. [x] 隔离库 + 八轨 + 目标包 `-race` + 占槽 rebuild
6. [x] 验收报告;最后一句 **继续 U10**
## 验收标准
- [x] backfill 中断、重复、并发新终态时分母/分子可复算且不重复 artifact
- [x] legacy-v0 / 旧 schema / 高 ID / projection fork / 缺 snapshot → quarantine 或升级
- [x] restore 拒绝共享 DSN、错误 storage identity、篡改 manifest、缺权限
- [x] coverage / backup / corpus 任一失败阻止 destroy
- [x] 批准 dataset 导入后关系、SHA、sequence 可复算
## 相关链接
- Checklist: `.doc/ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md`
- Plan: `.doc/remediation/2026-09-14-module-decoupling-refactor-plan.md` U9
- Test report: `.doc/test-reports/2026-09-15-dataset-lifecycle-u9-test-report.md`
## 证据 / 备注
见验收报告。Goose 00038。dev schema 38。
@@ -1,46 +0,0 @@
---
title: "D6 doccontent canonical 边界"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/doccontent-canonical-boundary
worktree: "-"
mutex: docgov
---
# D6 doccontent canonical 边界
## 目标
Markdown canonicalization 与 SHA 抽到 `internal/doccontent`;生产 `docgov` 不再 import `docrevision`。
## 范围
- `internal/doccontent`
- `docgov/lease.go` 改走 doccontent
- `docrevision` 薄封装保持旧调用方
- golden + wrapper 对账
## 非目标
- 不改 hash 语义
- 不碰项目 143 数据
- 不删 `docrevision.CanonicalizeMarkdown` 导出(兼容)
## 步骤
1. [x] 分支与 CURRENT
2. [x] 提取模块与切断 docgov→docrevision
3. [x] golden / arch-check
4. [x] 报告并合入
## 验收标准
- [x] 生产 docgov 不 import docrevision
- [x] project143 hard-break golden 仍过
- [x] [S3 报告](../../test-reports/2026-09-15-doccontent-canonical-boundary-test-report.md)
## 相关链接
- Phase 2: [../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
@@ -1,53 +0,0 @@
---
title: "Track E 持久事件交付"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-e2-hook-guard
worktree: "-"
mutex: events
---
# Track E 持久事件交付
## 目标
按 E0A→E0B→E1A→E1B→E1C 完成 notify、workflow advance、projection 的 PG 持久交付,并用授权页面刷新/重启恢复证据关闭 `DOC-RELIABILITY-PILOT` 的事件部分。
## 范围
- E0A:生产入口/UoW、event contract、runtime registry、历史数据与 sequence 门。
- E0B:PG dispatcher、attempt audit、独立进程、并发与故障注入。
- E1A/B/C:三个消费者独立 shadow、switch、rollback 和真实恢复验收。
## 非目标
- FAV consumer 激活、bizdev/chat/intent 结构重构、HTTP 错误信封、PI typed result。
- 删除或覆盖历史事件;在 E0A 通过前启动 dispatcher。
## 步骤
1. [x] E0A 单独建 short-term/分支,dispatcher 保持 off。
2. [x] E0A 报告通过后再认领 E0B。
3. [x] 依次交付 E1A notify、E1B workflow advance、E1C projection;每步独立 go/no-go。
4. [x] E2 兼容守卫:live 时闭包停写;hook API 待 live 窗口后删除。
5. [x] 同步 test report、CURRENT、FEATURE-MATRIX、gap-matrix、[复盘](../research/2026-09-15-track-e-retrospective.md)。
## 验收标准
- [ ] 满足 [Phase 2 Track E Definition of Done](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md#track-e-definition-of-done)(共享 live 与删除 hook API 仍开放)。
- [x] 每个波次拥有独立 owner、mutex、分支、报告和回滚证据。
- [x] 未把计划、MemoryBus、stub 或日志冒充生产 PG/browser/restart 验收。
## 相关链接
- Checklist: 按每个波次建立
- Audit: [Phase 2 方案审阅](../../audit/2026-09-15-module-decoupling-phase2-plan-review.md)
- Remediation: [Phase 2 修订计划](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
- Test report: [E2](../../test-reports/2026-09-15-event-e2-hook-guard-test-report.md)
- 复盘: [./research/2026-09-15-track-e-retrospective.md](../research/2026-09-15-track-e-retrospective.md)
## 证据 / 备注
本条只建立执行入口,不代表已批准 E0A 或已认领 mutex。实施前必须按 CURRENT 检查冲突并从当时最新 dev 建分支。
@@ -1,49 +0,0 @@
---
title: "E0A 事件生产、契约与历史数据门"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-production-scope-contract
worktree: "-"
mutex: events
---
# E0A 事件生产、契约与历史数据门
## 目标
组合根注入唯一 `docflow.Commands`;candidate-ready、downstream-impact、approved 三条链在同一 UoW 写 envelope/delivery;缺 env/project fail closed;FAV 不写入;allowlist 与 runtime registry parity;历史 inventory 分类且不删数据;dispatcher 保持 off。
## 范围
- D3 生产入口与作用域
- D10 既有 event allowlist 补全与 registry parity
- D11 inventory、sequence ADR、repair/quarantine/expire、replay 骨架、service principal 表
## 非目标
- 不实现/启动 PG dispatcher
- 不激活 FAV,不写 staging/artifact/publication
- 不删除历史事件
- 不开始 Track S/P
## 步骤
1. [x] 从最新 `dev` 开 `fix/event-production-scope-contract` 并登记 CURRENT
2. [x] 唯一 Commands、三条链同 UoW、FAV 隔离
3. [x] allowlist + registry parity + 动态 FAV 注册失败
4. [x] inventory/repair/replay/principal additive schema 与用例
5. [x] 连续性模型 ADR;gap blocking 关闭
6. [x] 隔离库 PG 证据与 test-report
## 验收标准
- [x] 见 [E0A 测试报告](../../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md)
## 相关链接
- Remediation: [../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md](../../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md)
- ADR: [../../adr/2026-09-15-event-consumer-checkpoint.md](../../adr/2026-09-15-event-consumer-checkpoint.md)
@@ -1,43 +0,0 @@
---
title: "E0B PG dispatcher 基座"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/events-dispatcher-pg
worktree: "-"
mutex: events
---
# E0B PG dispatcher 基座
## 目标
原子 lease/attempt/heartbeat/fencing、独立 `cmd/events`、默认 mode=off、1/2/4 worker 与崩溃注入。
## 范围
- Goose 00040、ClaimLeases、cmd/events、compose events 服务
## 非目标
- 不把任何 consumer 切 live
- 不激活 FAV
- 不删除历史
## 步骤
1. [x] 从 E0A 后 `dev` 开 `feature/events-dispatcher-pg`
2. [x] additive schema + atomic claim
3. [x] worker/heartbeat/fencing/shadow scan
4. [x] cmd/events + compose
5. [x] 隔离库 PG + race + 报告
## 验收标准
- [x] [E0B 测试报告](../../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md](../../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md)
@@ -1,48 +0,0 @@
---
title: "E1A notify shadow 与切换"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-notify-cutover
worktree: "-"
mutex: events
---
# E1A notify shadow 与切换
## 目标
notify 消费者具备 shadow 覆盖门、live 唯一可见结果与显式 rollback;生产集群保持 off。
## 范围
- Goose 00041、`EmitVisibleDocumentEvent`、`docnotify.EventConsumer`、Handler 与 Ack 同事务
- cmd/events 注册 notify(mode=off 时不 claim)
## 非目标
- 不把共享环境 notify 切 live
- 不删除 OnOutbox 闭包
- 不激活 FAV / workflow advance / projection live
## 步骤
1. [x] 从 E0B 后 `dev` 开 `fix/event-notify-cutover`
2. [x] additive `source_event_id` 与可见结果唯一索引
3. [x] shadow dry-run + live 同事务 ack
4. [x] fixture N=30、quarantine、correlation、rollback
5. [x] 隔离库 PG + race + 报告
## 验收标准
- [x] [E1A 测试报告](../../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md](../../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md)
## 证据 / 备注
隔离库 `agent_rel_e1a` 测完已 DROP。共享 `event_consumer_modes.notify=off`。
@@ -1,44 +0,0 @@
---
title: "E1B workflow advance shadow 与切换"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-workflow-advance
worktree: "-"
mutex: events
---
# E1B workflow advance shadow 与切换
## 目标
workflow_advance 具备 shadow/live/rollback;并发或重放批准只产生一次阶段可推进可见结果。生产集群保持 off。
## 范围
- Goose 00042、`docadvance.EventConsumer`、`EmitVisibleStageReady`、MarkDocTaskApproved 走 fenced tx
- cmd/events 注册 workflow_advance
## 非目标
- 不把共享环境 workflow_advance 切 live
- 不删除 AddOnApprovedHook
- 不激活 FAV / projection live
## 步骤
1. [x] 从 E1A 后 `dev` 开 `fix/event-workflow-advance`
2. [x] additive source_event_id on stage_advance_requests
3. [x] consumer 重读文档并同事务 ack
4. [x] 隔离库并发/重放/quarantine/rollback
5. [x] 报告
## 验收标准
- [x] [E1B 测试报告](../../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md](../../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md)
@@ -1,41 +0,0 @@
---
title: "E1C projection no-replace"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-projection-cutover
worktree: "-"
mutex: events
---
# E1C projection no-replace
## 目标
projection 消费者幂等只前进;共享集群保持 off。
## 范围
- Goose 00043、ProjectHeadNoReplace、docproject.EventConsumer
## 非目标
- 不把共享 projection 切 live
- 不激活 FAV
- 不删除闭包
## 步骤
1. [x] 分支与 additive schema
2. [x] no-replace SQL + consumer
3. [x] 隔离库 + race + worker 重启
4. [x] 报告
## 验收标准
- [x] [E1C 测试报告](../../test-reports/2026-09-15-event-e1c-projection-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
@@ -1,48 +0,0 @@
---
title: "E2 闭包 live 停写与 Track E 复盘"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-e2-hook-guard
worktree: "-"
mutex: events
---
# E2 闭包 live 停写与 Track E 复盘
## 目标
在 dispatcher 仍默认 off 时保留 `OnOutbox` / `AddOnApprovedHook` 接线,使对应消费者切 `live` 后闭包立即停写,避免双写;并写 Track E 复盘。不关闭 `DOC-RELIABILITY-PILOT`。
## 范围
- `events.WriterLive`
- `docnotify.Subscriber.SkipWrite`
- Runtime / 遗留 HTTP hook 在 `workflow_advance` live 时 no-op
- 复盘与 E2 测试报告
## 非目标
- 不删除 hook API(须等 live 发布窗口)
- 不把共享 notify/advance/projection 切 live
- 不激活 FAV
- 不关闭 Track E 发布 blocker
## 步骤
1. [x] 从最新 `dev` 开 `fix/event-e2-hook-guard` 并登记 CURRENT
2. [x] WriterLive + 闭包守卫 + 单测
3. [x] 隔离库 mode 矩阵
4. [x] 复盘与报告
## 验收标准
- [x] live 时闭包不写;off/shadow 仍写
- [x] 生产仍保留 Bind / AddOnApprovedHook(mode=off 必需)
- [x] [E2 报告](../../test-reports/2026-09-15-event-e2-hook-guard-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- 复盘: [../research/2026-09-15-track-e-retrospective.md](../research/2026-09-15-track-e-retrospective.md)
@@ -1,54 +0,0 @@
---
title: "共享环境事件消费者 live 切换"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/event-shared-live-cutover
worktree: "-"
mutex: events
---
# 共享环境事件消费者 live 切换
## 目标
在共享 `agent-dev` 上按 notify → workflow_advance → projection 完成 shadow → drain → live → 回滚演练,再删除生产 hook 注册。
## 范围
- `scripts/event-consumer-mode.sh` + `cmd/eventmode`
- 共享 `agent_system_dev` inventory / quarantine
- 逐消费者 live 与授权页纵切(项目 6275;143 只读)
## 非目标
- FAV live
- test/main 环境
- 编辑 Phase 2 计划原文
- Track P(独立波次)
## 步骤
1. [x] L0 受控 SetMode 与 inventory
2. [x] L1 notify
3. [x] L2 workflow_advance
4. [x] L3 projection + 授权页
5. [x] L4 删除生产 hook 注册
## 验收标准
- [x] fav / test / main 切模式失败
- [x] 每消费者独立 live 报告
- [x] 生产代码无 `OnOutbox =` / `AddOnApprovedHook(`
## 相关链接
- Long-term: [.doc/archive/ops/2026-09-15-event-shared-live-cutover.md](../../archive/ops/2026-09-15-event-shared-live-cutover.md)
- Notify: [.doc/test-reports/2026-09-15-event-notify-shared-live-test-report.md](../../test-reports/2026-09-15-event-notify-shared-live-test-report.md)
- Advance: [.doc/test-reports/2026-09-15-event-workflow-advance-shared-live-test-report.md](../../test-reports/2026-09-15-event-workflow-advance-shared-live-test-report.md)
- Projection: [.doc/test-reports/2026-09-15-event-projection-shared-live-test-report.md](../../test-reports/2026-09-15-event-projection-shared-live-test-report.md)
## 证据 / 备注
已合入 `dev@39dc68d`。生产 hook 注册已删;方法本体保留一个窗口。
@@ -1,34 +0,0 @@
---
title: "共享环境事件消费者 live 切换"
status: done
created: 2026-09-15
updated: 2026-09-15
---
# 共享环境事件消费者 live 切换
## 动机
Track E 已在隔离库证明 notify / workflow_advance / projection 的 exactly-one visible outcome 与 E2 闭包守卫。共享集群仍为 `off`,HTTP 闭包仍是唯一真实写者。未 live 则不能删 hook API,也不能关闭 `DOC-RELIABILITY-PILOT`。
## 成功标准
- 按消费者独立:shadow coverage → drain → 原子 live;E2 守卫使对应闭包停写。
- 授权页刷新/重启正文与 head digest 一致;未授权不泄露。
- 回滚开关保留一个发布窗口后再删 `OnOutbox` / `AddOnApprovedHook`。
- FAV 保持 disabled;项目 143 只读。
## 依赖
- E0A–E2 已合入;隔离库报告已归档。
- 需要明确授权:动共享 `agent-dev` 消费者 mode。
## 暂不启动原因
已完成共享 live 与生产去注册。方法本体保留一个窗口。
## 相关链接
- [Track E 复盘](../research/2026-09-15-track-e-retrospective.md)
- [E2 报告](../../test-reports/2026-09-15-event-e2-hook-guard-test-report.md)
- [gap-matrix DOC-RELIABILITY-PILOT](../../remediation/gap-matrix.md)
@@ -1,39 +0,0 @@
---
title: "D7a intent 与 bizdev 解绑"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/intent-bizdev-boundary
worktree: "-"
mutex: intent
---
# D7a intent 与 bizdev 解绑
## 目标
intent 只依赖成熟度词汇叶子包,不再 import bizdev。
## 范围
- `internal/maturity`
- intent 生产与表征测试
- bizdev 类型别名保持兼容
## 非目标
- 不改识别规则
- 不迁 coordinator / chatflow(D5/D7b)
## 步骤
1. [x] 叶子包与别名
2. [x] intent 切断 bizdev
3. [x] 表征测试与 arch-check
4. [x] 报告
## 验收标准
- [x] intent 生产 import 无 bizdev
- [x] [S4a 报告](../../test-reports/2026-09-15-intent-bizdev-boundary-test-report.md)
@@ -1,50 +0,0 @@
---
title: "清点旁支并收口已合入本地分支"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: chore/leftover-branch-cleanup
worktree: "-"
mutex: ops
---
# 清点旁支并收口已合入本地分支
## 目标
删除 tip 已是 `dev` 祖先的本地旁支与对应 worktree;不整支合入会回归或触红线的 5 条未合并分支;主仓跑一次 short 冒烟。
## 范围
- 拆 7 个已合入 worktree
- `git branch -d` 已 `--merged` 旁支
- CURRENT 记录故意保留的 FAV / herdr-removal / diagnosis / data-root / `dev-old-linear`
- vet / short / arch-check / health+ready
## 非目标
- 不整支 merge `feature/final-artifact-vault`;不启用 `FAV_DEGRADED_READ`
- 不合入 `feature/remove-herdr-agent-settings`(会回归 U12 arch-check、删 Herdr 脚本)
- 不合入 `fix/project143-controlled-content-404-diagnosis`(会回退审计关闭结果)
- 不合入 `fix/dev-runtime-data-root-guard`、`dev-old-linear`
- 不 push;不删 `origin/*`;不从 worktree 起 docker;不碰项目 143
## 步骤
1. [x] 占 CURRENT 集成槽
2. [x] 拆已合入 worktree
3. [x] 删除已 merged 本地旁支
4. [x] 冒烟并写报告
5. [x] 槽位 idle + archive
## 验收标准
- [x] 已合入旁支 worktree 只剩 FAV 错名目录
- [x] `--merged dev` 旁支已删(31 条)
- [x] 5 条未合入分支仍在
- [x] 测试报告 + health/ready schema 38
## 相关链接
- Test report: [../../test-reports/2026-09-15-leftover-branch-cleanup-test-report.md](../../test-reports/2026-09-15-leftover-branch-cleanup-test-report.md)
@@ -1,57 +0,0 @@
---
title: "审阅并修订模块解耦 Phase 2 方案"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Codex
branch: docs/module-decoupling-ipc-assessment
worktree: "-"
mutex: architecture-docs
---
# 审阅并修订模块解耦 Phase 2 方案
## 目标
以当前代码、migration、ADR 和 Phase 1 计划为证据,修正调研与 Phase 2 方案,并补齐高并发、互斥、权限、历史数据、灰度和回滚设计;不实施业务代码。
## 范围
- 复核调研报告与原 Phase 2 方案的事实、依赖和完成边界。
- 将事件可靠性、结构解耦、HTTP/PI 协议拆成独立轨道。
- 补充 PG 状态机、fencing、幂等、顺序、连接预算、权限、replay、脱敏、迁移和 browser/restart 验收。
- 同步 audit、remediation、CURRENT、FEATURE-MATRIX 与 gap-matrix。
## 非目标
- 不实现 dispatcher、consumer、migration 或协议代码。
- 不合并、部署、重启容器、删除数据或审计/合入 FAV 分支。
- 不把文档完成写成系统能力完成。
## 步骤
1. [x] 完成仓库启动链和上位 ADR/Phase 1 证据复核。
2. [x] 完成一致性、可行性、范围、安全、产品与对抗视角审阅。
3. [x] 修正调研报告中的 PG、依赖方向、allowlist 与进程边界事实。
4. [x] 重写 Phase 2 为 Track E/S/P,补齐详细实施和停走门。
5. [x] 同步索引与状态 SSOT。
6. [x] 执行文档链接、diff、冲突标记和术语检查。
## 验收标准
- [x] 调研不再把 SELECT-only Claim、MemoryBus 测试或 allowlist 基线写成生产闭环。
- [x] Track E 可独立关闭,FAV/D8/D9 不阻塞。
- [x] 方案明确 at-least-once 与 exactly-one visible outcome、最终提交点 fencing、集群级切换和授权模型。
- [x] 历史脏数据只分类/隔离/修复,不授权删除。
- [x] 文档状态一致且没有实施或发布声明。
## 相关链接
- Audit: [方案审阅](../../audit/2026-09-15-module-decoupling-phase2-plan-review.md)
- Remediation: [Phase 2 修订计划](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
- Research: [IPC/RPC 现状评估](../../ops/research/2026-09-15-module-decoupling-ipc-assessment.md)
- Test report: 不适用(文档审阅,无业务实现)
## 证据 / 备注
本任务沿用用户已创建的 `docs/module-decoupling-ipc-assessment` 分支。该分支名早于当前 `feature/*|fix/*` 规则;未改写或重命名用户分支。起点提交为 `a3392e3` 与 `5cef856`,本轮未获授权 commit/push。
@@ -1,47 +0,0 @@
---
title: "PI typed-result-v1 P1–P4"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/pi-typed-result
worktree: "-"
mutex: pi-agent
---
# PI typed-result-v1 P1–P4
## 目标
Runner additive 输出 `result_v1`;Go typed-first fail-closed;共享 dev 真实 PI 双轨对账;去掉 stderr/legacy 明文错误。
## 范围
- `configs/schemas/pi-run-result-v1.json`
- `deploy/pi-agent/result-v1.mjs` + runner 接线
- `internal/agent` parser / 负例 / `RUN_PI_E2E=1` 双轨
## 非目标
- 不把 member 正文搬进 `result_v1`(仍走 `patches[]`)
- 不改 HTTP 状态码;不启用 FAV;不写项目 143
## 步骤
1. [x] Schema + Runner additive
2. [x] Go typed-first + handshake
3. [x] 真实 PI 双轨
4. [x] 删 stderr/隐式 legacy;报告与合入
## 验收标准
- [x] typed-present-invalid 永不 fallback
- [x] handshake downgrade 负例 PASS
- [x] `RUN_PI_E2E=1` 成功/失败/取消/超时对账
- [x] test-report 归档
## 相关链接
- Test report: `.doc/test-reports/2026-09-15-pi-typed-result-v1-test-report.md`
- Remediation: `.doc/remediation/2026-09-15-pi-typed-result-v1-remediation.md`
- P0: `.doc/ops/research/2026-09-15-pi-typed-result-p0-matrix.md`
@@ -1,45 +0,0 @@
---
title: "晋升 dev → test 并部署测试环境"
status: in_progress
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/promote-dev-to-test-2026-09-15
worktree: "-"
mutex: infra
---
# 晋升 dev → test 并部署测试环境
## 目标
把已完成的 Phase 2 代码从本地 `dev` 合入 `test`,重建并冒烟测试环境,供人工实测。不实施多意图 HITL。
## 范围
- `test` 分支 `--no-ff` 合入当前 `dev`
- `./scripts/env-service.sh test rebuild`
- test 库 notify/workflow_advance/projection 切 live(L4 去 hook 后 off 会停写);FAV 保持 off
## 非目标
- 不实施多意图 HITL U1+
- 不合入 `main`、不启用 FAV
- 不写项目 143
## 步骤
1. [x] 确认 Phase 2 已在本地 `dev`
2. [ ] occupy 集成槽并合入 `test`
3. [ ] rebuild 测试服务
4. [ ] health/ready + schema 冒烟
## 验收标准
- [ ] `:8081` health/ready PASS
- [ ] events `:8089` health PASS
- [ ] FAV 仍 off
## 相关链接
- CURRENT: `.doc/ops/CURRENT.md`
@@ -1,40 +0,0 @@
---
title: "D5 stageflow 类型归属与 D7b chatflow 首批"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/stageflow-type-ownership
worktree: "-"
mutex: stageflow
---
# D5 stageflow 类型归属与 D7b chatflow 首批
## 目标
coordinator 生产代码不再 import bizdev;task/stage 请求走 stageflow 类型;chatflow assembler 改用 maturity。
## 范围
- stageflow 类型别名与状态常量
- coordinator 构造改为 StageTaskRunner + ContextServices
- chatflow 去掉 bizdev import
## 非目标
- 不复制行为方法成 DTO(身份别名 + token golden)
- 不删除 bizdev 八个 getter(D4)
- 不搬空 chat 包
## 步骤
1. [x] 类型边界与 coordinator 解绑
2. [x] chatflow assembler
3. [x] 表征测试与 arch-check
4. [x] 报告
## 验收标准
- [x] coordinator 生产 import 无 bizdev
- [x] [S2/S4b 报告](../../test-reports/2026-09-15-stageflow-type-ownership-test-report.md)
@@ -1,60 +0,0 @@
---
title: "M3 U8 TaskRun 终态与 RunManifest"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/taskrun-runmanifest
worktree: "-"
mutex: taskrun
---
# M3 U8 TaskRun 终态与 RunManifest
## 目标
TaskRun 终态在同一 UoW 内 CAS 写入唯一合法状态,并持久化类型化 RunManifest;重复 finalize / cancel race / SSE 断线不得产生第二条助手消息或第二份 artifact;workspace 清理仅在 verified receipt 之后。
## 范围
- Goose 00037 `task_run_manifests` + `finalizing` 状态
- `internal/taskrun` RunManifest 规范字节 / SHA / members
- `taskrun.Commands.Finalize` 唯一 finalize 命令;server 变薄
- `ctxmgr.FinalizeAssistantTaskMessage` 仅此写路径加入 UoW
- workspace 清理门禁;`ReadArtifact` 替代 `Join(workDir, "output.md")`
- BackendRef 服务端 policy;隔离库并发测试;占槽 rebuild;U8 报告
## 非目标
- U9 backfill / corpus / 八轨 / 销毁
- M4–M6;整支 merge FAV;启用 `FAV_DEGRADED_READ`
- 终止或改写项目 143
- 动 `chat` / `intent` 刷新任务
- worktree 内 `env-service`
## 步骤
1. [x] CURRENT 认领 `mutex=taskrun`;从本地 `dev` 开 `feature/taskrun-runmanifest`
2. [x] Goose 00037 Up+Down;`module-boundaries.yaml` 表属主
3. [x] Finalize 同 UoW:CAS + 助手 turn + manifest + envelope/staging
4. [x] 清理门禁与 server 去路径、BackendRef
5. [x] 隔离库双 pool / race;占槽 rebuild;报告最后一句只能「继续 U9」或「停止扩面」
## 验收标准
- [x] 重复 finalize:同一 status、同一 manifest SHA、助手消息 1 条、envelope/staging 不加倍
- [x] finalize ∥ cancel:恰好一个合法终态
- [x] SSE `done` 不出现在 TX 失败路径;commit 前断线重试不第二 turn
- [x] 无 verified receipt 则 cleanup FAIL;有 receipt 则可清 workspace 且 staging 仍能取出原 SHA
- [x] 报告最后一句为「继续 U9」或「停止扩面」;U9 清单项保持未勾
## 相关链接
- Checklist: [2026-09-14-module-decoupling-refactor-acceptance.md](../checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Remediation: [2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- 权威停走门: [2026-09-14-document-reliability-m2-test-report.md](../../test-reports/2026-09-14-document-reliability-m2-test-report.md)(继续 M3)
- Test report: [2026-09-15-taskrun-runmanifest-u8-test-report.md](../../test-reports/2026-09-15-taskrun-runmanifest-u8-test-report.md)
## 证据 / 备注
未签字前禁止 U9–U12。合入 + 容器测占集成槽,主仓 `./scripts/env-service.sh dev rebuild`。
@@ -1,31 +0,0 @@
---
title: "Track P 协议实施(信封与 typed-result)"
status: done
created: 2026-09-15
updated: 2026-09-15
---
# Track P 协议实施(信封与 typed-result)
## 动机
H0/P0 盘点后独立实施 HTTP 信封与 PI typed-result,不回退事件 live。
## 成功标准
已关闭:
- [HTTP 信封 H1–H3](../../test-reports/2026-09-15-http-error-envelope-h1-h3-test-report.md)
- [PI typed-result P1–P4](../../test-reports/2026-09-15-pi-typed-result-v1-test-report.md)
## 依赖
mutex `server`/`web`/`pi-agent` 已释放。
## 暂不启动原因
已完成。
## 相关链接
- [Phase 2 计划](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
@@ -1,30 +0,0 @@
---
title: "Wave 2 PU4 真实 PI 补证(U8 + full/none)"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor
branch: feature/wave2-real-pi-evidence
worktree: "-"
mutex: intent-plan
---
# Wave 2 PU4 真实 PI 补证(U8 + full/none)
## 目标
补齐 multi-intent U8 与工作流 full/none 的真实 PI / PG / 跨用户 / 恢复证据。
## 步骤
1. [x] 认领 + 占槽 rebuild
2. [x] U8 live 证据路径
3. [x] full/none 混合长链 live 测试
4. [x] 报告 + 矩阵更新 + 释放槽位
## 验收标准
- [x] U8 真实 PI PASS
- [x] full 跨用户审批 PASS
- [x] none 免审批且不阻塞 PASS
- [x] 报告归档 `.doc/test-reports/2026-09-16-wave2-real-pi-evidence-test-report.md`
@@ -1,45 +0,0 @@
---
title: "对话刷新恢复整改 Checklist"
status: done
created: 2026-09-13
updated: 2026-09-15
related_task: "../2026-09-13-chat-history-refresh-remediation.md"
---
# 对话刷新恢复整改 Checklist
## Wave 0 — 锁定回归
- [x] `MessageVisible` / `ScopeFromMetadata` 单测 — 证据:`internal/projectinstance/message_scope_test.go`
- [x] PG 集成:激活前 + 任务 scope + 刷新窗口 — 证据:`internal/server/chat_history_refresh_pg_test.go`
- [x] 前端:空 messages 日桶不覆盖缓存 — 证据:`web/src/hooks/useChatWindow.ts`
## Wave 1 — 写入作用域
- [x] Goose `00026` 列迁移 — 证据:`deploy/postgres/goose/00026_2026-09-13-chat-message-scope.sql`
- [x] `ResolveMessageScopeForChat/Task` — 证据:`internal/projectinstance/message_scope.go`
- [x] 任务/聊天写入接线 — 证据:`task_run_handlers.go`, `session.go`, `ctxmgr/manager.go`
## Wave 2 — 授权同集
- [x] `authorizeSessionRead` + 可见性谓词 — 证据:`internal/server/chat_history_auth.go`
- [x] window/day/search/dates/categories/unread/digest 授权 — 证据:各 `*_api.go`
## Wave 3 — 历史回填
- [x] Goose `00027` backfill SQL — 证据:`deploy/postgres/goose/00027_2026-09-13-chat-message-scope-backfill.sql`
## Wave 4 — 前端恢复态
- [x] `useChatWindow` 阶段态 + 用户隔离缓存 — 证据:`web/src/hooks/useChatWindow.ts`, `web/src/data/storage.ts`
## Wave 5 — 验收
- [x] `go test -short ./...` — 证据:本机执行输出
- [x] 真实 PI 刷新 E2E(需 dev 容器 + pi-agent)— 证据:`.doc/test-reports/assets/2026-09-15-chat-history-refresh-live/live.json`(项目 6252 闲聊刷新同集 + guest 403;编制任务链未通过)
- [x] 测试报告归档 — 证据:`.doc/test-reports/2026-09-13-chat-history-refresh-test-report.md`
## 完成定义
- [x] 全部勾选且有证据链接
- [x] gap-matrix `CHAT-HISTORY-REFRESH` → PASS
@@ -10,20 +10,20 @@ related_task: short-term/2026-09-13-codex-audit-p0-remediation.md
## Wave 0 — Agent 文档
- [x] AGENTS.md / PROJECT.md / CLAUDE.md — commit 0d10c9a(原 31fe607,见 [rewrite map](../../reference/commit-rewrite-map-2026-09-13.md))
- [x] AGENTS.md / PROJECT.md / CLAUDE.md — commit 31fe607
- [x] .cursor/rules — agent-collaboration + git-secrets
- [x] .doc/ops templates + CURRENT
## Wave A — P0
- [x] AUTH tasks/run + stream — commit 3b7b49c(原 d82021e);`task_run_authz_pg_test.go`
- [x] DB 00025 — commit 8c5dd97(原 b13ced6);dev/test setval
- [x] AUTH tasks/run + stream — commit d82021e;`task_run_authz_pg_test.go`
- [x] DB 00025 — commit b13ced6;dev/test setval
- [x] DATA lifecycle — dev UPDATE 47 → 0
- [x] DATA test wf — UPDATE 5 retired
## Wave B — Go 门禁
- [x] go vet ./... PASS — commit 3d09bd6(原 91985a2)
- [x] go vet ./... PASS — commit 91985a2
- [x] go test -short ./... PASS
- [x] AdvisorBrief / V0.5 / chat / kb / health / asset
@@ -32,7 +32,7 @@ related_task: short-term/2026-09-13-codex-audit-p0-remediation.md
- [x] test rebuild schema 25 — health 8081
- [x] dev docker app schema 25 — health 8080
- [x] main 冒烟 — health/ready 8000 schema 25;restart 恢复
- [x] HTTP 超时 + env status 只读 — commit 0547bd5(原 505c419)
- [x] HTTP 超时 + env status 只读 — commit 505c419
- [x] .env.dev/.env.test chmod 600
## Wave D — 文档
@@ -1,23 +0,0 @@
---
title: "PG ID 重映射收紧"
status: done
created: 2026-09-13
updated: 2026-09-14
related_task: "2026-09-13-document-revision-pg-id-remap.md"
---
# PG ID 重映射收紧
## Wave 0
- [x] `adopt*ID` 推进 counter,仅删同一对象
- [x] 临时 ID 跳过已占用键(snapshot/version/event/report/candidate)
- [x] openTemplate / human / candidate / commit / noop event 全走 adopt
- [x] 纯函数 + 高序列首次生成 PG 回归
- [x] `gofmt` / `go vet` / `go test -short ./...`
- [x] 真实 UI-03:Round20 PASS(6159 / `doc_proj6159_intake` / V2/r0)
## 完成定义
- [x] 上述实现项有测试证据
- [x] 现场 UI-03 Round20 已通过;Round19 失败归档不删
@@ -1,23 +0,0 @@
---
title: "post-restart 最终持久正文 snippet"
status: done
created: 2026-09-13
updated: 2026-09-14
related_task: "2026-09-13-document-revision-post-restart-final-snippet.md"
---
# post-restart 最终持久正文 snippet
## 本轮
- [x] `nextDurableBodySnippet`:后续成功修订覆盖旧 snippet
- [x] 冲突失败稿不成为期望正文
- [x] UI-13b 冲突断言完成后回写 `markerA1`;UI-15-pre 写出最终值
- [x] 不放宽/删除 post-restart body 断言
- [x] `npm test` / `npm run build`
- [x] 真实 UI-15 post-restart:Round20 PASS
## 完成定义
- [x] 上述实现项有单测或脚本证据
- [x] 现场 post-restart Round20 已通过;stale-snippet 失败归档不删
@@ -1,23 +0,0 @@
---
title: "post-restart 项目名 selector 收紧"
status: done
created: 2026-09-13
updated: 2026-09-14
related_task: "2026-09-13-document-revision-post-restart-selector.md"
---
# post-restart 项目名 selector 收紧
## 本轮
- [x] 点击来自侧栏可见项目入口(complementary exact title),不用 `.first()` 弱化
- [x] 恢复断言为 banner 内 exact 项目名
- [x] `UI_PHASE` 分离 `playwright-output-main|post-restart` 与 `playwright-report-main|post-restart`
- [x] 结果 JSON 分文件:`ui-acceptance-results.json`(main)与 `ui-acceptance-results-post-restart.json`;phase-state/secrets 仍共享
- [x] helper 契约测试 + `npm test` / `npm run build`
- [ ] 真实 UI-15 post-restart(本轮不做)
## 完成定义
- [x] 上述实现项有单测或脚本证据
- [ ] 现场 post-restart 仍开放,不得标 done
@@ -1,25 +0,0 @@
---
title: "项目 reviewer 职责同步收紧"
status: done
created: 2026-09-13
updated: 2026-09-14
related_task: "2026-09-13-document-revision-reviewer-duty-sync.md"
---
# 项目 reviewer 职责同步收紧
## 最后一轮严格修复
- [x] 移出成员后端 reconcile + `ERR_DUTY_SYNC`;前端 `afterProjectMemberPersisted` 刷新文档
- [x] Heal 空 assigned 仅清退出/非成员;在任成员保留;author 不清空
- [x] 显式 revoke:reviewer→viewer、职责转移、退出、幂等;author 不进撤销集
- [x] `CreateOrGetDocument` 失败任务不成功;fault test
- [x] 成员 upsert/退出:advisory lock、读旧/冲突 holder、成员更新、`document_records` 精确清槽同一事务;提交后 heal;失败 `ERR_DUTY_SYNC`
- [x] `HealProjectDocuments` 与成员写同锁键/顺序;解析与文档更新同事务;转移后旧 holder 不复活;第二次 heal 幂等
- [x] `gofmt` / `go vet` / `go test -short` / 相关 `-race` / `npm test` / `build` / 隔离 PG
- [ ] 真实 UI-13a(本轮不做)
## 完成定义
- [x] 上述实现项有测试或隔离 PG 证据
- [ ] 现场 UI-13a 仍开放,不得标 done
@@ -1,149 +0,0 @@
---
title: "文档版本账本运行时 — Ubuntu Server 无头浏览器真实 UI 验收计划"
status: done
created: 2026-09-13
updated: 2026-09-14
---
# 文档版本账本运行时 — Ubuntu Server 无头浏览器真实 UI 验收计划
> **与工程门禁分离**:本文件仅描述**用户限定的最终实战验收**(浏览器页面操作)。
> **严禁**用 API 直灌、DB fixture、`page.route` mock、stub 模型、或伪造 SSE 冒充小队完成。
> 工程单测 / `go vet` / `npm test` / `npm run build` 属于「工程门禁」,见 short-term 证据区,**不能替代**本计划。
## 0. 环境前置(必须占 CURRENT 集成槽位后执行)
| 项 | 要求 |
|----|------|
| OS | Ubuntu Server 22.04+(无图形桌面亦可) |
| 服务 | `./scripts/env-service.sh dev rebuild` → `curl -sf http://127.0.0.1:8080/health`;schema ≥ 28 |
| Agent | 真实 `pi-agent` + 运行中的 `MiniMax-M2.7-highspeed` 容器(禁止 stub) |
| 账号 | ≥2 名项目成员(编制人 A、协作者 B);禁止共用 token 串号;**管理员凭据仅来自 `ADMIN_USERNAME`/`ADMIN_PASSWORD` 环境变量(禁止 spec 硬编码)** |
| 认证契约 | 真实 login/me 返回 snake_case `role_id` 等;前端须映射为 `roleId`,否则管理员入口隐藏(UI-00 已踩坑,见 audit) |
| 用户目录 | 管理员开通 A/B 后,同浏览器立项成员候选须含新账号(`onRefreshUsers` 不得死 prop);跨设备缺口见 [../../audit/2026-09-13-admin-user-directory-sync-ui01.md](../../../audit/2026-09-13-admin-user-directory-sync-ui01.md) |
| 证据根 | `.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/` |
| 报告 | `.doc/test-reports/YYYY-MM-DD-document-revision-runtime-ui-test-report.md` |
### 0.1 Ubuntu Server 无头 Playwright(Round20 实际路径)
**本轮采用官方容器,无需给 Ubuntu host 安装浏览器:**
```bash
# 测试前部署合入基线(Round20:b258ab8)
./scripts/env-service.sh dev rebuild
curl -sf http://127.0.0.1:8080/health
# 官方镜像跑页面验收(host 网络;BASE_URL 指向工作台 :3100)
docker run --rm --network host --ipc host \
-e RUN_UI_ACCEPTANCE=1 \
-e BASE_URL=http://127.0.0.1:3100 \
-v "$PWD":/work -w /work/web \
mcr.microsoft.com/playwright:v1.63.0-noble \
npx playwright test e2e/document-revision-runtime.spec.ts --project=chromium
```
**备选(本轮未走)**:宿主 `cd web && npx playwright install --with-deps chromium`。仅当不能跑官方容器时使用。
### 0.2 两阶段(验收轮)
1. `RUN_UI_ACCEPTANCE=1 UI_PHASE=main BASE_URL=http://127.0.0.1:3100` 跑主场景(写 `phase-state.json`,密码仅落本地 `phase-secrets.local.json`,不得提交)。产物:`playwright-output-main` / `playwright-report-main` / `ui-acceptance-results.json`
2. 宿主仅 `restart shuimu-agent-app-dev` 一次(PG/PI 未动;不是再次 rebuild)
3. `RUN_UI_ACCEPTANCE=1 UI_PHASE=post-restart` 仅页面登录校验 UI-15。产物:`playwright-output-post-restart` / `playwright-report-post-restart` / `ui-acceptance-results-post-restart.json`(不得覆盖 main 总账或 trace)
4. 文档收口阶段不再动容器。
证据:`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/`(trace/video/screenshot);结果 JSON 不得含凭证与 URL query。
---
## 1. 数据来源铁律(FAIL 即整轮作废)
| 允许 | 禁止(一票否决) |
|------|------------------|
| 页面登录后创建项目 | `INSERT`/`psql` 灌 document_records / snapshots |
| 页面上传附件 | 测试进程直连 Postgres 插 fixture |
| 对话输入框真实提问触发小队 | `page.route` 劫持 `/api/v1/chat` 或 SSE 返回假成功 |
| 等待真实 runner 完成 | `AgentBackend=stub` 或 mock MiniMax |
| 打开生成的文档 Tab 观察 UI | API-only 调用 PATCH/OpenTemplate 冒充「用户操作」 |
---
## 2. 用例矩阵(全部必须页面可见)
| ID | 步骤(仅 UI) | 期望页面现象 | 证据 | 判定 |
|----|---------------|--------------|------|------|
| UI-01 | 管理员开通 B 后,tech-lead A **页面创建**项目并勾选成员 | 立项成员候选含 B;项目工作台三栏可见 | 截图 `01-project.png` | PASS |
| UI-02 | 对话输入框发起真实任务(触发真实小队编排) | 助手流式回复;任务进度/文档 busy 可见;网络可见真实 agent 请求 | 截图 + trace | PASS |
| UI-03 | 等待小队**首轮**完成,打开生成的受控文档 Tab | 右侧出现文档;版本工具条 `Vn`/`r*`(非「账本未就绪」) | 截图 `03-first-doc.png` | PASS |
| UI-04 | 打开变更报告:工具条「变更报告」/「待确认报告」或版本历史「报告」 | **首轮**可见:摘要、**风险条目**、项目影响内容、各文档影响原因/建议、开放问题;加载失败显式错误非永久加载中;`fallback` 不得宣称为完整 PI | 截图 `04-first-report.png` | PASS |
| UI-05 | 同项目再触发**二轮**更新生成(真实对话) | 低/中风险:新版本+报告;**高风险**:工具条显示「待确认报告」与 pending 徽章,**版本历史尚无新 V**,打开报告可见完整字段 | 截图 `05-second-report.png` | PASS |
| UI-05a | 编制人对高风险候选点「确认提交」 | decision API `confirmed:true`;版本前进;pending 消失;历史出现带 `change_report_id` 的新版本 | 截图+网络 | PASS |
| UI-05b | 编制人对高风险候选点「拒绝」 | 候选拒绝;pending 消失;版本号不前进;无权用户无确认/拒绝按钮或 decision 403 | 截图+网络 | PASS |
| UI-06 | 双击块编辑 → 保存 → **硬刷新** | 无冲突时工具条 `r` **立即**递增(`revisionRefreshKey`);硬刷新后正文仍为保存内容 | 截图前后对比 | PASS |
| UI-07 | 切换「纯净阅读」 | 块无琥珀/蓝色装饰底 | 截图 | PASS |
| UI-08 | 切换「人工修改」 | 相对当前 Version 的人工修订块琥珀底+下划线暗示 | 截图 | PASS |
| UI-09 | 切换「全部变更」 | 智能体+人工差异;仅人工时允许与 UI-08 相同 | 三模式并排或连续截图 | PASS |
| UI-10 | 「版本历史」+「比较」 | 抽屉列出版本;比较视图展示 hunk | 截图 | PASS |
| UI-11 | **多文档**:同项目再生成/打开第二份受控文档 + **页面上传**附件 Tab | 多 Tab 可切换;各文档 revision-state 独立;附件可预览 | 截图 | PASS |
| UI-12 | 用户 C 打开无权限项目(非成员) | 项目不可见,**不泄漏正文** | 截图 + 网络 403/404 | PASS |
| UI-13 | 拆为 13a reviewer 只读 + 13b A/A 同 r 冲突 | B 无正文编辑;A2 `409 DOCUMENT_HEAD_CONFLICT` 保留草稿 | 双 context 截图 | PASS |
| UI-14 | A 退出 → **重登录** → 打开同一文档 | revision-state 200;正文与 `r` 与退出前一致 | 截图 | PASS |
| UI-15 | (集成槽内)**重启 app 容器**后再打开同一文档 | 账本与正文仍可恢复;非「未就绪」除非确无事实源 | 截图 + `docker restart` 日志摘录 | PASS |
| UI-16 | 页面上传经 freeform 注册后打开;禁止 `doc-upload` 假账本 | 已注册 `doc-free-*` 工具条 V 可见;无 orphan revision-state | 截图 | PASS |
---
## 3. 证据要求(归档规范)
| 类型 | 路径约定 | 最低要求 |
|------|----------|----------|
| 截图 | `assets/.../screenshots/UI-XX-*.png` | 每用例 ≥1;UI-07/08/09 必须能看出三模式差异 |
| Trace | `assets/.../traces/UI-XX.zip`(Playwright trace) | 失败用例必留;PASS 建议全留 |
| 录像 | `assets/.../videos/*.webm` | 首轮生成 + 二轮报告 + 双人冲突 必留 |
| 网络摘录 | 报告正文粘贴关键响应 | `revision-state` 200;`change-reports` 含 summary/risk/open_questions;禁止贴 token |
报告正文每个用例必须含:**Input(页面操作)** / **Actual(可见文本+状态码)** / **Verdict PASS|FAIL** / **Duration**。
---
## 4. 失败标准(任一即 FAIL)
1. 使用 stub / `page.route` mock / DB fixture / 纯 API 灌库冒充 UI 路径
2. 首轮成功生成后仍无变更报告入口,或报告摘要为固定假句「智能体交付物已生成」;或报告面板缺少风险条目/项目影响/文档影响原因建议/开放问题
2b. 高风险二轮仅有小队成功文案但工具条无「待确认报告」、或未确认就静默进版本历史、或 `confirmed:false` 仍提交成功
3. 把 `analysis_status=fallback` 文案写成「PI 完整分析」或隐瞒开放问题
4. 人工保存返回成功但刷新丢正文,或投影失败仍 200
5. 三 overlay 视觉无差异(截图无法区分)
6. 双上下文后写静默覆盖
7. 无权限用户可见正文片段
8. 容器重启后受控已落盘文档仍永久「账本未就绪」(在确有 output.md / 记录的前提下)
9. 证据目录缺失或无法打开 trace/截图复盘
---
## 5. 通过标准
- UI-01…UI-16 全部 PASS,证据归档完整
- 工程门禁另栏 PASS(不记入本计划勾选)
- 已知 blocker `DOCREV-RT-PI-NARRATIVE`:允许 fallback,但必须可见真实 diff 摘要 + 开放问题标明叙事待补
- `DOCREV-RT-UPLOAD-ORPHAN`:UI-16 按空状态 PASS,不得伪造成功账本
---
## 6. 与工程门禁对照
| 类型 | 命令/产物 | 可否代替 UI 验收 |
|------|-----------|------------------|
| 工程 | `go vet ./...`;`go test -short ./...`;`cd web && npm test && npm run build` | **否** |
| PG 可选 | `TEST_DATABASE_URL=... go test ./internal/docrevision -run TestPGPersist` | **否** |
| 本计划 | Playwright 无头真实页面 + 真实小队 | **是(唯一最终)** |
## 7. 本轮状态
- Round20(2026-09-14)真实页面验收 **PASS**:results JSON 21/21;Playwright main 18 passed / 1 post skipped;仅 `restart shuimu-agent-app-dev` 后 post 1 passed / 18 skipped。
- 测试前 `env-service.sh dev rebuild` 部署 `b258ab8`;文档收口不再动容器。
- 项目 `UI验收-超声微创系统-mu0gwiez`(6159);intake `doc_proj6159_intake`;终态 V3/r2 / `A1-win-mu0gwiez`。
- 报告:[../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- Ubuntu 无头:`mcr.microsoft.com/playwright:v1.63.0-noble`(`--network host --ipc host`,`BASE_URL :3100`);本次无需给 host 装浏览器。宿主 `npx playwright install` 仅备选。
- 顶层截图 **21** 个文件:主阶段 20 张(含 UI-15-pre)+ post-restart 1 张;与 results JSON 21 条不是同一计数。
- 工程门禁另栏:`go test -short` / `go vet` / web 333+30 / build PASS;`-race` 全包并行 **NOT PASS**(`TestCreateTaskRun_PreActivationAcceptedNot409` TempDir cleanup)。
- 全仓仍 `production_ready=no`(`CHAT-INTENT` 等)。
@@ -1,57 +0,0 @@
---
title: "PG ID 重映射:Round20 后关闭"
created: 2026-09-13
updated: 2026-09-14
from: Cursor-Auto
to: next-agent
status: done
---
# 交接:PG ID 重映射(已合入并经 Round20 验证)
## 目标(下一位 Agent 应完成什么)
- 不要重开本缺陷,除非新现场再次出现 `CommitAgentVersion` not found
- 不要改删 Round19 失败归档
- 全仓焦点已离开文档运行时 UI;勿占用已释放的 DOCREV-RT 集成槽,除非新任务登记
## 已完成
- 统一 `advanceID` / `nextFreeID` / `adopt*ID`
- 隔离 PG 高序列首次生成:baseline 不丢、重启 hydration
- 合入 `dev@b258ab8`
- Round20 真实 UI-03:项目 6159 首次生成 V2/r0,不再 `docrevision: not found`
## 未完成
- 无(本缺陷)。PI 叙事 fallback 与 `CHAT-INTENT` 属其他条目
## 认领 / 槽位状态
| 项 | 值 |
|----|-----|
| mutex 已释放 | yes |
| 集成槽位 holder | idle(运行时 UI 收口后释放) |
| branch | 已合入 `dev`(`merge: fix/document-revision-pg-id-remap`) |
| worktree | - |
## 关键文件
| 路径 | 说明 |
|------|------|
| `internal/docrevision/ids.go` | counter / adopt |
| `internal/docrevision/pg_mutate.go` | PG 写入后 adopt |
| `internal/docrevision/pg_id_remap_test.go` | 隔离 PG 碰撞 |
## 如何验证
见 [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)。不要把 output snapshot 250 写成 candidate 250(6158 现场:candidate id=175、output snapshot id=250、report id=175)。
## 风险 / Blocker
- 不得把 `ErrNotFound` 改成忽略
## 相关链接
- CURRENT: [../CURRENT.md](../../../ops/CURRENT.md)
- Task: [../short-term/2026-09-13-document-revision-pg-id-remap.md](../2026-09-13-document-revision-pg-id-remap.md)
@@ -1,40 +0,0 @@
---
title: "post-restart 最终正文 snippet:Round20 后关闭"
created: 2026-09-13
updated: 2026-09-14
from: Cursor-Auto
to: next-agent
status: done
---
# 交接:post-restart 最终正文 snippet(已验证)
## 目标(下一位 Agent 应完成什么)
- 不要改删 `schema31-postrestart-stale-body-snippet-failure`
- 不要删除 post-restart `bodySnippet` 可见断言
- 新 UI 轮次必须继续把 UI-13b A1 成功正文写入 phase-state
## 已完成
- `durableBodySnippet`:成功修订覆盖;冲突稿不入账
- UI-13b / UI-15-pre 同步最终 marker
- Round20 post-restart:login / 项目 6159 / `revision-state` 200 / V3/r2 / `A1-win-mu0gwiez`
## 未完成
- 无(本缺陷)
## 认领 / 槽位状态
| 项 | 值 |
|----|-----|
| mutex 已释放 | yes |
| 集成槽位 holder | idle |
| branch | 已合入 `dev` |
| worktree | - |
## 相关链接
- Test report: [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- Task: [../short-term/2026-09-13-document-revision-post-restart-final-snippet.md](../2026-09-13-document-revision-post-restart-final-snippet.md)
@@ -1,70 +0,0 @@
---
title: "post-restart 项目名 selector:编码后交接"
created: 2026-09-13
from: Cursor-Auto
to: next-agent
status: done
updated: 2026-09-14
---
# 交接:post-restart 项目名 selector(暂不合入)
## 目标(下一位 Agent 应完成什么)
- 不要在本分支继续改职责/业务语义
- 合入前占 CURRENT 集成槽位;本轮禁止 merge / 重建容器 / 声称 post-restart 通过
- 占槽后重跑 `UI_PHASE=post-restart`,确认 UI-15 走到 revision-state
## 已完成
- post-restart:侧栏 exact title 点击 + banner exact 项目名断言
- Playwright 产物按 `UI_PHASE` 分目录,避免第二阶段覆盖主阶段
- 结果 JSON:main 仍写 `ui-acceptance-results.json`;post-restart 写 `ui-acceptance-results-post-restart.json`;`phase-state` / secrets 共享
- helper 契约测试;`npm test` / `npm run build`
## 未完成
- 真实 UI-15 post-restart
- 合入 `dev`
## 认领 / 槽位状态
| 项 | 值 |
|----|-----|
| mutex 已释放 | no(`document-revision-post-restart-selector` 仍 `in_progress`) |
| 集成槽位 holder | 他人 e2e;本任务未占槽 |
| branch | `fix/document-revision-post-restart-selector` |
| worktree | - |
> 若 mutex 未释放,下一位须先在 CURRENT 认领或写 blocker。
## 关键文件
| 路径 | 说明 |
|------|------|
| `web/src/lib/currentProjectRestore.ts` | 入口 / banner locator 契约 |
| `web/src/lib/playwrightPhaseArtifacts.ts` | 阶段目录名 |
| `web/e2e/document-revision-runtime.spec.ts` | post-restart UI-15 |
| `web/playwright.config.ts` | 分阶段 outputDir / HTML report |
## 如何验证
```bash
cd web && npm test && npm run build
# 真实 UI(本轮不做):
# RUN_UI_ACCEPTANCE=1 UI_PHASE=post-restart npx playwright test e2e/document-revision-runtime.spec.ts
```
产物:`playwright-output-main` / `playwright-report-main` / `ui-acceptance-results.json` 与 `playwright-output-post-restart` / `playwright-report-post-restart` / `ui-acceptance-results-post-restart.json`。`phase-state.json` 与 `phase-secrets.local.json` 跨阶段共享;`UI-15-post-restart.png` 可与主阶段截图同目录。
## 风险 / Blocker
- 侧栏折叠时 complementary 入口不可见,应 FAIL 而非 `.first()` 跳过
- 不得改删 schema31 失败归档
## 相关链接
- CURRENT: [../CURRENT.md](../../../ops/CURRENT.md)
- Task: [../short-term/2026-09-13-document-revision-post-restart-selector.md](../2026-09-13-document-revision-post-restart-selector.md)
- Checklist: [../checklists/2026-09-13-document-revision-post-restart-selector.md](../checklists/2026-09-13-document-revision-post-restart-selector.md)
@@ -1,73 +0,0 @@
---
title: "reviewer 职责同步:heal 同事务锁后交接"
created: 2026-09-13
from: Cursor-Auto
to: next-agent
status: done
updated: 2026-09-14
---
# 交接:reviewer 职责同步(暂不合入)
## 目标(下一位 Agent 应完成什么)
- 不要在本分支继续改职责语义,除非新审查点
- 合入前占 CURRENT 集成槽位,再 `--no-ff` 合 `dev`;本轮禁止 merge / 重建容器 / 声称 E2E
- 6145 的 B 仍是空 `document_duty`,须再走成员 API 写成 reviewer 后自愈才会对齐文档
## 已完成
- Heal 以 assigned 为权威;空 assigned 只清失效审核/批准 holder
- 成员增改/移出:同一事务内 advisory lock + 读旧/冲突 holder + 成员写 + 精确清 reviewer/approver 槽;提交后服务层 heal 新 holder
- `HealProjectDocuments` 与成员写共用 `pg_advisory_xact_lock(project_id)`;解析与文档读写同事务;错误回滚
- 确定性并发 PG:成员写持锁未提交时 heal 进入 `pg_locks` 等待;提交后旧 reviewer 不复活;第二次 heal 幂等
- 同步失败仍显式 `ERR_DUTY_SYNC`;author 不因普通成员变更清空
- 账本创建失败任务失败
## 未完成
- 真实 UI-13a
- 合入 `dev` 与共享容器 schema 31 晋升
## 认领 / 槽位状态
| 项 | 值 |
|----|-----|
| mutex 已释放 | no(`document-revision-reviewer-duty-sync` 仍 `in_progress`) |
| 集成槽位 holder | 他人 e2e;本任务未占槽 |
| branch | `fix/document-revision-reviewer-duty-sync` |
| worktree | - |
> 若 mutex 未释放,下一位须先在 CURRENT 认领或写 blocker。
## 关键文件
| 路径 | 说明 |
|------|------|
| `internal/docduty/revoke.go` | `AcquireProjectDutyLock`(与成员写同键) |
| `internal/docduty/store.go` | heal lock + 解析 + 回填同事务 |
| `internal/authz/authorizer.go` | upsert / setStatus 走同一 lock helper |
| `scripts/run-isolated-duty-sync-pg-tests.sh` | 隔离 PG 入口 |
## 如何验证
```bash
go test -short ./...
go test -short -race ./internal/docduty ./internal/authz ./internal/bizdev ./internal/server
cd web && npm test && npm run build
# 隔离库,禁止 agent_system_dev:
./scripts/run-isolated-duty-sync-pg-tests.sh
```
## 风险 / Blocker
- 旧项目未写 `document_duty` 时,在任成员仍留在文档槽位(有意兼容)
- 显式降级/退出才会撤 reviewer/approver;author 永不被 revoke
- 6145 B 不会被臆造为 reviewer
## 相关链接
- CURRENT: [../CURRENT.md](../../../ops/CURRENT.md)
- Task: [../short-term/2026-09-13-document-revision-reviewer-duty-sync.md](../2026-09-13-document-revision-reviewer-duty-sync.md)
- Checklist: [../checklists/2026-09-13-document-revision-reviewer-duty-sync.md](../checklists/2026-09-13-document-revision-reviewer-duty-sync.md)
@@ -1,49 +0,0 @@
---
title: "FEATURE-MATRIX 深度测试 + 晋升部署 test"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor-Auto
branch: feature/matrix-deep-test-promote-test
worktree: "-"
mutex: infra
---
# FEATURE-MATRIX 深度测试 + 晋升部署 test
## 目标
按 FEATURE-MATRIX 对已实现模块做分层深度回归,通过后将本地 `dev` 晋升到 `test`(`rc-v1.0.0-beta.2`)并 rebuild/冒烟 `:8081`。
## 范围
- Wave 1:vet/short/arch/npm/bundle + 模块定向 + 隔离治理 PG
- Wave 2:dev `:8080` live API 抽检
- Wave 3:真实 PI 抽样(失败再升格三链)
- Wave 4:`dev` → `test` + rebuild + smoke
- Wave 5:测试报告 + SSOT
## 非目标
- 不实现纯软件项目自举
- 不默认 28min 三工作流 PI;不合 `main`;不改项目 143;不启用 FAV
## 步骤
1. [x] 认领占槽
2. [x] 自动化深度回归
3. [x] live `:8080` 抽检
4. [x] PI 抽样
5. [x] 晋升 test 并冒烟
6. [x] 报告与归档
## 验收标准
- [x] 矩阵已实现行均有 PASS 证据
- [x] `:8081` health/ready schema=47;`test-env-smoke.sh` PASS
- [x] tag `rc-v1.0.0-beta.2`;报告归档
## 相关链接
- Plan: matrix_deep_test_promote
- FEATURE-MATRIX / CURRENT / gap-matrix
@@ -1,47 +0,0 @@
---
title: "发布门禁闭环 → production_ready"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor-Auto
branch: docs/production-ready-flip
worktree: "-"
mutex: ci
---
# 发布门禁闭环 → production_ready
## 目标
按 gap-matrix 发布门禁勾选 B1–B4,对齐环境 schema 后翻 `production_ready=yes`。
## 范围
- B1 CI TEST_DATABASE_URL + 治理 PG(已完成)
- B2 真实 PI 三工作流 E2E(已完成)
- B3 对话全链路恢复(已完成)
- B4 版本冲突/终止 preview(已完成)
- B5 SSOT 翻旗 + main schema 对齐(已完成)
## 非目标
- 多意图 U9–U12、软件项目自举、FAV、完整 PI change-report 叙事
## 步骤
1. [x] B1 BUG-08
2. [x] B2 PI E2E
3. [x] B3 chat refresh + restart
4. [x] B4 conflict + termination-preview + envelope unwrap
5. [x] B5 merge/smoke、main rebuild 迁库、翻旗
## 验收标准
- [x] gap 门禁四框可勾(含对话与前端)
- [x] FEATURE-MATRIX / gap / CURRENT `production_ready: yes`
- [x] main/dev/test health schema_version=47
## 相关链接
- Test reports: `2026-09-16-ci-governance-pg-bug08`、`pi-three-workflow-e2e`、`chat-refresh-gate`、`frontend-gate-b4`
- gap-matrix / FEATURE-MATRIX / CURRENT
@@ -1,48 +0,0 @@
---
title: "Wave 2B PU5B:nightly PI + promotion receipt"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor
branch: feature/wave2b-nightly-promotion-receipt
worktree: "-"
mutex: ci
---
# Wave 2B PU5B:nightly PI + promotion receipt
## 目标
落地夜间真实 PI 回归入口、不可变 promotion receipt,以及晋升脚本强制校验;same-image digest 晋升本轮仅做到 same-commit + digest 可追溯。
## 范围
- promotion receipt 写/校验 + waiver
- nightly-real-pi.yml + run-nightly-real-pi.sh
- git-workflow-helper / promote-to-test / release-to-main 门禁钩子
- 报告与 FEATURE-MATRIX / remediation 同步
## 非目标
- compose 按 digest pull 的同镜像晋升流水线
- Playwright 双标签;升 MULTI_INTENT tier
## 步骤
1. [x] 认领 + 开分支
2. [x] receipt 写/校验脚本
3. [x] nightly workflow + 本机脚本
4. [x] 晋升钩子
5. [x] 报告 + 合入 dev
## 验收标准
- [x] 缺 secret/runner → infra_fail,晋升拒绝
- [x] product_fail → 晋升拒绝
- [x] pass receipt → 晋升可过;无 receipt → 非零退出
- [x] 报告归档(`.doc/test-reports/2026-09-16-wave2b-nightly-promotion-receipt-test-report.md`)
## 相关链接
- Remediation PU5B: `../../remediation/2026-09-16-feature-matrix-production-readiness-plan.md`
- Test report: `../../test-reports/2026-09-16-wave2b-nightly-promotion-receipt-test-report.md`
@@ -1,41 +0,0 @@
---
title: "Wave 2C:同 digest 镜像晋升"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor
branch: feature/wave2c-same-image-digest
worktree: "-"
mutex: infra
---
# Wave 2C:同 digest 镜像晋升
## 目标
候选 commit 一次构建;test/main 按 receipt digests 启动;pinned 禁止 rebuild 另造镜像。
## 范围
- candidate-images-build/apply
- compose + env-service pinned
- promote/release 钩子 + receipt --require-digests
- nightly digests 对齐
## 非目标
- 远程 registry;升 tier;Playwright;U8 quality_failed(Phase 3)
## 步骤
1. [x] 认领 + 开分支
2. [x] build/apply + check digests
3. [x] compose/env-service/hooks
4. [x] nightly align
5. [x] 报告合入
## 验收标准
- [x] PASS receipt 含 digests;apply 后 ID 一致
- [x] pinned rebuild 不换 ID(env-service 拒绝 --build)
- [x] 缺 digest 拒绝晋升
@@ -1,26 +0,0 @@
---
title: "Wave 3 PU6–PU8 go/no-go 文档任务"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor
branch: feature/wave3-pu6-pu8-go-no-go
worktree: "-"
mutex: architecture-docs
---
# Wave 3 PU6–PU8 go/no-go 文档任务
## 目标
完成 PU6–PU8 产品 go/no-go 记录与获批后契约;未获批不实施。
## 步骤
1. [x] 调研 go/no-go 总文
2. [x] PU6–PU8 / U9–U12 契约
3. [x] 勾 DoD + 矩阵/CURRENT 同步 + 合入
## 相关链接
- Research: `../research/2026-09-16-wave3-pu6-pu8-go-no-go.md`
@@ -1,43 +0,0 @@
# Commit SHA 重写对照表(2026-09-13)
> **背景**:2026-09-13 将 358 个线性 `dev` commit 按 14 个功能史诗重放为 `feature/*` / `fix/*` + `merge --no-ff` 拓扑(策略 A)。
> **代码树**:`git diff backup/pre-rewrite-2026-09-13 dev` 为空——HEAD 实现与重写前一致。
> **旧线性历史**:本地保留于分支 `dev-old-linear` 与 tag `backup/pre-rewrite-2026-09-13`。
## 对照规则
- 匹配键:`subject | author | email | committer date`(重写前后一致)
- 下列「旧 SHA」来自 `dev-old-linear`;「新 SHA」来自重组后 `dev`
- 6 条缺 scope 的 message 已在重写中修正(如 `fix:` → `fix(quality):`)
## 关键引用(checklist / test-report)
| 旧 SHA | 新 SHA | 说明 |
|--------|--------|------|
| `d27b0ad` | `ee18e54` | 首 commit → `docs(ops):` 建立仓库基础架构 |
| `31fe607` | `0d10c9a` | AGENTS / PROJECT / CLAUDE 入口 |
| `d82021e` | `3b7b49c` | AUTH tasks/run + stream |
| `b13ced6` | `8c5dd97` | DB 00025 种子序列 |
| `91985a2` | `3d09bd6` | Go 质量门禁(message 修正为 `fix(quality):`) |
| `505c419` | `0547bd5` | HTTP 超时 + env status 只读 |
| `8f3aa0f` | `c605993` | pi-agent MiniMax 模型对齐 |
| `abd0893e` | `f75e509` | StepEvaluator 实现 |
| `bb3f3a1` | `73bf082` | pi-agent E2E v5 PASS |
| `99e0d4a` | `096dc8a` | long-task recovery UX |
| `56fb318` | `d03d939` | chat SSE wiring scope |
| `33b1b8b` | `511864b` | doc taxonomy scaffold |
| `5e5bc1f` | `f30886e` | 策略 A 分支规范 |
## 新历史拓扑
- 1 个 root anchor + 358 原子 commit + 14 个 `merge --no-ff` = **373 commit**
- 史诗清单:[`scripts/history-epic-manifest.tsv`](../../../scripts/history-epic-manifest.tsv)
- 重放脚本:[`scripts/rewrite-history-epics.sh`](../../../scripts/rewrite-history-epics.sh)
## 全量映射生成
```bash
python3 scripts/generate-commit-rewrite-map.py > /tmp/full-map.tsv
```
(脚本随 `feature/chore-history-rewrite` 一并入库)
@@ -1,55 +0,0 @@
---
title: "管理员开通账号后立项成员候选缺失(UI-01)"
status: done
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# 管理员开通账号后立项成员候选缺失(UI-01)
## 现象
Antigravity 真实 UI:UI-00 管理员入口已 PASS。UI-01 产品失败——管理员经 UI 成功创建账号 B,但 tech-lead A 打开「新建项目」时成员候选列表中无 B。
## 根因分析
1. `AdminSettingsModalProps` 已声明 `onRefreshUsers`;`App` 已传入 `getAdminUsers → setAllUsers`。
2. 组件 **destructuring 漏掉** `onRefreshUsers`,成为死 prop。
3. 模态内 `refreshUsers()` 仅 `setAdminUsers`,创建/角色/状态成功后从未同步父级 `allUsers`。
4. `CreateProjectModal` / `ProjectMembersModal` 的 `availableUsers` 来自 App `allUsers`(并经 `saveUsers` 写入 localStorage),故同会话内立项候选仍是旧目录。
5. 附带:App 原 `onRefreshUsers` 用 `.catch(() => {})` 静默吞错,即使接线也会掩盖同步失败。
## 严重度
`high`(同浏览器管理员开通后立项立刻缺人;阻断 UI-01)
## 本轮修复(本任务范围内)
- 抽出可测 helper:`web/src/lib/adminUserDirectorySync.ts`(缺 `onRefreshUsers` / 父级抛错均 fail-closed)
- `AdminSettingsModal` 正确 destructure;创建/角色/状态/审批/重置后 `await refreshUsers()`;同步失败对用户可见
- `App` `onRefreshUsers` 改为 async 上抛,禁止静默
## 残留审计风险(本任务不越权补齐)
| 风险 ID | 说明 | 为何本轮不修 |
|---------|------|--------------|
| **DOCREV-RT-USER-DIR-CROSS-DEVICE** | 立项成员目录仍以浏览器 `allUsers`/localStorage 为事实源。tech-lead 在**新设备 / 清缓存 / 从未在本机跑过管理员同步**的会话中,即使服务端已有 B,本地候选仍可能只有 MOCK/`loadUsers` 缓存。非管理员无 `GET /api/v1/admin/users` 权限。 | 安全补齐需**非 admin 的成员目录/搜索 API**(最小权限、按项目或组织范围),属授权面扩展;禁止把 admin users API 下放给 tech-lead。 |
相关代码锚点:`App.tsx` `availableUsers={allUsers}`;`storage.loadUsers`/`saveUsers`;服务端仅 `GET /api/v1/admin/users`。
## 关联整改
- Short-term: [../ops/short-term/2026-09-13-document-revision-runtime.md](../archive/ops/2026-09-13-document-revision-runtime.md)
- Checklist: [../ops/checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](../archive/ops/checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
- 前序 auth 映射: [2026-09-13-auth-useraccount-snake-case-mapping.md](./2026-09-13-auth-useraccount-snake-case-mapping.md)
## 证据
- 实战:UI-00 PASS;UI-01 创建 B 后 A 立项候选无 B
- 代码:`AdminSettingsModal` 原未解构 `onRefreshUsers`;App 静默 catch
- 单测:`web/src/lib/adminUserDirectorySync.test.ts`(死 prop / 父级错误上浮)
## 开放问题
- 跨设备成员目录 API(见上表)→ 记入 short-term blocker,勿用 admin API workaround
@@ -1,39 +0,0 @@
---
title: "Auth UserAccount snake_case 契约漏映射导致管理员入口隐藏"
status: done
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# Auth UserAccount snake_case 契约漏映射导致管理员入口隐藏
## 现象
真实浏览器 UI-00(Antigravity):管理员登录后左侧「系统管理」入口不可见,无法开通 A/B 账号。控制台侧 `currentUser.roleId` 为 `undefined`(服务端实际返回 `role_id: "role-admin"`)。
## 根因分析
- Go `auth.UserAccount` JSON 标签为 snake_case:`role_id` / `employee_id` / `must_change_password` / `created_at` / `updated_at`。
- 前端 `AuthClient` 将 login / me / admin users 响应直接当作 camelCase `UserAccount` 使用,未在 API 边界映射。
- 既有单测使用内存 `auth.local` 或驼峰假响应,未覆盖真实 wire 契约,故漏检。
- `BootstrapAdminFromConfig` 对已存在非 admin 账号调用 `UpdateUserRole` 时静默忽略错误(`_, _ =`),可能留下非 `role-admin` 管理员配置账号。
## 严重度
`high`
## 关联整改
- Short-term: [../ops/short-term/2026-09-13-document-revision-runtime.md](../archive/ops/2026-09-13-document-revision-runtime.md)
- Checklist: [../ops/checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](../archive/ops/checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
## 证据
- UI-00 实战:管理员登录后无系统管理入口(roleId undefined)
- `internal/auth/models.go` UserAccount json tags
- `web/src/api/auth.ts` 原直接 `resp.json()` 赋给 UserAccount
## 开放问题
- 无(映射层 + bootstrap 错误上浮已落地;占槽后需重跑 UI-00 验证管理员入口)
@@ -1,99 +0,0 @@
---
title: "刷新后对话正文消失但统计仍存在"
status: done
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# 刷新后对话正文消失但统计仍存在
## 现象
用户在项目会话中可以正常与助手对话并生成文档;页面刷新后,消息正文区域显示为空,但顶部分类过滤和右侧分类锚点仍显示消息数量及首尾消息 ID。
结论:**消息没有从数据库删除,而是在刷新后的服务端历史恢复链路中被阶段权限过滤器全部剔除。统计接口没有应用同一权限范围,因此仍返回未过滤的数量和锚点。**
## 根因分析
### 1. 刷新前与刷新后使用不同消息来源
- 刷新前,`web/src/App.tsx:1634-1656` 中的组件内 `messages` 保存本轮实时消息,`useChatWindow` 将它们合并到画面。
- 刷新后,组件内 `messages` 从空数组重新开始,正文依赖 `GET /api/v1/chat/messages/window` 恢复。
- `web/src/hooks/useChatWindow.ts:112-120` 只要服务端返回非空 `days`,就用返回桶覆盖窗口和本地缓存;即使桶中的 `messages` 已被过滤为空也照常覆盖。
因此,实时画面正常不代表历史恢复链路正常。
### 2. 文档任务消息没有绑定工作流阶段
- 普通聊天路径会在 `internal/chat/session.go:267-274,425-438` 把 `ActiveStageKey` 写入用户与助手消息的 `metadata.stage_key`。
- 文档生成使用的异步任务路径在 `internal/server/task_run_handlers.go:81-96` 只写入 `project_id`、`client_turn_id`、`task_key`、`task_status`,没有写 `stage_key`、`workflow_instance_id` 或 `stage_instance_id`。
- 任务完成投影 `internal/server/task_finalize.go:58-85` 仍未补这些作用域字段。
这使得文档任务在当前页面可见,但重载后无法通过阶段可见性判定。
### 3. 工作流激活前的历史也会被追溯性隐藏
- `internal/server/stage_access_helpers.go:135-163` 在项目进入受限工作流后,明确丢弃所有 `metadata.stage_key` 为空的历史消息。
- `internal/projectinstance/stage_access.go:15-77` 根据当前 live 实例计算可见阶段;策略一旦进入 `Restricted=true`,激活前产生、天然没有阶段键的消息也无法恢复。
- `StageKeyAllowed("")` 本身在 `internal/projectinstance/stage_access.go:103-108` 返回允许,但外层过滤器在调用它之前已经对空阶段执行 `continue`;现有单测只验证前者,没有覆盖组合行为。
这不是合理的“拒绝越权”,而是缺少对 `pre_activation/legacy` 对话作用域的正式建模。
### 4. 统计与正文的授权口径分裂
- 窗口和按日正文在 `internal/server/chat_window_api.go:48-50,104-106` 应用阶段过滤。
- 分类与日期统计在同文件 `111-155` 直接查询并返回原始统计,没有会话所有权校验,也没有阶段过滤。
- `internal/ctxmgr/chat_window.go:622-749` 的 SQL 对会话内全部未删除消息聚合,返回数量及 `MIN/MAX(id)`。
- 前端 `CategoryFilterBar` 使用这些服务端统计显示数量;`CategoryDock` 还以统计中的首尾 ID 作为锚点兜底。因此正文为空时,数量与锚点仍存在。
此外,所有这些端点虽由全局中间件要求登录,但窗口、日期、分类等端点没有统一调用 `assertSessionOwnedByUser`。这会造成私聊会话对象级授权不一致,并可能泄露其他会话的消息存在性、分类数量和消息 ID。
## 运行态证据(dev,2026-09-13)
只读查询 `shuimu-context-pg-dev/agent_system_dev`:
| 项目/会话 | 结果 |
|---|---|
| project `143` | 创建者 user `9`,live instance `89`,active stage `V0.1_triage` |
| session `sess-p143-u9` | 共 4 条未删除消息,4 条正文长度均大于 0 |
| 激活前消息 `431-432` | 创建于 instance `89` 之前,无 `stage_key` |
| 文档任务消息 `433-434` | 创建于激活之后,`task_key=intake`,仍无 `stage_key` |
| 过滤结果 | 4 条均命中“空 stage_key → 丢弃”,窗口日桶保留但消息数组为空 |
| 分类统计 | 仍按全量 4 条聚合,可返回数量及首尾 ID |
全库当前有 live 工作流实例的会话消息统计也显示:所有命中的消息均缺少 `stage_key`。这说明不是单条偶发数据,而是写入链路缺字段与历史兼容策略共同造成的系统性问题。
## 严重度
`high`,并应作为发布 blocker:
- 核心对话记录在刷新/重新登录后不可用,用户会误认为数据丢失;
- 文档任务的对话留痕无法恢复,破坏可审计性;
- 正文、搜索、日期、统计、锚点的授权集合不一致;
- 分类数量和消息 ID 可在对象级授权不完整时形成侧信道泄露。
## 关联整改
- Remediation: [../remediation/2026-09-13-chat-history-refresh-remediation.md](../remediation/2026-09-13-chat-history-refresh-remediation.md)
- Short-term: [../archive/ops/2026-09-13-chat-history-refresh-remediation.md](../archive/ops/2026-09-13-chat-history-refresh-remediation.md)
- Gap matrix: [../remediation/gap-matrix.md](../remediation/gap-matrix.md)
## 证据
- `web/src/App.tsx:1634-1656,3393-3506`
- `web/src/hooks/useChatWindow.ts:81-170,446-578`
- `web/src/api/chatWindow.ts:73-164`
- `internal/chat/session.go:267-280,425-468`
- `internal/server/task_run_handlers.go:76-108`
- `internal/server/task_finalize.go:58-96`
- `internal/server/stage_access_helpers.go:135-212`
- `internal/server/chat_window_api.go:12-155`
- `internal/ctxmgr/chat_window.go:39-174,622-749`
- dev PostgreSQL 只读查询(未读取或落盘消息正文)
- 相关测试通过但缺场景:`go test -short ./internal/server -run 'TestServer_ChatWindow' -count=1 -v`、`go test -short ./internal/ctxmgr -run 'TestChatWindow' -count=1 -v`、`cd web && npm test`
## 开放问题
- 激活前项目私聊应默认仅对会话所有者可见,还是按项目成员和退出留痕策略共享,需要在实现前固化为策略测试;本方案建议保持现有“每人独立私聊”语义,优先按会话所有者授权。
- 历史上若同一 `task_key` 在多个工作流实例/阶段重复出现,不能仅按当前模板名称盲目回填,必须结合运行实例、创建时间和不可变实例 ID;无法唯一归属的数据应标记为 `legacy_unscoped` 并走显式兼容策略。
@@ -1,106 +0,0 @@
---
title: "小队完成未同步受控文档状态 + UI-03 选择器非 Tab + Retry 暴露 DB 约束(UI-03)"
status: done
created: 2026-09-13
updated: 2026-09-13
severity: critical
---
# 小队完成未同步受控文档状态 + UI-03 选择器非 Tab + Retry 暴露 DB 约束(UI-03)
## 1. 现场实战概况与判定
在真实 UI 验收(`UI_PHASE=main`,dev 环境 `schema 29`,真实 `pi-agent` + `MiniMax-M2.7-highspeed`):
- **UI-00 PASS**(4.9s):管理员真实创建 A/B/C,准确按 DOM 作用域关闭模态,三用户完成首次登录改密。
- **UI-01 PASS**(774ms):A 页面立项并分配 B 为 reviewer,项目工作台就绪,零 404,模板预览正确。
- **UI-02 PASS**(191ms):真实发任务,`POST /api/v1/tasks/runs` 返回 202 Accepted,小队编排启动;真实模型耗时约 157 秒完成编排,后端成功生成受控文档 `doc_proj6089_user_requirements`(质量评分 100/100)。
- **UI-03 FAIL**:`await expect(page.locator('[data-testid="doc-rev-version"]')).toBeVisible({ timeout: 60_000 });` 超时失败。
- **页面真实状态**:页面已明确显示小队任务完成,正文标出 `📄 受控文档:doc_proj6089_user_requirements`。
- **右栏面板状态**:右栏仍保持为 `doc-p intake` 初始模板(`用户初始需求收集表 模板`,`模板预览:首轮编制后启用版本账本`),版本工具条 `[data-testid="doc-rev-version"]` 根本未挂载。
- **UI-04 ~ UI-16**:**NOT RUN**(因 UI-03 失败立即停机保全现场,未执行后续用例)。
---
## 2. 根因与现场异常分析
### A. 产品缺陷:前端在小队完成后未同步工作流文档列表
1. **服务端已落库受控文档**:
后端 `document_records` 表已落库 `doc_id="doc_proj6089_user_requirements"`,`is_template_only=false`,`current_state="drafting"`。且前端每 5 秒发起的轮询 `GET /api/v1/projects/6089/documents?category=workflow` 已正确返回该受控文档记录。
2. **`syncLeases` 轮询丢弃新文档**:
在 `web/src/App.tsx` 第 1664–1697 行,每 5 秒执行的 `syncLeases` 仅提取 `doc.lease_holder_type` 并更新既有 `doc.docId` 的租约。由于本地 React 状态 `deliverables` 初始仅有 `doc-p6089-*` 模板,`leases.has(doc.docId)` 匹配不上 `doc_proj*`,新文档从未被合并进 `deliverables`。
3. **`syncWorkflowDocs` 依赖项未触发**:
在 `App.tsx` 第 1618–1661 行,`syncWorkflowDocs`(调用 `mergeWorkflowDocumentsFromServer`)仅在 `currentProjectId` 或 `session` 变动时执行;同一会话内小队完成不会触发该 effect。
4. **流式结束 `case 'done'` 遗漏文档同步**:
在 `App.tsx` 第 2571–2593 行,任务流完成时仅调用了 `await chatWindow.refresh().catch(() => undefined)`(仅刷新聊天消息),未同步工作流文档列表。
5. **连锁阻断工具条挂载**:
前端 `deliverables` 中的 `user_requirements` 一直是 `isTemplateOnly: true`。根据 `revisionToolbarMountMode` 契约,`isTemplateOnly === true` 时返回 `'template_hint'`,阻断 `DocumentRevisionToolbar`(`[data-testid="doc-rev-version"]`)挂载。
### B. 测试脚本缺陷:定位器假设水平 Tab 且命中页头 Banner 徽章
1. 在 `web/e2e/document-revision-runtime.spec.ts` 第 538 行:
`const tab = page.locator('[role="tab"], button, div').filter({ hasText: /需求|摸底|URS|用户/ }).first();`
2. **穿透到页头徽章**:
`[role="tab"], button, div` 包含全局所有 `div`。页面顶部 Header Banner 含有 `当前项目: ... V0.1 需求摸底`(`div` 元素)。`.first()` 命中了该非交互的 Banner 徽章 `div`,根本没有点击文档切换器。
3. **真实 UI 为下拉/抽屉交互**:
`SlimTabBar.tsx` 为面包屑下拉(`button.dropdown-trigger` -> `.dropdown-menu`)或大盘抽屉(`DeckDrawer`),页面不存在水平文档 Tab。
### C. 前端断线自动重试与 DB 约束异常暴露
1. **前端断线自动重试导致同 turn 二次触发(非 Playwright retries)**:
`web/playwright.config.ts` 中 **`retries: 0`**。现场 13:02 完成首轮后,13:05 再次出现同 prompt 处理中,根因是前端 `runTaskAttempt` 在连接异常路径上自动重试,且重试开头 `setRunId(null)` / 未显式传递 `reconnectRunId`,导致重复 `POST /tasks/runs` 而非订阅既有 run:
- 13:02:`TRIGGER_TASK 请基于本项目编制首轮...` → `《用户需求表》已生成。当前状态:已完成`
- 13:05:同 turn 自动重试路径再次进入处理中(工程修复:`reconnectRunId` 跨 attempt + Claim 幂等)
2. **暴露 `task_runs` 状态约束缺陷**:
在二次运行与高风险候选流转路径中,后台服务尝试将 `task_runs.status` 更新为 `pending_author_confirmation` 时,暴露了数据库底层约束拦截:
goose **`00019`** 原始 `chk_task_run_status` 仅允许:
```sql
CHECK (status IN ('pending', 'running', 'completed', 'failed', 'cancelled', 'finalizing_failed', 'quality_failed', 'interrupted'))
```
该枚举**未包含** `pending_author_confirmation`,导致写入状态时触发 PostgreSQL check constraint 违规(由 goose `00030` 补齐)。
---
## 3. 严重度与阻断
- **严重度**:`critical`
- **阻断项**:
1. 产品前端:`App.tsx` 在小队完成(`case 'done'`)以及定期轮询中必须调用 `mergeWorkflowDocumentsFromServer` 动态更新受控文档。
2. 数据库约束:`task_runs` 表的 `chk_task_run_status` 约束必须补齐 `pending_author_confirmation`。
3. 测试脚本:修正 UI-03 文档切换定位器,禁止使用全局 `div` 通配,走真实 `SlimTabBar` 下拉或 `DeckDrawer` 动作;关闭非幂等的单用例重试。
---
## 4. 证据保全清单
- **归档路径**:`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/ui03-controlled-doc-sync-failure/`
- `playwright-output/`(含完整 `trace.zip`、`test-failed-1.png`、`error-context.md`)
- `playwright-report/`(HTML 完整执行报告)
- `screenshots/`(UI-00~UI-02 真实过程截图)
- `traces/`、`videos/`
- `ui-acceptance-results.json`(UI-00~UI-02 逐项 PASS 记录)
- `phase-secrets.local.json`、`phase-state.json`
- 历史归档目录全部原位保全:
- `post-auth-ui00-backdrop-click-failure/`
- `post-auth-ui00-close-selector-failure/`
- `post-auth-ui00-wrong-close-locator-failure/`
- `pre-auth-fix-ui00-failure/`
- `ui01-parent-directory-sync-failure/`
- `ui01-strict-mode-title-selector-failure/`
- `ui02-task-scope-409-failure/`
- `ui02-workflow-access-failure/`
---
## 5. 工程修复落盘(`fix/document-revision-runtime-ui03`,合入前)
| 根因 | 修复 | 门禁 |
|---|---|---|
| A 任务完成后未 merge 受控文档 | `pollUntilPostTaskServerDoc` + `deliverablesRef` 显式快照(禁止 setState updater 取 mergedSnap)+ 有限重试至 `doc_proj*` | focused + `npm test` / `build` |
| A′ intake vs URS 误匹配 | `templateMatch`:**intake 标记优先**于裸「用户需求」 | 单测 PASS |
| B UI-03 选择器命中 Banner | SlimTabBar/DeckDrawer;`data-chat-role/status` + 本轮 assistant sibling 等待;UI-11 禁止全局 div | 待真实 UI 重跑 |
| C `pending_author_confirmation` 约束 | goose `00030` 扩展 `chk_task_run_status`(相对 **00019** 枚举) | 真实现卷迁移合入前独立验证 |
| C′ 断线自动重试重复 POST | `reconnectRunId` 显式跨 retry;`ClaimRun`;`GetRun` 读回 `idempotency_key`;`StartClaimedRun` UpdateRun 失败不启 worker | `go test -short ./internal/taskrun` |
**未做**:占槽 rebuild、真实 UI UI-03 重验、schema30 对现有重复 `(session_id,client_turn_id)` 卷的迁移实测。
@@ -1,71 +0,0 @@
---
title: "真实会话被调试探针污染、查询误触发写任务与刷新状态退化"
status: done
created: 2026-09-13
updated: 2026-09-13
severity: critical
---
# 真实会话被调试探针污染、查询误触发写任务与刷新状态退化
## 现象
- 用户在“对话协同会话”中看到 `test` 等非本人业务输入,多次任务失败。
- “总结一下用户初始需求表”没有读取/总结已有文档,而是启动 `intake` 写任务。
- 实时失败卡片带恢复动作;刷新后只剩错误正文,重试/继续/重新开始能力消失。
- 文档被智能体小队编辑期间,页面没有持续、醒目的占用状态,用户继续工作后才从失败中得知冲突。
## 根因分析
### 1. 诊断请求写入了真实用户会话
dev PostgreSQL 的 `sess-p143-u9` 在 03:17–03:32 记录了 `debug ping`、`test task`、`test`、`验证租约修复`。这些请求带有 `debug-turn-*` 等诊断标识,并与真实用户消息混排。结论不是“意图模型把输入改成 test”,而是调试过程直接复用了真实会话和项目 143,污染了审计记录与 UI。
### 2. 前端用名词命中代替动作意图识别
`web/src/engine/templateMatch.ts` 的 `resolveTaskKeyFromMessage` 只要文本包含“需求/用户”等名词就返回 `intake` 或 `user_requirements`。`App.tsx` 在聊天请求进入后端意图识别前先执行该匹配,并直接调用 `/api/v1/tasks/runs`。因此查询句“总结一下用户初始需求表”被确定性误判为写任务。
这不是模型偶发误判,而是客户端关键词捷径绕过了服务端意图合同;现有测试只覆盖“开始编写”,没有任何“总结/查看/当前状态/谁在编辑”等只读负例。
### 3. 结构化失败状态只存在于实时 SSE
实时路径把 `error_info`、`taskRequest`、`phaseEvents` 保存在 React 内存消息中;失败投影到 `chat_messages` 时只持久化 `run_id/workspace_id/task_status` 和错误正文。`mapRecordToMessage` 刷新恢复时也只依据 `task_status` 还原 `failed`,没有恢复 `errorInfo.actions`、原始任务请求或事件进度,导致 `MessageBubble` 无法渲染重试/继续/重新开始按钮。
### 4. 编辑租约存在,但不是可恢复的页面状态
`task_run_events` 已保存 `lease_acquired/lease_released`,`document_records` 也保存 `lease_holder_type/id/expires_at/heartbeat_at`。但 `App.tsx` 的任务事件处理只消费 `phase/status/delta/deliverable/error/done`,忽略 `governance`;刷新历史也不回放运行中任务事件。租约提示只可能短暂出现在内部数据,不能驱动会话、文档列表和编辑器的统一 busy 状态。
### 5. 文档忙被错误分型为系统内部错误
并发请求因有效租约拒绝时,事件被分类为 `INTERNAL_ERROR/fatal/actions=[restart]`,用户看到“系统内部错误,请重新开始会话”。实际是可预期的 `DOC_BUSY` 状态;除正确分型外,还必须在创建 `task_runs` 之前做服务端 busy 预检,持久化“未创建新任务”的只读状态卡,且不提供重试动作。
### 6. dev restart 不会加载新代码,健康检查可对旧镜像误报通过
`env-service.sh dev restart` 调用的是 `docker compose restart`;应用代码未挂载进容器,因此该命令只重启旧镜像。第一次修复后真实验证仍返回旧的 `CASUAL_CHAT`,但 `/health` 与 `/ready` 都为绿色。重建 app 镜像后,同一句话才返回 `QUERY_DOC_STATUS/doc_summary`。已新增显式 `rebuild` 动作,并将集成冒烟命令改为 `dev rebuild`。
## 严重度
`critical`:真实会话污染破坏可审计性;只读请求触发写入违反用户意图;刷新丢失恢复能力;后台编辑不可见导致重复劳动和冲突。
## 关联整改
- Remediation: [../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md](../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md)
- Short-term: [../ops/short-term/2026-09-13-conversation-intent-runtime-state.md](../ops/short-term/2026-09-13-conversation-intent-runtime-state.md)
## 证据
- dev PostgreSQL:`chat_sessions.id=138/session_id=sess-p143-u9/project_id=143/user_id=9`
- `chat_messages.id=554..567`:诊断探针、误路由与失败投影
- `task_runs.run_id=run_1789269755258510844`:03:22–03:32 持有租约;并发请求均因 busy 失败
- `task_runs.run_id=run_1789270446838831656`:由“总结一下用户初始需求表”启动的新写任务
- `task_run_events`:租约获取/释放与 `INTERNAL_ERROR` 分型
- `web/src/engine/templateMatch.ts`
- `web/src/App.tsx`
- `web/src/api/chatWindow.ts`
- `internal/taskrun/manager.go`
- `scripts/env-service.sh`(`restart` 与 `rebuild` 语义)
## 开放问题
- 已污染的四条诊断消息是否由项目创建者确认后做可审计软删除;本任务不擅自修改用户数据。
- 误启动的最新任务是否保留其产物;本任务不擅自取消或删除。
@@ -1,48 +0,0 @@
---
title: "当前受控文档改写被领域关键词改路由到另一交付物"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# 当前受控文档改写被领域关键词改路由到另一交付物
## 现象
第二轮真实 UI(schema 30)**UI-05 首个失败**:
- 页面打开 `doc_proj6109_intake`(用户初始需求收集表,V2/r0)
- 用户输入含「当前受控文档」的高风险改写提示(YY/T、GB 9706.1、NMPA 注册法规)
- 前端按法规关键词路由为 `feasibility_reg`
- `POST` 启动 `run_1789313290400899325`,生成 `doc_proj6109_feasibility_reg` 并 `completed`
- 当前 intake **无 pending badge**;E2E 等待 60s 失败
## 根因分析
| 层 | 问题 |
|---|---|
| `resolveTaskKeyFromMessage` | 写动词「改写」通过后,正文「注册」命中 `feasibility_reg`,无视当前打开文档 |
| `handleSendMessage` | 只把文案+模板池交给 `resolveTaskTemplateForMessage`,未传入 active `doc_proj` |
| 产品 | 「当前受控文档/本文件/这份文档」是指示语,领域词是改写内容,不是切换交付物 |
服务端 `ResolveAndValidateDocID` 已校验 project + task_key 与已注册文档一致,**不得**用客户端 `doc_id` 覆盖 `task_key`。本轮补了 `feasibility_reg` + `doc_proj6109_intake` mismatch 拒绝用例:攻击或误路由不得借 intake 文档改写另一任务键。
## 严重度
`high`
## 关联整改
- Short-term: [../ops/short-term/2026-09-13-document-revision-active-doc-routing.md](../archive/ops/2026-09-13-document-revision-active-doc-routing.md)
- 分支: `fix/document-revision-active-doc-routing`
## 证据
- Evidence root(勿删、勿提交本轮):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05-active-doc-routing-failure`
- E2E:`web/e2e/document-revision-runtime.spec.ts` UI-05(断言不改弱)
- 审查约束:E2E/用例提示词只留在 test 文件,生产 `templateMatch.ts` 不导出用例编号常量
## 开放问题
- 占槽后真实 UI-05 重跑;本轮不操作容器
@@ -1,45 +0,0 @@
---
title: "UI-06 用 overlay/p/h 选择器找不到真实文档块"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# UI-06 用 overlay/p/h 选择器找不到真实文档块
## 现象
第六轮真实 UI(schema 30):
- UI-00~05b **PASS**
- UI-06 在 `editFirstPaneBlockAndSave` 里对 `[data-overlay-kind], p, h1, h2` **双击前超时**
- 失败页正文真实存在;工具条版本徽章可见
## 根因分析
| 层 | 问题 |
|---|---|
| DOM | `BlockRenderer` 块 wrapper 是 generic `div`;`HeadingBlockView` / `ParagraphBlockView` 也不是 `h1`/`p` |
| overlay | `data-overlay-kind` 仅在非 `pure` 且命中 hunk 时出现;默认 `pure` 模式该属性不存在 |
| 脚本 | `openFirstPaneEditorAndFill` 依赖 overlay 装饰或原生标题/段落标签,与产品 DOM 契约不符 |
这是 **UI 自动化可寻址缺口**,不是正文未加载。继续用 overlay 选择器会误点标题栏/骨架/报告,或在 pure 模式直接超时。
## 严重度
`high`
## 关联整改
- Short-term: [../ops/short-term/2026-09-13-document-revision-e2e-block-selector.md](../archive/ops/2026-09-13-document-revision-e2e-block-selector.md)
- 分支: `fix/document-revision-e2e-block-selector`
## 证据
- Evidence root(已归档、本轮勿提交):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-block-selector-failure/`
- `ui-acceptance-results.json`:UI-00~05b PASS;UI-06 未写入 PASS
## 开放问题
- 占槽后真实 UI-06/13b 重跑;本任务保持 `in_progress`,不得标 `done`
@@ -1,48 +0,0 @@
---
title: "UI-13a 用整行 option 文案误判编制负责人"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# UI-13a 用整行 option 文案误判编制负责人
## 现象
第16轮真实 UI(schema 30,`dev@dd5671e`):UI-00 至 UI-12 PASS;分类导航修复已实证,UI-13a 已能从「我的私密」切回「流程受控」并打开 reviewer B 权限矩阵。
失败在职责断言:`intakeRow.innerText` 被整行匹配,报 `reviewer B must not be 编制负责人`。实际 `innerText` 为:
`V0.5 用户初始需求收集表当前打开 状态: drafting ✍️ 编制负责人 🔍 审核负责人 👑 批准负责人 👁️ 查阅者 (只读) 前往`
## 根因分析
| 层 | 问题 | 后果 |
|---|---|---|
| 职责单元格 | `onRoleChangeForDoc` 存在时渲染 `<select>`,四个 option 文案都在 DOM | `element.innerText` 含全部 option |
| 验收 | `/编制负责人/.test(整行文本)` | 审核人行也被判成编制负责人 |
| 控件语义 | select/badge 无稳定 `data-testid` / `data-doc-role` | 脚本只能刮行文案 |
select 的 `value` 才是当前职责。USER_B 在 UI-01 被明确分配 reviewer:验收必须证明 `role=reviewer`,不得把职责同步丢失降级成的 `viewer` 判通过。select 还须 `data-can-assign=false` 且 `disabled`;`canAssignLead=true` 一律拒绝。
## 严重度
`high`
权限矩阵已打开,真实只读检查未跑到就被假阳性打断。
## 关联整改
- Remediation: [../remediation/2026-09-13-document-revision-duty-cell-assertion.md](../remediation/2026-09-13-document-revision-duty-cell-assertion.md)
- Short-term: [../ops/short-term/2026-09-13-document-revision-duty-cell-assertion.md](../archive/ops/2026-09-13-document-revision-duty-cell-assertion.md)
- 分支: `fix/document-revision-duty-cell-assertion`
## 证据
- 失败证据(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui13a-duty-cell-assertion-failure/`
## 开放问题
- 本轮不重跑真实 UI-13a;不得标 E2E 通过或任务 `done`
- 独立审查:不得用 `reviewer|viewer` 宽判;`evaluateReviewerDuty` 只接受精确 reviewer
@@ -1,58 +0,0 @@
---
title: "文档职责伪造与保存时重取 ETag 可覆盖并发正文"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: critical
---
# 文档职责伪造与保存时重取 ETag 可覆盖并发正文
## 现象
静态审查与 E2E UI-13 路径暴露两类产品缺陷:
1. **职责提升**:审核人 B 或项目外陌生人打开受控文档后,工作台把其当成编制人,出现正文编辑 / 送审动作。
2. **并发覆盖**:两窗口同开同一修订时,后保存方在点击保存瞬间重新 GET 最新 ETag,If-Match 对准已更新账本,409 不会出现,先保存方的正文被静默覆盖。
## 根因分析
| 层 | 问题 | 风险 |
|---|---|---|
| API | `ListWorkflowDocumentsByProject` / `GET projects/{id}/documents` 的 summary 不投影 `document_records` 的 author/reviewer/approver id+name | 前端无权威职责,只能猜 |
| 前端 merge | `mergeWorkflowDocumentsFromServer` 用当前登录用户名伪造 `author`,审核/批准写死「李主管」「王总监」 | B 登录后 `author===自己`,权限矩阵显示编制人 |
| 角色解析 | `currentDocRole` 比 name,失败默认 `'author'` | 未知身份 fail-open,陌生人获得编辑/送审 |
| 保存 | `handleSaveBlockEdit` 在 PATCH 前 `getRevisionState` 取最新 ETag | 打开时基线被丢弃;后写覆盖先写 |
| E2E | UI-13b 在 A1 完整保存后才打开 A2 编辑器 | 不是真实竞争,无法钉住上述 ETag 缺陷 |
独立审查补强(同一分支):
| 层 | 问题 | 风险 |
|---|---|---|
| PATCH | `resolvePatchEtag` 在 controlled 缺基线时仍返回 `0:0` | 服务异常被当成合法 bootstrap,可能覆盖已有账本 |
| hydrate | revision-state 5xx/网络失败只写 undefined 仍返回可编辑 AST | 用户能改正文,保存再 PATCH `0:0` |
| 批注 | viewer 被 cast 为 reviewer/approver,`canAnnotate` 对 viewer 开放 | 查阅者可新增评审批注 |
| 职责 | `isLegacyLocalDoc = !ids`:服务端 duty id 为 0 仍走 name fallback | 同名用户被提权为编制人 |
安全含义:职责伪造是**越权写**(viewer/reviewer 可改受控正文并送审)。ETag 刷新或 `0:0` 误用是**完整性破坏**。viewer 批注是**越权写元数据**。
## 严重度
`critical`
## 关联整改
- Remediation: [../remediation/2026-09-13-document-revision-duty-etag-overwrite.md](../remediation/2026-09-13-document-revision-duty-etag-overwrite.md)
- Short-term: [../ops/short-term/2026-09-13-document-revision-e2e-reject-routing.md](../archive/ops/2026-09-13-document-revision-e2e-reject-routing.md)
- 分支: `fix/document-revision-e2e-reject-routing`
## 证据
- 代码(修复前):`internal/docgov/project_docs.go` summary 无职责列;`web/src/lib/deliverableSync.ts` `author: fallbackUser.name`;`web/src/App.tsx` 默认 `'author'` 与保存前 `getRevisionState`
- 单测钉住:B/陌生人不成 author;stale hydrate ETag 用于 PATCH
- 补强单测:controlled 缺 ETag/5xx 不可保存或不可打开;freeform 可 `0:0`;viewer 不能批注;服务端 duty id=0 不按 name 提权
- 本轮不跑真实 E2E、不提交 evidence assets
## 开放问题
- 占槽后真实 UI-13a/13b 重跑;CURRENT 仍 `in_progress`,不得标 `done`
@@ -1,51 +0,0 @@
---
title: "UI-05b 缺当前受控文档指示语被路由到 feasibility_reg"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# UI-05b 缺当前受控文档指示语被路由到 feasibility_reg
## 现象
第五轮真实 UI(schema 30)**UI-05b 首个失败**:
- UI-00~05a PASS(含第四轮「待确认报告」真实打开)
- UI-05b 等待 `doc-rev-pending-badge` 60s 超时
- Prompt 为「请再次按医疗器械临床试验与注册检验法规,重写电磁兼容与软件生存周期章节…」,**没有**「当前受控文档《用户初始需求收集表》」
- 助手实际生成《注册路径可行性评估报告》`doc_proj6120_feasibility_reg`,状态 `completed`
- 原 intake `doc_proj6120_intake` 工具条为 V3/r0、「变更报告」,**无 pending**
项目 `UI验收-超声微创系统-mu01100b`。
## 根因分析
| 层 | 问题 |
|---|---|
| Prompt | 缺「当前受控文档」指示语;「注册检验法规」命中 `feasibility_reg` 关键词 |
| 产品路由 | 无 deixis 时按领域词选任务,这是既有契约;本轮**不改产品** |
| 脚本 | 未在 `sendChat` 前等待并校验本轮 `POST /api/v1/tasks/runs` 的 `task_key`/`doc_id`,失败时才在 pending 徽章上暴露 |
同轮审查:UI-10 点全局工具条「比较」冒充历史比较;UI-12 接受「项目可见但只查一个 marker」;UI-13 把立项审核人 B 当正文第二编辑者。
## 严重度
`high`
## 关联整改
- Short-term: [../ops/short-term/2026-09-13-document-revision-e2e-reject-routing.md](../archive/ops/2026-09-13-document-revision-e2e-reject-routing.md)
- 分支: `fix/document-revision-e2e-reject-routing`
## 证据
- Evidence root(勿删、勿提交本轮):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05b-reject-routing-failure`
- Playwright:`playwright-output/document-revision-runtime--bc8cd-date-→-reject-version-stays-chromium/error-context.md`
- 结果:`ui-acceptance-results.json`(UI-05a PASS;UI-05b 未写入 PASS)
## 开放问题
- 占槽后真实 UI-05b 起重跑;本轮不操作容器、不重跑 E2E
- 脚本收紧后状态仍为 `in_progress`,真实重跑前不得 `done`
@@ -1,60 +0,0 @@
---
title: "UI-06 编辑弹窗打开期间 hydration 换块 ID 导致保存静默丢稿"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# UI-06 编辑弹窗打开期间 hydration 换块 ID 导致保存静默丢稿
## 现象
第十二轮真实 UI(schema 30,dev@4c465d2 基线):
- 双击正文块、fill 标记、点击「保存修改」动作均成功,编辑器随后关闭
- 30 秒内修订仍为 **r0**
- 网络 trace 中 `PATCH /api/v1/documents/.../content` **数量为 0**
- 动作 monotonic:dblclick 611755–611807;fill 611860–611910;save 611917–611979
- 恰在 fill 开始时,后台 `GET /api/v1/docgov/documents/doc_proj6140_intake/content` 于 **611862.379** 发起并完成 hydration
本轮不是选择器点错按钮(第七轮 save-selector),而是保存路径在客户端被静默短路。
## 根因分析
| 层 | 问题 | 后果 |
|---|---|---|
| AST 身份 | `markdownToBlockAST` / `generateId()` 明确 `Math.random()`,每次 parse 新建 `blk_*` | 弹窗持有打开时的块 ID,当前 `docAST` 已是新 ID |
| hydrate 丢账本 | `fetchRevisionState` 依赖被窄化为 `Promise<{etag:string}>`;`buildControlledDocumentAST` 之后**没有** `applyHeadBlockMap(rev.st.head_block_map)` | 服务端已有稳定块身份,前端每次 hydration 仍随机换 ID |
| 保存 | `handleSaveBlockEdit` 按 `updated.id` 在 `docAST.rootBlock.children` 查找;`idx === -1` 时 `setEditingBlock(null)` 后 return | 关窗、不发 PATCH、无提示 |
| hydration 触发 | `useEffect([session, sessionValidated, activeDocId, deliverables])` 在 lease/工作流同步改 `deliverables` 时重跑 | fill 窗口打出新 GET |
| 迟到响应 | hydrate `.then` 无 generation / 编辑门闩 | 弹窗打开后或 PATCH 成功后仍可覆盖编辑基线(即使 ID 已对齐,也会回滚新正文) |
| 会话绑定 | 只按块 ID 保存;`activeDocId` 可被 canonical/session/任务流改写,不经 `handleSelectDoc` | 可能对另一份文档发 PATCH,或块 ID 碰巧对上 |
| 关窗续跑 | 编辑中拒绝/跳过的首次 hydrate,effect 依赖不再变化 | 关窗后可能永久停在 loading skeleton |
| 切文档 | `handleSelectDoc` 在编辑中静默 `closeBlockEditor` | 草稿被丢;modal 虽 `fixed inset:0 zIndex 100` 挡住 SlimTabBar,但 chat/drawer 等仍会调 `handleSelectDoc` |
`deliverables` 被 5s lease 同步、任务完成后 `syncControlledDocsAfterTask`、工作流列表合并(清 cache)以及 governance 事件改写。任一变化都会在编辑期间再拉正文并换块身份。
## 严重度
`high`
用户可见「已保存」(弹窗关闭),账本仍 r0。属于静默丢稿,不是提示后的失败。
## 关联整改
- Remediation: [../remediation/2026-09-13-document-revision-editor-hydration-race.md](../remediation/2026-09-13-document-revision-editor-hydration-race.md)
- Short-term: [../ops/short-term/2026-09-13-document-revision-editor-hydration-race.md](../archive/ops/2026-09-13-document-revision-editor-hydration-race.md)
- 分支: `fix/document-revision-editor-hydration-race`
## 证据
- 失败证据目录(根代理保留、本轮不得改/移/删/提交):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-r-bump-noop-failure/`
- Playwright 断言:`[data-testid="doc-rev-revision"]` 30s 内仍为 `r0`
## 开放问题
- 本轮只做前端门闩与单测/构建验证;**未跑真实 UI-06**,不得标 E2E 通过或任务 `done`
- 关窗后的下一次 deliverables 驱动 hydrate 仍会重建块 ID(编辑会话已结束;缺 map 时仍随机,门闩已消费)
- **首次 hydrate 在 `editor_open` 被拒后会卡 skeleton**:可达(骨架块可双击,或清 cache 后编辑中跳过 GET)。关窗时 `takeHydrationResume()` 递增 `hydrateResumeKey` 重跑 effect。
- modal 不能硬保证挡死所有 `handleSelectDoc`;编辑中切文档 fail-closed,不静默关窗。
@@ -1,47 +0,0 @@
---
title: "UI-11 快速 completed 被验收脚本误判为失败"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# UI-11 快速 completed 被验收脚本误判为失败
## 现象
第14轮真实 UI(schema 30,`dev@339e871`)在 **UI-11** 失败:页面上传附件并发送「请将此附件归档」后,相邻助手卡片已快速处于 `completed`(文案:已收录补充材料并关联黑板)。
`waitForSquadCompletion` 默认 `requireInflight=true`,用 Playwright `toHaveAttribute` 硬等 `pending|streaming_status|auto_retrying` 60 秒。收到的属性已是 `completed`,被当成 unexpected value,60s 后 FAIL。产品终态成功,验收误判。
## 根因分析
| 层 | 问题 | 后果 |
|---|---|---|
| 验收契约 | `requireInflight !== false` 默认为必须先看到处理中 | 快路径成功被 60s 超时打死 |
| Playwright 匹配 | `toHaveAttribute` 对已是 `completed` 的节点持续重试同一错误匹配 | 日志里 123 次 resolved 到 completed 仍等 inflight |
| UI-03 先例 | 已用 `{ requireInflight: false }` 避开同类竞态 | UI-11 未沿用,默认仍硬等 |
| 真实性 | 现场助手无错误、用户句与相邻卡片对应、上传已走 freeform | 不得放宽上传/对应关系/终态/无错误,只改观测顺序 |
证据 `error-context.md`:Locator 命中 `data-chat-status="completed"`,Expected `/pending|streaming_status|auto_retrying/`。
## 严重度
`high`
真实成功轮次被脚本误杀,阻断后续 UI-12+。
## 关联整改
- Remediation: [../remediation/2026-09-13-document-revision-fast-completion-observation.md](../remediation/2026-09-13-document-revision-fast-completion-observation.md)
- Short-term: [../ops/short-term/2026-09-13-document-revision-fast-completion-observation.md](../archive/ops/2026-09-13-document-revision-fast-completion-observation.md)
- 分支: `fix/document-revision-fast-completion-observation`
## 证据
- 失败证据(只读,不得改/移/删/提交):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-fast-completion-observation-failure/`
## 开放问题
- 本轮不重跑真实 UI-11;不得标 E2E 通过或任务 `done`
- 处理中状态仅作可选观测,不作为成功必要条件
@@ -1,105 +0,0 @@
---
title: "文档修改、版本差异与智能体变更说明能力缺口分析"
status: done
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# 文档修改、版本差异与智能体变更说明能力缺口分析
## 1. 结论
系统已有受控文档生命周期、编辑租约、正文 SHA-256、审计日志、智能体变更提案、自由文档版本表和阶段通知 Outbox,可作为本能力的基础;但当前尚不存在可信的“受控文档版本库”。受控正文仍以工作区单个 `output.md` 为事实源,人工或智能体更新会覆盖现状,无法复原任一历史正文,也无法可靠回答“谁在何时基于哪个智能体版本改了什么”。
本需求不能通过前端缓存一份旧正文后做颜色标记来完成。必须把不可变正文快照、以智能体生成为边界的版本周期、每次已提交人工修改、精确 diff、智能体变更报告和负责人通知放入同一个服务端一致性模型。
## 2. 用户规则的确定性解释
用户描述中的“版本以智能体修改为准”按以下语义实现:
1. 模板或一次成功提交的智能体/智能体小队产物,是一个版本周期的 `baseline`。
2. 此后所有人工保存都形成该版本下的 `revision`,改变当前 `head`,但不增加面向用户的版本号。
3. 下次智能体基于当时的 `head` 生成成功后,旧版本以该 `head` 封存;智能体输出成为新版本的 `baseline`。
4. “人工修改标记”永远计算为当前版本 `baseline → head`。智能体新版本生效后该标记归零,后续只显示相对新 baseline 的人工修改。
5. 两个版本的默认比较使用各版本的最终内容:已封存版本取 `sealed_head`,当前开放版本取实时 `head`;智能体自身的改动单独用“上一版本最终内容 → 新版本 baseline”表达。
该解释既满足“模板/上一次智能体生成 + 下一次智能体生成前人工修改为一个版本”,也不会把每次自动保存误展示成一个正式版本。
## 3. 已确认的现有基础
| 能力 | 当前证据 | 可复用部分 |
|---|---|---|
| 受控文档元数据 | `deploy/postgres/goose/00001_baseline.sql:230-280` | `document_records`、三权、状态、当前 SHA、版本号 |
| 编辑互斥 | `internal/docgov/lease.go:41-180` | human/squad 租约、心跳和忙状态 |
| 人工保存入口 | `internal/docgov/lease.go:290-360` | 编制人/状态校验与 `expected_sha256` 乐观锁 |
| 智能体修改授权 | `internal/docgov/engine.go:448-577`、`internal/bizdev/service.go:451-538` | 已认领文档先提案、编制人裁决 |
| 智能体执行归属 | `internal/squad/models.go:35-95,216-226` | 小队角色、步骤、manifest 与工作区信息 |
| 自由文档版本 | `internal/freedoc/service.go:416-535` | 事务、`FOR UPDATE`、每次保存快照与 If-Match |
| 文档血缘 | `deploy/postgres/goose/00010_2026-09-11-project-workflows-and-lineage.sql:66-84` | 上下游文档版本、哈希和 stale 传播 |
| 可靠通知基础 | `deploy/postgres/goose/00018_2026-09-12-outbox-notifications-stage-advance.sql`、`internal/notification/service.go` | Outbox、用户通知、去重键 |
| 右侧块编辑器 | `web/src/components/doc/BlockRenderer.tsx`、`BlockEditorModal.tsx` | 块级阅读、编辑、批注和右侧栏布局 |
## 4. 已确认缺口
| ID | 缺口 | 当前证据 | 后果 |
|---|---|---|---|
| DOCREV-01 | 受控正文没有不可变历史快照 | `ReadDocumentContent` 只读取当前工作区 `output.md`;`document_records.version` 没有对应的受控版本表 | 不能查看旧版本、恢复证据或验证历史哈希 |
| DOCREV-02 | 人工保存只覆盖文件和当前哈希 | `SaveDocumentContent` 写 `output.md` 后更新 `document_records`,不增加版本/修订记录;数据库错误还被忽略 | 无法记录具体修改人和前后正文;文件与 DB 可分裂 |
| DOCREV-03 | 前端块编辑尚未持久化 | `handleSaveBlockEdit` 只修改 React `docCache`;`saveDocumentContent` 没有调用者;编辑弹窗把修改人硬编码为“张工” | 刷新丢失、归属不可信、展示与服务端不一致 |
| DOCREV-04 | 智能体完成只更新当前哈希 | `internal/bizdev/service.go:694-705` 只调用 `SetDocumentWorkDir` 和 `MarkDocumentContentUpdated` | 不能把 run、输入快照、输出快照和版本关联 |
| DOCREV-05 | 现有提案不是实际 diff | `service.go:499-502` 在智能体执行前写入通用文案,未绑定真实 before/after | 不能作为生成完成后的改动摘要、风险或影响证据 |
| DOCREV-06 | 块锚点不稳定 | `markdownToBlockAST` 每次解析使用随机 `blk_*` ID | 刷新或换版本后不能稳定定位修改块、批注和 diff |
| DOCREV-07 | 自由文档“每次保存一个版本”与本需求语义不同 | `freedoc.UpdateDocument` 每次正文变化都 `current_version_id + 1` | 同一右侧栏内“版本”概念不一致,自动保存会制造版本噪声 |
| DOCREV-08 | 通知只覆盖阶段推进 | `notification/types.go` 只有 stage-ready 类型;前端仅 `StageAdvanceBanner` 消费 | 文档负责人不会收到智能体版本摘要、风险和影响 |
| DOCREV-09 | 内容修改链路的一致性和授权边界不足以支撑审计 | 租约 API 接受客户端 holder type/id;部分 DocGov 入口只认证后直接调用领域引擎;当前锁主要是进程内 mutex | 多实例、伪造 holder、并发提交时可能发生越权或静默覆盖 |
## 5. 根因分析
### 5.1 “当前文档”同时承担事实源、工作副本和历史版本
`document_records` 的 `version` 和 `content_sha256` 只是当前指针;`output.md` 同时被智能体工作区、人工编辑和读取 API 使用。缺少 immutable snapshot 后,审计日志只能证明发生过一个动作,不能证明动作前后内容。
### 5.2 版本、修订、生命周期三种概念没有拆开
- 智能体生成版本:本需求要求的业务版本边界;
- 人工保存修订:高频、可聚合展示,但必须逐次留痕;
- 送审/批准快照:生命周期冻结点。
当前单个 `version` 整数无法同时表达三者,继续叠加字段会导致比较对象含糊。
### 5.3 UI 的 Block AST 是临时视图,不是稳定编辑协议
Markdown 每次解析都会重新生成随机块 ID;编辑 metadata 由浏览器填写,既不能作为服务端身份,也无法跨快照追踪。需要由服务端产生稳定 block map,并由 immutable snapshot 保存。
### 5.4 智能体说明与确定性事实没有分层
智能体适合解释“为什么改、有哪些风险”,但真实增删内容必须由服务端 diff 得出,上下游影响必须由工作流/血缘图计算,风险等级也不能允许模型自行降级。当前变更提案把三者都存为自由文本,且没有版本关联。
## 6. 严重度
`high`
该能力尚未对外承诺为已实现,因此不是现有数据破坏事件;但若仅增加 UI 高亮便宣称完成,会形成错误审计证据,并在多人/多智能体协作下引入静默覆盖、错误归属和不完整通知。
## 7. 设计边界
- 受控工作流文档与自由文档继续使用各自权限/生命周期策略;只共享底层快照、修订和 diff 能力。
- Markdown 正文为规范化内容真源,Block AST 是带稳定映射的编辑/展示投影,避免双真源。
- 未保存的浏览器按键不属于审计记录;每次服务端成功提交才是 revision。
- 批注、审核意见与正文修改是不同事件,不混入人工正文高亮。
- 已批准内容不可原地修改;后续修改必须经受控变更/驳回回编制流程创建新工作周期。
## 8. 关联整改
- System design: [../system-design/document-revision-management.md](../system-design/document-revision-management.md)
- Remediation: [../remediation/2026-09-13-document-revision-management-implementation-plan.md](../remediation/2026-09-13-document-revision-management-implementation-plan.md)
- Short-term: [../ops/short-term/2026-09-13-document-revision-management-design.md](../archive/ops/2026-09-13-document-revision-management-design.md)
## 9. 开放问题
方案给出推荐默认值,等待评审时确认:
1. 高/严重风险的智能体候选是否一律要求编制负责人再次确认后才成为新版本(推荐:是)。
2. 首期是否同时迁移自由文档到“智能体版本 + 人工修订”语义(推荐:底层统一,UI 第二波启用)。
3. 历史快照默认保留期限(推荐:受控文档随项目/法规保留策略;自由文档默认 365 天且可配置,不做静默硬删除)。
@@ -1,45 +0,0 @@
---
title: "UI-07 纯净阅读用 overlay/class*block 找不到真实块"
status: in_progress
created: 2026-09-13
updated: 2026-09-13
severity: high
---
# UI-07 纯净阅读用 overlay/class*block 找不到真实块
## 现象
第八轮真实 UI(schema 30):
- UI-00~UI-06 **PASS**(UI-06 `r0→r1` 且硬刷新持久)
- UI-07 `captureOverlayFingerprint(mode=pure)` 抛 `no block to sample computed style`
## 根因分析
| 层 | 问题 |
|---|---|
| DOM | `BlockRenderer` 真实块是 `data-testid=document-block` 的 generic wrapper;无 `class` 含 `block` |
| overlay | `data-overlay-kind` 仅在 `overlayMode !== 'pure'` 且 hunk 命中时出现;纯净阅读该属性不存在 |
| 脚本 | pure 取样 `[data-overlay-kind], [class*="block"]`;manual/all 全页 `[data-overlay-kind]`,未限定活动文档 |
`ManualChangeOverlay` 只是工具条 hint,不是块装饰。块装饰是同一 wrapper 上的 inline style。
同一 human hunk 在 manual/all 都是琥珀底,产品不保证两两不同。Checklist:UI-07 无装饰、UI-08 琥珀标记、失败标准是「三 overlay 视觉无差异」,不是强制 manual≠all。
## 严重度
`high`
## 关联整改
- Short-term: [../ops/short-term/2026-09-13-document-revision-e2e-overlay-selector.md](../archive/ops/2026-09-13-document-revision-e2e-overlay-selector.md)
- 分支: `fix/document-revision-e2e-overlay-selector`
## 证据
- Evidence root(已归档、本轮勿提交):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-pure-selector-failure/`
## 开放问题
- 占槽后真实 UI-07/08/09 重跑;本任务保持 `in_progress`,不得标 `done`

Some files were not shown because too many files have changed in this diff Show More