-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add PR draft dialog and UI updates #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| branches: [main, master] | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint (typecheck) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: oven-sh/setup-bun@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Type check | ||
| run: bun run typecheck | ||
|
|
||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: oven-sh/setup-bun@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Run tests | ||
| run: bun test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,10 +16,12 @@ import { | |
| pushWorktreeBranch, | ||
| } from "./worktree-service"; | ||
| import { | ||
| generatePullRequestDraft as generatePullRequestDraftService, | ||
| gitPull as gitPullService, | ||
| gitStatus as gitStatusService, | ||
| runStackedAction as runStackedActionService, | ||
| gitPull as gitPullService, | ||
| type GitStackedAction, | ||
| type GitPullRequestOptions, | ||
| } from "./git-service"; | ||
| import { CONVEX_SITE_URL } from "./build-constants"; | ||
|
|
||
|
|
@@ -750,15 +752,20 @@ ipcMain.handle( | |
| action: GitStackedAction, | ||
| commitMessage?: string, | ||
| featureBranch?: boolean, | ||
| prOptions?: GitPullRequestOptions, | ||
| ) => { | ||
| return await runStackedActionService(cwd, action, commitMessage, featureBranch); | ||
| return await runStackedActionService(cwd, action, commitMessage, featureBranch, prOptions); | ||
| }, | ||
| ); | ||
|
|
||
| ipcMain.handle("git:pull", async (_event, cwd: string) => { | ||
| return await gitPullService(cwd); | ||
| }); | ||
|
|
||
| ipcMain.handle("git:generatePullRequestDraft", async (_event, cwd: string) => { | ||
| return await generatePullRequestDraftService(cwd); | ||
| }); | ||
|
|
||
| // --- Worktree Management --- | ||
|
|
||
| ipcMain.handle( | ||
|
|
@@ -1066,13 +1073,13 @@ ipcMain.handle( | |
| console.log("[codex:send-message] thread/start result:", JSON.stringify(thread)); | ||
| tid = thread.threadId; | ||
| } | ||
| console.log("[codex:send-message] starting turn:", { tid, model, messageCount: messages.length }); | ||
| const turn = await server.startTurn(tid, messages, model); | ||
| console.log("[codex:send-message] turn/start result:", JSON.stringify(turn)); | ||
| // Store mapping so forwarded events carry the Convex thread ID | ||
| if (tid && convexThreadId) { | ||
| // Approval/status events can arrive before turn/start resolves. | ||
| codexThreadToConvexId.set(tid, convexThreadId); | ||
| } | ||
| console.log("[codex:send-message] starting turn:", { tid, model, messageCount: messages.length }); | ||
| const turn = await server.startTurn(tid, messages, model); | ||
| console.log("[codex:send-message] turn/start result:", JSON.stringify(turn)); | ||
|
Comment on lines
1076
to
+1082
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clean up the Codex mapping when The mapping now gets inserted before 🐛 Suggested fix if (tid && convexThreadId) {
// Approval/status events can arrive before turn/start resolves.
codexThreadToConvexId.set(tid, convexThreadId);
}
- console.log("[codex:send-message] starting turn:", { tid, model, messageCount: messages.length });
- const turn = await server.startTurn(tid, messages, model);
- console.log("[codex:send-message] turn/start result:", JSON.stringify(turn));
+ try {
+ console.log("[codex:send-message] starting turn:", { tid, model, messageCount: messages.length });
+ const turn = await server.startTurn(tid, messages, model);
+ console.log("[codex:send-message] turn/start result:", JSON.stringify(turn));
+ return { turnId: turn.turnId, threadId: tid };
+ } catch (err) {
+ if (tid && convexThreadId) {
+ codexThreadToConvexId.delete(tid);
+ }
+ throw err;
+ }
- return { turnId: turn.turnId, threadId: tid };🤖 Prompt for AI Agents |
||
| return { turnId: turn.turnId, threadId: tid }; | ||
| }, | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -953,6 +953,18 @@ export default function App() { | |
| needsInput, | ||
| }; | ||
| } | ||
|
|
||
| if (provider !== "codex" || !approvalMap) return; | ||
|
|
||
| for (const [providerThreadId, rawApprovals] of approvalMap.entries()) { | ||
| if (!rawApprovals.length) continue; | ||
| const fallbackThreadId = rawApprovals.find((request) => typeof request.convexThreadId === "string")?.convexThreadId; | ||
| if (!fallbackThreadId || next[fallbackThreadId]) continue; | ||
| next[fallbackThreadId] = { | ||
| userInputRequests: codexApprovalToUserInput(providerThreadId, rawApprovals), | ||
| needsInput: true, | ||
| }; | ||
|
Comment on lines
+959
to
+966
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fallback approvals still miss sidebar badges and notifications. This block only populates the transient store. 🤖 Prompt for AI Agents |
||
| } | ||
| }; | ||
|
|
||
| addProvider("codex", codexToConvexThread.current, codex.streamingContent, codex.streamingReasoning, codex.tokenUsage, codex.commandExecutions, codex.approvalRequests, codex.threadsWaitingOnApproval); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 3268
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 973
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 197
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 410
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 3522
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 877
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 149
🏁 Script executed:
Repository: echoes-sh/echoes-code
Length of output: 3888
Keep draft file stats aligned with the actual PR contents.
gitStatus()explicitly backfills files from porcelain that don't appear in numstat, but this draft builder only aggregates the twogit diff --numstatcalls. Git's numstat only covers tracked files; untracked files and other porcelain-only changes won't appear in the draft file list, even thoughrunStackedAction()will later include them viagit add -A. Additionally,hasWorkingTreeChangeson line 643 uses a simple numstat check and can be false when porcelain detects untracked files. Reuse the same porcelain+numstat aggregation here, or extract a shared helper.🤖 Prompt for AI Agents