Skip to content

feat: tab-scoped ai chat.#111

Merged
knightedcodemonkey merged 4 commits intonextfrom
bananas
May 2, 2026
Merged

feat: tab-scoped ai chat.#111
knightedcodemonkey merged 4 commits intonextfrom
bananas

Conversation

@knightedcodemonkey
Copy link
Copy Markdown
Owner

Copilot AI review requested due to automatic review settings May 2, 2026 01:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements tab-scoped AI chat proposal routing, applying, and undo behavior so assistant edits target explicit workspace tab identities (id/path) rather than the legacy fixed component/styles editor assumptions.

Changes:

  • Introduces tab-aware proposal parsing + target resolution (id/path/name + optional language hint) and per-tab undo snapshot storage.
  • Refactors the AI chat drawer to send active-tab context, render per-tab apply actions, apply updates via workspace tab APIs, and undo per active tab.
  • Updates app wiring, UI copy, Playwright coverage, and adds documentation describing the new context/payload strategy.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/modules/github/chat/utils.js Shared chat string/model/repository helpers (replaces legacy chat-utils).
src/modules/github/chat/proposals.js Tool + markdown proposal extraction for tab-targeted updates.
src/modules/github/chat/tab-target-resolver.js Resolves proposal targets to workspace tabs (id/path/name + language + active fallback).
src/modules/github/chat/tab-scoped-undo-state.js Stores undo snapshots per tab id.
src/modules/github/chat/active-tab-context.js Builds system prompt editor context for the active tab + available tab targets list.
src/modules/github/chat/payload.js Expands mode/style policy guidance in system prompt; switches to new utils import.
src/modules/github/chat/drawer.js Core refactor: tab-scoped apply/undo, dynamic apply actions, active-tab context payload, new workspace tab API integration.
src/modules/app-core/github-chat-workspace-actions.js Adds tab-scoped adapter functions for chat drawer (get contexts + apply content).
src/modules/app-core/github-workflows.js Wires chat drawer with new tab-scoped workspace actions.
src/modules/app-core/github-workflows-setup.js Passes tab-scoped actions into workflows setup.
src/app.js Switches drawer import path and hooks active-tab change events into chat drawer rendering; provides tab-scoped workspace actions.
src/index.html Updates checkbox label copy (“Send tab content”).
playwright/github-byot-ai.spec.ts Updates/extends e2e tests for tab-scoped apply/undo behavior and active-tab context messaging.
docs/ai-chat-context-and-payload-strategy.md Documents the new context/payload and tab-targeting strategy.
src/modules/github/chat-drawer/proposals.js Removes legacy fixed-editor proposal extraction.
Comments suppressed due to low confidence (3)

src/modules/github/chat/drawer.js:437

  • proposalIndex stored on the Apply button is derived from the resolvedProposals loop, but applyProposalToTab() later uses it to index into the original proposals array. If any proposals are filtered out during resolution (invalid targets), the indices can diverge and clicking Apply may select the wrong proposal or fail to apply. Preserve the original proposals index when resolving (or store the resolved tab id) so the click handler can apply deterministically.
    src/modules/github/chat/drawer.js:415
  • appliedKey is computed from the raw proposal.target string. Different textual targets can resolve to the same tab (e.g., active vs a path, or backslashes vs slashes), which can lead to duplicate apply actions and inconsistent appliedTargets gating. Consider using resolvedTab.id (or another canonical resolved identifier) as the applied key and in applyProposalToTab()’s return value.
    src/modules/github/chat/drawer.js:410
  • Unresolvable proposal targets are currently dropped (return null), which can leave the user with an assistant message but no apply actions and no explanation. Per the tab-target contract, consider surfacing an actionable status/error (or rendering a disabled action) when proposals exist but none match current tabs, rather than failing silently.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@knightedcodemonkey knightedcodemonkey merged commit 9da5e93 into next May 2, 2026
6 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch May 2, 2026 01:51
knightedcodemonkey added a commit that referenced this pull request May 2, 2026
* feat: idb infrastructure. (#63)

* feat: dynamic tabs. (#64)

* refactor: better accessbility for tabs. (#68)

* feat: remove allow-same-origin for better security. (#69)

* feat: tab reordering via drag-n-drop. (#70)

* feat: explicit css imports, diagnostics per editor buffer. (#71)

* feat: idb + github sync with atomic open and push to remote. (#78)

* closes #73, closes #74, closes #75.

* refactor: more colocation and smaller file sizes. (#79)

* refactor: improvements with styles and gh syncs. (#82)

* test: webkit flake. (#83)

* test: address flake. (#84)

* refactor: github pr context. (#85)

* fix: require app in entry, hide workspaces without pat, remove star important. (#86)

* feat: make idb source of truth for pr context. (#87)

* fix: active pr context on reload and dedupe workspace identity. (#88)

* fix: edited and push sync across reloads. (#89)

* fix: properly commit tab name changes. (#90)

* fix(tabs): filename edits, min-widths, scrolling, content sync. (#91)

* feat: improved workspace disconnect and closed ux. (#92)

* refactor: status styling and biome config. (#94)

* fix(diagnostics): enforce current-editor snapshots and stale results. (#95)

* fix: consistent head handling. (#96)

* fix: prevent workspace overwrites. (#100)

* fix(playwright): stabilize lint diagnostics waits with one-time rerun fallback. (#101)

* feat: improved workspace ux and state identity separation.  (#103)

* fix: iframe protocol mismatch in receiver reads. (#104)

* refactor: remove remaining fixed editor assumptions. (#105)

* refactor: simplify PR close flow with deterministic workspace state updates (#106)

* feat: mode-aware entry tab extensions. (#108)

* feat: workspace status bar. (#109)

* feat: tab-scoped ai chat. (#111)

* refactor: better workspace drawer ux. (#112)

* refactor: remove collapsible editors and update breakpoint styles. (#113)

* docs: update for vnext. (#114)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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