Mercata: harden Griphook agent chat flow and payload limits#6442
Open
jamessummerwill wants to merge 3 commits intodevelopfrom
Open
Mercata: harden Griphook agent chat flow and payload limits#6442jamessummerwill wants to merge 3 commits intodevelopfrom
jamessummerwill wants to merge 3 commits intodevelopfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR introduces a first-class Griphook agent experience inside Mercata and hardens the end-to-end chat path so it is usable under real mainnet payload sizes.
Primary goals:
/tools,/call,/help)406MCP proxy failures, GPT timeout surfacing as API error, oversized payload loops causing413)Root Cause Summary (Observed in local runtime)
historyrequests.413 request entity too large.NODE_URL) still executed local node sync checks in backend startup, causing unnecessary blocking behavior.What Changed
Backend API / MCP proxy
POST /api/chat/mcpPOST /api/chat/agent/api/chatin the main router.ChatControllerwith:mcp-session-idrequest/response header passthroughinitialize+notifications/initialized)strato.tokens,strato.rewards,strato.lending,strato.cdp,strato.bridge,strato.swap)Resilience / payload hardening
20008items120016000chars max2400chars maxmax_tokens:3801mbto better tolerate legitimate request sizes.Backend config/runtime wiring
GRIPHOOK_MCP_URLGRIPHOOK_MCP_TIMEOUT_MSOPENAI_API_KEY/GPT_TOKEN/GPT_API_KEYOPENAI_MODEL/GPT_MODELOPENAI_API_BASEOPENAI_TIMEOUT_MSmercata/docker-compose.yml.mercata/backend/docker-run.sh:NODE_URLis set, skip local STRATO sync polling and start backend immediately.Frontend Assistant experience
ui/src/pages/Assistant.tsx/help/tools/call <tool> <json-args>/api/chat/agentmcp-session-idcontinuity across requestsProtectedRoutefor/dashboard/assistantAI AssistantAI Assistant/chat/agentsubmissionFile-by-File Summary
mercata/backend/src/api/controllers/chat.controller.tsmercata/backend/src/api/routes/chat.routes.tsmercata/backend/src/api/routes.ts/chatrouter.mercata/backend/src/config/config.tsmercata/backend/src/app.tsexpress.json({ limit: "1mb" }).mercata/backend/docker-run.shNODE_URLis present.mercata/docker-compose.ymlmercata/ui/src/pages/Assistant.tsxmercata/ui/src/App.tsx/dashboard/assistantroute.mercata/ui/src/components/dashboard/DashboardSidebar.tsxmercata/ui/src/components/dashboard/MobileBottomNav.tsxValidation Performed
mercata-backend:latestmercata-ui:lateststrato-backend-1strato-ui-1POST /api/chat/agent=>200+ short answer200(no413)413 request entity too largepattern reproduced before hardeningNotes / Non-Goals
creditCard.routespredate this work and are not introduced by this PR.Follow-ups (Optional)
/api/chat/agentpayload bounding and timeout fallback behavior.historypayload shape.