Commit Graph

36 Commits

Author SHA1 Message Date
q792602257 023ab2f30e git 逻辑 2026-06-10 15:30:52 +08:00
q792602257 9853b6fc1b 修复启动问题 2026-06-10 10:01:12 +08:00
q792602257 01b3375395 原型阶段 2026-06-09 23:44:31 +08:00
q792602257 f4a7c770af 启动项目逻辑 2026-06-09 22:43:29 +08:00
q792602257 0484e79978 修改 2026-06-09 21:22:28 +08:00
q792602257 e4cb55dae2 test(mcp): K5 — prompts + resources integration scenarios
- PromptsList_FromTemplates: system template visible via prompts/list + prompts/get
- ResourceRead_NotFound: non-existent pm://projects/{uuid} returns error
- ResourceList_ScopeFilter: in-scope project resource readable; resources listed

All 14 spec §8.2 integration scenarios now complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:31:18 +08:00
q792602257 f708e102d8 test(mcp): K4 — rate limit + ACP lifecycle + startup reaper
- RateLimit_PerToken: 110 burst calls -> at least 1 rate-limit error
- ACPSession_TokenLifecycle: create session -> token appears; terminate -> revoked
- StartupReaper: crashed session + live token -> ReapStaleSystemTokens revokes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:26:12 +08:00
q792602257 e0e9ae7bda test(mcp): K2 — transport + auth integration scenarios
- StreamableHTTP_FullFlow: initialize → tools/list → tools/call
- LegacySSE_FullFlow: same flow over /mcp/sse
- BearerVsQueryToken: header + ?token= both authenticate
- MCPSDKVersionNegotiation: unknown version -> graceful response

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:24:36 +08:00
q792602257 20b449bb37 test(mcp): K3 — scope + visibility + audit integration scenarios
- ScopeViolation_Tool: token without create_issue can't call it
- ScopeViolation_Project: token can't access projects outside scope.project_ids
- VisibilityRespect: service-layer visibility blocks private projects
- WriteToolAudit: audit_logs contains via_mcp:true + mcp_token_id

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:20:11 +08:00
q792602257 f2ed098f32 test(mcp): integration scaffold — 14 scenarios per spec §8.2
- Matrix dispatcher with 14 sub-test stubs
- Suite struct with setup/cleanup lifecycle
- All sub-tests start as t.Skip stubs; filled in K2-K5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:11:04 +08:00
q792602257 0644fc9b3b feat(app): startup reaper for MCP system tokens (spec §6.4)
- Runs after ACP startup reaper marks stuck sessions as crashed
- mcpRepo.ReapStaleSystemTokens revokes tokens bound to crashed/exited sessions
- Single audit entry per batch: mcp.token.expire_on_restart with count + token_ids
- Errors logged but don't block boot

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:08:21 +08:00
q792602257 6917acb778 feat(jobs): wire mcp_tokens_purge runner into jobs.Module
- Config.MCPTokensPurge + scheduleEntry branch
- app.go constructs runner with mcpTokensPurgeAdapter
- Registered as 'mcp_tokens_purge' in RunnerFns map

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:05:12 +08:00
q792602257 18f6c8bd2e feat(acp): SessionService.Create issues system MCP token in tx
- InTx wraps InsertSession + IssueSystemTokenWithTx (spec §6.1 atomic guarantee)
- Tx failure -> releaseOnFailure (worktree rollback)
- Spawn called with extraEnv = ACW_MCP_TOKEN + ACW_MCP_URL
- Spawn failure -> RevokeBySession (idempotent) + releaseOnFailure
- app.go SessionService construction updated with mcpTokens + config
- Unit tests: token issuance happy path + rollback on token failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 13:01:16 +08:00
q792602257 702daced7d feat(acp): Supervisor.onExit revokes system MCP token (spec §6.3)
- mcpTokens dep added to Supervisor; nil-safe (test fixtures may skip)
- RevokeBySession called after audit Record in onExit
- app.go wires mcpTokenSvc (was nil placeholder)
- Integration test: fakeSupMCPTokens verifies onExit calls RevokeBySession

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 12:52:25 +08:00
q792602257 d44ffc851f feat(acp): Supervisor.Spawn extraEnv parameter
- extraEnv overrides agent_kinds.encrypted_env same-name keys (spec §6.1 #11)
- Prevents admin from hard-coding ACW_MCP_TOKEN in agent_kinds
- SessionService passes nil for now; system token wiring lands in I4
- BuildSpawnEnv exported for testing the override priority
- Fix app.go NewSupervisor call to match updated signature (from I5)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 12:46:50 +08:00
q792602257 d0efe2bdd4 feat(mcp): admin token CRUD HTTP handler (POST/GET/DELETE) + TokenService.List/GetByID
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 11:04:37 +08:00
q792602257 5cccc97edd feat(app): wire MCP module — repo/service/ratelimiter/server + transport mount + AuditWrap
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:44:17 +08:00
q792602257 ce53c54fde test(acp): integration matrix scaffold + 3 implemented scenarios (CreateSuccess/Quota/BranchConflict) 2026-05-07 18:18:08 +08:00
q792602257 faebfc3135 feat(app): wire acp_events_purge runner into jobs scheduler 2026-05-07 17:47:50 +08:00
q792602257 f5f048083a feat(acp): WebSocket session handler (history + live + ping/pong + owner-only prompt/cancel) 2026-05-07 17:08:09 +08:00
q792602257 72cd353757 feat(acp): handler refactor + sessions REST endpoints (list/create/get/delete/events) 2026-05-07 14:34:47 +08:00
q792602257 26011975b4 feat(app): wire ACP Supervisor + SessionService + startup reaper 2026-05-07 14:29:14 +08:00
q792602257 e97541030a feat(app): wire ACP AgentKindService + handler 2026-05-07 11:41:14 +08:00
q792602257 a2b6d5382e feat(workspace,jobs): emit sync_aborted_on_restart audit + enrich worktree.pruned metadata
- workspace.ResetStuckSyncStatuses now returns affected IDs so app.New can record one workspace.sync_aborted_on_restart audit per reset row
- worktree_prune audit metadata gains workspace_id and path alongside existing branch
- updated fakeRepo + integration test for new ResetStuckSyncStatuses signature
- add TestWorktreePrune_AuditMetadataContainsWorkspaceIDAndPath
2026-05-07 10:14:46 +08:00
q792602257 b1ccce567e feat(jobs): emit job.enqueue + worktree.pruned audit rows
Deferred audit retrofits from Plan #5 self-review:
- WebhookNotifier now records a job.enqueue audit row after each
  successful repo.Enqueue (best-effort: failures are warn-logged, not
  propagated). Added optional audit.Recorder + *slog.Logger params to
  NewWebhookNotifier.
- WorktreePrune.executionPhase now records a worktree.pruned audit row
  after each successful FinishPruneSuccess. Added optional audit.Recorder
  param to NewWorktreePrune.
- app.go wires the existing auditRec into both constructors.
- integration_test.go: drop the _ = auditRec suppression and pass
  auditRec into the webhook notifier so the closed-loop test exercises
  the audit emit path.
2026-05-06 13:35:45 +08:00
q792602257 cf1ec7b1c6 fix(app): give dispatcher.Shutdown its own ctx in ctx.Done branch
Final cross-cutting review finding: shutCtx was shared between
server.Shutdown and dispatcher.Shutdown, with jobs.Stop's wall-clock
time burning the budget in between. Under load, dispatcher.Shutdown
could receive an already-dead ctx and skip draining in-flight async
notify dispatches (including webhook enqueues). Mirror the errCh
branch by creating a fresh 10s drainCtx for dispatcher.Shutdown.
2026-05-06 11:40:34 +08:00
q792602257 69c5831783 fix(app): respect cfg.Jobs.ShutdownGrace and skip jobs.Stop when disabled
Code review fixes for T16:
- Pass cfg.Jobs.ShutdownGrace+5s to jobs.Stop call-site context (was
  hard-coded 30s, would mask configured longer grace).
- Guard jobs.Stop block on cfg.Jobs.Enabled so disabled jobs don't
  spin up the no-op shutdown goroutine + timer.
- Use clock.Real().Now() in deadLetterFn for consistency with the rest
  of the jobs wiring.
2026-05-06 11:10:29 +08:00
q792602257 c7db7a9604 feat(app): wire jobs.Module + WebhookNotifier + integration test for webhook closed loop 2026-05-06 09:25:19 +08:00
q792602257 8effeee063 feat(app): wire chat module + LocalFS storage + LLM registry into app.New 2026-05-04 19:37:14 +08:00
q792602257 7429a817bc feat(app): wire workspace module + integration test for ws closed loop 2026-05-02 12:32:05 +08:00
q792602257 a0087d2c25 feat(app): wire project module and integration test for pm closed loop 2026-05-01 10:36:37 +08:00
q792602257 7377c2135f fix(notify): waitgroup-based dispatcher shutdown, withoutcancel persist 2026-04-29 11:55:18 +08:00
q792602257 0f9c7fa657 fix(server): propagate shutdown error, http timeouts, ctx-aware migrate 2026-04-29 11:52:27 +08:00
q792602257 78989a42ac feat(server): embed SPA dist with fallback handler; single-binary deploy 2026-04-29 10:43:42 +08:00
q792602257 b72de98f15 test(app): integration test for login -> dispatch -> list flow 2026-04-28 23:18:27 +08:00
q792602257 d0f34e4e5e feat(app): composition root with migrate, pool, modules, router, bootstrap 2026-04-28 23:08:38 +08:00