Skip to content

fix(sse): share applied proxy capture across duplicated fetch modules - #14620

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.51from
maxmad64bis:fix/applied-proxy-shared-context
Sep 24, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.51from
maxmad64bis:fix/applied-proxy-shared-context

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #14547

Summary

The proxy journal keeps one capture context per proxyFetch module copy, so when the server bundle serves a dispatch from a copy that did not open the capture, the provider status actually received is never recorded. This change shares the capture context across duplicated module copies, so the journal can tell a received provider status apart from a local failure no matter which server copy serves the dispatch.

Related Issues

Related to #13580

Validation

  • Change type: other
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/proxy-fetch-applied-context.test.ts (new, 3 cases: single-copy trap that passes before and after, two-copy capture undefined !== 429 RED then GREEN, sequential isolation with throw leaving no stale status).
  • Neighbors re-run one by one, all green: tests/unit/proxyfetch-upstream-status-capture.test.ts (9/9), tests/unit/proxy-fetch.test.ts (9/9), tests/unit/proxy-logs-upstream-status.test.ts (4/4).

Coverage Notes

  • N/A — no coverage gate movement; new behavior is covered by the new test plus the three neighbor suites above.

Reviewer Notes

  • File-size rebaseline: open-sse/utils/proxyFetch.ts 1287 → 1294 (+7, shared key + store type + lazy getter and four one-line call-site swaps; irreducible at the single store-identity chokepoint), recorded as _rebaseline_2026_09_23_applied_proxy_shared_context in config/quality/file-size-baseline.json.
  • typecheck:core shows one error in src/lib/services/cliproxyAccountHealth.ts(157,5) (TS2322) plus check-open-sse-typecheck on open-sse/executors/auggie.ts (TS2769/TS18047); both reproduce on the pure base and touch no file in this PR — inherited, non-blocking.
  • CI API Route Typecheck reports 4 diagnostics in open-sse/executors/auggie.ts (TS2769/TS18047) and src/app/api/v1/combos/projectCombo.ts (TS2459/TS2724); both files are unchanged since the merge-base and the same 4 lines fail on same-base PRs test(sse): lock per-key ceiling 429 out of neighbor cooldown scope #14581/fix(sse): serve the stored 429 instead of re-sending refused requests #14588, so inherited via 🔴 Release branch not green: release/v3.8.51 #14547 and non-blocking.
Recensement (upstream positions)

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Good catch on the module-duplication trap — keying the AsyncLocalStorage off
globalThis via Symbol.for is the right fix so every bundle copy of proxyFetch.ts shares one
capture context. The file-size-baseline rebaseline entry is properly justified. This is the base
commit for #14659 and #14637 (both stacked on it) — merging this one first.

@diegosouzapw
diegosouzapw merged commit 699738b into cheaper-inference:release/v3.8.51 Sep 24, 2026
17 of 25 checks passed
@maxmad64bis
maxmad64bis deleted the fix/applied-proxy-shared-context branch September 24, 2026 21:12
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