Skip to content

feat(agent): return useful decision packs while snapshots refresh #15

Description

@JSONbored

Problem

GET /v1/contributors/:login/decision-pack can return needs_snapshot_refresh with no actions even when core repo signal fidelity is complete. That makes MCP/agent usage feel empty at the exact moment a contributor is asking what to do next.

Desired behavior

Return the last usable decision-pack snapshot when one exists, clearly mark it as stale, and enqueue a refresh in the background. If no usable snapshot exists, return a bounded needs_snapshot_refresh response with enough status for the client to explain what is happening.

Implementation notes

  • Start in src/services/decision-pack.ts and the agent orchestration path that calls it.
  • Preserve Worker budget safety: do not scan all cached issues or PRs inline.
  • Prefer latest signal_snapshots first, then bounded rebuild only when it is safe.
  • Add explicit freshness fields: fresh | stale | rebuilding | missing.
  • MCP agent plan should degrade gracefully instead of returning an empty-looking result.

Public/private boundaries

This can include private scoreability context only in authenticated API/MCP responses. Do not add public GitHub comments or public check output for this issue.

Acceptance criteria

  • A contributor gets actionable recommendations from a stale but usable snapshot.
  • Response includes snapshot age, freshness status, and rebuild status.
  • A background rebuild is queued when needed.
  • No broad issue/PR scans happen inline on request paths.
  • jsonbored or a fixture contributor no longer receives an empty agent plan solely because the pack is stale.

Tests

  • Fresh snapshot returns normal decision pack.
  • Stale snapshot returns actionable data plus freshness warning.
  • Missing snapshot returns bounded needs_snapshot_refresh and queues rebuild.
  • Rebuild-queued response is deterministic.
  • Performance regression proves the request path does not call broad issue/PR list helpers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions