Skip to content

feat/fix/ci/test: context_window, tuple streaming, CI gate, E2E coverage, keepalive scheduler - #604

Closed
icebear0828 wants to merge 9 commits into
devfrom
fix/egress-log-request-details
Closed

feat/fix/ci/test: context_window, tuple streaming, CI gate, E2E coverage, keepalive scheduler#604
icebear0828 wants to merge 9 commits into
devfrom
fix/egress-log-request-details

Conversation

@icebear0828

@icebear0828 icebear0828 commented May 27, 2026

Copy link
Copy Markdown
Owner

Summary

Test Plan

  • npm test — 243 test files, 2431 tests passed, 1 skipped
  • npx tsc --noEmit — 0 errors
  • npm run build:web — builds in ~600ms

Notes

TupleStreamDecoder

State machine (await-open → skip-key → collect-value → done) tracks JSON depth character-by-character, calls reconvertTupleValues on each emitted element. Handles nested tuples, objects, arrays, and escaped strings.

KeepaliveScheduler

Calls /codex/usage per active account on schedule to refresh quota window state. Deactivated/banned accounts are auto-marked expired. Dashboard UI left for follow-up.

New E2E test pattern

admin-settings.test.ts and dashboard-login.test.ts are self-contained (no e2e-setup.ts), following the pattern established in proxy-routes.test.ts.

…arden affinity

- wantReasoning/wantThinking now derived from codexRequest.reasoning?.effort
  after translation; previously only explicit client fields were checked, so
  effort injected via model suffix (e.g. gpt-5.4-high) or default_reasoning_effort
  config was sent upstream but the returned reasoning deltas were silently dropped
- SessionAffinityMap stores instructions as SHA-256 hash instead of raw string
  to bound per-entry memory usage; implicit-resume comparison updated to match
- developer role in Codex requests now mapped to system for OpenAI-compatible
  backends that reject the developer role; CodexInputItem type updated accordingly
- Proxy host field now accepts a full URL directly to avoid double-prefix when
  user pastes http://... or socks5://... into the host input
- Dashboard proxy panel adds "Paste URL" mode as alternative to field-by-field
  entry; i18n strings added for zh/en
- Config version bump to 26.519.81530 / build 3178
- [CRITICAL] null instructions → hash regression: record() now accepts
  string|null|undefined and uses sha256(instructions ?? "") so that
  no-system-prompt sessions store sha256("") instead of undefined,
  matching the comparison side in proxy-session-context; callers no
  longer coerce null→undefined via ?? undefined
- [HIGH] ProxyPool handleAdd useCallback missing urlMode/newRawUrl deps
  caused URL paste mode to always see stale empty values and never
  submit; also reset urlMode in resetForm()
- [MEDIUM] proxy name credential leak: when name is empty and falls back
  to the full URL, strip username/password before using as display name
Cover three missing paths from PR review:
- empty name with credential URL → name has creds stripped
- full URL pasted into host field → accepted as-is
- explicit name takes precedence over URL fallback
…ls response

Clients such as OpenCode read context_window from the model list to
determine the usable context size. The field was absent, causing them
to fall back to hardcoded defaults that didn't match actual model limits.

Closes #578
…tal decoder

Previously, any structured-output request using prefixItems (tuple schemas)
caused the entire response text to be held in memory until response.completed,
then emitted as a single chunk — the client saw nothing until the response
finished.

TupleStreamDecoder tracks JSON depth character-by-character and emits each
top-level array element as soon as its boundary is found, giving progressive
output for both the OpenAI and Gemini streaming paths.

Closes #379
@icebear0828 icebear0828 changed the title feat(models): expose context_window and max_output_tokens in /v1/models response fix(translation): add context_window to /v1/models and fix tuple-schema streaming May 27, 2026
@icebear0828 icebear0828 changed the title fix(translation): add context_window to /v1/models and fix tuple-schema streaming fix/feat/ci: context_window in /v1/models, tuple streaming decoder, and CI quality gate May 27, 2026
…coverage

47 new tests across 3 files covering the full HTTP pipeline:
- accounts.test.ts: list/add/delete/reset-usage/label/cookies/batch ops/export
- admin-settings.test.ts: rotation/settings/general/quota GET+POST + auth gating
- dashboard-login.test.ts: login/logout/status + rate-limit enforcement

Partially closes #376
- Config schema: account_keepalive section (enabled, mode, fixed_times,
  interval_minutes, concurrency, per_account_delay_ms) with defaults
- KeepaliveScheduler: fixed_times and interval modes, batch concurrency,
  per-batch stagger delay, single-run guard, deactivated-account detection
- Admin routes: GET /admin/keepalive-status, POST /admin/keepalive-config,
  POST /admin/keepalive-run
- Wired into server startup (keepaliveScheduler.start()) and shutdown
- 14 unit tests: computeNextRun + executeAll edge cases

Partially closes #512 (Dashboard UI to follow)
@icebear0828 icebear0828 changed the title fix/feat/ci: context_window in /v1/models, tuple streaming decoder, and CI quality gate feat/fix/ci/test: context_window, tuple streaming, CI gate, E2E coverage, keepalive scheduler May 27, 2026
@icebear0828

Copy link
Copy Markdown
Owner Author

Closing: core changes (tuple-schema, context_window, CI gate, session-affinity) already landed via subsequent PRs. Keepalive scheduler overlaps with #624's ActiveQuotaRefresher. E2E tests can be cherry-picked in a follow-up if needed.

@SsuJojo

SsuJojo commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

经过对 PR #604 #604 中全部 9
个 commits 以及当前 dev 分支代码和历史 PR 的详细比对分析:

结论:#604 中的全部有价值内容均已合并或被更优方案替代,分支 fix/egress-log-
request-details 完全可以安全删除。
──────

9 个 Commits 落地与利用情况明细

Commit │ 简述 │ 落地状态与对应 PR
────────────────────────┼─────────────────────────┼─────────────────────────
1 ~ 4 (ba163e6, │ model-suffix/config │ 已合并:已通过 PR
407c679, b298964, │ effort │ #603[1](commit
e3a00d5) │ 传递到流式响应、Session │ 3dd7415)并入 dev。
│ Affinity sha256 │
│ 优化、代理面板 URL │
│ 粘贴模式及评审修复与测 │
│ 试 │
5 (88ea815) │ /v1/models 暴露 │ 已合并:已通过 PR
│ context_window、max_out │ #670[2](commit
│ put_tokens │ 899d540)并入 dev。
6 (fa88e0c) │ TupleStreamDecoder │ 已归档/放弃:目前主线采
│ 逐字符状态机(tuple │ 用 prefixItems
│ schema 增量流式解析) │ 在流结束(response.comp
│ │ leted)时统一调用
│ │ reconvertTupleValues
│ │ 的稳定策略,Issue #379
│ │ 已关闭。
7 (46cb281) │ ci-quality.yml │ 已实现:当前
│ 质量门禁补充全量测试与 │ ci-quality.yml 已包含
│ web 构建 │ backend-
│ │ tests、frontend-tests、
│ │ package-boundary 与
│ │ build:web 全套检查。
8 (3d505e3) │ Account CRUD、Admin │ 已合并:已通过 PR
│ settings、Dashboard │ #760[3](commit 1d8ba57
│ login E2E 测试用例 (47 │ / f62f954)适配最新
│ 个测试) │ auth 中间件后并入 dev。
9 (81b56c5) │ keepalive │ 已替代:已被 PR #624[4]
│ 账号保活调度器及相关 │ 的
│ admin 路由 │ ActiveQuotaRefresher(
│ │ 主动配额心跳与级联封禁
│ │ 防护)方案完全替代并已
│ │ 并入 dev。

[1]: PR #603 #603
[2]: PR #670 #670
[3]: PR #760 #760
[4]: PR #624 #624
──────

分支清理

该分支关联的历史 PR(#588#594#603 已 merge,#604 已 closed),已无任何
open PR 依赖它。

@SsuJojo
SsuJojo deleted the fix/egress-log-request-details branch August 30, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants