Repository navigation
installer: pin each Codex home's marketplace to the release tag, so Codex's own updates keep the hook trusted (2.2.5) - #67
Merged
Conversation
chhoumann
marked this pull request as ready for review
November 6, 2026 19:26
…e tag A new suite serves Git marketplaces from repositories in the throwaway root, through the global Git config. It checks that doctor fails an unpinned home and one pinned to an older tag, that install pins homes from the default source, a GitHub --source, and a Git URL --source, that a local directory stays unpinned, that a source without the tag keeps its old ref, that a second run changes nothing, and that a newer commit on main reaches only an unpinned home through Codex's own marketplace upgrade.
Codex 0.164 and later tie a plugin hook's trust to every file in the plugin, and Codex's own marketplace auto-upgrade moved each home to the latest commit on main, so each release turned the session-start hook off until the installer ran again. install and update now write ref = "v<version>" to the home's t3-pstack marketplace through Codex's config writer, then run codex plugin marketplace upgrade, which fetches the tag. Codex's auto-upgrade leaves a tag where it is. When Codex cannot fetch the tag, the old ref goes back and the home updates as before. doctor's new marketplace pin check fails a home that is not on this release's tag.
…ut the tag does Codex compares the hash git ls-remote reports for the ref with the commit it installed. For an annotated tag those never match, so every Codex start would clone the marketplace and reinstall the plugin. CONTRIBUTING now asks for a lightweight tag and says that a home already pinned keeps its tag until the new one exists. CHANGES says that a source without the tag fails doctor on every run, and that a ref set by hand is replaced too.
chhoumann
force-pushed
the
fix/56-pin-codex-tag
branch
from
November 6, 2026 19:54
7b2050b to
200a400
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every Codex session should start with t3-pstack's routing text. On Codex 0.164 and later, a plugin hook's trust covers every file in the installed plugin. Codex's own marketplace auto-upgrade moved each home to the latest commit on
main, so each release turned the session-start hook off until someone reran the installer. This is cause 2 of #56, which 2.2.3 left as it was. The installer now pins each Codex home's marketplace to the release's tag. A release then reaches a Codex home only throughinstallorupdate, and that run trusts the hook again.What changed
installandupdateset therefof each Codex home'st3-pstackGit marketplace tov<version>, then runcodex plugin marketplace upgrade t3-pstack, which fetches the tag and reinstalls the plugin from it.doctorhas a new Codex check,marketplace pin. It fails a home that is unpinned or on another tag, and its fix reruns the installer with the run's--source.What it writes to a Codex home's config
One line in that home's
config.toml, inside the tablecodex plugin marketplace addalready wrote:codex plugin marketplace add chhoumann/t3-pstack --ref v2.2.5writes. That command refuses a marketplace that is already added, so the installer writes the key through the Codex app-server'sconfig/value/write, as it already writes the hook's trust.config.tomlchanged in between. Only a marketplace fromchhoumann/t3-pstackor the run's--sourceis pinned. Itssourcenever changes.mainbefore the tag exists, the installer writes the old value back. The file is then byte for byte what it was, as tested on Codex 0.167.0. The run printsCodex could not fetch v2.2.5, so the marketplace stays unpinned (...)and updates the home as before.To undo it, delete the
ref = "v2.2.5"line from[marketplaces.t3-pstack]. At its next start, Codex moves the home to the latest commit onmain, as before. The nextinstallorupdatepins it again, anddoctorfails it until then.Scope
--source, and a Git URL--source. A home already on another tag, such as an older release's, moves to this release's tag.updateon Codex. What changes is that Codex no longer installs the release on its own and turns the hook off.doctoron every run, and the printed fix (rerun the installer) cannot clear it. A run killed between the ref write and the fetch, on such a source, leaves a ref thatdoctoraccepts. Codex's own config writer corrupts a hand-written inlinemarketplaces = { ... }table that has two or more entries and a comment above it. The installer's existing hook-trust write has the same exposure on an inlinehookstable, andcodex plugin marketplace adddrops every entry from that shape.Tradeoffs
codex plugin marketplace removefollowed byadd --refwould also pin. But it deletes the marketplace's snapshot first, so a failed fetch would leave the home with no marketplace. Writing the ref keeps the old snapshot until Codex activates the new one.main.Blast Radius
Users who do nothing keep today's behaviour. On the next
update, every Codex home whose marketplace comes from a Git source is pinned. A fork withoutv<version>tags stays unpinned, anddoctornow fails it. The maintainer has to pushv2.2.5as a lightweight tag as soon as this merges. Until then,updateleaves each Codex home on the ref it had. An annotated tag would make every Codex start clone the marketplace and reinstall the plugin again, and CONTRIBUTING now says so.Verification
Throwaway homes on macOS with Codex 0.167.0. A local repository serves
https://github.com/chhoumann/t3-pstack.gitthrough the global Git config.main.codex plugin marketplace upgradeand a plain app-server start (within 0.8 s) each move the home to 9.9.9. The hook then readsmodified, and doctor failsinstalled: 9.9.9, expected 2.2.3andsession-start hook trusted: ... modified.ref = "v2.2.5".codex plugin marketplace upgradeprintsAll configured Git marketplaces are already up to date., an app-server ran 20 s without moving the home, the hook staystrusted, and doctor passes.codex.mjs, all 5 fail.bun install --frozen-lockfileandbun tools/generate.mjs --checkpass.GIT_CONFIG_GLOBAL=/dev/null bun test tests/ --timeout 30000passes 554, skips 56, and fails 0.T3_PSTACK_E2E=1 GIT_CONFIG_GLOBAL=/dev/null bun test tests/install-e2e.test.mjs --timeout 300000passes 18 of 18, with Claude Code 2.1.319 and Bun 1.4.4.Closes #56
Note
Medium Risk
Installer now edits every Codex
config.tomlmarketplace ref and trusts hooks only after tag fetches; mis-pinned tags or fetch failures could strand users on unexpected refs.Overview
Release 2.2.5 now treats Codex installs differently:
install/updatewritemarketplaces.t3-pstack.ref = v2.2.5, reruncodex plugin marketplace upgrade, and only trust hooks once the tag fetch succeeds—forks without tags fall back without pinning. Local directory sources stay unpinned and Claude Code behaviour is unchanged.doctorgains amarketplace pincheck so homes drifting tomainor another tag fail fast with the usual reinstall fix. Documentation (README,CONTRIBUTING,CHANGES) describes the new flow, insists releases publish lightweight tags, and bumps every manifest to2.2.5.Tests expand
install-e2ewith a Git-marketplace matrix (default, fork, URL, unpinned CLI setups) plus focused unit tests forpinCheck, ensuring repeated runs are idempotent and upgrade races stay covered.Reviewed by Cursor Bugbot for commit 200a400. Bugbot is set up for automated code reviews on this repo. Configure here.