Skip to content

feat: track the latest Qoder CLI release for the COSY identity - #35

Merged
simonsmh merged 1 commit into
mainfrom
feat/dynamic-cosy-version
Oct 15, 2026
Merged

simonsmh merged 1 commit into
mainfrom
feat/dynamic-cosy-version

Conversation

@simonsmh

Copy link
Copy Markdown
Owner

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

  • New 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 over QoderAI/changelog-CLI, the endpoint behind qoder.com/changelog?type=cli).
  • The newest stable (non-draft, non-prerelease, x.y.z) tag is cached in ~/.pi/agent/qoder-cosy-version-cache.json and refreshed at most once a day, fire-and-forget after a successful model-catalog update (skipped under vitest so fixture suites stay hermetic).
  • buildAuthHeaders stays 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.
  • Bundled fallback bumped to 1.1.72 (current CLI release, 2026-10-15).

Tests

  • 11 new tests in cosy-version.test.ts: fallback resolution, no-downgrade, malformed cache, draft/prerelease/malformed tag skipping, fetch failure tolerance, daily throttle.
  • cosy.test.ts identity expectation updated 1.1.71 → 1.1.72.
  • Full suite: lint + typecheck + 310/310 tests + build, all green (run twice).

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T15:52:39.443288Z f3e80ab PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@simonsmh
simonsmh merged commit e12f381 into main Oct 15, 2026
1 check passed
@simonsmh
simonsmh deleted the feat/dynamic-cosy-version branch October 15, 2026 15:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/catalog.ts
Comment on lines +712 to +713
if (!process.env.VITEST) {
void refreshGatewayCosyVersion();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

simonsmh added a commit that referenced this pull request Oct 15, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant