Skip to content

fix: use repository name for Linear repo-selection options - #1379

Open
litnimax wants to merge 3 commits into
cyrusagents:mainfrom
oduist:fix/repo-selection-option-value
Open

litnimax wants to merge 3 commits into
cyrusagents:mainfrom
oduist:fix/repo-selection-option-value

Conversation

@litnimax

Copy link
Copy Markdown

Problem

When no routing rule matches an issue, RepositoryRouter posts a repository-selection elicitation to Linear with the configured git URL (githubUrl/gitlabUrl) as the select-signal option value. Linear rejects option values longer than 100 characters, so for repositories whose configured URL embeds an access token (e.g. https://user:github_pat_...@github.com/org/repo), the elicitation always fails and the session stalls with an error:

Invalid signal metadata for "select" with activity type "elicitation": [options.0.value]: Value length cannot exceed 100 characters.

Worse, this transmitted credential-bearing git URLs to Linear as part of the mutation payload, and the resulting SDK error logged them in plaintext.

Fix

  • Option values now use the configured repository name (a required config field, and what users should see anyway), truncated to Linear's 100-character limit. Git URLs are never sent to Linear.
  • selectRepositoryFromResponse resolves names first (including the truncated form) and keeps URL matching for compatibility.

Testing

  • Updated existing elicitation tests to expect repository names as option values.
  • Added a test asserting credential-bearing URLs never appear in the payload sent to Linear.
  • Added a test for the 100-character truncation round trip (option value → selection resolution).
  • pnpm test:packages:run and pnpm typecheck pass.

litnimax added 3 commits July 20, 2026 23:07
Repository selection elicitations sent the configured git URL as the
select-signal option value. When the URL embeds an access token it
exceeds Linear's 100-character option value limit, so the elicitation
failed to post and the session stalled. It also transmitted
credential-bearing URLs to Linear.

Options now use the configured repository name (truncated to Linear's
100-character limit), and response matching resolves names first while
keeping URL matching for compatibility.

@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: c421b4eef0

ℹ️ 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".

// sent to Linear) and can exceed Linear's option value length limit.
const options = workspaceRepos.map((repo) => ({
value: repo.githubUrl || repo.gitlabUrl || repo.name,
value: repo.name.slice(0, MAX_SELECT_OPTION_VALUE_LENGTH),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve unique repository option values

When two workspace repositories have distinct git URLs but names that share the same first 100 characters, this emits duplicate select option values. Linear sends only the selected value back, and selectRepositoryFromResponse matches that truncated value by scanning workspaceRepos in order, so selecting the later repository routes the session into the first one instead. Use a unique non-secret value per repository rather than truncating names alone.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@litnimax I like this code comment from codex, would like to see that.
This is a nice fix though 👍

will be happy to approve

@Connoropolous Connoropolous left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just requesting the codex changes 👍

past that should be an easy merge

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.

2 participants