Skip to content

refactor: chat module. - #147

Merged
knightedcodemonkey merged 1 commit into
chatfrom
chat-phase-1-extract-module
Sep 6, 2026
Merged

refactor: chat module.#147
knightedcodemonkey merged 1 commit into
chatfrom
chat-phase-1-extract-module

Conversation

@knightedcodemonkey

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings September 6, 2026 15:52

Copilot AI 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.

🟡 Changes recommended

User-facing credential terminology is inconsistent (“API key”/“key” vs “GitHub token”), which can confuse users and breaks message-matching logic unless aligned.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Refactors the AI chat implementation by moving it out of the GitHub-specific module namespace into a dedicated src/modules/chat/ area, while keeping the app wiring functional and updating docs/tests to match.

Changes:

  • Moved chat API constants/headers/error parsing into src/modules/chat/api/* and updated chat completion request/stream functions.
  • Extracted/introduced chat helpers for payload sizing/summarization, proposal parsing, tab targeting, and tab-scoped undo state.
  • Decoupled chat UI wiring from github-workflows by adding app-core/chat-workflows.js, updating src/app.js, docs, tests, and CI branch triggers.
File summaries
File Description
src/modules/github/api/core.js Removes chat-specific header helper from shared GitHub API core exports.
src/modules/github/api/constants.js Leaves only githubApiBaseUrl after moving chat-specific constants.
src/modules/chat/workspace-actions.js Renames exported factory to createChatWorkspaceActions.
src/modules/chat/utils.js Updates chat model defaults and model-access status/error messaging.
src/modules/chat/tab-target-resolver.js Adds tab target resolution logic for proposals (id/path/name + language scoping).
src/modules/chat/tab-scoped-undo-state.js Adds per-tab snapshot storage for undo/apply behavior.
src/modules/chat/proposals.js Adds tool-call and markdown parsing to extract editor update proposals.
src/modules/chat/payload.js Adds bounded payload building with conversation summarization and mode-aware system policy.
src/modules/chat/drawer.js Updates drawer to use the new chat/api/completions.js entrypoints and new constants.
src/modules/chat/api/request.js Introduces chat request headers + shared error/rate-limit parsing utilities.
src/modules/chat/api/constants.js Defines chat completions URL, default model, and model option list.
src/modules/chat/api/completions.js Refactors completion request/stream logic to the new constants + request helpers and exports new names.
src/modules/chat/active-tab-context.js Adds editor context builder including “available tab targets” + active-tab source embedding.
src/modules/app-core/github-workflows.js Removes chat drawer wiring from GitHub workflows initialization/return value.
src/modules/app-core/github-workflows-setup.js Stops passing chat-specific runtime/actions into GitHub workflows setup.
src/modules/app-core/chat-workflows.js New workflow initializer dedicated to chat drawer wiring.
src/app.js Switches to new chat workspace actions + chat workflows initializer and updates wiring.
playwright/github-byot-ai.spec.ts Updates default model import to the new chat module export.
docs/ai-chat-context-and-payload-strategy.md Updates file references to new chat module paths.
.github/workflows/playwright.yml Runs Playwright workflow for PRs targeting chat branch in addition to main.
Review details

Suppressed comments (5)

src/modules/chat/api/completions.js:288

  • Token validation errors in this module say "API key", but the rest of the app (including the chat drawer UI) consistently refers to a "GitHub token". This inconsistency is user-facing and can be confusing; align the wording with the UI.

This issue also appears on line 403 of the same file.
src/modules/chat/api/completions.js:405

  • Token validation errors in this module say "API key", but the rest of the app (including the chat drawer UI) consistently refers to a "GitHub token". Please keep the error message consistent with the UI wording.
    src/modules/chat/utils.js:39
  • This status/error copy says "key", but the rest of the UI uses "GitHub token". Aligning terminology avoids confusing users about what credential they need to provide.

This issue also appears on line 46 of the same file.
src/modules/chat/utils.js:48

  • This status-message detector looks for "key" wording, but other parts of the UI refer to the credential as a "GitHub token". Keep the sentinel text consistent so status clearing/replacement logic continues to work with the displayed message.
    src/app.js:1388
  • This spread uses the "githubChatWorkspaceActions" identifier, which is now a bit misleading given the refactor to generic chat modules (createChatWorkspaceActions / chat workflows). Consider renaming this usage to match the updated, non-GitHub naming.
  ...githubChatWorkspaceActions,
  • Files reviewed: 15/20 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/app.js
})

const githubChatWorkspaceActions = createGitHubChatWorkspaceActions({
const githubChatWorkspaceActions = createChatWorkspaceActions({
@knightedcodemonkey
knightedcodemonkey merged commit 813f15b into chat Sep 6, 2026
6 checks passed
@knightedcodemonkey
knightedcodemonkey deleted the chat-phase-1-extract-module branch September 6, 2026 20:12
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