Skip to content

Add Copilot-only lsp frontmatter support with schema, codegen, engine guardrails, and LSP instructions (experimental)#41777

Open
Copilot wants to merge 17 commits into
mainfrom
copilot/add-lsp-compiler-support
Open

Add Copilot-only lsp frontmatter support with schema, codegen, engine guardrails, and LSP instructions (experimental)#41777
Copilot wants to merge 17 commits into
mainfrom
copilot/add-lsp-compiler-support

Conversation

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This change adds first-class lsp frontmatter support so workflows can declare language-server configuration and have Copilot CLI receive generated lspServers config plus required server dependencies in agent setup. The feature is explicitly gated to Copilot; non-Copilot engines now fail fast when lsp is present. The lsp field is marked experimental and emits a compile-time warning.

  • Frontmatter + schema surface

    • Adds top-level lsp schema in main_workflow_schema.json with an experimental description.
    • Supports per-language entries with:
      • command
      • args
      • fileExtensions
    • Wires typed parsing into workflow/frontmatter models and WorkflowData.
  • LSP manager (normalization + generation)

    • Introduces a dedicated LSP manager to:
      • normalize/validate lsp entries,
      • build Copilot-compatible lspServers payload,
      • emit install steps for known server ecosystems.
    • Includes lightweight diagnostics for ignored/invalid keys during normalization/parsing.
    • Input keys are sorted before normalization so duplicate keys that collapse to the same lowercase value resolve deterministically (lexicographically first wins); collisions are logged explicitly.
    • npm install steps respect runtimes.node.run-install-scripts (default: --ignore-scripts for supply-chain protection) and runtimes.node.cooldown settings, consistent with the runtime manager.
  • Runtime manager integration

    • LSP servers that require Go, Ruby, or Node.js declare RuntimeRequirement values fed into the standard DetectRuntimeRequirements / GenerateRuntimeSetupSteps flow, which emits properly SHA-pinned setup actions (e.g. actions/setup-go, ruby/setup-ruby).
  • Copilot code generation integration

    • Extends Copilot settings generation to write ~/.copilot/settings.json with both:
      • builtInAgents.rubberDuck=false
      • lspServers (from frontmatter).
    • Extends Copilot installation flow to append LSP dependency install steps in the agent job.
  • Engine compatibility enforcement

    • Adds compiler validation that rejects lsp unless the resolved engine is copilot, with explicit error messaging.
    • Uses the shared ResolveEngineID helper for engine ID resolution to avoid future drift.
    • Emits an experimental compile-time warning whenever lsp is used.
  • LSP instructions file

    • Adds .github/aw/lsp.md documenting the lsp frontmatter syntax, built-in server table with auto-injected install commands, per-language examples, network requirements, and compile-time validation rules.
    • Registered in the agentic-workflows skill so it is loaded when relevant.
  • jsweep workflow

    • Adds TypeScript LSP server to jsweep.md covering .js, .cjs, .mjs, .ts, and .tsx extensions to enable full language-server support while the agent works on JavaScript files.
  • smoke-copilot workflow

  • Example

    engine: copilot
    tools:
      github: {}
    lsp:
      typescript:
        command: typescript-language-server
        args: ["--stdio"]
        fileExtensions:
          ".ts": typescript
          ".tsx": typescriptreact

Copilot AI and others added 2 commits June 26, 2026 18:31
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add Copilot-only LSP frontmatter support Add Copilot-only lsp frontmatter support with schema, codegen, and engine guardrails Jun 26, 2026
Copilot AI requested a review from pelikhan June 26, 2026 18:36
@pelikhan pelikhan marked this pull request as ready for review June 26, 2026 19:06
Copilot AI review requested due to automatic review settings June 26, 2026 19:06

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.

Pull request overview

Adds a new top-level lsp frontmatter field to agentic workflows, enabling workflows running on the Copilot engine to generate Copilot CLI ~/.copilot/settings.json with lspServers and to install known LSP dependencies during setup, while rejecting lsp for non-Copilot engines.

Changes:

  • Adds lsp to the main workflow JSON schema and wires typed parsing into FrontmatterConfig / WorkflowData.
  • Introduces an LSPManager to normalize/validate LSP config, generate Copilot-compatible lspServers, and emit LSP dependency install steps.
  • Enforces engine compatibility via compiler validation (reject lsp unless engine resolves to copilot) and updates Copilot engine codegen + tests to include the settings payload and install steps.
Show a summary per file
File Description
pkg/workflow/workflow_builder.go Extracts lsp from typed frontmatter (or raw frontmatter fallback) into WorkflowData.
pkg/workflow/lsp_validation.go Adds compiler validation to gate lsp to Copilot and validate lsp config.
pkg/workflow/lsp_validation_test.go Adds unit coverage for lsp gating + validation errors.
pkg/workflow/lsp_manager.go Adds normalization/validation plus Copilot payload generation and install-step generation.
pkg/workflow/lsp_manager_test.go Adds tests for LSPManager validation and install-step generation behavior.
pkg/workflow/frontmatter_types.go Extends typed frontmatter model with lsp field.
pkg/workflow/copilot_home_expansion_test.go Updates tests for new buildCopilotSettingsSetup signature.
pkg/workflow/copilot_engine_test.go Adds tests asserting Copilot settings include lspServers and install steps are appended.
pkg/workflow/copilot_engine_installation.go Appends LSP dependency install steps to Copilot installation steps.
pkg/workflow/copilot_engine_execution.go Generates Copilot settings JSON dynamically (default + lspServers) and writes it during setup.
pkg/workflow/compiler_types.go Adds WorkflowData.LSP field to carry parsed LSP configuration.
pkg/workflow/compiler_orchestrator_workflow.go Integrates validateLSPSupport into engine-setting validation ordering.
pkg/workflow/compiler_orchestrator_workflow_test.go Adds test ensuring non-Copilot engine rejects workflows with lsp.
pkg/parser/schemas/main_workflow_schema.json Adds JSON schema definition for top-level lsp frontmatter.
pkg/parser/schema_test.go Adds schema validation test for a valid lsp frontmatter configuration.

Review details

Tip

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

  • Files reviewed: 15/15 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment on lines +26 to +39
func NewLSPManager(servers map[string]LSPServerConfig) *LSPManager {
normalized := make(map[string]LSPServerConfig, len(servers))
for key, value := range servers {
language := strings.TrimSpace(strings.ToLower(key))
if language == "" {
lspManagerLog.Printf("Skipping invalid LSP language key: %q", key)
continue
}
config := value
config.Command = strings.TrimSpace(config.Command)
normalized[language] = config
}
return &LSPManager{servers: normalized}
}
Comment thread pkg/workflow/lsp_validation.go Outdated
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot Add the TypeScript LSP server to agentic-workflows to enable workflows that operate on JavaScript code, similar to JS Sweep.

…pt code intelligence

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Add the TypeScript LSP server to agentic-workflows to enable workflows that operate on JavaScript code, similar to JS Sweep.

Added the TypeScript LSP server to jsweep.md in commit feat(jsweep): add TypeScript LSP server. The configuration covers .js, .cjs, .mjs, .ts, and .tsx file extensions so the Copilot agent gets full TypeScript language server support while working on the JavaScript files in that workflow.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot generate an instructions file on how to use LSPs. .github/aw/lsp.md

…ation

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot generate an instructions file on how to use LSPs. .github/aw/lsp.md

Created .github/aw/lsp.md in the latest commit. It covers the frontmatter syntax, required vs optional fields, the full table of built-in servers with their auto-injected install commands, per-language examples (TypeScript, Python, Go, multi-language, and custom servers), network requirements per ecosystem, and compile-time validation rules.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, update this branch from main (it is behind by 15 commits), address any remaining review feedback, and rerun checks after the branch refresh.

Generated by 👨‍🍳 PR Sous Chef · 83.6 AIC · ⌖ 0.993 AIC · ⊞ 17.2K ·

Copilot AI and others added 3 commits June 26, 2026 23:42
…ler-support

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…ter lsp.md in skill

- lsp_manager.go: sort input keys before normalizing so duplicate keys
  (e.g. 'TypeScript' vs 'typescript') always resolve to the same winner
  deterministically; log collisions explicitly instead of silently losing entries.
- lsp_validation.go: replace inline engine-ID resolution with the shared
  ResolveEngineID helper to avoid future drift.
- lsp_manager_test.go: add TestLSPManagerDuplicateKeyNormalization.
- pkg/cli/data/agentic_workflows_fallback_aw_files.json: add lsp.md.
- .github/skills/agentic-workflows/SKILL.md: regenerate to include lsp.md.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title Add Copilot-only lsp frontmatter support with schema, codegen, and engine guardrails Add Copilot-only lsp frontmatter support with schema, codegen, engine guardrails, and LSP instructions Jun 26, 2026
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot the packages of each languages should be pinned to releases and the frontmatter should allow to configuration the version

- Change engine from codex to copilot with copilot-sdk: true to
  enable LSP support (LSP is Copilot-only per compiler validation)
- Add lsp.typescript frontmatter with typescript-language-server
  covering .js, .cjs, .mjs, .ts, .tsx extensions
- Add Node.js runtime (v20) required by the TypeScript LSP server
- Add test #11: use LSP document symbols to count functions in
  actions/setup/js/safe_output_helpers.cjs and report >=1 as pass
- Update issue body reference to include test #11 in results
- Recompile: lock.yml updated with lspServers settings.json payload,
  npm install --ignore-scripts typescript typescript-language-server,
  and NPM_CONFIG_MIN_RELEASE_AGE cooldown env var

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add Version field to LSPServerConfig for per-language version override
- Add NpmPackageVersions map to lspInstallSpec for default pinned npm versions
- Add DefaultVersion to go/ruby specs for pinned non-npm installs
- Update GenerateInstallSteps to emit versioned install commands
- Strip leading v prefix from user-provided version to avoid double-v
- Add version field to JSON schema
- Update .github/aw/lsp.md docs with version column and override note
- Add tests for default pinning, version override, and v-prefix handling
- Recompile lock files to pick up new pinned versions

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot Revert codex changes and update smoke-copilot instead

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage (updated)

Attribute Value
Category feature
Risk 🔴 High
Priority 🔴 High
Score 61/100
Action 👥 batch_review
Batch feature-promo (#41824 + #41777)

Score breakdown: Impact 38 + Urgency 13 + Quality 10 = 61

Assessment: Large change (+984/-29, 21 files) adding first-class lsp frontmatter support with schema, codegen, engine guardrails, and LSP instructions for Copilot. CI in-progress. Reviewer commented (no approve/block). Age: ~24h. Recommend batch review together with #41824 (model policy frontmatter) as complementary feature-promo changes.

Run §28298156610

Generated by 🔧 PR Triage Agent · 74.3 AIC · ⌖ 8.1 AIC · ⊞ 5.4K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the latest feedback by reverting the Codex-specific changes and moving the LSP smoke coverage to smoke-copilot instead. If any runtime-manager/pinning or --ignore-scripts follow-ups remain, please finish those too, then rerun checks.

Generated by 👨‍🍳 PR Sous Chef · 75.8 AIC · ⌖ 1.05 AIC · ⊞ 17.2K ·

…ilot

- Revert LSP changes from smoke-codex (engine change from codex to copilot,
  lsp frontmatter, node runtime v20, test #11 LSP TypeScript)
- Add TypeScript LSP server to smoke-copilot with lsp frontmatter and
  node runtime v20
- Add test #16 LSP TypeScript to smoke-copilot to count functions in
  actions/setup/js/safe_output_helpers.cjs
- Recompile both workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🥧 Pi initializing... Smoke Pi begins on this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🔮 The ancient spirits stir... Smoke Codex awakens to divine this pull request...

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Antigravity MISSION COMPLETE! Antigravity has spoken. ✨

@github-actions

Copy link
Copy Markdown
Contributor

✨ Gemini awakens... Smoke Gemini begins its journey on this pull request...

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions

Copy link
Copy Markdown
Contributor

💥 WHOOSH! Smoke Claude springs into action on this pull request! [Panel 1 begins...]

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (apikey) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (Entra) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.54.0
jq 1.7
yq v4.53.3
curl 8.5.0
gh 2.95.0
node v22.23.0
python3 3.11.15 (PyPy 7.3.23)
go 1.24.13
java 21.0.11
dotnet 10.0.301

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test · 15.5 AIC · ⌖ 6.49 AIC · ⊞ 5.4K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants