Skip to content

feat(fork): DiepXuan custom feature — cli-tools, console-log, combo fallback, contextLength, identity docs - #46

Merged
caothu159 merged 12 commits into
mainfrom
diepxuan
Jul 23, 2026
Merged

caothu159 merged 12 commits into
mainfrom
diepxuan

Conversation

@caothu159

@caothu159 caothu159 commented Jul 21, 2026 •

Copy link
Copy Markdown

Tổng quan

Branch diepxuan base từ origin/main (v0.5.40, 79918c7), gom các custom feature của fork diepxuan/9router chưa được merge vào main.

Đợt 2 (2026-07-22): sync docs/manifest + wrap hooks + xóa dead code

6 commit mới trên đỉnh 2f447c06:

  • 0995bd9e docs(TOOLS): note that npm run build must run outside Codex sandbox
  • 46da85e7 docs(CHECKLIST): sync with current fork state, add NVIDIA + v1 models sections
  • fe58aa98 chore(manifest): add auto-context-length, drop stale nvidia-executor-strip
  • fe747a87 chore(fork): drop dead-code files (executorHooks + console-logs-structured)
  • fe2a1123 feat(fork): wrap contextLength hooks with isDiepXuanEnabled()
  • b558622a feat(fork): wrap codex subagent config with isDiepXuanEnabled()

Tổng đợt 2: 10 file thay đổi (+317 / -235, trong đó 2 file delete).

Verify sau đợt 2

  • node --check toàn bộ file wrap + delete: PASS.
  • node scripts/diepxuan/check-custom-features.mjs: 360 PASS / 0 WARN / 0 FAIL (14 features).
  • npm run build (ngoài sandbox, sau npm install còn thiếu @next/third-parties): PASS.

Known issues #1 đã fix

Manifest rule fork-branding-header stale → đã bỏ forbiddenFiles, chỉ giữ forbiddenPatterns (Header không import DonateModal). Cho phép upstream thêm lại file nếu cần.

Dead code đã xóa

  • open-sse/diepxuan/executorHooks.js (37 dòng, NVIDIA strip helper, không ai import)
  • src/diepxuan/app/api/console-logs-structured/route.js (159 dòng, structured log API route, EnhancedConsoleLog.jsx không dùng)

Đã xác nhận xóa 2 file này không ảnh hưởng đến enhanced-console-log feature (đã grep trước khi xóa).

Hook wrap mới

  • open-sse/diepxuan/contextLength/{index,cache,modelsApi,errorParser}.js: khi DIEPXUAN_ENABLED=false, context_length lookup + cache + API fetch + error parsing thành no-op. /v1/models trả response không có context_length, giống upstream.
  • src/diepxuan/app/dashboard/cli-tools/codex.js: khi DIEPXUAN_ENABLED=false, extendCodexSubagentConfig() trả config gốc (không extend description).

Đợt 1 (PR body gốc — giữ audit trail)

Phạm vi đợt 1

  • 1 commit (2f447c06), 54 file thay đổi, +4430 / -119.
  • File mới nằm trong fork layer (src/diepxuan/, open-sse/diepxuan/).
  • Base file bị sửa đều là hook mỏng gọi vào fork layer (đúng AGENTS.md §6).

Nhóm thay đổi chính (đợt 1)

  1. Identity docs — 11 file .md ở root (AGENTS, SOUL, IDENTITY, USER, TOOLS, MEMORY, BOOTSTRAP, AGENT_WORKSPACE, HEARTBEAT, .editorconfig, .gitignore).
  2. CLI tools — current origin endpoint cho 9 tool + codex subagent description, hook vào ToolDetailClient.js + 8 file *ToolCard.jsx.
  3. Enhanced console log — EnhancedConsoleLog.jsx + structured log API (đợt 2 xóa route dead code).
  4. Combo/fallback hooks — comboFailTracker, webComboFallback, hook vào search.js/fetch.js/combo.js/accountFallback.js/stream.js/settings/route.js.
  5. Context length cache — open-sse/diepxuan/contextLength/ (cache + errorParser + modelsApi).
  6. Combo curl snippet — combo detail page hiển thị origin đầy đủ trong curl command.
  7. V1 models API — hook enrich models.
  8. Dev/CI — dev.sh (242 dòng), .github/workflows/build-and-deploy.yml.
  9. Fork branding — gỡ Donate UI khỏi Header.
  10. Tests — 2 file unit test mới (combo fallback, feature flags).
  11. Docs/manifest — docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md + docs/custom-features.manifest.json.

Verify (cộng dồn 2 đợt)

  • Không có conflict marker.
  • node --check pass toàn bộ file fork + base files bị sửa.
  • node scripts/diepxuan/check-custom-features.mjs 360 PASS / 0 WARN / 0 FAIL.
  • Fork layer convention tuân thủ (file mới vào src/diepxuan/, open-sse/diepxuan/).
  • docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md đã sync với state hiện tại.
  • docs/custom-features.manifest.json đã sync (14 features).
  • npm run build PASS (ngoài sandbox, sau npm install).

Known issues còn lại (theo dõi)

  • Branch name diepxuan không theo convention task/<short-desc> — đề xuất giữ cho đợt này, từ đợt sau áp dụng convention.
  • Test runtime (tests/unit/{combo-immediate-fallback-node.test.mjs,diepxuan-feature-flags.test.js}) chưa chạy được trong sandbox — cần môi trường có vitest cài sẵn.

Reviewer: @diepxuan

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

caothu159 added 11 commits July 22, 2026 01:56
Sandbox chặn DNS fonts.googleapis.com nên `next/font/google` không fetch được
Inter font lúc build. Thêm section 7.1 trong TOOLS.md giải thích root cause và
quy trình escalate ra ngoài sandbox.

Refs: nhật ký memory/2026-07-21.md, memory/2026-07-22.md
… sections

- Section "Features đã xóa": update tham chiếu UPDATE-*.md (đã xóa khỏi
  working tree 2026-07-21, còn trong git history qua `git show`).
- Section 11 (Runtime feature flag): update bảng guard file, bỏ executorHooks
  sau khi xóa dead code, smoke test mở rộng cho context_length + codex
  subagent, giải thích baseUrl.js + EnhancedConsoleLog không cần guard.
- Section 12: verify mới nhất (360 PASS, 14 features, build pass ngoài sandbox).
- Section 17 (NVIDIA NIM executor strip): xóa vì file dead code đã xóa.
- Section 18 (mới): /v1/models context_length enrichment.
…strip

- Thêm feature `auto-context-length`: bảo vệ fork layer contextLength/ + hook
  enrich `context_length` trong /api/v1/models (NVIDIA resolver + static).
- Xóa feature `nvidia-executor-strip`: file open-sse/diepxuan/executorHooks.js
  bị xóa vì là dead code (không ai import/gọi).
- Update feature `fork-branding-header`: bỏ `forbiddenFiles` cho
  DonateModal.js vì upstream v0.5.40 (commit ccb0842) thêm lại file. Fork
  chỉ cần đảm bảo Header.js không import DonateModal/voluteer_activism/Donate.
- Tổng features: 13 -> 14.
…tured)

- open-sse/diepxuan/executorHooks.js (37 dòng): `stripNvidiaUnsupportedParams`
  export nhưng không ai import/call. File dở dang, hook chưa wire vào base
  executor. Nếu sau này cần NVIDIA strip, tạo lại file + wrap với flag.
- src/diepxuan/app/api/console-logs-structured/route.js (159 dòng): API route
  structured log. `EnhancedConsoleLog.jsx` dùng logic parseLogsIntoRequests
  inline, không gọi API này. Route bị bỏ rơi.

Verified: enhanced-console-log feature KHÔNG bị ảnh hưởng (đã grep confirm
trước khi xóa). Build pass ngoài sandbox sau khi xóa.

Refs: docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md §11 ghi chú (ghi lại lý do xóa).
4 file trong open-sse/diepxuan/contextLength/:
- index.js: wrap getContextLength, getContextLengthBatchCached, getStaticContextLength,
  getContextLengthSync. Khi flag false: trả null/empty Map; getStaticContextLength
  vẫn trả giá trị nhưng không ghi DB.
- cache.js: wrap initContextLengthCache, getCachedContextLength,
  upsertContextLength, getCachedContextLengthBatch, clearContextLengthCache.
- modelsApi.js: wrap fetchProviderContextLengths, resolveProviderModelsWithContext.
- errorParser.js: wrap extractContextLengthFromError, updateContextLengthFromError.

Khi DIEPXUAN_ENABLED=false: /v1/models trả response KHÔNG có field context_length,
giống upstream.

Refs: docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md §11 + §18.
`extendCodexSubagentConfig(config)` khi flag false: trả config gốc (không extend
`description`). Codex config KHÔNG có `description` trong [agents.subagent],
giống upstream.

Refs: docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md §11 + §15.
* fix(context-length): import isDiepXuanEnabled in cache.js

upsertContextLength() called isDiepXuanEnabled() without importing it,
throwing 'ReferenceError: isDiepXuanEnabled is not defined' on every
provider model fetch (logged as 'Error fetching models'). Add the same
flags import used by sibling contextLength modules.

* docs(checklist): ghi nhận fix import isDiepXuanEnabled trong contextLength/cache.js

Bổ sung mục 13 (Auto Context Length) và cập nhật bảng mục 11 theo quy tắc
changelog fork: mô tả triệu chứng, nguyên nhân, fix, bài học và verify.

* feat(agnes): add Agnes AI provider (fork-layer registry)

Add Agnes AI (Sapiens AI), an OpenAI-compatible multimodal gateway.
Base URL https://apihub.agnes-ai.com/v1, apikey Bearer auth.

Models verified live via GET /v1/models + real calls (2026-07-23):
- agnes-2.0-flash        text/vision  POST /v1/chat/completions   (200 OK)
- agnes-image-2.0-flash  image        POST /v1/images/generations (200 OK)
- agnes-image-2.1-flash  image        (listed live)
- agnes-1.5-flash        omitted (503 model_not_found)
- agnes-video-v2.0       deferred (async shape needs dedicated executor)

Fork-layer approach (huong 2, AGENTS section 6): provider logic lives in
open-sse/diepxuan/registry/agnes.js; base touched minimally at the two
required merge points:
- registry/index.js: import d1 (dN namespace avoids upstream pN renumber)
- imageProviders/index.js: register agnes OpenAI-compatible image adapter

Add provider icon public/providers/agnes.png (128x128, official logo mark
extracted from platform favicon.ico). Document in CUSTOM-FEATURES-MERGE-CHECKLIST section 19.
Add 5 keys to public/i18n/literals/vi.json:
- Group models under one name...
- Fallback, Round Robin, Fusion, Capacity auto-switch descriptions

Mechanism: runtime i18n (src/i18n/runtime.js) reads vi.json as exact-match
translation map; locale=vi users see translated text, locale=en falls back
to upstream English.

No base file touched (combos/page.js stays untouched); zero merge conflict
risk on upstream rebase.

Verify:
- python3 -m json.tool vi.json: valid JSON
- node scripts/diepxuan/check-custom-features.mjs: 360 PASS / 0 WARN / 0 FAIL
- 5/5 keys match base file text exactly (incl. em-dash)

Docs: docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md §20.
Sếp yêu cầu trực tiếp: 'Round Robin' không dịch thành 'Vòng tròn'
(nghĩa đen, không đúng kỹ thuật). Bản dịch đúng trong ngữ cảnh
load balancing / scheduling là 'Luân phiên' (round-robin scheduling).

Changes:
- public/i18n/literals/vi.json:
  * key 'Round Robin': 'Vòng tròn' -> 'Luân phiên' (fix chuẩn kỹ thuật)
  * long-form key value: dùng 'Luân phiên — xoay vòng model...' thay vì lặp
    'Round Robin — luân phiên model...'
  * +3 keys mới cho STRATEGY_OPTIONS modal:
    - 'Round Robin — rotate' -> 'Luân phiên — xoay vòng'
    - 'Fallback — try in order' -> 'Fallback — thử theo thứ tự'
    - 'Fusion — panel + judge' -> 'Fusion — panel + judge'
- docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md §20: rev 2, bảng quyết định dịch,
  smoke test mở rộng (modal strategy dropdown + ConnectionsCard).

Verify:
- python3 -m json.tool: JSON hợp lệ
- 201 keys, không trùng lặp
- node scripts/diepxuan/check-custom-features.mjs: 360 PASS / 0 WARN / 0 FAIL
- 'Round Robin' key giờ áp dụng cho 2 chỗ (combos bullet + ConnectionsCard)
PR #50: i18n(vi) — dịch phần giải thích Combos sang tiếng Việt (rev 2).
Conflicts resolved:
- docs/CUSTOM-FEATURES-MERGE-CHECKLIST.md: giữ HEAD (ghi chú fix import
  + bug fix section từ §13) + thêm §20 từ PR #50. Không xóa marker
  script rule (line 452 chỉ là docstring về marker, không phải marker).
- open-sse/diepxuan/contextLength/cache.js: giữ HEAD (đã có
  isDiepXuanEnabled import fix từ PR #49). Cả 2 nhánh đều có cùng
  nội dung 178 dòng — chỉ khác conflict marker.

Verify:
- 360 PASS / 0 WARN / 0 FAIL (custom-features check)
- node --check cache.js PASS
- python3 -m json.tool public/i18n/literals/vi.json OK
- 20 sections trong CHECKLIST (giữ §19 Agnes + thêm §20 i18n)
Bring PR #49 fix-import into local diepxuan branch before pushing
the i18n merge (#50). Conflict in CHECKLIST is benign: local already
has §20 i18n after the previous merge of task/i18n-combos-vi, so just
drop markers and keep HEAD content.

Verify (after both merges):
- 360 PASS / 0 WARN / 0 FAIL
- 20 sections in CHECKLIST (§13-§20)
- vi.json 201 keys, JSON valid
@caothu159
caothu159 merged commit 1464cd9 into main Jul 23, 2026
caothu159 added a commit that referenced this pull request Jul 23, 2026
- Record i18n(vi) Combos PR #51 + fork sync PR #46 merged into main.
- Note Round Robin translation fix: 'Vòng tròn' -> 'Luân phiên' (chuẩn kỹ thuật).
- vi.json: 196 -> 201 keys, runtime i18n only, no base file touched.

Refs: AGENTS.md §1 (boot sequence + MEMORY.md reading).
@caothu159
caothu159 deleted the diepxuan branch August 1, 2026 05:53
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.

1 participant