docs: fix platform-protocol drift from both implementations#158
Conversation
The platform protocol doc had drifted from both the gateway (consumer) and the reference platform (peer): - The "default peer implementation" link pointed at this repo (the consumer) instead of the platform; repoint it at mozilla-ai/otari-ai. - The resolve response carries fields the doc never mentioned (workspace_id, organization_id, provider_key_id, allowed_models). Add an explicit extension policy: the doc describes only the fields the gateway reads, responses are open for extension, and consumers must ignore unknown fields. List the known extras as an example. - The gateway now also consumes mcp-servers/resolve and web-search/resolve (#144), which were undocumented. Document their request/response shapes, auth headers, and failure mapping, with a pointer to #146 as the eventual contract of record. Fixes #149 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesPlatform Protocol Documentation Expansion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
The gateway does not switch backends based on the policy's `provider` field; the active web-search backend is configured via WEB_SEARCH_URL. Noting this keeps the doc consistent with its own extension policy (describe only the fields the gateway reads). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
otari-ai (the platform implementation) is a private repo that readers of the public docs cannot access. Point the peer reference at otari.ai instead, and drop the private internal type name from the extension-policy example (the field names already come from the public issue). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates docs/platform-protocol.md to realign the written platform-mode HTTP contract with what the gateway consumes, adding the missing resolve endpoints and clarifying that response shapes are extension-friendly.
Changes:
- Fixes the introductory “reference peer” wording/link and expands the endpoint list to include MCP server and web-search resolve.
- Adds an explicit extension policy (document only what the gateway reads; ignore unknown response fields).
- Documents request/response shapes and failure mapping for
mcp-servers/resolveandweb-search/resolve, plus updated authentication guidance.
|
|
||
| | Status | Behaviour | | ||
| |---|---| | ||
| | `401`, `402`, `403`, `404`, `429` | Mapped through to the client as-is. `429`'s `Retry-After` header is preserved. | |
|
|
||
| | Status | Behaviour | | ||
| |---|---| | ||
| | `401`, `402`, `403`, `404`, `429` | Mapped through to the client as-is. `429`'s `Retry-After` header is preserved. | |
The 4xx/429 failure rows said responses are forwarded "as-is", but the gateway only forwards the status code (and Retry-After on 429). The detail body comes from _safe_detail_from_platform(): the platform's JSON detail string when present, otherwise a per-endpoint fallback string. Update all three resolve failure tables to match. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Description
docs/platform-protocol.mdhad drifted from both the gateway (consumer) and the reference platform (peer). This PR realigns it:mozilla-ai/otari-aiand reworded "default" to "reference peer implementation".GatewayResolveResponsein otari-ai (workspace_id,organization_id,provider_key_id,allowed_models) are listed as the concrete example.mcp-servers/resolveandweb-search/resolve, each with request/response shapes, auth headers, and failure mapping. Corrected the Authentication section (was "Both endpoints"; now all four requireX-Gateway-Token, the three resolve endpoints addX-User-Token, and usage sends only the gateway token). Added a forward pointer to Consumer-side contract fixtures for platform /gateway/*/resolve responses #146 as the eventual contract of record.All shapes were verified against the code in
src/gateway/api/routes/_platform.pyand_pipeline.py.PR Type
Relevant issues
Fixes #149
Checklist
tests/unit,tests/integration). (Docs-only change; no code paths affected.)make lint,make typecheck,make test). (Docs-only change; no code, lint, typecheck, or OpenAPI surface touched.)uv run python scripts/generate_openapi.py). (No API contract change.)AI Usage
AI Model/Tool used:
Claude Code (Opus 4.8)
Any additional AI details you'd like to share:
Claude drafted the doc changes via back-and-forth with @njbrake; the reasoning and decisions are his.
NOTE:
When responding to reviewer questions, please respond yourself rather than copy/pasting reviewer comments into an AI and pasting back its answer. We want to discuss with you, not your AI :)
Overview
This PR corrects and expands the documentation of Otari's platform-mode HTTP API contract in
docs/platform-protocol.md, addressing documentation drift between the gateway implementation and its specification.Key Changes
Updated references and clarifications:
Documented previously undocumented resolve endpoints:
Clarified authentication requirements:
X-Gateway-TokenheaderX-User-Tokenheader, while the usage endpoint sends only the gateway tokenImproved error handling documentation:
401/402/403/404/429) and error fallbacks (422/5xxand timeouts →502 Bad Gateway)Benefits
This documentation now accurately reflects the gateway's current implementation, reducing confusion for platform integrators and making the API contract clearer and more maintainable.