AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-236
  5. plan
  6. context.json
context.json(2.9 KB)· Apr 2, 2026
{
  "meta": {
    "agent": "planner",
    "task_id": "236",
    "title": "Fix MetricsSummary successRate and add inProgressCount",
    "created_at": "2026-04-02T12:00:00Z"
  },
  "inputs": [
    {
      "name": "GitHub Issue #236",
      "type": "context",
      "ref": "https://github.com/AgentSDE/agent-core/issues/236",
      "notes": "Metrics successRate denominator bug + missing inProgressCount field"
    },
    {
      "name": "metrics.service.ts",
      "type": "file",
      "ref": "src/metrics/metrics.service.ts",
      "notes": "Contains computeSummary with current success rate logic"
    },
    {
      "name": "metrics.types.ts",
      "type": "file",
      "ref": "src/metrics/metrics.types.ts",
      "notes": "MetricsSummary interface — missing inProgressCount"
    },
    {
      "name": "metrics.service.spec.ts",
      "type": "file",
      "ref": "src/metrics/metrics.service.spec.ts",
      "notes": "Existing tests — need new coverage for inProgressCount and edge cases"
    }
  ],
  "outputs": [
    {
      "name": "plan.md",
      "type": "plan",
      "format": "md",
      "content": "Implementation plan for metrics fix"
    }
  ],
  "files": [
    {
      "path": "src/metrics/metrics.types.ts",
      "action": "modify",
      "reason": "Add inProgressCount field to MetricsSummary interface"
    },
    {
      "path": "src/metrics/metrics.service.ts",
      "action": "modify",
      "reason": "Compute inProgressCount, add code comment at zero-denominator guard"
    },
    {
      "path": "src/metrics/metrics.service.spec.ts",
      "action": "modify",
      "reason": "Add tests for inProgressCount, zero-terminal edge case, exact scenario from issue"
    }
  ],
  "steps": [
    {
      "id": "S1",
      "summary": "Add inProgressCount to MetricsSummary interface and compute it in computeSummary",
      "acceptance": [
        "MetricsSummary interface has inProgressCount: number field",
        "computeSummary returns inProgressCount = blocked + gated counts",
        "Code comment added at zero-denominator guard: // successRate is 0.0 when no terminal tasks exist",
        "npm run build compiles without errors"
      ],
      "depends_on": []
    },
    {
      "id": "S2",
      "summary": "Add unit tests for corrected formula, inProgressCount, and zero-terminal edge case",
      "acceptance": [
        "Test: 27 complete + 10 failed + 5 stopped + 3 stuck + 23 blocked + 15 gated → successRate ≈ 0.60, inProgressCount === 38",
        "Test: all tasks blocked/gated → successRate === 0.0, inProgressCount equals total",
        "Existing zero-tasks test asserts inProgressCount === 0",
        "npm run test passes, npm run lint passes"
      ],
      "depends_on": [
        "S1"
      ]
    }
  ],
  "risks": [
    {
      "risk": "Status string 'complete' vs 'completed' mismatch with acceptance criteria wording",
      "mitigation": "Existing test confirms DB uses 'complete'; acceptance criteria text uses colloquial 'completed'"
    }
  ],
  "assumptions": [
    "The DB status strings for in-progress states are exactly 'blocked' and 'gated'",
    "No downstream consumers will break from adding a new field to MetricsSummary (additive change)"
  ],
  "open_questions": []
}
Plan