Commit Graph

154 Commits

Author SHA1 Message Date
q792602257 3d16e4a877 feat(mcp): repository skeleton + Create + GetByHash + GetByID 2026-05-08 07:18:09 +08:00
q792602257 30a85d1b2d feat(config): add MCPConfig (enabled / public_url / system_token_ttl / rate_limit) 2026-05-08 07:14:24 +08:00
q792602257 29b4c50888 feat(mcp): plaintext token generator + SHA-256 hash helper 2026-05-08 07:12:43 +08:00
q792602257 a3710c8645 feat(mcp): domain types — Issuer / Scope / MCPToken + helpers 2026-05-08 07:11:03 +08:00
q792602257 b1db7841c7 feat(errs): add 8 MCP error codes + HTTPStatus mapping 2026-05-08 07:09:26 +08:00
q792602257 39f57df882 feat(mcp): sqlc queries for mcp_tokens (CRUD + revoke + reaper + purge) 2026-05-08 07:07:47 +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 4c19ce29ca feat(jobs): acp_events_purge runner (retention-based cron cleanup) 2026-05-07 17:39:57 +08:00
q792602257 b22aacee62 feat(middleware): support ?token= query param fallback for browser WebSocket auth 2026-05-07 17:30:10 +08:00
q792602257 70ffddb76c test(acp): handler integration e2e (POST session + WS state event + DELETE) 2026-05-07 17:20:33 +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 90f910fcdd feat(acp): SessionService.Create with worktree acquire + supervisor.Spawn 2026-05-07 14:23:01 +08:00
q792602257 3e50da4a49 feat(workspace): session-scoped Caller.Holder + ReleaseByHolder for ACP integration 2026-05-07 14:21:00 +08:00
q792602257 9fc96b0a1a feat(acp): SessionService skeleton + ResolveBranch (5 paths) + tests 2026-05-07 14:11:47 +08:00
q792602257 ce28b822f9 feat(acp): SessionService interface + CreateSessionInput 2026-05-07 14:09:42 +08:00
q792602257 54a69a46cd test(acp): supervisor integration with fake-acp-agent (happy/hang/crash) 2026-05-07 14:05:06 +08:00
q792602257 70c86a552b feat(acp): supervisor spawn / handshake / monitor / kill / onExit 2026-05-07 14:01:04 +08:00
q792602257 85a8bc0df7 test(acp): relay round-trip + fanout + agent request handling + slow subscriber 2026-05-07 13:45:25 +08:00
q792602257 679ded50c9 chore(sqlc): regenerate models for migration 0006
sqlc reads all migrations into every package's schema, so the
addition of acp_* tables and workspaces.active_main_session_id
in migration 0006 propagates type definitions and SELECT
column lists across all sub-packages. No code logic changes.
2026-05-07 13:39:08 +08:00
q792602257 3d5f63b28e feat(acp): relay reader/writer goroutines + Call + persist with truncation 2026-05-07 12:25:39 +08:00
q792602257 64ff2a8c02 feat(acp/handlers): initialize + session/new param builders 2026-05-07 12:22:31 +08:00
q792602257 6da1dc5a40 feat(acp/handlers): session/request_permission auto-reject 2026-05-07 12:21:18 +08:00
q792602257 b9f38b6e94 feat(acp/handlers): fs/read_text_file + fs/write_text_file with path safety 2026-05-07 12:19:03 +08:00
q792602257 de73ad4935 feat(acp): relay skeleton (subscribe/unsubscribe/fanout/close) + supervisor.GetRelay 2026-05-07 12:16:06 +08:00
q792602257 839e5c9e95 feat(acp/handlers): handlers subpackage with shared types + placeholder handlers 2026-05-07 12:16:03 +08:00
q792602257 bd95fd33d6 feat(acp): supervisor skeleton + AcpConfig wiring 2026-05-07 12:12:05 +08:00
q792602257 dee20bb618 feat(acp): ResolveSafePath helper (3-fold check: abs/prefix/symlink) 2026-05-07 12:06:37 +08:00
q792602257 cf314021e7 feat(acp): JSON-RPC 2.0 codec (number/string id, LF-delimited, concurrent-safe encoder) 2026-05-07 12:04:27 +08:00
q792602257 e97541030a feat(app): wire ACP AgentKindService + handler 2026-05-07 11:41:14 +08:00
q792602257 8202a7a679 test(acp): handler unit tests (admin / user / field redaction / PATCH semantics) 2026-05-07 11:37:33 +08:00
q792602257 e096b1a671 feat(acp): HTTP handler for agent kinds (admin write / user read with field redaction) 2026-05-07 11:34:11 +08:00
q792602257 79480b32f8 feat(acp): AgentKindService + unit tests (fake repo + real encryptor) 2026-05-07 11:28:15 +08:00
q792602257 1ef2e93b72 test(acp): pgRepo integration tests (CRUD + lifecycle + event order) 2026-05-07 11:21:40 +08:00
q792602257 a9a9e6d8ab feat(acp): repository interface + pgRepo full implementation (agent_kind + session + event) 2026-05-07 10:42:58 +08:00
q792602257 631f957cd9 feat(acp): sqlc queries (agent_kinds + sessions + events) + generated code 2026-05-07 10:37:16 +08:00
q792602257 cb845f2374 feat(acp): domain types + service interfaces (skeleton) 2026-05-07 10:34:31 +08:00
q792602257 c4ddfde0ff feat(errs): add 11 ACP error codes + HTTP mapping 2026-05-07 10:32:36 +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 f6089ac5fb chore(jobs): align log keys + add prune no-op test + down-migration comment
Cross-cutting review polish:
- worker.go: id/type → job_id/job_type; one stray attempts → attempt for
  consistency with the other 4 sites in the same file.
- runners/workspace_fetch.go: ws_id → workspace_id (matches the dispatched
  notify.Message metadata key).
- runners/worktree_prune.go: id → worktree_id (same reason).
- runners/worktree_prune_test.go: add TestWorktreePrune_NoRowsIsNoOp for
  symmetry with the no-op tests in the other 4 runner test files.
- migrations/0005_jobs.down.sql: comment that DROP TABLE jobs cascades to
  drop the three idx_jobs_* indexes automatically.
2026-05-06 11:52:17 +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 7b3892c42e feat(config,workspace,user): jobs/notify config + workspace fetch repo + user ListAdmins 2026-05-06 09:10:43 +08:00
q792602257 895799a6c9 fix(jobs): timer leak in Module.Stop and warn on unknown runner names
Module.Stop used time.After which leaks the timer if the done channel
wins first; switch to time.NewTimer + defer Stop() to align with the
codebase convention.

scheduleEntry silently returned {0, false} for unknown runner names —
typos in production wiring were invisible. Return (entry, known) and
log Warn at NewModule registration time so misconfiguration surfaces.
2026-05-06 08:37:09 +08:00
q792602257 895a816221 feat(jobs): Module wiring + WorkerOptions.OnDeadLetter hook 2026-05-06 08:31:24 +08:00
q792602257 2d0c45a52b feat(jobs/runners): job_reaper (lease timeout) + job_purge (retention) 2026-05-06 08:20:29 +08:00