Skip to content

Document per-session plugin directories - #2581

Open
1fanwang wants to merge 2 commits into
github:mainfrom
1fanwang:1fannnw/document-per-session-plugin-dirs
Open

Document per-session plugin directories#2581
1fanwang wants to merge 2 commits into
github:mainfrom
1fanwang:1fannnw/document-per-session-plugin-dirs

Conversation

@1fanwang

@1fanwang 1fanwang commented Sep 8, 2026

Copy link
Copy Markdown

Stacked on #2580, which the added example needs in order to be type-checked. Once that merges this reduces to the documentation commit.

Why

An SDK application wants one session to load a code-review plugin and another to load nothing, or it connects to a runtime it did not spawn. The reader opens the plugin directories guide and finds two ways to load a plugin: the --plugin-dir launch argument, and the trusted host-bundled startup option for plugins the host itself ships. Neither fits. The guide says plainly that loading a plugin directory "makes its extensions visible to every session created by the client", and that the SDK does not forward --plugin-dir to runtimes it did not spawn.

So the reader concludes per-session plugin sets are not supported, and reaches for a second client or a wrapper process.

They are supported. The session config takes pluginDirectories, it is typed in all six language bindings, and the SDK forwards it on both create and resume. Because it travels in the JSON-RPC payload rather than as a process argument, it also reaches an external runtime. It simply had no entry in its own guide.

After this change the reader finds it beside the two mechanisms they were already comparing.

What changed

A section covering the per-session option: what it does, how paths resolve, how it interacts with config discovery and precedence, an example, and the spelling in each language.

Testing Done

Documentation only, no code paths touched.

The option was absent from the guide before this change and present after:

$ git grep -c pluginDirectories upstream/main -- docs/features/plugin-directories.md
(no output, exit status 1)

$ git grep -c pluginDirectories HEAD -- docs/features/plugin-directories.md
HEAD:docs/features/plugin-directories.md:3

The added example is compiled against the SDK types by the docs validation, so a wrong option name or type fails the build.

Raw logs: docs validation
$ (cd scripts/docs-validation && npm run validate:ts) | tail -6
TypeScript:
  ✅ 192 files passed

✅ All documentation code blocks are valid!

Closing a docs-validate hidden block sets a pending skip so the visible
copy is not validated twice. A fence whose language has no validator,
such as rust, was never recognized as a code block, so it never consumed
that skip and the next validated block absorbed it instead.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
The plugin directories guide covered only the --plugin-dir launch
argument and the trusted host-bundled startup option, so the per-session
pluginDirectories config had no entry despite being typed in every
language binding and forwarded on create and resume.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang
1fanwang requested a review from a team as a code owner September 8, 2026 19:16
Copilot AI balanced review requested due to automatic review settings September 8, 2026 19:16

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.

🟢 Approval recommended

The documentation update is consistent with existing SDK option naming, and the extractor change is minimal and correctly scoped to preventing skip-directive leakage.

Pull request overview

This PR updates the plugin directories documentation to cover the per-session pluginDirectories session option (useful when different sessions need different plugins or when connecting to an external runtime), and adjusts the docs validation extractor so “hidden”/skip directives can’t leak past fenced code blocks whose language isn’t validated.

Changes:

  • Documented per-session plugin directories, including a TypeScript example and the option spelling across SDKs.
  • Updated scripts/docs-validation/extract.ts to track and close unvalidated fenced blocks so pending skips are consumed correctly.
File summaries
File Description
scripts/docs-validation/extract.ts Treats fences in unvalidated languages as blocks that still consume pending skip directives.
docs/features/plugin-directories.md Adds a “Per-session plugin directories” section documenting pluginDirectories and cross-SDK option names.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

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