Skip to content

Merge upstream new-api v1.0.0-rc.48 - #217

Merged
Gyarados4157 merged 32 commits into
mainfrom
chore/sync-upstream-v1.0.0-rc.48
Nov 7, 2026
Merged

Gyarados4157 merged 32 commits into
mainfrom
chore/sync-upstream-v1.0.0-rc.48

Conversation

@Gyarados4157

Copy link
Copy Markdown
Collaborator

Agent

  • Tool: Claude Code
  • Tool version: not recorded
  • Model (full id): claude-opus-5-5
  • Host (CLI / IDE / GitHub coding agent / other): CLI
  • Date (UTC): 2026-11-06

Links

User request

  • Verbatim:

同步更新一下 newapi 上游呢?

  • Later constraints or corrections from the user: none

Out of scope — refuse

  • Matched: no

Open gate — do not open unless all are satisfied

  • Out of scope (including pass-through-only forwarding): no
  • Usage / configuration / integration (answered instead of opening): no
  • Required issue facts present without invention: yes
  • Verification is actual commands or steps and observed results: yes
  • Body is short and factual: yes
  • Open: yes

Kind

  • Other: upstream sync

Issue facts

  • origin/main had upstream through f3660175e (2026-10-30). Upstream tagged v1.0.0-rc.48 on 2026-11-04, 30 commits later; upstream main is 8 commits past the tag, none of them security fixes (the Redis cross-slot fix applies to Redis Cluster; the relay runs one Redis).
  • Security in the batch: DOMPurify 3.4.17, go-jose 4.1.6, and the Redis auth cache integrity check (fix(auth): 校验 Redis 鉴权缓存完整性 QuantumNous/new-api#8200).
  • Applicable types: relay (task plugin paths, moego JSON, HTTP/2 health checks, Vertex v1beta1), billing (task plugins, Gemini embeddings usage), auth (token and user cache MAC), frontend (pricing badge, sidebar, Turnstile save order).

Change

git merge v1.0.0-rc.48 on a chore/sync-upstream-v1.0.0-rc.48 branch, landing as a merge commit (never squash, per .agents/notes/implemented/process/2026-10-22-merge-upstream-new-api-by-tag.md). 19 files conflicted; 10 replayed #168's recorded resolutions and were checked again against both sides.

Path Resolution
model/token_cache.go Upstream appends expiry, MAC, repair flag and stored MAC after AllowUserQuotaQuery; CoreCode passes UpstreamKey (N1) as ARGV[17]. git merged the Go argument list cleanly, so upstream's Lua numbers would read every later argument one place early. The script reads UpstreamKey 17, AllowUserQuotaQuery 18, TTL 19, upstream's four 20–23. The MAC names UpstreamKey beside AutoGroups (both json:"-"). New model/token_cache_upstream_key_test.go.
middleware/distributor.go Keeps jsonStringEnd; getJSONStringValue takes upstream's ojson types
relaykit/go.mod, go.sum Upstream's moego; this side's golang.org/x/text 0.41.0; go mod tidy
web/package.json, bun.lock This side's pins and overrides plus upstream's five bumps; lock regenerated with bun install (55 package versions change, all inside those five trees)
bot-protection-section.tsx and its test Upstream's Turnstile save order with this side's proof-of-work fields; the test keeps this side's version
model-ratio-table-columns.tsx Upstream's; this side only reformatted it (6613db2)
use-sidebar-data.ts, sidebar-config.test.tsx, router/relay_router_test.go Both sides' additions
web/src/i18n/locales/*.json This side's keys plus upstream's new ones, without restoring keys this side removed; ko.json (CoreCode only) gets Korean for the 16 new keys

web/lint-baseline.json drops one entry that no longer occurs (lint:check -- --update). The merge note records the rc.48 argument shift.

Research

Duplicate / prior art

Docs and code

  • https://docs.newapi.ai/ : not applicable to a sync.
  • https://deepwiki.com/QuantumNous/new-api : not consulted.
  • README / repo docs: the merge-by-tag process note; AGENTS.md (lint baseline after a tag merge).
  • Code paths: git diff of base..origin/main against base..rc.48 lists 37 files both sides changed; of upstream's Lua scripts, only token_cache.go is one CoreCode also changed (user_session.go and user_auth_cache.go are upstream only).

Alternatives considered

  • Option A: merge Merge upstream new-api main (24 commits through 45746eee4) #168 first, then rc.48. Two production server releases for one tag.
  • Option B: merge upstream main (38 commits). The 8 past the tag carry no fix the relay needs now; the next tag takes them.
  • Why this approach: a tag is a version upstream shipped; one merge.

Files

Path Why
merge of v1.0.0-rc.48 upstream's 30 commits and the resolutions above
model/token_cache_upstream_key_test.go UpstreamKey round trip, TTL position, tampered UpstreamKey
web/src/i18n/locales/ko.json Korean for upstream's 16 new keys
.agents/notes/implemented/process/2026-10-22-merge-upstream-new-api-by-tag.md the rc.48 argument shift

Behavior

  • Before: upstream through f3660175e.
  • After: upstream v1.0.0-rc.48. Token and user cache hashes carry an expiry and MAC; a hash that fails verification is read from the database and rewritten.
  • Explicit non-goals: the 8 upstream main commits after the tag.

Verification

  • Go: go build ./... (both modules), go vet ./..., and the CI set go test ./common/... ./controller/... ./middleware/... ./model/... ./service/...: exit 0, 7 packages ok, 0 failures; go test -race ./pkg/deployment ./pkg/riskpolicy ok; relaykit go test ./...: 9 ok, 0 failures. With this machine's ALL_PROXY/HTTPS_PROXY set, TestUpstreamAddressesMaskOnlyConfiguredAddresses/environment_proxy_is_masked_on_a_preset_channel fails (the variables override the test's own proxy); unset, it passes.
  • Token cache: TestTokenCacheCarriesAndVerifiesUpstreamKey and TestAuthCacheIntegrityDatabaseMatrix/sqlite pass. With the Lua numbered as upstream's half, three integrity subtests fail; with UpstreamKey left out of the MAC, the new test fails at the tamper check. Both restored before commit.
  • Web: bun install --frozen-lockfile, bun run build, bun run typecheck (1,615 files), bun run lint:check ("no new lint findings"), bun run first-load:check, bun run test (269 files, 2,924 tests) pass. DOMPurify resolves to 3.4.17, go-jose to 4.1.6.
  • Not verified: MySQL and Postgres legs of the integrity matrix (no DSN here); a running server against Redis outside tests.

Risks

  • Failure modes: during the blue/green release the old server writes token hashes without a MAC; the new server reads those from the database once and rewrites them. Every cached token and user takes one database read after the release.
  • Billing / quota / auth impact: quota counters survive the rewrite (the script keeps integer counters). Auth now rejects a cache hash whose metadata changed outside the server.
  • Follow-ups: close Merge upstream new-api main (24 commits through 45746eee4) #168 when this merges.

Scope check

  • Single focused change: yes (one tag merge)
  • Secrets included: no
  • Out of scope: no

🤖 Generated with Claude Code

RedwindA and others added 30 commits October 30, 2026 15:26
…e after rotation (QuantumNous#8098)

The gin access logger and panic recovery captured gin.DefaultWriter and
gin.DefaultErrorWriter when the server was built. Since log rotation closes
the previous file, every [GIN] access line and [Recovery] stack after the
first rotation reached stdout/stderr only and never any log file.

Both middlewares now write through common.LogWriter / common.ErrorLogWriter,
which forward each write to the current gin writers under LogWriterMu, so
rotation can swap and close files without losing lines or leaking the old fd.
The server-wide recovery moves from main.go to middleware.PanicRecover so the
production wiring is covered by the regression test.
…uantumNous#8112)

Bumps [github.com/go-jose/go-jose/v4](https://github.com/go-jose/go-jose) from 4.1.4 to 4.1.6.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Commits](go-jose/go-jose@v4.1.4...v4.1.6)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v4
  dependency-version: 4.1.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps  and [undici](https://github.com/nodejs/undici). These dependencies needed to be updated together.

Updates `undici` from 7.30.0 to 7.30.1
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v7.30.0...v7.30.1)

Updates `undici` from 6.29.0 to 6.29.1
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v7.30.0...v7.30.1)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 7.30.1
  dependency-type: indirect
- dependency-name: undici
  dependency-version: 6.29.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…uantumNous#8008)

Bumps [electron](https://github.com/electron/electron) from 41.10.6 to 42.11.16.
- [Release notes](https://github.com/electron/electron/releases)
- [Commits](electron/electron@v41.10.6...v42.11.16)

---
updated-dependencies:
- dependency-name: electron
  dependency-version: 42.11.16
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…tumNous#8007)

Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.7 to 3.1.9.
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](fastify/fast-uri@v3.1.7...v3.1.9)

---
updated-dependencies:
- dependency-name: fast-uri
  dependency-version: 3.1.9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…Nous#8106)

Bumps [tailwind-merge](https://github.com/dcastil/tailwind-merge/tree/HEAD/packages/tailwind-merge) from 3.6.0 to 3.7.0.
- [Release notes](https://github.com/dcastil/tailwind-merge/releases)
- [Commits](https://github.com/dcastil/tailwind-merge/commits/tailwind-merge@3.7.0/packages/tailwind-merge)

---
updated-dependencies:
- dependency-name: tailwind-merge
  dependency-version: 3.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#8105)

Bumps [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip) from 6.27.0 to 6.43.0.
- [Release notes](https://github.com/webpro-nl/knip/releases)
- [Commits](https://github.com/webpro-nl/knip/commits/knip@6.43.0/packages/knip)

---
updated-dependencies:
- dependency-name: knip
  dependency-version: 6.43.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…Nous#8104)

Bumps [@tanstack/react-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/react-query-devtools) from 5.101.2 to 5.105.0.
- [Release notes](https://github.com/TanStack/query/releases)
- [Changelog](https://github.com/TanStack/query/blob/main/packages/react-query-devtools/CHANGELOG.md)
- [Commits](https://github.com/TanStack/query/commits/@tanstack/react-query-devtools@5.105.0/packages/react-query-devtools)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query-devtools"
  dependency-version: 5.105.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Bumps [marked](https://github.com/markedjs/marked) from 18.0.6 to 18.1.2.
- [Release notes](https://github.com/markedjs/marked/releases)
- [Commits](markedjs/marked@v18.0.6...v18.1.2)

---
updated-dependencies:
- dependency-name: marked
  dependency-version: 18.1.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…uantumNous#8102)

Bumps [@codemirror/language](https://github.com/codemirror/language) from 6.12.4 to 6.13.1.
- [Changelog](https://github.com/codemirror/language/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/language/commits)

---
updated-dependencies:
- dependency-name: "@codemirror/language"
  dependency-version: 6.13.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
A plugin change can leave a task model without a usable price: no price
is set, the price uses usage the plugin no longer provides, or the
plugin no longer offers the model. The gateway now lists these models.
The list follows the plugins currently serving, so a gateway update
that changes a built-in plugin shows up too.

- Uploading, installing from the marketplace, activating or enabling a
  plugin, or deleting its active version, lists the models it cannot
  charge in the upload dialog or in the notice after the action.
- Model pricing marks each of them "Price needs attention" with the
  reason, and a "Price status" filter lists them. A plugin model that
  was never priced now appears in the table too. The badge replaces
  "Task pricing not configured".
- The sidebar shows how many models need attention on System Settings,
  Billing & Payment and Model Pricing, for super administrators.
- GET /api/option/model_pricing/issues returns the list. It is root
  only; access tokens need the option:read scope.
- Prices kept for a switched-off plugin are not reported. They apply
  again when the plugin is switched back on.
Upgrade the direct dependency and override to address GHSA-cg2g-xh64-v4q7.

Regenerate bun.lock with Bun and update the third-party license inventory.
* fix(profile): honor global sidebar visibility

* fix(profile): wait for sidebar status
…r as the vendors do (QuantumNous#8117)

* feat(plugins): serve task plugins at the vendors' own paths

A vendor SDK or plain HTTP client can now point at the gateway and keep the
vendor's official paths. Every plugin route is also served under
/{plugin key}, and that address always runs that plugin.

- Plugins declare the vendor's official paths and the gateway adds the
  /{key} copy. Existing prefixed addresses keep working, including /ali
  for Alibaba Bailian.
- Several plugins may declare the same path. A submit runs on the plugin
  whose channel is selected; a query is answered by the plugin that owns
  the task.
- Under the gateway's own path segments (/api, /v1, /v1beta and so on)
  only built-in plugins get top-level paths; other plugins are served at
  their /{key} address. Plugin keys cannot reuse these segments.
- Jimeng uses the official Bearer API (/api/common/v3/submit_task_v2 and
  get_result_v2). The /jimeng/ route, which requests could not reach, is
  removed.
- MiniMax supports the official v1 query with ?task_id= and
  /v1/files/retrieve. The unimplemented GET /v1/files/{id} placeholder is
  removed. Vertex AI also accepts v1beta1 paths.
- Vidu routes accept Authorization: Token, and Google routes accept
  x-goog-api-key and ?key=. The key is redacted from logs.
- Gemini Veo results are read from generatedSamples, so their videos
  download again. Vertex AI videos returned inline are fetched again when
  downloaded.
- GET /v1/videos/{id} answers tasks created on xAI's routes in xAI's
  format, and :predictLongRunning requests reach the Veo plugin.
- Enabling, activating or promoting a plugin version is refused when it
  conflicts with another plugin, and force no longer skips that check.
- The plugin page lists each endpoint once, with a switch between the
  vendor path and the /{key} address. Legacy addresses are folded away.

* fix(logging): use the shared query credential masking for key=

The access log already masks credentials passed in the query string,
key included. A second redaction for the Gemini ?key= form rewrote it to
key=[REDACTED], so the log showed two masking styles and the masking
tests failed. Only the shared masking remains.

The Gemini native routes take ?key= out of the URL. With no query left,
the log fell back to the path gin recorded on arrival, which still
carried the key. The log now writes the path alone in that case, and the
plugin API document no longer says the key is logged as key=[REDACTED].

* feat(plugins): answer native plugin routes as the vendors do

A request sent to a vendor's own path now reaches the vendor as the client
wrote it, and the client gets the vendor's reply shape and status. The
gateway answers a native request with its own 400 only when it cannot tell
the model, cannot price the request, or cannot provide the feature; the
vendor checks everything else.

- New gateway rejections of that kind on native routes: callback_url on
  Ark, Kling, Vidu and MiniMax; Kling external_task_id and a body with
  model but no model_name; xAI storage_options, which was dropped
  silently; and for Jimeng, req_json on get_result_v2, a req_key the
  plugin cannot price, and frames other than 121 or 241. A value the
  plugin cannot read reserves the model's dearest tier, and settlement is
  unchanged.
- Native bodies are sent as the client wrote them. Plugins no longer fill
  in MiniMax-H3's duration, resolution and ratio or Vidu's
  movement_amplitude and images: null, drop Vidu's bgm: false, turn
  Jimeng's image and images into image_urls, or merge Ark's content.
  Kling requests no longer carry an added aspect_ratio 1:1, cfg_scale 0.5
  or model field; without a size Kling uses its own 16:9. DashScope
  requests go to the endpoint the client called.
- Replies keep each vendor's shapes and error codes. A native presenter
  may answer with the vendor's own status through a reply wrapper
  ({__status, __headers, __body}): xAI answers a pending video with 202,
  DashScope an unknown task with 200 UNKNOWN. A task the gateway failed
  shows as failed instead of still running. xAI's native query shows a
  video that failed but was charged as failed with xAI's usage, instead of
  done; billing is unchanged.
- A native client that asks the vendor for a stream (Seedream with
  stream: true, Wan interleaved output with X-DashScope-Sse: enable) gets
  the vendor's events as they arrive. Once an event has reached the
  client the task settles and is never refunded: a finished stream bills
  what was delivered, and a stream that stopped early bills the
  reservation and cuts the client's connection, so a downstream gateway
  keeps its reservation too. The client leaving does not cancel the
  upstream request, which TASK_PLUGIN_PROTOCOL_TIMEOUT_SECONDS bounds. A
  JSON reply from an older new-api upstream is still accepted.
- Routes that keep no result (retainResult: false) accept replies up to
  MAX_FILE_DOWNLOAD_MB, so b64_json images fit.
- Native decoders get the client's request headers, without gateway
  credentials, as ctx.requestHeaders.
- Native routes accept a channel's model aliases and case variants of
  model names, as the gateway's own formats do, also on routes that list
  their models.
- Kling lists kling-v2-5-turbo, kling-v2-6 and kling-v3, priced in units
  per mode, sound and voice; Kling retired kling-v1, kling-v1-6 and
  kling-v2-master on 2026-09-15. Vidu lists its current models, from
  viduq4-preview to vidu1.5.
- Clients of /v1/videos and the other gateway formats can no longer pass
  a native body through the field the plugins use for it internally.

* feat(plugins): add Kling 4.0 to the kling plugin

Kling 4.0 takes the model in the path and has its own request shape, so
the plugin serves POST /text-to-video/kling-4.0, /image-to-video/kling-4.0
and /omni-video/kling-4.0 as native routes, and answers GET
/tasks?task_ids= for their tasks. /v1/videos and the Responses API send
kling-4.0 as text-to-video or image-to-video, with size picking 720p or
1080p.

Billing follows Kling's price list: units per output second by
resolution, or, with an input video, twice the output, or input plus
output when the input is longer. Kling picks the length when the request
has none and only Kling knows how long an input video is, so the
reservation covers the longest of each. A task settles on the units Kling
deducted, or, when Kling took cash, on the durations it reports.

Kling 4.0 Flash has no published price yet and is left out.

* chore(plugins): bump the task plugins this branch changes

Each of these plugins now declares its vendor's own paths and answers
native requests as the vendor does; kling also adds Kling 4.0. That is
new behavior in every one of them, so each takes a minor version:
alibaba 1.5.0, doubao 1.4.0, google 1.2.0, hailuo 1.4.0, jimeng 1.2.0,
kling 1.2.0, vertex-ai 1.2.0, vidu 1.2.0 and xai 1.2.0.
…ize (QuantumNous#8118)

Kling 4.0 makes videos of 3 to 30 seconds. The plugin accepted 1 to 3600,
so a longer or shorter duration was reserved and then refunded when Kling
refused it. It is now refused before anything is reserved.

A /v1/videos size now gets the nearest of Kling's text-to-video aspect
ratios, 21:9 included for Kling 4.0, and Kling 4.0 takes 720p or 1080p by
the size's shorter side. Before, only four sizes were mapped: 720x720 was
reserved at 1080p and 1792x1024 was sent as 1:1. A size that is not
WIDTHxHEIGHT is refused.
…ntumNous#8119)

Since the gateway also serves every route under /{key}, a plugin that
declared both a top-level route and the same route under its key failed
to load with "duplicate route". TypeSafe 1.2.0, already published,
declares POST /v1/systemone and POST /typesafe/v1/systemone and stopped
loading. The declared address now serves the copy, so the host no longer
adds it a second time.
…sert fails (QuantumNous#8121)

A native route relays the vendor's SSE events to the client as they arrive.
If the final reserve or the task insert then failed, the controller refunded
the whole reservation. The client kept the images and paid nothing.

Once the first event reaches the client, the controller no longer refunds.
A failed reserve no longer stops the submission. Settlement charges the
actual quota and may overdraw the token, as ordinary settlement does. A
failed task insert still settles the charge and writes the consume log.
)

* perf: read and edit request JSON and base64 with moego

Switch gjson/sjson to moego/ojson and base64 on media, file and plugin
paths to moego/base64. Both keep the same results on valid input.

- Param overrides apply every edit to one ojson.Doc and write the body
  once, instead of copying the whole body for each edit.
- The video proxy and the audio check validate base64 without decoding
  it; plugin icons and inlined plugin files build data URLs directly.
- Login, password, OAuth and signature code keeps gjson and
  encoding/base64.

* perf: rewrite request fields without re-encoding the whole body

Removing disabled fields, the Responses WebSocket create event, AWS Mantle
and pass-through bodies, the OpenAI usage patch, alpha search, video result
redaction and image SSE events now edit the body with ojson.Doc instead of
decoding it into a map and encoding it again. Everything the gateway does
not touch keeps the client's member order, number spelling and characters.

- A key the client repeats is removed or rewritten in every copy, so an
  upstream that reads the last copy sees the same value the gateway routed
  and billed. A key that appears once is rewritten in place.
- Image responses and the video proxy read large values without copying
  them.

* perf: keep member order in param override merges and prune_objects

Merging an object (append/prepend) now replaces existing members where
they stand and appends new members, sorted by key, at the end. prune_objects
deletes the matching objects from the body in place instead of encoding
the pruned part, or the whole body, again. Everything else keeps the
client's member order, number spelling and characters.
…ous#6420)

xAIStreamHandler only copied prompt_tokens/total_tokens/completion_tokens
when converting the xAI stream usage, dropping prompt_tokens_details
(cached_tokens) and completion_tokens_details. As a result cached tokens
from streaming grok requests never reach the log, and cache pricing is
never applied — cached prompt tokens are billed at the full input rate.
Non-stream requests already keep these fields via xAIHandler.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…mNous#8172)

IncrementFailedAttempts kept the stale counter after a lockout window
expired, so the first wrong code after expiry computed MaxFailAttempts+1
and re-locked the account for the full LockoutDuration. When the stored
lockout has expired, start a new window at 1 and clear locked_until.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(channel): return IDs of newly created channels

1. Preserve the success envelope and return created IDs for single and batch requests.

2. Keep generated IDs in the input slice and propagate panics after transaction rollback.

3. Document the response and cover duplicate credentials, chunk boundaries, empty batches, and rollback.

* feat(channel): map creation results to original inputs

Return input_index and channel_id for each accepted input while preserving existing IDs and credential parsing. Cover filtered empty inputs, duplicate keys, Vertex JSON, and multi-key channels in the API contract tests and OpenAPI examples.
* feat(gemini): add Argon fields and reasoning mappings

* feat(vertex): add per-channel v1beta1 endpoint switch
* fix(auth): verify Redis authentication cache integrity

* fix(auth): repair auth cache hashes with unreadable fields

A token cache hash with a field that cannot be parsed, or with a stray
DeletedAt field, fell back to the database on every request and was
never rewritten. Repairs now read the stored signature on its own,
drop DeletedAt, and replace quota counters that are not integers in
both the token and user caches. Valid counters are still kept.
Gyarados4157 and others added 2 commits November 7, 2026 06:35
30 upstream commits since f366017, including everything in #168
(through 45746ee), which this supersedes. Among them: the Redis auth
cache integrity check (QuantumNous#8200), DOMPurify 3.4.17 and go-jose 4.1.6,
moego in place of gjson/sjson, task plugins at the vendors' own paths,
opt-in HTTP/2 health checks, the Vertex v1beta1 switch and the model
pricing badge.

Conflicts:

- model/token_cache.go: upstream appends the cache expiry, MAC, repair
  flag and stored MAC after AllowUserQuotaQuery, and CoreCode passes
  UpstreamKey (N1) as ARGV[17]. git merged the Go argument list without a
  conflict, so upstream's Lua numbers would have read every argument after
  the 17th one place early. The script now reads UpstreamKey at 17,
  AllowUserQuotaQuery at 18, the TTL at 19 and upstream's four at 20-23.
  The MAC names UpstreamKey beside AutoGroups, since both are json:"-" on
  Token and would otherwise change unverified.
  token_cache_upstream_key_test.go checks the round trip, the TTL and a
  tampered UpstreamKey.
- middleware/distributor.go: keeps jsonStringEnd, with upstream's ojson
  types in getJSONStringValue.
- relaykit/go.mod, go.sum: upstream's moego; this side's x/text 0.41.0.
- web/package.json, bun.lock: this side's pins and overrides, plus
  upstream's five bumps; lock regenerated with bun install.
- bot-protection-section.tsx: upstream's Turnstile save order with this
  side's proof-of-work fields; the test keeps this side's version.
- model-ratio-table-columns.tsx: upstream's; this side only reformatted it.
- use-sidebar-data.ts, sidebar-config.test.tsx, relay_router_test.go:
  both sides' additions.
- i18n locales: this side's keys plus upstream's new ones, without the
  keys this side removed. ko.json, which upstream does not carry, gets
  Korean for the 16 new keys.

web/lint-baseline.json drops one entry that no longer occurs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gyarados4157
Gyarados4157 merged commit 2694d24 into main Nov 7, 2026
3 checks passed
@Gyarados4157
Gyarados4157 deleted the chore/sync-upstream-v1.0.0-rc.48 branch November 7, 2026 01:50
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.