Skip to content

feat(linearagent): Linear Agent Session webhook types + API client (RIG-2717 T1/T2) - #638

Open
rigel-mintaka wants to merge 2 commits into
mainfrom
compass-server/rig-2717-store
Open

feat(linearagent): Linear Agent Session webhook types + API client (RIG-2717 T1/T2)#638
rigel-mintaka wants to merge 2 commits into
mainfrom
compass-server/rig-2717-store

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 3 PRs:

  1. main
  2. "feat(store): linear_agent_sessions table + @linear bridge seed (RIG-2717 T3/T3a)" (this PR)
  3. feat(server): per-deployment public URL + deep-link builder (RIG-2717 T5) #639
  4. feat(linearagent): responder routing + async dispatcher (RIG-2717 T4/T6) #646

Persistence for the Linear Agent Session responder:

  • T3: new 0002_linear_agent_sessions migration (association row keyed on the
    Linear session id; no dedup column — dedup is the comms rail's
    client_request_id), UpsertLinearAgentSession (ON CONFLICT DO NOTHING,
    created=false on replay) + LinearAgentSession lookup, and
    AuthoredArtifactByCoordinate (by-coordinate ownership read the router needs).
  • T3a: generalize the reserved system-account seed to a shared
    ensureSystemSubtypeAccount, add EnsureLinearBridgeAccount seeding @linear as
    a second system-subtype account, and reserve the 'linear' handle against
    user/agent registration.

pgtest-covered (upsert/replay/lookup, by-coordinate hit/miss, @linear
idempotent seed + structural exclusions + reserved-handle guard).

Ref: RIG-2717
Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Aug 26, 2026

Copy link
Copy Markdown

RIG-2717

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-server-rig-2717-stor.compass-eng-docs.pages.dev

Deployed from compass-server/rig-2717-store at dd0e7e7.

rigel-mintaka and others added 2 commits August 25, 2026 23:55
…IG-2717 T1/T2)

New go/internal/linearagent package for the Linear Agent Session responder:

- webhook.go (T1): SessionEvent envelope (AgentSessionEventWebhookPayload
  shape), ParseSessionEvent, VerifySignature (constant-time HMAC-SHA256 over
  the raw body, false on hex-decode error), CheckTimestamp (bidirectional
  skew on the ms-epoch webhookTimestamp).
- client.go (T2): client-credentials TokenSource (in-memory cache,
  singleflight-coalesced re-mint, pinned scope), and the Client emitter
  wrapping agentActivityCreate (the thought ack) + agentSessionUpdate (the
  external-URL deep link), re-minting once and retrying once on 401.

Pure/unit-tested against httptest; no HTTP handler, store, or dispatcher yet
(sibling tasks). Builds against the frozen record
docs/designs/product/compass-linear-agent-responder/design.md.

Ref: RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
…717 T3/T3a)

Persistence for the Linear Agent Session responder:

- T3: new 0002_linear_agent_sessions migration (association row keyed on the
  Linear session id; no dedup column — dedup is the comms rail's
  client_request_id), UpsertLinearAgentSession (ON CONFLICT DO NOTHING,
  created=false on replay) + LinearAgentSession lookup, and
  AuthoredArtifactByCoordinate (by-coordinate ownership read the router needs).
- T3a: generalize the reserved system-account seed to a shared
  ensureSystemSubtypeAccount, add EnsureLinearBridgeAccount seeding @linear as
  a second system-subtype account, and reserve the 'linear' handle against
  user/agent registration.

pgtest-covered (upsert/replay/lookup, by-coordinate hit/miss, @linear
idempotent seed + structural exclusions + reserved-handle guard).

Ref: RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-2717-linearagent branch from 15102f9 to 012b113 Compare August 26, 2026 04:01
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-2717-store branch from 276657c to dd0e7e7 Compare August 26, 2026 04:02
Base automatically changed from compass-server/rig-2717-linearagent to main August 26, 2026 04:23
@rigel-mintaka rigel-mintaka changed the title feat(store): linear_agent_sessions table + @linear bridge seed (RIG-2717 T3/T3a) feat(linearagent): Linear Agent Session webhook types + API client (RIG-2717 T1/T2) Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant