Skip to content

fix: classify MCP sync failures as retryable - #1084

Draft
Dante-dan wants to merge 5 commits into
LodyAI:mainfrom
Dante-dan:fix/400-mcp-error-classification
Draft

Dante-dan wants to merge 5 commits into
LodyAI:mainfrom
Dante-dan:fix/400-mcp-error-classification

Conversation

@Dante-dan

@Dante-dan Dante-dan commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

Closes #400

Problem / pressure

When workspace connectivity fails, MCP callers can receive a nonretryable internal error or COMMAND_REJECTED for a temporary dependency failure. The generic sync error also tells tools without an operationId parameter to reuse one, while create/chat callers need to know whether an Operation was accepted before choosing resume.

Summary

  • Classify the observed fetch failed transport error and failed machine-document sync as retryable SYNC_UNAVAILABLE.
  • Keep generic sync guidance valid for tools without operationId.
  • Tell create/chat callers to resend the full request with the same operationId and without resume if sync failed before Operation acceptance. Preserve accepted-Operation recovery behavior.
  • Add regressions for error classification and pre-acceptance guidance.

The user authorized this contribution round broadly; the assistant selected #400 and completed the case-specific scope from the issue and code. The original instruction is quoted below without converting that scope into a user-authored prompt.

Visual explanation

CLI session commands ── machine document sync
        │                      └─ failure → WorkspaceSyncUnavailableError
        └─ MCP boundary ────── fetch failure → retryable SYNC_UNAVAILABLE
                                  │
                                  ├─ generic tools: retry after connectivity returns
                                  └─ create/chat before acceptance: resend full request,
                                     same operationId, without resume

Before / after

Before After
Transient transport/sync failures could be nonretryable or COMMAND_REJECTED. They return retryable SYNC_UNAVAILABLE.
Generic error recommended operationId reuse even when a tool had no such parameter. Generic guidance applies to all tools; pre-acceptance create/chat guidance is specific.

Test plan

  • LODY_DATA_DIR=/private/tmp/lody-400-data corepack pnpm --dir apps/cli exec vitest run src/commands/session.test.ts src/mcp/lody-mcp-server.test.ts --maxWorkers=2 — 117 passed on head aa83461272fb59de81a4e53af901c34b2fc25e1e.
  • CLI typecheck, lint, pnpm format, and docs check passed on prior head aa83461272fb59de81a4e53af901c34b2fc25e1e.
  • On follow-up head 75d9a8cddf52c317f15bfc2ad280f7bfb8c10280, the two chat sync assertions now match the pre-acceptance resend guidance. The focused chat-sync/server suite passed 41/41; CLI typecheck, formatting check, and git diff --check passed. The prior CI run Tests (cli) failed only those two stale assertions; the current-head CLI and other test jobs passed. Static checks stopped during Electron postinstall with an HTTP 500 download response, before format/typecheck/lint; the target main Static checks passed dependency installation and downstream checks at SHA e89ab564b24b236f906a3f10baef79d7be0da88a. GitHub denied my failed-job rerun request because it requires repository admin rights.
  • After merging main at 933657b5 into head 88179e677e0aecc383860e120e529a9dafeedd8e, focused CLI/MCP tests passed 125/125, CLI typecheck, pnpm format, docs check, and git diff --check passed. The merge conflict was limited to preserving both MCP error-handling imports. Current-head CI is pending.

Context handoff

Original user prompt

The triggering instruction below is quoted verbatim from the user's broader contribution-round request. The #400-specific implementation scope in this PR was filled in by the assistant under that authorization.

Show original prompt
在 `/Users/duan/Codebase/issue-tracker` 执行本次已授权的贡献轮次。

Sharing refusal (verbatim)

Lody的明确拒绝就好了,omp 的按照你的建议直接发送就好了,这些我都 review 过了。看起来没问题。 我让你发送的提示词本身就是原创说明啊

Shared conversation

Status: user-declined
Reason: The user explicitly declined sharing the Lody authoring conversation; their exact reply is quoted above. No public conversation link was supplied.

Dante-dan and others added 3 commits September 27, 2026 12:55
Unverified work in progress: targeted tests could not collect before submodule and dependency setup. Do not treat this commit as a finished fix.

Model: gpt-6-sol
Import the typed sync error in session command execution and cover preacceptance resend advice.

Model: gpt-6-sol
Issue 398 is a separate report, not an existing pull request.

Model: gpt-6-sol
Align the single and batch chat prevalidation assertions with the error returned before an Operation is accepted.

Model: gpt-6-sol
@Dante-dan

Dante-dan commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

The current-head Static checks job stopped in Install dependencies: Electron postinstall received HTTP 500 while downloading the binary, before format, typecheck, or lint ran. The target main Static checks job at e89ab564 passed the same installation step and downstream checks minutes earlier. This PR does not change dependency manifests or the lockfile; its CLI and other test jobs passed on head 75d9a8cd.

I tried rerunning the failed jobs, but GitHub returned Must have admin rights to Repository; that run remained at attempt 1. I have since merged current main into the PR branch to resolve its merge conflict, and head 88179e677e0aecc383860e120e529a9dafeedd8e started a new CI run. The earlier rerun request is superseded; current-head checks are pending.

Merge current main while retaining both the sync-unavailable guidance and local daemon IPC error classification.

Model: gpt-6-sol

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MCP error classification: network failures marked non-retryable and unactionable operationId retry advice

1 participant