Skip to content

[Bug]: 2026.7.1 — Codex plugin fails: "does not provide an export named 'formatToolExecutionErrorMessage'" in agent-harness-runtime #108705

Closed

Description

@Serial17

Bug type

Regression (worked before, now fails)

Summary

After updating to OpenClaw 2026.7.1, switching to OpenAI GPT models (via ChatGPT OAuth) in the webchat GUI fails with:

⚠️ Agent failed before reply: The requested module 'openclaw/plugin-sdk/agent-harness-runtime' does not provide an export named 'formatToolExecutionErrorMessage'.

The Codex plugin (@openclaw/codex@2026.7.1) imports formatToolExecutionErrorMessage from openclaw/plugin-sdk/agent-harness-runtime. However, multiple bundled instances of agent-harness-runtime.js in the Gateway and Email plugin do not export this function — only the Codex plugin's own bundled openclaw copy does. Node.js module resolution can resolve the import to any of these instances, causing inconsistent failures.

Steps to reproduce

  1. Install OpenClaw 2026.7.1 (npm, Docker)
  2. Authenticate with OpenAI via OAuth: openclaw models auth login --provider openai
  3. Open webchat GUI, switch model to openai/gpt-5.5
  4. Send a message
  5. Error: "The requested module 'openclaw/plugin-sdk/agent-harness-runtime' does not provide an export named 'formatToolExecutionErrorMessage'"

Expected behavior

GPT models work after OAuth login without module export errors.

Actual behavior

Agent fails before reply. The function formatToolExecutionErrorMessage exists in tool-result-error-*.js and is exported by the Codex plugin's bundled openclaw copy, but is missing from at least 3 other agent-harness-runtime.js instances:

  • /app/dist/plugin-sdk/agent-harness-runtime.js (Gateway)
  • ~/.openclaw/extensions/email/node_modules/openclaw/dist/plugin-sdk/agent-harness-runtime.js (Email plugin)
  • ~/.openclaw/extensions/email/node_modules/.openclaw-80GR2TWS/dist/plugin-sdk/agent-harness-runtime.js (Email plugin alias)

Root cause: Build pipeline sync issue — the @openclaw/codex@2026.7.1 plugin was compiled against a newer openclaw SDK build that exports formatToolExecutionErrorMessage, but the Gateway and Email plugin bundles ship an older build without the export. When Node.js resolves openclaw/plugin-sdk/agent-harness-runtime from the Codex plugin, it can resolve to any of the older instances depending on module resolution order.

Workaround: Manually add the function definition and export to all instances of agent-harness-runtime.js:

function formatToolExecutionErrorMessage(error, fallback) {
    try {
        return formatErrorMessage(error) || fallback;
    } catch {
        return fallback;
    }
}

And add formatToolExecutionErrorMessage to the export statement. After patching all 4 instances and restarting the gateway, GPT models work correctly.

OpenClaw version

2026.7.1

Operating system

Linux (Docker container, Ubuntu 26.04 host)

Install method

npm (Docker)

Model

openai/gpt-5.5 (via ChatGPT OAuth)

Provider / routing chain

openai (ChatGPT OAuth)

Additional provider/model setup details

OAuth login via openclaw models auth login --provider openai --device-code

Logs

Error message: The requested module 'openclaw/plugin-sdk/agent-harness-runtime' does not provide an export named 'formatToolExecutionErrorMessage'

Impact and severity

Blocks all OpenAI GPT model usage via OAuth. Other providers (Ollama Cloud, Comet) work fine.

Additional information

Activity

  1. NianJiuZst commented on Jul 16, 2026

    @NianJiuZst
    Contributor

    I checked the shipped artifacts directly. My current conclusion is that the reported import error is plausible, but the proposed root cause ("the official 2026.7.1 Gateway/npm/Docker build is missing the export and Node randomly selects another copy") is not supported by the published artifacts.

    Evidence checked on 2026-07-16:

    • The official openclaw@2026.7.1 npm tarball (SHA-256 67ad539d9915efb63d5f294beeb9290b7172d23c92d8052110a9c8355f783458) imports and exports formatToolExecutionErrorMessage from dist/plugin-sdk/agent-harness-runtime.js.
    • The official @openclaw/codex@2026.7.1 tarball (SHA-256 7909c0de5c79c3b00dac6f99a6f0f866424c719818b48da19b55b75efd6d157d) imports that same SDK export.
    • Both current official GHCR openclaw:2026.7.1 architectures, amd64 and arm64, identify revision 2d2ddc43d0dcf71f31283d780f9fe9ff4cc04fe4 and contain the export in /app/dist/plugin-sdk/agent-harness-runtime.js.
    • The helper was introduced by f53346944db01a57e0522d494c4e15f281201c7d in feat: correlate native search outcomes in audit history #98704 on 2026-07-06, and that commit is an ancestor of the v2026.7.1 release commit.
    • Node's ESM package resolution is deterministic relative to the importing module's parentURL; it does not randomly select a sibling package copy. OpenClaw 2026.7.1 also installs a scoped native Plugin SDK resolver and links plugin openclaw peer dependencies back to the host package.
    • @clawemail/email@0.9.13 is a third-party package with an openclaw >=2026.3.22 peer dependency. Its published tarball does not bundle an OpenClaw package. Nested OpenClaw copies under that installation therefore point to installation/peer-link state, not an official Email plugin bundle.

    There is, however, a plausible mixed-version failure mode: I also checked openclaw@2026.7.1-beta.2, and that older package does not export this helper. If the stable Codex plugin resolves an older retained SDK copy, the exact named-export error would be expected. That would make this an install-tree/peer-link/resolver consistency issue rather than a missing export in the stable release.

    To distinguish a real loader bug from stale installation state, could you provide:

    1. The exact resolved openclaw/plugin-sdk/agent-harness-runtime path from the failing Codex importer.
    2. The package version and SHA-256 of that resolved file.
    3. The target of the Codex plugin's node_modules/openclaw symlink/peer link.
    4. Output from openclaw plugins inspect codex --runtime --json.

    Manually patching every copy can mask the resolution problem, so I would avoid treating that as the product fix. If the evidence above shows that the 2026.7.1 host resolver is selecting an older nested copy, that would be a concrete loader/repair bug to fix. I did not reproduce the reporter's exact persisted installation and OAuth state; the conclusion above is specifically about the published package/image claim and the module-resolution boundary.

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    on Jul 31, 2026
  3. clawsweeper commented on Jul 31, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 31, 2026, 9:28 AM ET / 13:28 UTC.

    Summary
    Keep this issue open: the reported named-export failure remains plausible for a mixed or stale managed-plugin install, but the supplied artifact review shows that the official v2026.7.1 core package and images already export the helper, so the stated “random bundled-copy selection” root cause is not established. The next useful step is to capture the Codex importer’s resolved SDK path and peer link, then confirm whether current repair logic corrects that installation state.

    Reproducibility: no. high-confidence current-main reproduction is available. The published 2026.7.1 artifacts reportedly contain the export, but the exact named-export error remains source-plausible if Codex resolves a retained incompatible peer dependency; the resolved importer path and link target are still needed.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    Do not dispatch a repair PR until the failing Codex importer path and peer-link state distinguish an unresolved resolver defect from a repaired stale installation.

    Review details

    Best possible solution:

    Make the managed-plugin resolver bind Codex to the current host SDK, add a focused mixed-version/retained-peer-link regression test if that path is not already covered, and provide a supported doctor repair rather than editing generated distribution files.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence current-main reproduction is available. The published 2026.7.1 artifacts reportedly contain the export, but the exact named-export error remains source-plausible if Codex resolves a retained incompatible peer dependency; the resolved importer path and link target are still needed.

    Is this the best way to solve the issue?

    No: patching every installed runtime copy is not the best fix because it masks the actual dependency-resolution boundary. A host-peer-link or managed-plugin repair, backed by a mixed-version regression test and a supported doctor path, is the narrower durable solution.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • A stale nested SDK or broken managed-plugin peer link may still survive an update and block OpenAI/Codex turns even though the official 2026.7.1 artifacts contain the correct export.
    • Manually editing every generated runtime copy can hide the resolver or installation-repair defect and makes a later diagnosis less reliable.

    Codex review notes: model internal, reasoning high; reviewed against aaab981ab097.

    Label changes

    Label changes:

    • add P1: The reported failure prevents a normal OpenAI OAuth-backed agent turn from producing any reply after an update.
    • add impact:auth-provider: The failing path is the OpenAI/Codex provider runtime reached after ChatGPT OAuth authentication.
    • add impact:ux-friction: The only reported workaround is invasive manual patching of installed generated files, creating substantial recovery burden.
    • add issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.

    Label justifications:

    • P1: The reported failure prevents a normal OpenAI OAuth-backed agent turn from producing any reply after an update.
    • impact:auth-provider: The failing path is the OpenAI/Codex provider runtime reached after ChatGPT OAuth authentication.
    • impact:ux-friction: The only reported workaround is invasive manual patching of installed generated files, creating substantial recovery burden.
    Evidence reviewed

    What I checked:

    • Shipped-artifact counterevidence: The detailed issue comment reports that the official openclaw@2026.7.1 tarball and both official 2026.7.1 container architectures export formatToolExecutionErrorMessage; this weakens the claim that the stable host artifact itself omitted the export, while leaving a mixed installed tree plausible. (2d2ddc43d0dc)
    • Introduction provenance: Related merged pull request feat: correlate native search outcomes in audit history #98704 is identified in the supplied discussion as introducing the helper, and its merge commit predates the v2026.7.1 release commit. (src/plugin-sdk/agent-harness-runtime.ts, f53346944db0)
    • Resolver-boundary diagnosis: The supplied artifact review correctly distinguishes deterministic Node ESM resolution from an arbitrary sibling-copy choice and asks for the decisive evidence: the resolved module path, file version/hash, Codex openclaw peer-link target, and openclaw plugins inspect codex --runtime --json output.
    • Adjacent report: [Bug]: Gateway refuses readiness after 2026.7.1 update due to plugin install metadata conflict for codex/discord #107727 concerned conflicting persisted plugin-install metadata and Gateway readiness after the same release; it supports checking upgrade/install repair paths but does not prove this issue has the same root cause.

    Likely related people:

    • steipete: The supplied issue discussion ties the helper’s introduction to the merged SDK-related work in commit f53346944db01a57e0522d494c4e15f281201c7d. (role: feature introducer and recent SDK-area contributor; confidence: medium; commits: f53346944db0; files: src/plugin-sdk/agent-harness-runtime.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  4. locked as resolved and limited conversation to collaborators on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions