Skip to content

fix: drop restartOnCrash + maxRestarts (loader rejects them) — 0.1.1 - #3

Merged
avifenesh merged 1 commit into
mainfrom
fix/remove-unimplemented-lifecycle-fields
Apr 26, 2026
Merged

fix: drop restartOnCrash + maxRestarts (loader rejects them) — 0.1.1#3
avifenesh merged 1 commit into
mainfrom
fix/remove-unimplemented-lifecycle-fields

Conversation

@avifenesh

@avifenesh avifenesh commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Claude Code 2.1.x runtime documents restartOnCrash and maxRestarts in the plugins reference, but the LSP loader rejects them at init time:

```
[ERROR] Failed to initialize LSP server plugin:zig-lsp:zig: LSP server 'plugin:zig-lsp:zig': restartOnCrash is not yet implemented. Remove this field from the configuration.
```

When these fields are present, the entire LSP server is rejected (not just the field) — .zig files get `No LSP server available`. Removing them makes ZLS spawn cleanly and documentSymbol / hover / post-edit diagnostics work. `startupTimeout` is fine; only the lifecycle-restart fields are unimplemented.

Empirical verification

Tested end-to-end against `cockpit/src-tauri/sidecars/agent-probe-zig` (Zig 0.17, ~900 LOC):

Action Before After
Plugin init Failed to initialize LSP server Loaded 1 LSP server(s) from plugin: zig-lsp
LSP documentSymbol on main.zig No LSP server available for file type .zig Returns 30+ top-level functions with line numbers
LSP hover on Session struct Same error Returns the full struct definition
publishDiagnostics Never delivered 0 diagnostics for clean file

Changes

File Change
plugins/zig-lsp/.lsp.json Drop restartOnCrash, maxRestarts; keep startupTimeout: 30000
.claude-plugin/marketplace.json Same in inline lspServers block; bump entry version 0.1.0 → 0.1.1
plugins/zig-lsp/.claude-plugin/plugin.json Version 0.1.0 → 0.1.1
plugins/zig-lsp/README.md Defaults table no longer lists those fields; gotcha note that a crashed ZLS stays dead until session restart
CLAUDE.md / AGENTS.md / CONTRIBUTING.md Plug-shape rules now explicitly forbid these fields until runtime ships them
agent-knowledge/claude-code-lsp-plugin-contribution.md Empirical evidence table updated; corrected key facts
CHANGELOG.md 0.1.1 entry, also captures the prior Unreleased .lsp.json-restore work

Test plan

  • claude plugin validate . passes
  • claude plugin validate plugins/zig-lsp passes
  • agnix --target claude-code passes (0 errors)
  • Local cache reflects new 0.1.1 → ZLS spawns and LSP operations return real results on cockpit/.../agent-probe-zig
  • Post-merge: /plugin marketplace update agent-sh && /plugin uninstall zig-lsp@agent-sh && /plugin install zig-lsp@agent-sh produces a clean install with the LSP working from a fresh cache

Note

Medium Risk
Updates shipped LSP manifests and marketplace metadata; while the change is small, any manifest/schema mistake could prevent zig-lsp from loading and break Zig LSP for users.

Overview
Releases zig-lsp v0.1.1 and fixes initialization on Claude Code 2.1.x by removing the unsupported restartOnCrash/maxRestarts fields from both plugins/zig-lsp/.lsp.json and the marketplace lspServers entry (keeping startupTimeout).

Updates contributor/user docs and the changelog to reflect the corrected third-party LSP plugin shape and explicitly forbid these fields until the loader implements them, plus adjusts the README to note that crashed ZLS won’t auto-restart.

Reviewed by Cursor Bugbot for commit e6ffad6. Configure here.

The Claude Code 2.1.x runtime documents `restartOnCrash` and
`maxRestarts` in the plugins reference but rejects them at LSP server
init with: "restartOnCrash is not yet implemented. Remove this field
from the configuration." With these fields in `.lsp.json` (or in the
marketplace.json `lspServers` block), the entire LSP server is
rejected — `claude --debug` shows `Failed to initialize LSP server
plugin:zig-lsp:zig` and `.zig` files get `No LSP server available`.

Without them, ZLS spawns, didOpen succeeds, publishDiagnostics flows,
and documentSymbol / hover return real results. Verified end-to-end
against a Zig 0.17 project (cockpit/.../agent-probe-zig).

Bumps to 0.1.1.

Files:
- plugins/zig-lsp/.lsp.json: drop restartOnCrash + maxRestarts;
  keep startupTimeout
- .claude-plugin/marketplace.json: same in lspServers block; bump
  zig-lsp entry version 0.1.0 -> 0.1.1
- plugins/zig-lsp/.claude-plugin/plugin.json: version 0.1.0 -> 0.1.1
- plugins/zig-lsp/README.md: defaults table no longer lists those
  fields; gotchas note that a crashed ZLS stays dead until session
  restart (since no auto-restart available)
- CLAUDE.md / AGENTS.md / CONTRIBUTING.md: plug-shape rules forbid
  restartOnCrash / maxRestarts until runtime ships them
- agent-knowledge/claude-code-lsp-plugin-contribution.md: empirical
  evidence row added; corrected key facts now also note
  `lspServers` inline in plugin.json works as a third config path
  (verified by user's local edit + michelsciortino/dart-lsp)
- CHANGELOG.md: 0.1.1 entry merging the prior Unreleased work
@avifenesh
avifenesh merged commit ecf3267 into main Apr 26, 2026
4 checks passed
@avifenesh
avifenesh deleted the fix/remove-unimplemented-lifecycle-fields branch April 26, 2026 02:12

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the zig-lsp plugin to version 0.1.1, primarily to remove the restartOnCrash and maxRestarts configuration fields which were found to cause initialization failures in Claude Code v2.1.119. Documentation across several files has been revised to reflect these findings and clarify the necessary plugin structure for third-party LSP servers. Feedback was provided regarding the CHANGELOG.md to ensure historical accuracy by retaining the original description of the 0.1.0 release.

Comment thread CHANGELOG.md
- Initial `zig-lsp` plugin for Claude Code, dispatching to user-installed `zls`
- `agent-sh` marketplace shell hosting `zig-lsp` (and ready for future LSP plugins)
- `.lsp.json` mapping `.zig` and `.zon` to language ID `zig`, with `enable_build_on_save`, `restartOnCrash`, and a 30 s startup timeout
- `.lsp.json` mapping `.zig` and `.zon` to language ID `zig`, with `enable_build_on_save` and a 30 s startup timeout

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Retroactively modifying the 0.1.0 entry to remove restartOnCrash makes the changelog historically inaccurate, as that version did include those fields in its manifest. It is generally better to keep historical entries as they were released and document the removal in the current version's section.

Suggested change
- `.lsp.json` mapping `.zig` and `.zon` to language ID `zig`, with `enable_build_on_save` and a 30 s startup timeout
- .lsp.json mapping .zig and .zon to language ID zig, with enable_build_on_save, restartOnCrash, and a 30 s startup timeout

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.

1 participant