Make Claude v2 profile authoritative for TLS, session, and cache exits#2
Merged
dofastted merged 12 commits intoJun 24, 2026
Merged
Conversation
Benchmark entrypoint: bash autoresearch.sh Goal: 分析近期 profile 模块与旧 sub2api 逻辑(TLS 指纹、会话 ID 伪装、缓存 TTL/断点替换、旧 header profile)是否冲突,并寻找让 profile 启动时作为唯一出口的改进点。
Result: {"status":"keep","profile_conflict_count":4,"profile_alignment_checks":3,"profile_workload_cases":8}
Result: {"status":"keep","profile_conflict_count":3,"profile_alignment_checks":3,"profile_workload_cases":7}
Result: {"status":"keep","profile_conflict_count":1,"profile_alignment_checks":3,"profile_workload_cases":6}
Result: {"status":"keep","profile_conflict_count":0,"profile_alignment_checks":3,"profile_workload_cases":5}
…he policy
Result: {"status":"keep","profile_conflict_count":0,"profile_alignment_checks":3,"profile_workload_cases":7}
Preserve existing per-OS device identity (client_id/device_id/session_seed) when upgrading a legacy auto_default pool to schema v2 so upstream fingerprints stay continuous. Reject already-v2 or missing pools, and clear the legacy single-profile key to avoid stale fallback after migration.
…lly work
The VersionFetcherService never refreshed codex/claude CLI versions into
profiles due to three compounding defects: ua_auto_fetch defaulted to
disabled (Start returned immediately), the first fetch waited a full
interval after boot, and registry.Swap only updated an in-memory
atomic.Pointer with no persistence (lost on restart, never written to
profile/DB).
- Default gateway.ua_auto_fetch.enabled to true (config + deploy example)
- Bootstrap from DB on Start: load persisted versions into the registry
so profiles use the last fetched version immediately on boot
- Fetch once immediately on Start before entering the ticker loop
- Split all-or-nothing: claude and codex fetch/persist independently so
one side failing no longer discards the other's fresh version
- Persist fetched versions to the setting table
(claude_cli_version JSON {cli,sdk}, codex_cli_version) and reload them
on boot; falls back to hardcoded defaults when DB is empty
- Wire SettingRepository into NewVersionFetcherService
- Tests: update constructor signature, partial-success semantics, and
add persistence / bootstrap coverage
…cleanup The repository-presentation cleanup (9afaa31) rewrote the first comment line of several migration files from "Sub2API" to "claude2api". This changed their trimmed-content checksums while leaving DDL and resulting schema identical. Existing deployments recorded the pre-cleanup checksums in schema_migrations, so rebuilding the image from source fails startup with a checksum mismatch. Add compatibility rules for the four affected, already-applied files (001_init, 002_account_type_migration, 003_subscription, 052_migrate_upstream_to_apikey) so the new checksum is accepted against the legacy DB checksum without modifying migrations or the database. 051 is unaffected (its content trims to empty, identical checksum).
…PI gateway - gofmt: normalize import grouping/ordering and indentation across service/handler files (no logic change) - rebrand UI subtitle 'Subscription to API Conversion Platform' -> 'Local-first AI API gateway' (en.ts, SettingsView.vue, VISUAL_GUIDE.md)
) 32a46e3 covered the four files touched by 9afaa31's Sub2API->claude2api cleanup but missed 038_ops_errors_..._classification.sql, which the same cleanup also rewrote (first-line comment + one owner-normalization WHERE condition sub2api->claude2api). The migration was already applied on the green/sub2api-migrated DB, so DDL/data are unaffected; only its trimmed checksum changed. Without this rule, rebuilding from source fails startup with a 038 checksum mismatch (db=4cc121d9..., file=3281353a...). Verified by booting the image against a restored production snapshot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Review
Verification
Metrics