Skip to content

Add constrained Copilot-assisted commit planning [3/7] - #22977

Merged
sergiou87 merged 5 commits into
sergiou87-assisted-commit-transactionsfrom
sergiou87-assisted-commit-planning
Nov 3, 2026
Merged

sergiou87 merged 5 commits into
sergiou87-assisted-commit-transactionsfrom
sergiou87-assisted-commit-planning

Conversation

@sergiou87

@sergiou87 sergiou87 commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Layer 3 of the plan-first Copilot-assisted commit series, stacked on #22976. This backend-only layer does not close the complete feature work.

Description

  • Add snapshot-analysis-only Copilot planning with strict immutable outcomes, opaque-ID exact-once ownership, instruction-aware commit messages, explicit unsafe errors, and canonical whole-plan validation before any execution. Only a valid unsafe split can request one fresh whole-selection message; malformed output and transport/ownership errors never consolidate to success.
  • Explain intent-first grouping reasons: features, bug/root causes, cohesive modules/subsystems, shared prerequisites, meaningful steps and coordinated contract changes. Common paths do not merge unrelated features, and shared whole-file units remain indivisible. Normal planning has no commit-count quota; whole-selection fallback still requests one fresh message. Synthetic tests cover prompt contracts and complete input preservation, not measured model grouping quality.
  • Reuse the existing SDK, account/model request types, commit-message model preference, and quota errors. Planner clients use session-bound access-token getters and the existing rotating SDK token provider; explicit BYOK sessions omit the GitHub provider. Rely on SDK-native global/repository/scoped instruction loading with append mode, repository cwd and custom instructions enabled. Do not override the instruction config directory, discover/copy files or reinsert instruction-source bodies. Deny built-in/custom/MCP model tools and reject permission requests; retain supported controls for file hooks, host Git context, questions, memory and session persistence. Omit obsolete remoteSession configuration and rely on SDK local-session defaults.
  • Own cancellation, response subscriptions/deadlines, late-created clients/sessions and ephemeral filesystems. Synthetic bundled-runtime tests prove native root instruction bodies and scoped-file references reach the model, no model tools are exposed, file-hook sentinels remain absent and unrelated file content is not read. Configured MCP processes may start under normal SDK behavior despite disabled model tools; this is not an OS sandbox or a guarantee against configured-process startup. Scoped instruction bodies are left to SDK behavior, not manually injected. No customer diff was sent to a live model.
  • Leave the assisted UI execution gate dormant. No Sidebar/AppStore/Dispatcher execution wiring, commit/push calls, UI lifecycle, new model picker or push option is introduced. Ordinary commit-message generation retains its existing prompt and behavior. Add backend architecture and layer-4 integration documentation.

Stack

Merge in order, starting with 1. Each PR builds on the preceding PR.

  1. #22971 - Repository-scoped assisted commit UX
  2. #22976 - Selected snapshots and validated Git transactions
  3. #22977 - Constrained Copilot-assisted commit planning (this PR)
  4. #22986 - Awaited local runs and recovery
  5. #22991 - Optional push and push-only retry
  6. #23079 - Shared Copilot lifecycle helpers
  7. #23081 - Assisted commit architecture documentation

Validation

The native-instruction fixture uses bundled SDK 1.0.18/runtime 1.0.94 and a completely local fake model. It observes configured MCP startup separately from zero model-tool access, verifies automatic global/repository root bodies and scoped references, and does not claim evaluated semantic adherence. Ordinary generation/conflict and credential-aware factories remain unchanged. No dependency manifests or compiler configuration were changed.

An isolated strict compiler fixture also checks the complete production session-config function verbatim against SDK 1.0.27-preview.1, pinned by the GitHub merge manifest and lockfile. It reproduced the sole TS2353 error for remoteSession before removal and passed with no diagnostics afterward, including SDK dependency declarations. SDK 1.0.18 documents local-only off as the omitted option's default; the newer SDK no longer exposes or serializes that option. No casts, compatibility shims or replacement remote/export policy were added.

  • corepack yarn test app/test/unit/copilot-assisted-commit-test.ts app/test/unit/copilot-assisted-commit-sdk-test.ts app/test/unit/stores/copilot-assisted-commit-test.ts app/test/unit/stores/copilot-store-credentials-test.ts app/test/unit/stores/copilot-store-test.ts app/test/unit/copilot-commit-message-test.ts app/test/unit/copilot-commit-message-prompt-test.ts app/test/unit/copilot-sdk-auth-test.ts app/test/unit/credential-sessions-test.ts app/test/unit/refresh-token-consumers-test.ts app/test/unit/git/assisted-commit-planning-test.ts — passed, 259 tests.
  • GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.bareRepository GIT_CONFIG_VALUE_0=all corepack yarn test — passed, 2595 tests / 2 skipped. Process-only fixture compatibility; no Git configuration files were changed.
  • Plain corepack yarn test was not rerun without that override. Four bare-repository fixture failures under CLI safe.bareRepository=explicit were independently reproduced on the rebased lower baseline; no unrelated fixes were made.
  • corepack yarn lint:fix and corepack yarn lint — passed.
  • corepack yarn tsc --noEmit --pretty false — passed, including dependency declarations; no skipLibCheck workaround.
  • corepack yarn exec markdownlint -- docs/technical/assisted-commit-planning.md --config .markdownlint.js --rules .markdownlint-rules.js — passed.
  • corepack yarn test:e2e:build:unpackaged — not rerun for this one-option compatibility fix. The prior SDK-native change passed the production unpackaged build; this fix separately passes the exact merge-SDK config compile. Native CI for the new head is not yet confirmed.

Screenshots

N/A — backend-only; the assisted execution UI remains dormant.

Release notes

Notes: no-notes

@sergiou87
sergiou87 force-pushed the sergiou87-assisted-commit-planning branch 2 times, most recently from 08357b2 to 627a1ab Compare October 7, 2026 09:08
@sergiou87
sergiou87 added this pull request to stack #22992 October 9, 2026 08:14
Copilot AI balanced review requested due to automatic review settings October 9, 2026 14:56

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

Instruction files from distinct SDK discovery roots can silently overwrite each other.

1 open finding
What changed in this PR

Adds the constrained backend for Copilot-assisted commit planning while preserving Desktop’s existing transaction validation and execution boundaries.

Changes:

  • Adds snapshot-only planning, strict response validation, and unsafe-split fallback.
  • Isolates SDK tools, instructions, storage, cancellation, and cleanup.
  • Adds extensive planner, SDK, lifecycle, and Git integration tests.
File Description
docs/​technical/​assisted-commit-transactions.md Links transaction and planning layers.
docs/​technical/​assisted-commit-planning.md Documents contracts, safety, and integration.
app/​src/​lib/​assisted-commit-planning.ts Orchestrates proposal and canonical validation.
app/​src/​lib/​copilot-assisted-commit.ts Defines planner protocol and SDK policy.
app/​src/​lib/​copilot-assisted-commit-instructions.ts Creates isolated instruction configuration.
app/​src/​lib/​copilot-operation.ts Adds cancellable SDK adapters.
app/​src/​lib/​copilot-in-memory-session-fs-provider.ts Adds explicit filesystem disposal.
app/​src/​lib/​stores/​copilot-store.ts Implements planner requests and cleanup.
app/​test/​helpers/​copilot-assisted-commit.ts Provides planner test fixtures.
app/​test/​unit/​copilot-assisted-commit-test.ts Tests protocol and session restrictions.
app/​test/​unit/​copilot-assisted-commit-sdk-test.ts Tests actual SDK isolation behavior.
app/​test/​unit/​copilot-assisted-commit-instructions-test.ts Tests instruction copying and ownership.
app/​test/​unit/​copilot-assisted-commit-instructions-error-test.ts Tests setup failure cleanup.
app/​test/​unit/​copilot-in-memory-session-fs-provider-test.ts Tests disposal behavior.
app/​test/​unit/​git/​assisted-commit-planning-test.ts Tests snapshot planning with Git validation.
app/​test/​unit/​stores/​copilot-assisted-commit-test.ts Tests store lifecycle and errors.

🧠 Review effort: Balanced


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

@sergiou87 sergiou87 changed the title Add constrained Copilot-assisted commit planning Add constrained Copilot-assisted commit planning [3/5] Oct 15, 2026
@sergiou87
sergiou87 force-pushed the sergiou87-assisted-commit-planning branch 2 times, most recently from efa2b07 to 45a8437 Compare October 15, 2026 14:57
@sergiou87
sergiou87 force-pushed the sergiou87-assisted-commit-planning branch from 45a8437 to 692f55d Compare October 15, 2026 16:21
@sergiou87
sergiou87 force-pushed the sergiou87-assisted-commit-planning branch from 692f55d to a02d7fe Compare October 16, 2026 12:00
@sergiou87
sergiou87 force-pushed the sergiou87-assisted-commit-planning branch 3 times, most recently from d9cebed to 44a32cb Compare October 21, 2026 08:36
@@ -0,0 +1,311 @@
/** Cancellation controls for SDK operations, preserving the caller's domain error. */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Some of this code can be reused in other Copilot features. That is done in #23079

@sergiou87
sergiou87 marked this pull request as ready for review October 27, 2026 08:11
@sergiou87
sergiou87 requested a review from a team as a code owner October 27, 2026 08:11
@sergiou87 sergiou87 changed the title Add constrained Copilot-assisted commit planning [3/5] Add constrained Copilot-assisted commit planning [3/7] Oct 28, 2026
tidy-dev
tidy-dev previously approved these changes Oct 29, 2026
@sergiou87
sergiou87 force-pushed the sergiou87-assisted-commit-planning branch from de2acca to 152454b Compare October 29, 2026 13:39
Remove duplicate custom instruction discovery, copied configuration and instruction-source reinjection. Keep SDK-native loading with model tools disabled, and document normal configured MCP startup and scoped-instruction references. Preserve owned cancellation, credential-aware sessions and plan validation.
Rely on SDK local-session defaults instead of passing remoteSession, which newer SDK versions no longer expose. Preserve all other assisted session controls and verify the exact session config against the CI merge SDK.
tidy-dev
tidy-dev previously approved these changes Nov 3, 2026
@sergiou87
sergiou87 merged commit 4f843bc into development Nov 3, 2026
9 checks passed
@sergiou87
sergiou87 dismissed tidy-dev’s stale review November 3, 2026 17:14

The merge-base changed after approval.

@sergiou87
sergiou87 deleted the sergiou87-assisted-commit-planning branch November 3, 2026 17:14
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.

3 participants