Skip to content

refactor(provider-core): latest-version lookups go through a ProviderLatestVersions service - #17434

Merged
juliusmarminge merged 1 commit into
t3/provider-core-conventionsfrom
t3/provider-core-services
Oct 9, 2026
Merged

juliusmarminge merged 1 commit into
t3/provider-core-conventionsfrom
t3/provider-core-services

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

The npm-registry and Muse release-channel "latest version" caches shared a Context.Reference holding a mutable Map. Its key (@t3tools/server/providerMaintenance/ProviderVersionCache) didn't match its module, and every consumer reached into the map directly (ws.ts deleted entries, the maintenance runner re-provided it by hand).

This PR adds @t3tools/provider-core/server/ProviderLatestVersions, a real service:

  • cached(key, lookup, { fresh? }) keeps the TTL policy in one place: 1h for found versions, 1min for failed lookups.
  • invalidate(key) replaces the direct map delete in ws.ts.
  • layer is provided once by the server. Tests use make(seed) for pre-cached entries.

Drivers (Claude, Codex, Grok, Muse, OpenCode, Pi) yield it next to HttpClient. Grok and Pi's enrich*Snapshot now require HttpClient from the environment instead of taking it as an argument.

Part of the provider-package audit (stack #17428).

Model: Claude Opus 5.5 via Claude Code in T3 Code.

🤖 Generated with Claude Code


Devin Review

@juliusmarminge
juliusmarminge added this pull request to stack #17428 October 9, 2026 07:37
@juliusmarminge
juliusmarminge marked this pull request as ready for review October 9, 2026 07:37
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 9, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 9, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR replaces the existing latest-version cache with a new shared service and propagates it across all provider drivers, maintenance flows, and refresh handling. The cache and invalidation behavior changes across multiple production paths, making this broader than an automatically approvable mechanical refactor.

No code changes detected at d3b5917. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 4.9 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.8 KiB — 29.3 KiB ✅
Codex Live turn messages — 1 — 8 ✅
Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 21.2 KiB — 29.3 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: d3b5917 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 9a2fff21-fdd8-4dfc-9e75-1618cc88b50e
📥 Commits

Reviewing files that changed from the base of the PR and between 7e29597 and 7da182d.

📒 Files selected for processing (28)
  • apps/server/src/orchestration-v2/AcpRegistryOrchestratorV2.live.test.ts
  • apps/server/src/orchestration-v2/CursorOrchestratorV2.live.test.ts
  • apps/server/src/orchestration-v2/GrokOrchestratorV2.live.test.ts
  • apps/server/src/orchestration-v2/OpenCode2OrchestratorV2.live.test.ts
  • apps/server/src/provider/Drivers/ClaudeDriver.ts
  • apps/server/src/provider/Drivers/CodexDriver.test.ts
  • apps/server/src/provider/Drivers/CodexDriver.ts
  • apps/server/src/provider/ProviderInstanceRegistry.test.ts
  • apps/server/src/provider/ProviderRegistry.test.ts
  • apps/server/src/provider/providerMaintenanceRunner.test.ts
  • apps/server/src/provider/providerMaintenanceRunner.ts
  • apps/server/src/server.ts
  • apps/server/src/ws.ts
  • packages/provider-core/package.json
  • packages/provider-core/src/server/ProviderLatestVersions.ts
  • packages/provider-core/src/server/maintenanceResolver.test.ts
  • packages/provider-core/src/server/maintenanceResolver.ts
  • packages/provider-grok/src/server/driver.test.ts
  • packages/provider-grok/src/server/driver.ts
  • packages/provider-grok/src/server/status.ts
  • packages/provider-muse/src/server/driver.ts
  • packages/provider-muse/src/server/maintenance.test.ts
  • packages/provider-muse/src/server/maintenance.ts
  • packages/provider-opencode/src/server/driver.test.ts
  • packages/provider-opencode/src/server/driver.ts
  • packages/provider-pi/src/server/driver.test.ts
  • packages/provider-pi/src/server/driver.ts
  • packages/provider-pi/src/server/status.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a shared provider latest-version cache and migrates maintenance lookups and provider snapshot enrichment to use it. Server runtime layers provide the service, and refresh flows invalidate cached entries.

Changes

Provider latest-version caching

Layer / File(s) Summary
Shared cache and maintenance lookups
packages/provider-core/src/server/ProviderLatestVersions.ts, packages/provider-core/src/server/maintenanceResolver.ts, packages/provider-muse/src/server/maintenance.ts, related tests and packages/provider-core/package.json
Provider core adds and exports a cache service with keyed lookup, invalidation, and different cache durations for found and missing versions. The maintenance resolver and Muse maintenance lookup use the shared service.
Provider driver integration
apps/server/src/provider/Drivers/*, packages/provider-grok/src/server/*, packages/provider-muse/src/server/driver.ts, packages/provider-opencode/src/server/driver.ts, packages/provider-pi/src/server/*, related tests
The listed drivers add ProviderLatestVersions to their service requirements and provide it to maintenance or snapshot-enrichment effects. Grok and Pi enrichment effects also declare their HTTP client service requirements.
Server and registry wiring
apps/server/src/server.ts, apps/server/src/ws.ts, apps/server/src/provider/providerMaintenanceRunner.ts, apps/server/src/provider/Provider*Registry.test.ts, apps/server/src/provider/providerMaintenanceRunner.test.ts, apps/server/src/orchestration-v2/*OrchestratorV2.live.test.ts
The server provides the shared service. The maintenance runner uses it for snapshot enrichment and latest-version resolution. Provider refresh invalidates the relevant package entry, and registry and orchestrator test layers provide the service.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 7da18

The cache migration has no identified regression that needs to be fixed before merging.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check Warning The description clearly explains the problem and the implementation. It does not include the required Scope and approval section or Verification details with focused test results and any limitations. Add a Scope and approval section with the triaged issue or explicit maintainer approval, or explain why the change qualifies for an exception. Add a Verification section that lists the focused tests or manual checks run and their observed r…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: routing latest-version lookups through the new ProviderLatestVersions service.
Full details: Description check

Resolution

Add a Scope and approval section with the triaged issue or explicit maintainer approval, or explain why the change qualifies for an exception. Add a Verification section that lists the focused tests or manual checks run and their observed results, including anything not checked.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

…LatestVersions service

The npm and Muse channel caches shared a Context.Reference to a mutable Map
with a server-namespaced key. ProviderLatestVersions owns the TTL policy and
invalidation; drivers yield it like any other service and the server provides
one instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the t3/provider-core-services branch from 7da182d to d3b5917 Compare October 9, 2026 16:07
@juliusmarminge
juliusmarminge merged commit 68ab16f into main Oct 9, 2026
29 of 30 checks passed
@juliusmarminge
juliusmarminge deleted the t3/provider-core-services branch October 9, 2026 16:15
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 9, 2026
## What's Changed
* fix(web): Local environment switch stays reachable after turning it off by @ScottN-PV in pingdotgg/t3code#17359
* fix(web): keep chat banners inside the lane beside the docked details card by @macodev00 in pingdotgg/t3code#17094
* fix(web): settled and snoozed lines line up with the messages above them by @RakshithBhat03 in pingdotgg/t3code#17191
* fix(web): distinguish project filter from new project by @voltcrash in pingdotgg/t3code#12113
* feat(web): assign a thread details panel shortcut by @maria-rcks in pingdotgg/t3code#16694
* fix(web): chat content keeps pace with sidebar resizing by @flamboh in pingdotgg/t3code#17383
* refactor(provider-core): expose model metadata through a ModelCatalog port by @juliusmarminge in pingdotgg/t3code#17417
* refactor(provider-core): follow the Effect service conventions throughout by @juliusmarminge in pingdotgg/t3code#17427
* refactor(provider-core): latest-version lookups go through a ProviderLatestVersions service by @juliusmarminge in pingdotgg/t3code#17434
* refactor(provider-core): MCP provider sessions live in a McpProviderSessions service by @juliusmarminge in pingdotgg/t3code#17446
* refactor(provider): bring opencode, muse, pi, core and testing in line with Effect conventions by @juliusmarminge in pingdotgg/t3code#17542
* refactor(provider-acp): ACP, ACP Registry and Grok follow the Effect service conventions by @juliusmarminge in pingdotgg/t3code#17544
* refactor(provider-cursor): follow the Effect service conventions by @juliusmarminge in pingdotgg/t3code#17545
* fix(marketing): use app wordmark in header by @voltcrash in pingdotgg/t3code#13240
* fix(web): pr merge actions stay visible while the stack refreshes by @maria-rcks in pingdotgg/t3code#17559

## New Contributors
* @voltcrash made their first contribution in pingdotgg/t3code#12113

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261009.2873...v0.0.46-nightly.20261009.2886

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261009.2886
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 9, 2026
## What's Changed
* fix(web): Local environment switch stays reachable after turning it off by @ScottN-PV in pingdotgg/t3code#17359
* fix(web): keep chat banners inside the lane beside the docked details card by @macodev00 in pingdotgg/t3code#17094
* fix(web): settled and snoozed lines line up with the messages above them by @RakshithBhat03 in pingdotgg/t3code#17191
* fix(web): distinguish project filter from new project by @voltcrash in pingdotgg/t3code#12113
* feat(web): assign a thread details panel shortcut by @maria-rcks in pingdotgg/t3code#16694
* fix(web): chat content keeps pace with sidebar resizing by @flamboh in pingdotgg/t3code#17383
* refactor(provider-core): expose model metadata through a ModelCatalog port by @juliusmarminge in pingdotgg/t3code#17417
* refactor(provider-core): follow the Effect service conventions throughout by @juliusmarminge in pingdotgg/t3code#17427
* refactor(provider-core): latest-version lookups go through a ProviderLatestVersions service by @juliusmarminge in pingdotgg/t3code#17434
* refactor(provider-core): MCP provider sessions live in a McpProviderSessions service by @juliusmarminge in pingdotgg/t3code#17446
* refactor(provider): bring opencode, muse, pi, core and testing in line with Effect conventions by @juliusmarminge in pingdotgg/t3code#17542
* refactor(provider-acp): ACP, ACP Registry and Grok follow the Effect service conventions by @juliusmarminge in pingdotgg/t3code#17544
* refactor(provider-cursor): follow the Effect service conventions by @juliusmarminge in pingdotgg/t3code#17545
* fix(marketing): use app wordmark in header by @voltcrash in pingdotgg/t3code#13240
* fix(web): pr merge actions stay visible while the stack refreshes by @maria-rcks in pingdotgg/t3code#17559

## New Contributors
* @voltcrash made their first contribution in pingdotgg/t3code#12113

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261009.2873...v0.0.46-nightly.20261009.2886

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261009.2886
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant