Skip to content

fix(mcp): guide client and provider timeout recovery - #5608

Merged
gensokyo-dev merged 2 commits into
mainfrom
feat/5598-precall-recovery
Oct 20, 2026
Merged

gensokyo-dev merged 2 commits into
mainfrom
feat/5598-precall-recovery

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #5598. Teach recovery before a host deadline can discard REA's error. The issue records a pinned, cloned RepoPrompt CE comparison and actual Codex counterexamples.

Problem and expected behavior

With a 1-second Codex MCP deadline, the old agent repeated an identical failed analysis without identifying the client setting. Returned provider errors also blurred the two deadline owners. An unavailable partial-Evidence reader must not block a corrected static retry.

Change and scope

  • Concise initialization guidance plus a targeted JavaScript tool-description warning: a host-only timeout needs client tool_timeout_sec, not server analysis_timeout_ms.
  • Producer-authored JavaScript errors name the actual per-source control and CLI equivalent, optional exact source selection, and summary-versus-analysis distinction. Shared generic error projection neither suggests client-only changes for returned server timeouts nor assumes adjustable controls on fixed-budget operations.
  • Update the shipped skill's focused recovery reference and version. Reuse the canonical error/reference parsers in boundary tests instead of interpreting the diagnostic twice.

Contract and boundary impact

  • Owner: initialization/catalog teaching surfaces; JavaScript timeout producer; shared domain error presentation.

  • Scope: routine usability fix; no new provider/capability or maintainer scope decision needed.

  • CLI/MCP: same error/schema identities, argument types, results, and caller choices. No discovery tool or repeated full schema payload added.

  • Evidence/provenance/cleanup: unchanged; partial references stay usable; unknown work/cleanup stays unknown. No execution, installation, configuration, or target-authority expansion.

  • Generated metadata: authored skill 44 and tracked package metadata; ignored catalogs/skills regenerated, not committed.

  • Documentation or usability only; no target interaction.

Evidence and regression coverage

  • The initialization regression failed against the unmodified compiled base, then passed after the fix.
  • Public CLI and stdio MCP exercise actual 1ms JavaScript timeouts, precise remediation, retained partial Evidence, continued analysis, caller bounds and provenance. Existing wire-budget/untrusted-content guards retained.
  • Actual standalone codex-cli 0.161.0, gpt-6.1-sol, Node 24.18.0; Commander 14.0.3, static only. Fresh processes, serial bounded-heap trials. Full calls and receipts retained locally; outcome/performance summary linked in the issue after final qualification.
  • Actual Codex qualification: client deadlines 4/4 actionable stops without unchanged retries; server timeouts 2/2 repaired in two calls; normal controls 2/2 one-call successes. Across all iterations 28 trials were retained. Final eight: 741,148 input tokens (587,136 cached), 4,825 output; 255.62s wall sum, 112.50s CPU, sampled peak family RSS 1,255.25 MiB. Warm/uncontrolled caches; 500ms summed RSS is not cgroup peak. Immediate cleanup samples are inconclusive where a pending refresh raced; a separate post-run audit found no task-specific process matches.
  • Important negative evidence retained: an initial imperative to inspect partial Evidence caused two stops with hidden readers; an initialization-only candidate still made one unchanged client retry. The final version makes inspection optional and also teaches via the advertised tool description. No claim of universal model reliability or a causal benchmark.
  • Two independent Codex CLI source reviews: no actionable findings; no target/provider execution by reviewers.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/javascriptAnalysisResources.test.ts tests/acceptance/applications/javascriptAnalysisLimits.test.ts tests/boundary/mcp/webBundleContainmentMcp.test.ts tests/boundary/mcp/targetContentFramingMcp.test.ts src/domain/analysisErrorProjection.test.ts src/server/EvidenceMcpServer.test.ts — 79 tests passed; the refactored resource file additionally rerun.
  • npm run check — passed (typecheck, lint, format, knip, metadata, architecture/module boundaries).
  • npm run docs:generate / npm run docs:check — passed.
  • Skill validator and npm pack --dry-run --json — passed.

Compatibility, safety, and release

No breaking changes or new runtime work/cache. Startup teaching costs extra context; whole-task tokens, wall/CPU time and sampled family RSS are reported, not inferred from bytes. No real Hopper/Ghidra/macOS qualification: unavailable-provider probes only test deliberate missing-install preflight; RepoPrompt research is source-only. Underlying analysis semantics are unchanged.

Author readiness

Human owner: @gensokyo-dev (task owner's explicitly selected account).

The task owner explicitly directed ready-for-review submission and delegated continuation/merge, including bypass when appropriate. Automated review and executed evidence are reported above; no separate human final-diff review is asserted by this agent.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Concrete problem, focused scope and Conventional Commit title.
  • No unresolved new authority or capability questions.
  • Related issue, observable output, owning docs and regression coverage included.
  • Meaningful verification limits recorded; generated outputs and credentials excluded.

Teach client deadline recovery at initialization and on the static JavaScript
tool. Name the producer-owned server budget, preserve partial Evidence and
cleanup uncertainty, and avoid making an unavailable Evidence reader a retry
prerequisite. Cover initialization delivery and real CLI/MCP timeout behavior.

Fixes #5598

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T16:12:28.242560Z af29cc3 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24e32b26d5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/domain/analysisErrorPresentation.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous timeout-command issue is fixed, and no new actionable failure was found.

Summary

The PR separates client deadlines from REA’s server/provider deadlines and teaches recovery before a host can discard the response.

  • MCP callers learn what to do when a host timeout hides the result.
  • Returned JavaScript timeouts name the server budget and ways to reduce work.

Reviews (2) · Last reviewed commit: "fix(errors): avoid invented controls in ..." · Reviewed by Greptile

Generic timeout errors cannot know whether the caller can change a budget.
Keep their remediation valid for fixed limits and leave exact adjustable
controls to the producer-owned override. Name the CLI command that supports
the JavaScript timeout flag instead of implying the analyze shorthand does.
Cover both counterexamples without changing error identity or cleanup semantics.

Refs #5598

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

Final reviewed head: af29cc3ef81d3b983930ffe1b8b162827fc590f7.

Both actionable automated findings were fixed and resolved after regression proof. Final source was additionally reviewed through an independent Codex CLI pass with no actionable P1/P2 findings. All 79 focused tests, complete local static/architecture checks, generated-document checks and skill validation passed. Thirty actual agent trials are retained; final layered 8/8 plus post-review 2/2 passed the scoped recovery oracle. Details and performance limits: #5598 (comment).

Fresh origin/main was checked before integration; no concurrent change was found in the touched core runtime/contract/skill files. No target authority or provider capability is added.

The task owner explicitly authorized ready-for-review submission, continued work and administrative bypass when appropriate. No independent human final-diff review is asserted, and unchecked human declarations are not silently filled. External checks still queued/running are not reported as passed. If normal merge remains blocked solely by those checks/declarations, the owner-authorized override is used with this verification limitation recorded.

@gensokyo-dev
gensokyo-dev merged commit a356237 into main Oct 20, 2026
7 of 9 checks passed
@gensokyo-dev
gensokyo-dev deleted the feat/5598-precall-recovery branch October 20, 2026 16:16
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026
3 tasks done
@morluto morluto added area: mcp MCP server, transport, and tool registration bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Teach recovery before client deadlines hide REA errors (RepoPrompt CE comparison)

2 participants