Skip to content

docs: document async loading sub-parameters - #398

Open
adity982 wants to merge 4 commits into
1mcp-app:mainfrom
adity982:agent/document-async-loading-options
Open

docs: document async loading sub-parameters#398
adity982 wants to merge 4 commits into
1mcp-app:mainfrom
adity982:agent/document-async-loading-options

Conversation

@adity982

@adity982 adity982 commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • document every async-loading CLI sub-parameter with its runtime default and behavior
  • explain readiness, timeout, batching, and notification tradeoffs for small and large server fleets
  • add matching guidance and an example to both the English and Chinese fast-startup guides

Validation

  • targeted Prettier check for both guides
  • pnpm docs:build

Closes #393

Summary by CodeRabbit

  • New Features
    • Added snapshot-based capability notifications with coalesced updates during asynchronous loading.
    • Added configurable notification batching, delays, and controls.
    • Clarified health checks for configuration readiness and backend loading progress.
  • Bug Fixes
    • Disabled capability notifications now remain suppressed regardless of batching settings.
  • Documentation
    • Updated English and Chinese guides with startup behavior, CLI options, compatibility settings, and health-check usage.
  • Deprecations
    • Marked legacy readiness, minimum-server, and timeout options as compatibility-only settings with warnings.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 45514752-56dc-4d75-ae31-27d8556a33a5

📥 Commits

Reviewing files that changed from the base of the PR and between 0249dd1 and 6f91db7.

📒 Files selected for processing (7)
  • docs/en/guide/advanced/fast-startup.md
  • docs/en/reference/health-check.md
  • docs/zh/guide/advanced/fast-startup.md
  • docs/zh/reference/health-check.md
  • src/commands/serve/asyncLoadingOptions.test.ts
  • src/commands/serve/asyncLoadingOptions.ts
  • src/commands/serve/index.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/commands/serve/index.test.ts
  • docs/zh/reference/health-check.md
  • docs/zh/guide/advanced/fast-startup.md
  • src/commands/serve/asyncLoadingOptions.test.ts
  • src/commands/serve/asyncLoadingOptions.ts
  • docs/en/guide/advanced/fast-startup.md
  • docs/en/reference/health-check.md

📝 Walkthrough

Walkthrough

The change centralizes async-loading option resolution, adds snapshot notification controls, marks legacy readiness settings as compatibility options, updates serve forwarding, and documents atomic capability snapshots and health endpoint semantics in English and Chinese.

Changes

Async loading behavior

Layer / File(s) Summary
Async-loading option resolution
src/commands/serve/asyncLoadingOptions.ts, src/core/types/transport.ts, src/commands/serve/asyncLoadingOptions.test.ts
Adds typed option resolution with defaults, deprecation warnings, alias precedence, validation, and compatibility no-ops.
Serve command wiring
src/commands/serve/index.ts, src/commands/serve/serve.ts, src/commands/serve/serveBackground.ts, src/commands/serve/*test.ts
Adds snapshot notification CLI support, resolves options during startup, forwards background settings, and updates precedence and environment tests.
Notification and health semantics
src/core/notifications/notificationManager.test.ts, docs/en/guide/advanced/fast-startup.md, docs/zh/guide/advanced/fast-startup.md, docs/en/reference/health-check.md, docs/zh/reference/health-check.md
Tests notification suppression and documents atomic capability snapshots, coalesced notifications, and supervised-backend readiness behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ServeCLI
  participant serveCommand
  participant resolveAsyncLoadingOptions
  participant AgentConfigManager
  ServeCLI->>serveCommand: Provide async-loading flags
  serveCommand->>resolveAsyncLoadingOptions: Resolve CLI and application settings
  resolveAsyncLoadingOptions-->>serveCommand: Return resolved asyncLoading options
  serveCommand->>AgentConfigManager: Initialize with resolved asyncLoading options
  AgentConfigManager-->>serveCommand: Publish capability snapshot and notifications
Loading

Possibly related PRs

Poem

A rabbit checks each option twice,
Snapshots settle, clean and precise.
Old readiness gates fade away,
Health paths show the current state.
Docs now guide each startup hop.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change: documenting async-loading sub-parameters.
Linked Issues check ✅ Passed The documentation and runtime updates address the requirements in issue #393, including defaults, readiness, batching, compatibility, and English and Chinese examples.
Out of Scope Changes check ✅ Passed The runtime compatibility changes and focused tests directly support the revised requirements for issue #393 and are not out of scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@xizhibei

Copy link
Copy Markdown
Contributor

Thank you for your contribution. I noticed this is still marked as a draft — would you like any further revisions, or is it ready to be merged?

@xizhibei

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Thanks for drafting the bilingual documentation. Source tracing found that the current table describes behavior that is not implemented: --async-min-servers and --async-timeout do not gate request acceptance, /health/ready, or capability publication.

Please keep this PR in draft and revise it against the accepted contract in #393: #393 (comment)

Required changes before this can be ready:

  • Do not document or recommend server-count readiness thresholds.
  • Deprecate the two ineffective CLI flags, their environment forms, and the matching TOML keys as warning compatibility no-ops.
  • Add and document --async-notify-on-snapshot; retain --async-notify-on-ready as a deprecated alias for one compatibility window.
  • Describe publication as one changed capability snapshot after all backends reach a terminal state.
  • Describe batching as coalescing capability-change events within the configured delay.
  • Clarify that /health/ready is configuration readiness and /health/mcp reports backend loading progress.
  • Include the runtime changes and focused tests, or retarget this PR so it no longer claims to close Document async loading sub-parameters (--async-min-servers, --async-timeout, --async-batch-notifications) #393 and make it depend on the runtime implementation.

The English and Chinese documentation should remain aligned.

@adity982

Copy link
Copy Markdown
Author

Updated this draft to match the accepted runtime contract and merged current main. Deprecated async server-count/timeout CLI, ONE_MCP env, and TOML inputs now warn as compatibility no-ops; --async-notify-on-snapshot is canonical, the old ready name warns as an alias, and the canonical value wins conflicts. English/Chinese docs now describe immediate listener availability, atomic snapshots, notification coalescing, and /health/ready vs /health/mcp. Validation: 51 focused tests passed; pnpm lint passed; pnpm typecheck passed; pnpm docs:build passed. Head: 0249dd1.

@adity982
adity982 marked this pull request as ready for review July 31, 2026 08:25

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
src/core/notifications/notificationManager.test.ts (1)

106-108: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use the shared mock factory for AgentConfigManager.

These lines create a local untyped manager test double. Use test/unit-utils/MockFactories.ts for this mock. If the factory does not support this case, add the factory there and reuse it.

As per coding guidelines, “Use test/unit-utils/MockFactories.ts for consistent mock data and mock factories.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/notifications/notificationManager.test.ts` around lines 106 - 108,
Replace the inline AgentConfigManager double in the relevant notification
manager test with the shared mock factory from MockFactories.ts, configuring it
to return clientNotifications: false. If the factory lacks the needed
configuration, extend it there first, then reuse the typed factory output
instead of the local cast and spy setup.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/en/reference/health-check.md`:
- Line 173: Update the `/health/ready` descriptions in
docs/en/reference/health-check.md:173-173,
docs/en/guide/advanced/fast-startup.md:178-178,
docs/zh/reference/health-check.md:158-158, and
docs/zh/guide/advanced/fast-startup.md:172-172 to state that readiness returns
503 when any supervised stdio backend is restarting or in a crash loop, while
retaining the distinction that it does not wait for backend loading or a
server-count threshold.

In `@src/commands/serve/asyncLoadingOptions.ts`:
- Around line 38-64: Update resolveAsyncLoadingOptions to validate and normalize
resolved values before returning them: cast boolean options at their consumption
points, reject or normalize invalid batchDelayMs values before they reach
setTimeout, and require parsed async-batch-delay CLI input to be an integer
before applying it to configuration. Preserve existing defaults and
canonical-option precedence while preventing malformed values from reaching
server config.

In `@src/commands/serve/index.test.ts`:
- Around line 65-78: Replace the direct process.env reads and writes in the
“passes deprecated async environment inputs through for warning handling” test
with the repository-approved environment stub or yargs environment helper. Set
ONE_MCP_ASYNC_MIN_SERVERS through that helper, preserve the existing assertion,
and restore the isolated environment value using the helper’s cleanup mechanism.

In `@src/commands/serve/serve.ts`:
- Around line 445-447: Align the async-loading batch delay default used by
resolveAsyncLoadingOptions with the value persisted by AgentConfigManager and
documented elsewhere. Update the relevant default configuration and tests so
serve.ts, the manager, notifications, documentation, and fast-startup examples
consistently use the same runtime default.

---

Nitpick comments:
In `@src/core/notifications/notificationManager.test.ts`:
- Around line 106-108: Replace the inline AgentConfigManager double in the
relevant notification manager test with the shared mock factory from
MockFactories.ts, configuring it to return clientNotifications: false. If the
factory lacks the needed configuration, extend it there first, then reuse the
typed factory output instead of the local cast and spy setup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 363f5c5d-8db9-466e-9f9b-28727889a5b4

📥 Commits

Reviewing files that changed from the base of the PR and between f3b1281 and 0249dd1.

📒 Files selected for processing (13)
  • docs/en/guide/advanced/fast-startup.md
  • docs/en/reference/health-check.md
  • docs/zh/guide/advanced/fast-startup.md
  • docs/zh/reference/health-check.md
  • src/commands/serve/asyncLoadingOptions.test.ts
  • src/commands/serve/asyncLoadingOptions.ts
  • src/commands/serve/index.test.ts
  • src/commands/serve/index.ts
  • src/commands/serve/serve.transport-precedence.test.ts
  • src/commands/serve/serve.ts
  • src/commands/serve/serveBackground.ts
  • src/core/notifications/notificationManager.test.ts
  • src/core/types/transport.ts

Comment thread docs/en/reference/health-check.md Outdated
Comment thread src/commands/serve/asyncLoadingOptions.ts
Comment thread src/commands/serve/index.test.ts
Comment thread src/commands/serve/serve.ts
@adity982

Copy link
Copy Markdown
Author

Addressed all four new CodeRabbit findings in 6f91db7: documented the supervised-backend readiness condition, restored the shared 1000 ms batch default, rejected malformed batch-delay values, and isolated the environment test with Vitest stubbing. Validation: 13 focused tests passed, typecheck passed, ESLint and Prettier passed, and the commit hook passed. All four threads are resolved.

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.

Document async loading sub-parameters (--async-min-servers, --async-timeout, --async-batch-notifications)

2 participants