Architecture Backend decision 14

Copilot deduplicates on session_id alone — a cross-repo dependency

Copilot’s ingest insert uses ON CONFLICT (session_id) DO NOTHING, backed by a unique index on session_id alone. Claude and OpenCode both dedupe on the wider key (session_id, prompt_id).

The narrow key is safe only because of a plugin-side invariant: the Copilot plugin sends each session exactly once, as a session-aggregated cumulative total. Copilot payloads carry no per-prompt id, unlike Claude and OpenCode, so no narrower key is available on the backend side even if one were wanted.

This is a cross-repo dependency, and the failure mode it protects against must be spelled out: if the Copilot plugin is ever changed to re-send an open session with updated cumulative totals, DO NOTHING will silently discard the update, and that session’s usage will stay frozen at its first-reported value — with no error raised anywhere, and a normal success response returned to the plugin. Should the Copilot plugin ever start re-sending open sessions, the conflict key here must widen to include a per-prompt identifier first, before that plugin change ships. Nothing in the plugin’s own repository currently hints that this backend assumption exists.