Commit Graph
67 Commits
Author SHA1 Message Date
weichenandCursor da15eb91b6 feat(infra): Wave 2C same-image digest pin for test/main promote
Build/apply candidate images once, require digests on promote, and keep
pinned env-service from rebuilding divergent images.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 14:44:26 +00:00
weichenandCursor 3b80582123 fix(pi-agent): stabilize real PI three-workflow E2E harness
Use shared DATA_DIR permissions (umask/chmod) and drop obsolete sync
notify asserts so governance PG PI chains can complete on MiniMax runner.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 04:11:54 +00:00
weichenandCursor c741d26eeb fix(db): add goose 00047 to retire demo project chat sessions
Dev already applied 00046 (projects only) before session retirement
was folded into that file; 00047 closes the gap idempotently.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 03:14:59 +00:00
weichenandCursor fbda195b7f fix(db): retire demo chat sessions with projects in 00046
Extend unapplied migration to mark 6001–6010 sessions demo_retired
and filter them (and retired projects) out of ListChatSessions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 03:12:25 +00:00
weichenandCursor bdc6415944 fix(db): retire goose-seeded demo projects from lists
Mark projects 6001–6010 as demo_retired and exclude them from default
project list queries so demo seeds no longer pollute real workspaces.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 02:50:34 +00:00
weichenandCursor cf063f5727 feat(db): add intent plan projection shadow tables
Store idempotent event outcomes and an only-forward shadow without replacing plan SSOT.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 00:46:09 +00:00
weichenandCursor 7dfd6d6f33 feat(db): add intent plan tables in goose 00044
Persist plans, steps, and append-only decisions with typed CAS, lease, and nonce columns.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 23:43:37 +00:00
weichenandCursor 0a61cfbe90 feat(agent): add typed-result-v1 and fail-closed remote parser
Remote /v1/run now emits additive result_v1; Go validates run_id, digest, and paths before materializing, and only accepts missing typed payloads with an explicit legacy handshake.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 15:25:18 +00:00
weichenandCursor 21d7692c94 feat(db): record unique projection outcomes per envelope version
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:59:54 +00:00
weichenandCursor 28bb0b8356 feat(db): correlate stage-ready requests to envelope event_id
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:43:09 +00:00
weichenandCursor 6702b16249 feat(db): correlate notifications to envelope event_id for unique visible outcomes
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:26:36 +00:00
weichenandCursor 6bee7630bd feat(service): run the event dispatcher as an independent cmd/events process
HTTP Runtime does not start the worker. Each compose environment gets its own events service, health port, and bounded pool.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:08:15 +00:00
weichenandCursor 5fd5588a3f feat(db): add dispatcher attempts, consumer modes, and checkpoints
E0B needs an additive lease audit trail and a cluster-level off/shadow/live table before any worker can claim. FAV remains constrained to off.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 09:08:15 +00:00
weichenandCursor 97305d699e feat(db): add event inventory, repair audit, replay plans, and service principals
E0A needs additive tables for classification and per-consumer identities before any dispatcher can claim work. FAV principals are rejected at the schema check.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 08:52:19 +00:00
weichenandCursor 5ac14d649b feat(db): add goose 00038 dataset lifecycle tables
Registry、checkpoint queue 与 destroy 请求表属主 dataset;必须可 Down,不改历史 Goose。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 02:31:34 +00:00
weichenandCursor eb75f855a5 feat(db): add goose 00037 task_run_manifests
Persist typed RunManifest bytes and SHA per run, and allow a finalizing status so U8 can freeze a unique terminal without sharing env databases.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 02:05:33 +00:00
weichenandCursor c7e3e99303 feat(artifactvault): extract audited FAV with union-deny reads
Goose 00036 is a renumbered copy of the vault tables. Degraded read stays off by default and only runs after authorization; tombstones and unpublished artifacts fail closed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 15:59:36 +00:00
weichenandCursor f27059b453 feat(events): add durable envelope delivery and drop commit OnOutbox
Agent commits append a validated envelope inside the command unit of work. SKIP LOCKED is only used to claim, and stale fencing plus integrity failures go to quarantine or dead-letter.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 15:59:24 +00:00
weichenandCursor 18ddd0f862 feat(workspace): add WorkspaceRef fencing and hide physical paths
Cross-module callers get an opaque ref plus rotating lease tokens so stale writers fail closed, and file I/O is refused inside a unit of work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 15:59:14 +00:00
weichenandCursor 68fee06da4 feat(db): allow blocked_pending_governance task run status
Pre-activation 202 runs must persist without hitting chk_task_run_status.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 08:39:44 +00:00
weichenandCursor e7b46e92d2 feat(db): allow migration_repair snapshot and event kinds
00028 check constraints would reject a real PG apply. Add goose 00032
with Up/Down so repair snapshots can persist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 02:21:44 +00:00
weichenandCursor 2f0a1b337c fix(docduty): treat assigned duty as authoritative on heal
Align document slots to project document_duty even when the wrong ID is
an active member, and fail generate/list instead of returning stale
placeholder duties. Owner author backfill now picks creator, else lowest ID.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 22:16:36 +00:00
weichenandCursor 6cd3991bad feat(db): store document duty on project members
Project access roles cannot carry reviewer. Persist a separate exclusive document_duty so later controlled docs can inherit the assigned reviewer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 21:57:43 +00:00
weichenandCursor 369fe7bf51 fix(pi-agent): copy settle-policy into the runner image
runner.mjs imports ./settle-policy.mjs but the Dockerfile only copied
runner.mjs, which crashed shuimu-pi-agent-dev on import. COPY the
runtime module and assert every relative import is in the image set.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 19:29:34 +00:00
weichenandCursor 051e69ccd1 fix(pi-agent): clear recovered SDK transients before settle
auto_retry_end success=true now drops providerTransient and lastErr so
a later agent_settled can succeed when the in-process retry landed a
real target. A new error after recovery still fails.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 19:25:41 +00:00
weichenandCursor 35b2e922bf fix(deploy): keep official templates in the image build context
*.md was excluding templates/docs from Docker context, so COPY and
go:embed could not see prelim_design.md at /app. Un-ignore those trees
and assert the smoke image can cat the official file.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 19:21:56 +00:00
weichenandCursor 11bdba0052 fix(pi-agent): treat exhausted SDK retry plus settle as failure
agent_settled after terminated or auto_retry_end success=false is not a
deliverable. Return retryable for provider transients and keep clean
missing targets permanent.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 19:17:09 +00:00
weichenandCursor 333c7a604f fix(pi-agent): do not settle success without a deliverable
agent_settled after exhausted retries is not success; missing or empty target files must return ok:false instead of an empty patch list.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 19:09:48 +00:00
weichenandCursor e04829ee8e fix(template): embed official doc templates for container cwd
App images have no templates/ checkout, so GetDocTemplate fell back to a two-section stub and prelim_design lost its real contract.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 19:09:48 +00:00
weichenandCursor 76e2028761 fix(docgov): UI-03 post-task doc sync, claim idempotency, schema30
Restore controlled-doc merge after task terminal states, prioritize intake
template match, ClaimRun before chat writes, and extend chk for
pending_author_confirmation via goose 00030. Real volume migrate + UI
re-run remain pre-merge gates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 13:39:07 +00:00
weichenandCursor 1e364f17ab feat(db): add freeform client_key for idempotent upload registration
Persist owner-scoped client_key on freeform_documents so upload create
can retry safely without inventing local doc-upload orphans.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 11:12:03 +00:00
weichenandCursor 7bbd6783fc feat(db): add document revision ledger schema 00028
Introduce immutable blobs/snapshots, versions, events, candidates,
change reports, and ledger_* root pointers; rename freeform
current_version_id to legacy_version_id.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 06:15:20 +00:00
weichenandCursor 1abafa3176 fix(chat): add message scope columns and write-path resolution
Persist workflow_instance_id, stage_instance_id, scope_kind on chat
messages and task runs; resolve scope from live instance for chat and
document tasks so refresh can apply consistent stage authorization.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 03:06:08 +00:00
weichenandCursor 8c5dd97d63 feat(db): 同步种子用户与项目序列避免冷启动主键冲突
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00
weichenandCursor 543ca310da 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-13 02:50:23 +00:00
weichenandCursor 90f77eac93 feat(authz): implement six-phase permissions, settings and workflow v2
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-13 02:50:23 +00:00
weichenandCursor 72879c6e22 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-13 02:50:23 +00:00
weichenandCursor d7a144de26 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-13 02:50:23 +00:00
weichenandCursor 3ade654256 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-13 02:50:23 +00:00
weichenandCursor aea391cdaf 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-13 02:50:23 +00:00
weichenandCursor ff81170f47 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-13 02:50:23 +00:00
weichenandCursor 0f5bc426e8 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-13 02:50:22 +00:00
weichenandCursor edffe74009 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-13 02:50:22 +00:00
weichen 3b72503ec6 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-13 02:50:22 +00:00
weichen 3145550a59 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-13 02:50:22 +00:00
WeiCHENandCursor ad2147445c chore(deploy): 三环境 Compose 构建真实 app 镜像并补齐法规库运维
将 dev/test/main 的 app 服务从占位容器改为 Dockerfile 多阶段构建,增加 healthcheck 与 .regulations 只读挂载;新增法规库备份/恢复脚本并同步 env-service 目录初始化与 gitignore。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:22 +00:00
WeiCHENandCursor e139b2b267 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-13 02:50:22 +00:00
WeiCHENandCursor 908d4bdb2e 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-13 02:50:22 +00:00
WeiCHENandCursor c887bc0480 feat(db): add chat_turns idempotency table
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00
WeiCHENandCursor 93ae180159 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-13 02:50:21 +00:00