fix(web): backend agent server-mode query routing and API compatibility#202
fix(web): backend agent server-mode query routing and API compatibility#202madmansn0w wants to merge 2 commits into
Conversation
|
@madmansn0w is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
reversTeam
left a comment
There was a problem hiding this comment.
Good set of changes addressing server-mode query routing. The overall direction is sound. A few observations and questions:
Strengths:
buildBackendApiUrlis a solid utility — handles both cases where the user provides a URL ending in/apior just the base URL. This prevents the/api/api/querydouble-prefix bug.createHttpOptionalExecuteQueryis a nice pattern for non-critical context queries — swallowing 404s forbuildCodebaseContextprevents hard failures when the backend lacks the/api/queryendpoint.- The
isServerModestate flag cleanly separates local vs. server workflows, preventing WASM embedding pipelines from running in server mode (which would be pointless). - Backward compatibility handling in
createHttpHybridSearchfor older backends returning flat arrays is a good defensive measure.
Concerns / suggestions:
-
handleServerConnectsignature change — The callback now takes(result, baseUrl)as arguments, butsetServerBaseUrl(baseUrl)is also called again in the auto-connect flow afterhandleServerConnect(line ~203 in App.tsx). This meanssetServerBaseUrlis called twice during auto-connect. Consider removing the duplicate call. -
Indentation inconsistency in
initializeBackendAgent— The function body uses 2-space indentation while it's inside auseCallbackthat starts at a different level. Thetry/catch/finallyblocks appear to be at the wrong indentation level (they're flush with the outer scope rather than indented inside the function body). This won't affect runtime behavior, but it makes the code harder to read. -
Indentation issue in
switchRepo— Around theinitializeBackendAgentcall and thesetEmbeddingStatus/setEmbeddingProgresslines, the indentation shifts unexpectedly (extra indent). Looks like a formatting artifact. -
runBackendQueryin worker — This new method creates a freshcreateHttpExecuteQueryclosure on every call. If it's called frequently, consider caching the executor per(backendUrl, repo)pair. If it's rarely called, this is fine as-is. -
Embedding skip in server mode —
startEmbeddingsnow returns early whenisServerModeis true, and the server-connect flow setssetEmbeddingStatus('ready')without actually running embeddings. This is correct behavior (server handles embeddings), but thereadystatus might confuse the UI into showing "embeddings available" when they're actually on the server side. Worth verifying the UI handles this correctly.
Not blocking, but the indentation issues in particular would be nice to clean up before merging.
|
Implemented the review follow-ups in this PR branch and pushed commit 849a1b4. What changed:
Validation:
|
|
|
Please submit a new PR if this is still relevant |
Summary
Fix backend-mode agent behavior in
gitnexus-webwhen connected togitnexus serve, including query routing and API compatibility issues that led to false “empty codebase” results.What this PR fixes
runBackendQuery)http://host:porthttp://host:port/api.../api/api/queryand.../api/api/searchrequests./api/searchresponse compatibilityprocess_symbols,definitions)results: [...])Files changed
gitnexus-web/src/App.tsxgitnexus-web/src/hooks/useAppState.tsxgitnexus-web/src/workers/ingestion.worker.tsUser-visible impact
crank,crank-control,mentat).Notes