Skip to content

feat(adapters/linear): typed proactive session creation + repository suggestions, with worked capability examples - #52

Merged
ThomasK33 merged 5 commits into
mainfrom
feat/linear-capabilities-47-48-49
Aug 27, 2026
Merged

feat(adapters/linear): typed proactive session creation + repository suggestions, with worked capability examples#52
ThomasK33 merged 5 commits into
mainfrom
feat/linear-capabilities-47-48-49

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Delivers the Linear capabilities work package (#47 + #48 + #49) as one coherent PR: typed helpers for the two remaining preview operations that previously required the GraphQL escape hatch, plus worked end-to-end examples that exercise them.

#47 — Typed proactive agent session creation

  • CreateSessionOnIssue / CreateSessionOnComment wrap agentSessionCreateOnIssue / agentSessionCreateOnComment (verified against Linear's published SDL) and return a CreatedAgentSession whose opaque ThreadID works everywhere a webhook-minted one does — chat.Chat.Thread, Thread.Post, PostThought, UpdateSession, ….
  • The Thread ID is minted from the canonical identifiers Linear returns (not the caller's input, which may be an ENG-123-style alias), and externalUrls can be seeded at creation to satisfy the first-thought window (ADR 0008).
  • CreateSessionOnIssueForTenant / CreateSessionOnCommentForTenant resolve per-org tokens through the InstallStore (ADR 0006); proactive creation has no inbound webhook to infer the tenant from, so the single-install entry points reject multi-tenant mode, and the single-install ForTenant form fails fast on an organization mismatch.

#48 — Typed repository suggestions

  • SuggestRepositories(ctx, threadID, []CandidateRepository) wraps issueRepositorySuggestions with the typed candidate input shape (hostname, repositoryFullName) and returns RepositorySuggestion values with confidence scores.
  • Works on both Linear thread kinds: agentSessionId is sent only for agent-session threads (it is a nullable variable upstream).

Both helpers reuse the adapter's existing GraphQL client, bounded rate-limit retry (ADR 0005), and per-tenant token resolution (ADR 0006). Additive public API only — Linear stays experimental-tier and the docs say so.

#49 — Worked capability examples

  • docs/how-to/linear-agent-sessions.md gains full interaction loops: auth elicitation (including the resume-after-linking follow-up, which Linear does not webhook), select elicitation with human-response handling (option value vs. free text), externalUrls session updates, stop handling with the confirm-response contract, proactive session creation, and repository suggestions paired with a low-confidence select elicitation.
  • Every doc snippet is extracted verbatim from the buildable, tested examples/linear-agent-hello-world/capabilities.go; a new documentation test (TestLinearHowToSnippetsAreExtractedFromBuildableSource) fails on doc/code drift via <!-- source: … --> markers.
  • The example bot wires the stop and select-answer helpers into its OnSubscribedMessage handler; each helper has unit tests against a recording fake.
  • docs/linear-agent-capabilities.md moves gaps docs: clarify Chat SDK Go positioning #1/Add Linear app-actor adapter #2/feat(adapters/msteams): land Microsoft Teams adapter as experimental (needs live-tenant validation) #6 to Supported and points the stop-serialization gap at the new worked pattern; the adapter GoDoc surface list is updated to match.

Tests

Validation

  • mise run vet — clean across all workspace modules.
  • GOFLAGS=-race mise run test — all modules ok (root, adapters, state/nats, state/postgres, state/redis, examples).
  • go build ./... in examples/linear-agent-hello-world — clean.

Closes #47
Closes #48
Closes #49


Generated with mux • Model: anthropic:claude-fable-5 • Thinking: xhigh

…uggestions, and worked capability examples

- CreateSessionOnIssue / CreateSessionOnComment (+ ForTenant variants) wrap
  agentSessionCreateOnIssue / agentSessionCreateOnComment and return a
  CreatedAgentSession whose opaque ThreadID posts like any webhook-minted
  agent-session thread (#47).
- SuggestRepositories wraps issueRepositorySuggestions with typed candidates
  and confidence-scored results, sending agentSessionId only on agent-session
  threads (#48).
- Worked capability loops (auth/select elicitations with follow-up handling,
  externalUrls updates, stop confirmation, proactive sessions, repository
  suggestions) in docs/how-to/linear-agent-sessions.md, extracted from the
  buildable, tested examples/linear-agent-hello-world/capabilities.go and kept
  in sync by a documentation drift test (#49).

Closes #47, closes #48, closes #49.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: e95dbb444b

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e95dbb444b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/linear-agent-hello-world/main.go Outdated
Comment thread examples/linear-agent-hello-world/capabilities.go Outdated
…e; host-qualify repository options

Addresses codex review findings on #52:
- A follow-up is interpreted as a select answer only while an elicitation is
  actually pending on that thread, via a take-once per-thread registry
  (take-once matches Linear dismissing the elicitation on free-text replies).
- Select option values/labels are qualified with the Git host so same-named
  repositories on different hosts stay distinguishable.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3de21f44da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/linear-agent-hello-world/main.go Outdated
Comment thread examples/linear-agent-hello-world/capabilities.go
@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 3de21f44da

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

…itory options as pending

Addresses round-2 codex review findings on #52:
- A confirmed stop abandons the thread's pending selection so a later message
  is not misread as a choice; follow-up routing is extracted into
  newFollowUpHandler and covered by a test.
- offerRepositoryChoice records the offered (host-qualified) option values as
  the thread's pending selection, matching the deploy loop's pattern.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 84344a21da

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84344a21da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/linear-agent-hello-world/capabilities.go Outdated
Comment thread examples/linear-agent-hello-world/capabilities.go Outdated
Comment thread examples/linear-agent-hello-world/main.go Outdated
…ed post, live handle on thought failure

Addresses round-3 codex review findings on #52:
- pendingSelection carries the elicitation kind so a repository choice is
  routed to repository handling instead of the deploy acknowledgement.
- A matched choice whose acknowledgement fails to post is re-registered
  (DispatchDeferred only observes handler errors), while free-text replies
  still consume the elicitation.
- startProactiveSession returns the created ThreadID with the error when the
  first thought fails, so the live session can be retried or ended instead of
  leaked or duplicated.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 92c72a408a

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 92c72a408a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33
ThomasK33 merged commit abb55a3 into main Aug 27, 2026
1 check passed
@ThomasK33
ThomasK33 deleted the feat/linear-capabilities-47-48-49 branch August 27, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant