[Bug] Codex VS Code Extension: "Error creating chat: unknown special value: ["bytes", {...}]" in Webview RPC deserializer

Summary

When continuing a chat session whose history contains binary buffers or serialized state, the Webview fails to initialize and throws:
Error creating chat: unknown special value: ["bytes", {"0": 123, "1": 10, ...}]

Steps to Reproduce

  1. Have an active Codex thread with file changes / audit reports containing serialized state.
  2. Reopen or continue the thread in the VS Code Codex sidebar.
  3. Observe error toast: Error creating chat: unknown special value: ["bytes", {"0": ...}].

Root Cause

In openai.chatgpt (v26.5901.22334), the RPC transport (capn-rpc) between the Extension Host (out/extension.js) and Webview (webview/assets/app-initial-*.js) runs with encodingLevel = "jsonCompatibleWithBytes".

When messages cross VS Code’s postMessage webview boundary, JSON serialization converts Uint8Array buffers into plain Objects with numeric keys ({ "0": 123, "1": 10, ... }).

In Ore.evaluateImpl under case "bytes":, the deserializer only checks:

  • e[1] instanceof Uint8Array
  • typeof e[1] === "string"

Because { "0": 123, ... } matches neither condition, it hits else break; and falls through to:
throw new TypeError('unknown special value: ' + JSON.stringify(e)).

Proposed Fix

In both out/extension.js and the Webview bundle under case "bytes":, add support for plain object/array representations:

case "bytes": {
    let s;
    if (e[1] instanceof Uint8Array) s = e[1];
    else if (typeof e[1] == "string") ...
    else if (e[1] && typeof e[1] === "object")
        s = new Uint8Array(Array.isArray(e[1]) ? e[1] : Array.isArray(e[1].data) ? e[1].data : Object.values(e[1]));
    else break;
    ...
}

Welcome to the forum!

You are welcome to discuss Codex issues here. However, the official place to report and track Codex bugs is the OpenAI Codex GitHub issue tracker.

I asked ChatGPT to search for the closest related issue, and it identified:

If that issue describes the same problem you are experiencing, consider adding a :+1: reaction to the GitHub issue itself, rather than only reacting to this forum topic. GitHub reactions can help the maintainers gauge how many users are affected.

If it does not match your problem closely enough, search the existing Codex issues for a better match. If you cannot find one, consider opening a new issue and include as much relevant information as possible, such as your Codex version, operating system, environment, reproduction steps, expected behavior, actual behavior, and any relevant logs or error messages.