Commit Graph

29 Commits

Author SHA1 Message Date
q792602257 b20435c027 主流程 2026-06-10 17:53:09 +08:00
q792602257 023ab2f30e git 逻辑 2026-06-10 15:30:52 +08:00
q792602257 f4a7c770af 启动项目逻辑 2026-06-09 22:43:29 +08:00
q792602257 0484e79978 修改 2026-06-09 21:22:28 +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 146dca7738 feat(jobs): mcp_tokens_purge runner (spec §6.5)
- Periodic delete of mcp_tokens where (expired OR revoked) before retention
- 24h interval default, 7d retention default
- Mirrors acp_events_purge pattern: idempotent, error-tolerant

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 12:56:10 +08:00
q792602257 980c6fcf0e models 2026-05-08 08:57:09 +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 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 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 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
q792602257 f6add1598e test(jobs/runners): cover partial-storage-success, list-error isolation, DB-delete-error branches 2026-05-06 08:14:47 +08:00
q792602257 f56fe449fd feat(jobs/runners): attachment cleanup + chat DeleteAttachments query/method 2026-05-06 08:07:49 +08:00
q792602257 c50621eeca feat(jobs/runners): worktree prune two-phase + workspace prune queries/repo methods 2026-05-06 07:55:56 +08:00
q792602257 0111135e78 test(jobs/runners): cover CAS-lost, MarkSyncing-error, MarkFetchResult-error branches 2026-05-06 07:33:40 +08:00
q792602257 af1855b753 feat(jobs/runners): workspace fetch runner with notify dispatch on failure 2026-05-05 23:35:58 +08:00
q792602257 e361670539 feat(jobs): WebhookNotifier enqueues webhook.deliver jobs (topic whitelist + disabled short-circuit) 2026-05-05 23:26:47 +08:00
q792602257 9f290335b2 feat(jobs/handlers): webhook handler with HMAC sign + 4xx permanent / 5xx retry 2026-05-05 23:17:47 +08:00
q792602257 3aa19c8f7e fix(jobs): log repo write errors in worker.execute
Previously, write-back errors from Complete/DeadLetter/FailWithRetry
were silently dropped via underscore assignment. A transient DB
failure here would leave a job stuck (still 'running' with active
lease) until the reaper resets it, with zero observability into why.

Log each write-back error at Error level so operators can correlate
stuck jobs with DB symptoms. Code quality review of T8.
2026-05-05 23:12:43 +08:00
q792602257 1a83a5b1cf feat(jobs): worker pool with retry/dead-letter/panic-recovery 2026-05-05 19:57:23 +08:00
q792602257 f235b1be63 feat(jobs): periodic scheduler with panic-recovery and per-entry enable flag 2026-05-05 19:47:51 +08:00
q792602257 2e8135bcdf feat(jobs): postgres repository with SKIP LOCKED lease + retry/dead-letter/purge 2026-05-05 19:40:39 +08:00
q792602257 ff3f27c1dc feat(jobs): sqlc queries for jobs table 2026-05-05 16:59:03 +08:00
q792602257 215c1bb821 feat(jobs): domain types + Handler interface + Config 2026-05-05 16:52:17 +08:00