fix(console): complete production data transports - #128
Conversation
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe Console now routes Filing and Proactivity GraphQL requests through ChangesConsole runtime contracts
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Console
participant PrincipalResolver
participant HarnessMCP
Console->>PrincipalResolver: Resolve tenant and principal headers
Console->>HarnessMCP: initialize
HarnessMCP-->>Console: Return MCP session ID
Console->>HarnessMCP: notifications/initialized
Console->>HarnessMCP: tools/call with tenant and actor arguments
HarnessMCP-->>Console: Return JSON or SSE payload
Console->>HarnessMCP: DELETE session
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Pull request overview
This PR hardens the Console’s production transport paths by correctly establishing authenticated MCP Streamable HTTP sessions for Harness tool calls, while keeping Proactivity/Filing on the explicit CommonPlace consumer GraphQL contract and failing fast on incomplete Railway data-plane configuration.
Changes:
- Add MCP session lifecycle (initialize → notifications/initialized → tools/call → DELETE) plus JSON + SSE (multiline + heartbeat) response parsing for Harness MCP calls.
- Centralize consumer GraphQL endpoint normalization via
consumerGraphqlUrl()and route Proactivity/Filing through it (no fallback to Harness MCP host). - Enforce Railway startup configuration by requiring
CONSOLE_DATA_API_URLbefore launching the standalone server, with tests.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| railway.console.toml | Updates deploy-time env var guidance, clarifying required vs optional transport configuration. |
| apps/console/src/views/filing/filing-client.ts | Updates Filing’s “missing capability” string to point at THEOREM_GRAPHQL_URL. |
| apps/console/src/lib/server/proactivity-harness.ts | Switches Proactivity GraphQL endpoint selection to the consumer schema helper and removes Harness-token auth. |
| apps/console/src/lib/server/harness-mcp.ts | Implements MCP session initialization/teardown and robust JSON/SSE parsing for tool responses. |
| apps/console/src/lib/server/harness-mcp.test.ts | Adds coverage for MCP session initialization, multiline SSE parsing, and fail-closed behavior. |
| apps/console/src/lib/server/filing-harness.ts | Switches Filing GraphQL endpoint selection to the consumer schema helper and removes Harness-token auth. |
| apps/console/src/lib/server/consumer-graphql.ts | Adds a single, explicit consumer GraphQL URL normalizer (origin or /graphql accepted). |
| apps/console/src/lib/server/consumer-graphql.test.ts | Tests consumer GraphQL URL normalization and the “no Harness fallback” rule. |
| apps/console/scripts/start-railway.mjs | Validates Railway environment before starting the Next standalone server. |
| apps/console/scripts/railway-env.mjs | Introduces Railway startup env assertions (requires CONSOLE_DATA_API_URL). |
| apps/console/scripts/railway-env.test.mjs | Adds node:test coverage for the Railway startup assertion helper. |
| apps/console/package.json | Extends Console test script to include the Railway env assertion tests. |
| apps/console/CLAUDE.md | Updates operational docs to reflect consumer GraphQL ownership for Proactivity/Filing. |
| apps/console/AGENTS.md | Updates agent docs to reflect consumer GraphQL ownership for Proactivity/Filing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@apps/console/src/lib/server/harness-mcp.test.ts`:
- Around line 43-58: Update the beforeEach and afterEach hooks in the Harness
test setup to use vi.stubEnv for CONSOLE_HARNESS_URL and CONSOLE_HARNESS_TOKEN,
then call vi.unstubAllEnvs() during cleanup instead of deleting the variables,
so Vitest restores any pre-existing environment values.
In `@apps/console/src/lib/server/harness-mcp.ts`:
- Around line 159-199: Update readMcpPayload and its callers to use the existing
eventsource-parser, consume all SSE events, and return only the JSON-RPC
response whose id matches the outbound request; ignore request-scoped
notifications such as notifications/progress. Pass the request id through the
parsing flow and preserve non-SSE JSON handling. Add a regression test in
apps/console/src/lib/server/harness-mcp.test.ts covering a notification before
the matching response.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 9cafa996-ba1e-4f79-844d-0a37f4243e3b
📒 Files selected for processing (14)
apps/console/AGENTS.mdapps/console/CLAUDE.mdapps/console/package.jsonapps/console/scripts/railway-env.mjsapps/console/scripts/railway-env.test.mjsapps/console/scripts/start-railway.mjsapps/console/src/lib/server/consumer-graphql.test.tsapps/console/src/lib/server/consumer-graphql.tsapps/console/src/lib/server/filing-harness.tsapps/console/src/lib/server/harness-mcp.test.tsapps/console/src/lib/server/harness-mcp.tsapps/console/src/lib/server/proactivity-harness.tsapps/console/src/views/filing/filing-client.tsrailway.console.toml
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a2d5be91f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ceae0f9a62
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| const MCP_PROTOCOL_VERSION = '2025-06-18'; | ||
| const MCP_TEARDOWN_TIMEOUT_MS = 2_000; | ||
| const MCP_SSE_MAX_BUFFER_SIZE = 1024 * 1024; |
There was a problem hiding this comment.
Allow MCP results larger than one MiB
The 1 MiB parser buffer rejects valid large SSE events and parseFailed then makes readMcpPayload return null. This is likely for topicPreviewAsset, whose base64 payload exceeds the limit for images larger than roughly 750 KiB, and for the memory query requesting up to 5,000 items; both routes will report an invalid MCP result despite a successful server response. Remove the arbitrary limit or parse large events without treating their size as malformed.
AGENTS.md reference: AGENTS.md:L25-L27
Useful? React with 👍 / 👎.
Summary
Validation
Live evidence
Summary by CodeRabbit
Configuration
Reliability
Documentation