Skip to content

feat(models): add passive availability tracking and opt-in probes - #171

Merged
jasonxu114514 merged 2 commits into
jasonxu114514:mainfrom
NekomyaDev:feat/passive-availability-and-quota-opt
Nov 5, 2026
Merged

jasonxu114514 merged 2 commits into
jasonxu114514:mainfrom
NekomyaDev:feat/passive-availability-and-quota-opt

Conversation

@NekomyaDev

Copy link
Copy Markdown
Contributor

Summary

This PR optimizes upstream quota consumption and efficiency for free models:

  1. Passive Model Availability Tracking:

    • Replaces mandatory synthetic background inference probes with passive telemetry from live client requests.
    • Successful user traffic (2xx) marks models as available and active.
    • Transient errors (HTTP 429, 403, 5xx, timeouts, transport errors) never disable a model.
    • Only authoritative errors (isModelUnavailable / missing model) can disable a model.
    • Active background inference probes are now strictly opt-in via models.active_probes: true (default false), saving ~10 real inference requests per hour across free models.
  2. Catalog Refresh Coalescing:

    • Implements TryLock / singleflight gating on StartModelRefresh to avoid duplicate concurrent refreshes while preserving the last-known-good catalog on upstream failure.
  3. Documentation & WebUI:

    • Updates config.example.json, README.md, README.zh-CN.md, and the WebUI configuration page to document models.active_probes.

Verification

  • Passed gofmt -l .
  • Passed go vet ./...
  • Passed go build ./...
  • Passed go test -count=1 ./... (including mock isolated availability and singleflight tests with 0 upstream network calls)

@jasonxu114514
jasonxu114514 merged commit cee32f7 into jasonxu114514:main Nov 5, 2026
jasonxu114514 added a commit that referenced this pull request Nov 5, 2026
#169 called anonymousNodes.CursorForOffset, warp.Pool.ReportWithRetryAfter and
warp.Pool.HasUntriedActive without defining them, so main did not compile.
Add the three methods: an attempt offset shifts the anonymous start node, a
longer Retry-After extends the egress cooldown, and HasUntriedActive matches
the pool's egress keys.

Also:
- rewrite title.go in house style: named limits, a prompt table, no issue
  numbers in comments, and a titleFallback helper shared by both lanes
- document the held-back tool-call helpers in protocol/stream.go
- gofmt internal/admin/server.go
- drop the _test.go files from #169, #170 and #171
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