Repository navigation
feat: track the latest Qoder CLI release for the COSY identity - #35
Conversation
The gateway returns a reduced model catalog to clients whose COSY version lags the current Qoder CLI, so the hardcoded identity needed a manual bump PR for every CLI release (1.1.38 -> 1.1.71 -> ...). Resolve the version dynamically instead: cosy-version.ts reads the same releases feed the public changelog page uses (repo.qoder.com/repos/QoderAI/changelog-CLI/releases), caches the newest stable tag in ~/.pi/agent/qoder-cosy-version-cache.json, and refreshes at most once a day after a successful model-catalog update. Signing stays synchronous and network-free; any failure keeps the cached or bundled version, and the identity never downgrades. The bundled fallback moves to 1.1.72, the current CLI release.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3e80ab5b5
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!process.env.VITEST) { | ||
| void refreshGatewayCosyVersion(); |
There was a problem hiding this comment.
Refresh COSY version before requesting the gated catalog
When Qoder publishes a version newer than the bundled or cached one, this refresh starts only after the model-list request has already been signed with the stale identity and its reduced result has been cached. Because the call is fire-and-forget, startup then registers that reduced list immediately, while the cache is considered fresh for an hour; later requests may use the new identity, but the current session's registered models are not rebuilt. Await the throttled version refresh before constructing the catalog request so the request this feature is intended to fix uses the current identity.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in #36. The catalog update now awaits the throttled COSY refresh before buildAuthHeaders signs the model-list request, so the request this feature exists for is the one that uses the fresh identity. The old fire-and-forget block (and its VITEST skip) is removed; the catalog fixture stub is URL-aware instead, and a new regression test pins the ordering and asserts the catalog request goes out with the freshly fetched Cosy-Version. Thanks for catching it.
The fire-and-forget refresh ran only after the model-list request had already been signed, so a catalog fetched right after a new Qoder CLI release was signed with the stale identity, returned the reduced list, and poisoned the model cache for its full TTL (Codex P1 on #35). Await the throttled refresh at the top of updateQoderModelsCache, before buildAuthHeaders signs the request, and drop the VITEST skip: the fixture stub in catalog-cache tests is now URL-aware so the releases call stays hermetic. Adds a regression test asserting the releases fetch precedes the catalog fetch and the catalog request is signed with the freshly fetched version. Co-authored-by: simonsmh <simonsmh@users.noreply.github.com>
Why
The gateway returns a reduced model catalog to clients whose COSY version lags the current Qoder CLI. Until now the identity was a hardcoded constant, so every CLI release needed a manual bump PR (#34 took it 1.1.38 → 1.1.71, and 1.1.72 shipped the next day).
What
src/cosy-version.ts: resolves the effective COSY version dynamically from the same releases feed the public changelog page uses —https://repo.qoder.com/repos/QoderAI/changelog-CLI/releases(GitHub-shaped API overQoderAI/changelog-CLI, the endpoint behind qoder.com/changelog?type=cli).x.y.z) tag is cached in~/.pi/agent/qoder-cosy-version-cache.jsonand refreshed at most once a day, fire-and-forget after a successful model-catalog update (skipped under vitest so fixture suites stay hermetic).buildAuthHeadersstays synchronous and network-free: it signs with the newest cached version when ahead of the bundled fallback, otherwise the bundled fallback. Refresh never throws and never downgrades the identity.Tests
cosy-version.test.ts: fallback resolution, no-downgrade, malformed cache, draft/prerelease/malformed tag skipping, fetch failure tolerance, daily throttle.cosy.test.tsidentity expectation updated 1.1.71 → 1.1.72.