[codex] Merge upstream terminal context and git model updates#23
[codex] Merge upstream terminal context and git model updates#23aaditagrawal merged 1 commit intomainfrom
Conversation
|
✅ Actions performedReview triggered.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (34)
📝 WalkthroughWalkthroughThis PR introduces terminal context integration into the chat interface, allowing users to capture and include terminal output inline within messages. It adds a new TerminalContext module with utilities for formatting, extracting, and managing terminal context blocks in prompts. Additionally, it implements per-provider Git text generation model overrides with a three-tier fallback system (explicit override → active thread model → provider default), extending AppSettings with provider-specific model configuration and related helpers. Changes
Sequence DiagramsequenceDiagram
actor User
participant Terminal as Terminal Drawer
participant Selection as Selection Handler
participant ChatView as Chat View
participant Store as Draft Store
participant Composer as Composer Editor
participant Server as Server
User->>Terminal: Selects text in terminal
Terminal->>Selection: Detects selection
Selection->>Selection: Resolve position & timing
Terminal->>ChatView: Calls onAddTerminalContext(selection)
ChatView->>Store: insertTerminalContext(context)
Store->>Store: Deduplicate & normalize
ChatView->>Composer: insertInlineTerminalContextPlaceholder
Composer->>Composer: Create token, update state
Composer->>ChatView: Report terminalContextIds
ChatView->>Composer: Render terminalContexts
Composer->>User: Display inline context pills
User->>Composer: Modifies message text
ChatView->>ChatView: deriveComposerSendState
User->>ChatView: Clicks Send
ChatView->>ChatView: appendTerminalContextsToPrompt
ChatView->>Server: Send message with contexts
Server->>Server: Process terminal contexts
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
Summary
This merges two upstream changes that were left out previously because of conflicts and adapts them to the fork's current multi-provider direction.
The first upstream change is terminal context support for chat composition and send flow (
#1032). Users can now capture terminal output into the composer, persist that context in draft state, render it clearly in the timeline, and send it through the existing composer pipeline. The implementation stays provider-agnostic by attaching terminal context at the web/composer layer rather than relying on any provider-specific runtime behavior.The second upstream change is configurable git text generation (
#1171). Instead of applying the upstream Codex-only model setting directly, this PR adds a provider-aware git text generation override that fits the fork's existing provider/model architecture. Git actions now resolve their model with the following precedence: provider-specific git override, then active thread model, then provider git default. For Codex, the git default usesgpt-5.4-mini, and this PR also addsgpt-5.4-minito the shared Codex model catalog.Key Changes
The terminal context work brings over the upstream draft persistence, inline composer chip handling, terminal selection plumbing, and user-message rendering helpers. The two conflict-heavy files were
apps/web/src/components/ChatView.tsxandapps/web/src/composerDraftStore.ts; both were merged manually so the new terminal context flow coexists with the fork's current composer state and provider/model selection logic.The git text generation work adds reusable app-settings helpers for provider-scoped custom model lists and provider-scoped git model overrides. The settings UI now exposes a per-provider git model override selector.
GitActionsControlwas updated to consume the currently selected provider/model from chat state instead of inferring from a session-only provider, which keeps git generation aligned with the thread the user is actively composing in.Validation
I ran the required repo checks successfully:
bun fmtbun lintbun typecheckI also ran a targeted web test pass covering the merged and adapted areas:
bun --cwd apps/web test src/appSettings.test.ts src/components/ChatView.logic.test.ts src/components/ThreadTerminalDrawer.test.ts src/components/chat/ComposerPendingTerminalContexts.test.tsx src/components/chat/MessagesTimeline.test.tsx src/components/chat/userMessageTerminalContexts.test.ts src/lib/terminalContext.test.tsSummary by CodeRabbit
New Features
Bug Fixes
Tests