Skip to content

feat(web): Start from issue dialog with prefilled composer - #5

Merged
Artic0din merged 27 commits into
feat/2-resolve-github-issuesfrom
feat/3-start-from-issue-dialog
Oct 6, 2026
Merged

Artic0din merged 27 commits into
feat/2-resolve-github-issuesfrom
feat/3-start-from-issue-dialog

Conversation

@Artic0din

Copy link
Copy Markdown
Owner

Problem

The server can now resolve a GitHub issue and prepare its worktree (#4), but nothing in the app calls it.
Users still have no way to start work from an issue.

Change

  • Start work from issue dialog: paste 123, #123, or a GitHub issue URL. It shows the issue's title and state, then Start work creates the issue worktree and opens the project's draft there.
  • The composer is prefilled with Work on #N: <title>, the issue body, and its URL. Nothing is sent automatically.
    • Text already typed in the draft is kept, and the issue is added after it.
    • The same issue is never added twice. URL matching uses whole tokens, so issue 3 isn't skipped when the draft mentions issue 31.
    • Starting a second issue replaces the first issue's prompt only while it is untouched.
  • Entry points:
    • Command palette, on any thread. From a server thread it opens the project's draft first.
    • Branch picker, with issue 123 or an issue URL. Bare 123 / #123 stay pull request checkout.
  • The source control user guide gains a short "Start work from an issue" section, including the fork caveat for bare numbers.

Scope and approval

Fork-only experiment, tracked in #1 and #3. Stacked on #4.
Mobile is out of scope for v1.

Verification

  • Focused tests: 172 pass across issueThread.logic, BranchToolbar.logic, CommandPalette.logic, and shared git. apps/web and packages/client-runtime typecheck clean.
  • Manual pass in the dev web client, using a seeded copy of real data and a throwaway clone of this fork:
    • Before (main): searching the palette for "issue" lists only threads. There is no start-from-issue action.
    • After: the palette shows Start work from issue. A PR URL shows "Paste a GitHub issue URL or enter 123 / Add Expo mobile client and wire up dev:mobile workflow pingdotgg/t3code#123." and Start work stays disabled. The fork's issue feat: start agent work from a GitHub issue #1 resolves with its title and Open state.
    • Start work created .t3/worktrees/fork-clone/issue-1-… on issue/1-feat-start-agent-work-from-a-github-issu. The draft opened in Worktree mode with the issue in the composer, and 0 messages were sent.
    • Branch picker issue 1 → Start work from issue reused the same worktree (still 2 worktrees), and the composer held the issue exactly once.
    • This pass found a real bug: the provider registry dropped getIssue, so every real project said "Only GitHub issues are supported". It is fixed in feat(server): resolve GitHub issues and prepare an issue worktree thread #4 with a registry test.
  • Not provided: screenshots. T3's Browser panel screenshot tool failed in this session, although navigation, typing and clicks worked. The evidence above was read from the page instead.
  • Known minors, not fixed: searching the palette for the full phrase "start work from issue" finds nothing, while "issue" and "start work" both do. The 40-character slug cap can cut a word (…github-issu).

Release note: Start work from a GitHub issue from the command palette or branch picker. T3 Code creates the issue's worktree and prefills the composer.

Fixes #3

Implemented by Claude Opus 5.5 (1M context) in Claude Code, running inside T3 Code.

🤖 Generated with Claude Code

Artic0din and others added 6 commits October 5, 2026 20:27
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Adds the Start work from issue dialog. It resolves the issue, prepares
its worktree, opens the project draft there, and prefills the composer
with the issue without discarding text already typed in the draft.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Adds a Start work from issue command palette action and a branch picker
item for issue 123 or a GitHub issue URL. Bare numbers stay pull request
checkout. Documents the flow in the source control guide.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review follow-ups:
- The palette action now works from any thread. It opens the project's
  draft first, because the dialog only mounts on a draft.
- Matching an issue URL in the draft uses whole tokens, so issue 3 is
  no longer skipped when the draft mentions issue 31.
- Starting a second issue replaces the first issue's untouched prompt
  instead of appending to it. Edited text is still kept.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T23:35:50.046478Z 31ffd9f New commits
🔒 Security Review ✅ Completed 2026-10-05T09:59:43.720696Z 744beb7 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai sourcery-ai 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.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="apps/web/src/components/IssueThreadDialog.tsx" line_range="126-131" />
<code_context>
+      if (isAtomCommandInterrupted(result)) prepareIssueThreadAction.resetError();
+      return;
+    }
+    await onPrepared({
+      issue: result.value.issue,
+      branch: result.value.branch,
+      worktreePath: result.value.worktreePath,
+    });
+    onOpenChange(false);
+  }, [
+    cwd,
</code_context>
<issue_to_address>
**issue (bug_risk):** If `onPrepared` throws while opening or navigating to the draft, `handleConfirm` rejects without displaying an error or resetting the action. The issue worktree has already been created, so the dialog remains open while the user receives no failure feedback and can be left with an orphaned worktree.

**Triggers:** When draft navigation or draft setup fails after `prepareIssueThread` succeeds.

**Suggested fix:** Catch failures from `onPrepared`, surface them through the dialog error state, and handle or clean up the already-created worktree as appropriate.
</issue_to_address>

### Comment 2
<location path="apps/web/src/components/issueThread.logic.ts" line_range="12" />
<code_context>
+    .join("\n\n");
+}
+
+function containsUrlToken(text: string, url: string): boolean {
+  return text.split(/\s+/).includes(url);
+}
+
+/**
+ * The project keeps one draft, so starting an issue reuses it. Text the user typed is kept and the
+ * same issue is never added twice. `previousPrefill` is the exact text an earlier issue start wrote;
+ * a draft still equal to it is replaced, so two issues never end up in one prompt.
+ */
+export function mergeIssuePrompt(
+  existing: string,
+  issuePrompt: string,
+  issueUrl: string,
+  previousPrefill?: string,
+): string {
+  if (existing.trim().length === 0 || existing === previousPrefill) return issuePrompt;
+  if (containsUrlToken(existing, issueUrl)) return existing;
+  return `${existing.trimEnd()}\n\n${issuePrompt}`;
+}
</code_context>
<issue_to_address>
**issue (bug_risk):** `containsUrlToken` only recognizes an issue URL when it is separated by whitespace. A draft containing the same URL followed by normal punctuation, such as `https://github.com/o/r/issues/31.`, is not recognized, so starting the issue again appends a duplicate prompt.

**Triggers:** When the draft contains an issue URL followed by punctuation.

**Suggested fix:** Match URL token boundaries while allowing common trailing punctuation, or normalize punctuation before checking for an existing issue URL.

```suggestion
  return text.split(/\s+/).some((token) => token.replace(/[.,!?;:)\]}]+$/, "") === url);
```
</issue_to_address>

Fix all in Cursor


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread apps/web/src/components/IssueThreadDialog.tsx Outdated
Comment thread apps/web/src/components/issueThread.logic.ts Outdated

@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: 744beb7529

ℹ️ 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 apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/CommandPalette.tsx Outdated
Comment thread apps/web/src/components/IssueThreadDialog.tsx
Comment thread apps/web/src/components/IssueThreadDialog.tsx
Artic0din and others added 4 commits October 5, 2026 21:07
- An issue URL followed by punctuation in the draft is recognized, so
  starting the same issue again does not add it twice.
- If opening the draft fails after the worktree is created, the dialog
  shows the error instead of failing silently. Starting again reuses
  the worktree.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codex review follow-ups:
- A prompt that mixes user text with an issue is never marked as
  replaceable, so a later issue start appends instead of deleting the
  user's text.
- Start from issue appears only when the server advertises issueThreads
  and the project is not the scratch project.
- The dialog request carries its project; a chat view for another
  project drops it instead of starting work in the wrong repository.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@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: 56cd3bd7ac

ℹ️ 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 apps/web/src/components/CommandPalette.tsx Outdated
Comment thread apps/web/src/components/ChatView.tsx
Artic0din and others added 2 commits October 5, 2026 21:42
…afts

- The palette opens a fresh draft whenever the route is a server thread,
  including threads promoted from a draft that still keep a draft record.
- The dialog request matches the logical project, so automatic
  environment selection moving the new draft no longer drops it; only a
  confirmed switch to another project closes it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

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

ℹ️ 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 apps/web/src/components/ChatView.tsx Outdated

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

ℹ️ 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 apps/web/src/components/IssueThreadDialog.tsx
Comment thread apps/web/src/components/IssueThreadDialog.tsx
Artic0din and others added 2 commits October 5, 2026 22:15
…ting

- A start that finishes after navigation closed the dialog no longer
  opens or prefills the originating draft.
- The issue field is disabled while the worktree is prepared, so the
  shown issue always matches the one being started.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@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: 92064eec94

ℹ️ 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 apps/web/src/components/CommandPalette.tsx
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/web/src/components/IssueThreadDialog.tsx
- The dialog request carries the draft it was opened on. Leaving that
  draft (Back, sidebar, another thread) drops it, while automatic
  environment selection keeps the same draft and the dialog.
- Start from issue is offered only for GitHub repositories.
- A failed start no longer lingers after the issue changes or when the
  dialog is opened again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@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: 9cc46cff18

ℹ️ 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 apps/web/src/components/IssueThreadDialog.tsx
Comment thread packages/client-runtime/src/state/git.ts
Artic0din and others added 2 commits October 5, 2026 22:57
prepareIssueThread creates or checks out an issue branch, but unlike
the VCS worktree and ref commands it left the cached ref list alone,
so an open branch picker could miss the new branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Artic0din and others added 4 commits October 6, 2026 08:47
…pgrade

Upstream moved reactivity out of effect/unstable when it upgraded to
Effect 4.0.1, which broke the issue dialog's import after merging main.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@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: 2c65f8edfa

ℹ️ 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 apps/web/src/components/IssueThreadDialog.tsx
Comment thread docs/user/source-control.md Outdated
The dialog used the VCS action's pending flag, which follows the
action's scope; automatic environment selection could change that scope
mid-start and re-enable Cancel and Start work. The dialog now owns its
starting state.

Also scope the user guide to web and desktop; mobile has no issue
start yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

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

ℹ️ 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 apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/web/src/components/IssueThreadDialog.tsx
Comment thread apps/web/src/components/IssueThreadDialog.tsx Outdated
Automatic environment selection could move the draft while an issue
start was running. The dialog then unmounted (dropping the result) or
read its error from the new environment's action state (hiding a
failure). The dialog now keeps its lookup and start on the environment
it opened on and stays mounted. If the draft has moved, it says so
instead of attaching a worktree from another environment.

Also hide a previous lookup error while a new reference is still being
typed, and show the lookup spinner again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Artic0din
Artic0din merged commit eb9b318 into feat/2-resolve-github-issues Oct 6, 2026
5 checks passed
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