Skip to content

[fix] AutoPing stale refreshAndUpdateCredentials import - #28

Merged
datj9 merged 1 commit into
masterfrom
fix/autoping-stale-import
Jun 30, 2026
Merged

datj9 merged 1 commit into
masterfrom
fix/autoping-stale-import

Conversation

@datj9

@datj9 datj9 commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Symptom

Every AutoPing tick logged and skipped the connection:

[AutoPing] <id>: refresh failed: (0 , k.refreshAndUpdateCredentials) is not a function

Root cause

refreshAndUpdateCredentials was relocated from the usage route into src/lib/usage/providerQuota.js in #20, but src/shared/services/claudeAutoPing.js still imported it from @/app/api/usage/[connectionId]/route.js — which now only exports GET. The named import resolved to undefined, so calling it threw on every tick. The bundler resolves a missing named export to undefined at runtime rather than failing the build, so nothing caught it until AutoPing ran.

The sibling caller codex-reset-credits/route.js was already updated in the same refactor; AutoPing was missed.

Fix

Point the import at the new canonical module:

-import { refreshAndUpdateCredentials } from "@/app/api/usage/[connectionId]/route.js";
+import { refreshAndUpdateCredentials } from "@/lib/usage/providerQuota";

Signature (connection, force, proxyOptions) and return shape { connection, refreshed } both match the existing call site — no other change needed.

Tests

No clean regression seam: the failure is module-resolution wiring, not logic, and AutoPing import wiring has no test harness — a unit test would give false confidence. Verified statically (export present in providerQuota.js, absent in route.js) and by parity with the working sibling caller. Lint clean.

🤖 Generated with Claude Code

The function was relocated from the usage route module to
src/lib/usage/providerQuota.js in #20, but claudeAutoPing.js still
imported it from @/app/api/usage/[connectionId]/route.js, which now only
exports GET. The named import resolved to undefined, so every AutoPing
tick threw "(0 , k.refreshAndUpdateCredentials) is not a function" and
skipped the connection. Point the import at the new canonical module,
matching the sibling caller in codex-reset-credits/route.js.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@datj9 datj9 self-assigned this Jun 30, 2026
@datj9-reader
datj9-reader self-requested a review June 30, 2026 03:08
@datj9
datj9 merged commit 58baff2 into master Jun 30, 2026
datj9 added a commit that referenced this pull request Jul 1, 2026
claudeAutoPing.js was a modify/delete conflict: deleted on this branch
(superseded by quotaAutoPing.js from the upstream merge) and modified on
master by PR #28 (stale refreshAndUpdateCredentials import fix). Accept the
deletion, and carry PR #28's intent forward by pointing quotaAutoPing.js's
import at @/lib/usage/providerQuota instead of the stale
[connectionId]/route.js path (which no longer exports the symbol).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.

2 participants