Skip to content

About

Workspace-scoped Codex session history patch kit for the OpenAI ChatGPT VS Code extension.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

Codex Sessions Workspace Patch Kit

Experimental patch kit for the shipped openai.chatgpt VS Code extension bundle.

This is not an upstream source patch and it is not a VS Code extension. It is a guarded local workaround that edits the installed extension bundle on disk after checking for known minified-code anchors.

Pre-Release Notice

This is a pre-release workaround and may contain bugs. It patches minified extension code that can change without notice, so always run scan and apply:dry before applying it. Please report breakage, version drift, and workspace-history edge cases through GitHub Issues.

What It Does

When a VS Code workspace is open, the patch narrows Codex session history to sessions whose saved cwd or cwds belong to the current workspace roots. In particular, it filters the visible Local chats list in the Codex sidebar, as well as supported thread/list responses. It also widens supported thread/list requests before filtering so older matching workspace sessions are less likely to be hidden behind newer sessions from other workspaces.

Some extension history surfaces request the same data through different providers. The patch tracks the native chat-session provider, the Codex webview provider, and the conversation-preview loader, but it only filters responses that actually include workspace path metadata. Pathless responses are left unchanged to avoid blanking the sidebar.

When no workspace folder is open, the patch leaves global history behavior unchanged.

This is a history-navigation safeguard, not complete session or tool-access isolation. Resuming a deliberately selected foreign session and enforcing its execution root remain upstream concerns.

Anchors

The kit locates its edit sites two ways.

Literal anchors are exact strings copied out of a known bundle. They are precise but they embed minified identifiers, so a Codex release renames them and they stop matching even when the underlying code is unchanged.

Structural anchors match on the parts a minifier does not rewrite -- string literals, property names and code shape -- and read the minified names out of the match. They survive a rebuild that only renames things. They do not survive a real upstream refactor, which still needs deliberate retargeting.

Literal anchors are always tried first, so a bundle the kit already knows gets exactly the edits it has always had. Structural anchors are consulted only when a literal anchor has drifted, and only if they cover a whole file -- a file is never patched half one way and half the other. Every structural anchor must match exactly once; zero or several matches is treated as unusable rather than guessed at.

--anchor-mode literal|pattern pins one strategy, which is how the structural anchors are exercised against bundles whose literal anchors still match.

Safety Model

  • scan checks whether the installed bundle matches the expected anchors.
  • Patched output is parsed with node --check before anything is written, so a bundle that would not load is never saved over a working one.
  • apply:dry simulates the patch and reports what would change.
  • apply creates a backup before writing the installed extension file.
  • repair safely reapplies the patch after VS Code installs a compatible fresh extension bundle.
  • restore restores the latest backup created by this tool.
  • If the extension bundle changes shape, the tool reports missing anchors instead of guessing.

Commands

Prerequisite: install Node.js. The kit currently has no npm dependencies, so npm install is not required.

If you downloaded the GitHub release ZIP or source ZIP:

  1. Extract the ZIP.
  2. Open PowerShell in the extracted folder.
  3. Run the dry-run flow before applying:
npm run scan
npm run apply:dry
npm run apply
  1. Reload VS Code with Developer: Reload Window.

To undo the patch:

npm run restore

When VS Code installs a fresh compatible openai.chatgpt-* bundle, you can use the guarded repair flow:

npm run repair

repair targets the newest installed bundle, exits successfully if it is already patched, and applies the patch only when every known anchor is still in its original unpatched state. If any anchor is missing, it reports retarget needed and makes no changes. If anchors are mixed between original, patched, or missing states, it reports mixed state and makes no changes.

By default, the tool targets the newest installed extension folder matching openai.chatgpt-* under the current user's VS Code extensions directory. Bundles VS Code has marked superseded in its .obsolete file are skipped, so the tool cannot report success against a copy the editor no longer loads. Among the remaining copies, it ignores candidates missing one of the expected patch target files so an incompatible older bundle cannot shadow a compatible installed bundle.

The Codex webview ships content-hashed asset filenames, so the webview target is located by content (the app-initial-*.js chunk carrying the Local chats selector) rather than by a fixed filename.

You can target a specific extension root:

node src/index.js scan --extension-root "C:\path\to\openai.chatgpt-version"
node src/index.js apply --extension-root "C:\path\to\openai.chatgpt-version"
node src/index.js repair --extension-root "C:\path\to\openai.chatgpt-version"

Reload VS Code after applying or restoring the patch.

Compatibility

This kit is version-fragile by design because it patches a minified shipped bundle. A VS Code extension update can overwrite the patch or change the anchor strings. Version 0.8.0 was tested against [email protected], and still carries the anchors for 26.5803.61601. A release that only renames minified identifiers should now be handled by the structural anchors without retargeting. After every Codex extension update, rerun:

npm run scan

If anchors are missing, the kit needs to be retargeted before applying again. Keeping automatic extension updates enabled is generally safer than pinning an old extension version; just rerun scan and, when compatible, repair after an update.

About

Workspace-scoped Codex session history patch kit for the OpenAI ChatGPT VS Code extension.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages