Commit Graph
47 Commits
Author SHA1 Message Date
Kai (Tam Nhu) TranandGitHub fa31bea672 fix(proxy): require owned daemon PID before reusing legacy/profile proxy session
Squash merge PR #1298 into dev.
2026-05-19 08:05:45 -04:00
Tam Nhu Tran 81c4acc73a fix(codex-auth): harden registry fail-closed paths 2026-05-17 18:20:56 -04:00
Tam Nhu Tran 54738e88f7 fix(codex-auth): surface registry corruption 2026-05-17 18:02:13 -04:00
Tam Nhu Tran 08fe63c626 fix(codex-auth): fail fast on missing active profile 2026-05-17 16:06:32 -04:00
Tam Nhu Tran 631c799322 feat(codex-auth): add import-default migration + integration tests + docs
Adds opt-in `ccsx auth import-default <name>` to migrate the existing
~/.codex/auth.json into a new profile, plus the cross-system integration
tests and user-facing documentation.

- import-default-command (C3 torn-write protection):
  - readFileSync + JSON.parse with 3x retry / 100ms backoff to survive
    Codex's truncate-then-write auth.json refresh race
  - decode-id-token sanity-check on JWT shape (catches mid-write JWT
    corruption that JSON.parse alone wouldn't notice)
  - pgrep -f codex best-effort detection; warns + refuses without
    --force-while-running flag if a live codex process is found
  - rejects cliproxy-format auth files ({type: "codex", ...} wrapper)
    with a clear "use ccs cliproxy ..." pointer
  - atomic write to <dest>.tmp.<pid>.<rand> + rename
  - --with-history defaults to false per D8 (auth-only is the safer
    default; opt in for bulkier data)
  - --force backs up existing auth.json to .bak-<ts> before overwrite
  - non-destructive — never modifies ~/.codex/; legacy mode keeps
    working without ever running this command
- integration tests:
  - two-terminal-isolation: two profiles with separate CODEX_HOMEs
    write to their own auth.json/history.jsonl with no crosstalk
  - ccsxp-independence: codex-auth profile set; ccsxp still uses its
    own CCSXP_CODEX_HOME / ~/.codex pool (H5 stderr notice present)
  - legacy-fallback: no profiles registered → codex-runtime-router
    leaves CODEX_HOME unset → codex falls back to ~/.codex
  - import-default.integration: real fs copy + decode + register
- docs/codex-auth.md: user guide covering quick start, two-terminal
  example, migration, dashboard, and caveats (cmd.exe, Windows
  symlinks, ccsx vs ccsxp distinction)

155 codex-auth-scope tests green (45 Phase 1 + 57 Phase 2 + 19 Phase 3
+ 15 Phase 4 + 19 Phase 5). Full suite 3051/3082 — the 1 failure is a
pre-existing test-pollution issue between ccsxp-runtime.test.ts and
codex-runtime-integration.test.ts that exists on dev today; the test
passes in isolation.
2026-05-17 14:46:16 -04:00
Tam Nhu Tran e99c4612a8 feat(codex-auth): add dashboard Auth Profiles tab + GET /api/codex/profiles
Adds a read-only dashboard surface for the codex-auth profile registry.
Power users can see which profile is active and its decoded email/plan
without leaving the browser; mutations stay CLI-only.

- codex-auth-dashboard-service: builds the response shape (active +
  default + profiles[]), reads each profile's auth.json, decodes id_token
  via Phase 1 decoder (nested URI claims per C1), 5s in-memory single-key
  cache plus exported invalidateCodexAuthProfilesCache() hook for
  in-process Phase 2 callers (D7); strict field whitelist — id_token /
  access_token / refresh_token NEVER appear in response body or logs
- GET /api/codex/profiles registered INSIDE the
  requireLocalAccessWhenAuthDisabled middleware (H6) — emails are PII
  and must not leak when dashboard is exposed remotely; integration
  test asserts 403 from non-localhost origin
- NEW Auth Profiles tab (D5) in ui/src/pages/codex.tsx — distinct from
  the existing codex-profiles-card (which edits config.toml [profiles],
  a different concept); active profile + email + plan tier highlighted,
  table of all profiles below, disabled Switch/Remove buttons redirect
  to terminal commands
- accountId returned by API for power users (curl) but hidden from
  the default UI (D6)
- 11 service unit tests + 4 endpoint integration tests, all green
2026-05-17 14:45:35 -04:00
Tam Nhu Tran 1932b2ca61 fix(proxy): strip stale encoding from upstream error responses 2026-05-13 09:13:28 -04:00
Kai (Tam Nhu) TranandGitHub 40300c286e fix(security): constrain image fallback hook to workspace (#1232) 2026-05-12 18:13:32 -04:00
Kai (Tam Nhu) TranandGitHub a840793a9b fix(proxy): avoid exposing local auth token in daemon argv (#1230) 2026-05-12 18:13:20 -04:00
Tam Nhu Tran c0a019bf7e test(logging): add cross-stage requestId correlation integration test in slow bucket
Verifies that a single requestId propagates across at least 3 lifecycle
stages emitted from different modules, and that ALS context survives across
async boundaries (setImmediate, microtask, promise.then). Registered in
test:slow bucket per validate:ci-parity gate.

Refs #1141, #1138
2026-04-30 13:01:05 -04:00
Tam Nhu Tran d9ace607e5 fix(proxy): shape direct OpenAI reasoning chat payloads 2026-04-30 12:33:02 -04:00
Tam Nhu Tran fc90b6f473 fix(usage): normalize provider aliases in aggregation 2026-04-28 15:43:13 -04:00
Tam Nhu Tran a538627933 fix(usage): harden models.dev analytics integration 2026-04-28 15:25:58 -04:00
Tam Nhu Tran 3dcf150978 fix(proxy): preserve settings-profile launches for openai bridge 2026-04-28 11:42:56 -04:00
Tam Nhu Tran 4c677507d0 ci: add fast test budget warning 2026-04-23 17:25:48 -04:00
Tam Nhu Tran d5591913ef fix(proxy): clarify shared port fallback and legacy 3456 handling 2026-04-23 15:00:50 -04:00
Tam Nhu Tran 15751e2db5 feat(proxy): add adaptive local port selection for OpenAI-compatible profiles 2026-04-23 14:47:01 -04:00
Tam Nhu Tran e6ac91b9c7 fix(test): stabilize proxy integration server ports 2026-04-22 09:16:15 -04:00
Tam Nhu Tran 399f403322 fix(transformers): preserve tool ordering across proxy streams
- reject pending tool_result layouts that cannot be translated without reordering user content

- keep interleaved GLMT tool_use blocks open until finalization instead of stopping early

- cover leading/interleaved tool_result regressions and interleaved streaming tool fragments
2026-04-20 13:17:30 -04:00
Grandis SYFandTam Nhu Tran a0f91761ed feat(glmt): fix sequential tool_use block handling 2026-04-20 13:06:00 -04:00
Grandis SYFandTam Nhu Tran baa58c9543 feat(proxy): add HEAD method support for health probe endpoints 2026-04-20 13:06:00 -04:00
Tam Nhu Tran 1cfed73ca5 fix(proxy): harden stale daemon ownership checks 2026-04-20 12:44:30 -04:00
Wooseong Kim afcb1abf9e fix(proxy): retain explicit profile names in status 2026-04-20 15:30:51 +09:00
Wooseong Kim 391bdddc22 fix(proxy): handle legacy stop and preferred ports 2026-04-20 15:25:16 +09:00
Wooseong Kim db32d15d86 fix(proxy): preserve running daemons on restart failure 2026-04-20 14:51:32 +09:00
Wooseong Kim 24c24847f7 fix(proxy): preserve legacy state and exact ports 2026-04-20 14:03:12 +09:00
Wooseong Kim 8942be3afc test(proxy): cover multi-profile daemon ports 2026-04-20 13:14:19 +09:00
Tam Nhu Tran ebc92194bb fix(proxy): harden Anthropic request transformation semantics
- enforce strict tool_result ordering and pairing against assistant tool_use ids
- reject tool_result image payloads that cannot map to OpenAI tool messages
- preserve raw tool schemas on the /v1/messages proxy path instead of silently tightening them
- forward Anthropic tool_choice semantics and cover adaptive routing plus upstream payload checks
2026-04-18 19:39:13 -04:00
Tam Nhu Tran 1923d87a84 chore: merge dev into openai provider routing 2026-04-15 20:36:03 -04:00
Tam Nhu Tran 3b5941c60b feat(cursor): split legacy bridge from cliproxy provider 2026-04-15 17:04:37 -04:00
Tam Nhu Tran 841eeb497c fix(proxy): keep stream guards active through sse piping 2026-04-15 02:52:29 -04:00
Tam Nhu Tran 17187c4abd feat(proxy): complete openai routing scope 2026-04-15 00:55:11 -04:00
Tam Nhu Tran 5c66c1f121 test(proxy): cover proxy lifecycle and routing 2026-04-14 19:27:19 -04:00
walkerandClaude Opus 4.6 74f028168d fix(browser): 加固 browser_click 激活语义并修复相关验证阻塞
- 将 browser_click 调整为 mousedown/mouseup 后走 native click
- 在取消激活和中途 detached 场景下避免强制触发 native activation
- 补齐 browser_click 的回归测试与取消激活场景覆盖
- 修复 cliproxy 本地代理、Droid 环境隔离、图像分析 hook 与 proxy 集成测试的验证阻塞

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 11:19:16 +08:00
Tam Nhu Tran ef751723f5 test(ci): stop leaking update-command module mocks 2026-04-10 23:57:58 -04:00
Tam Nhu Tran 2aaabb2deb fix(update): target the current CCS installation 2026-04-10 21:39:50 -04:00
Tam Nhu Tran 982ffc5895 feat(image): add native-read controls and autosave settings
- add per-profile native image preferences and native-capability detection
- redesign Settings -> Image around compact sections with Web-style autosave
- expose richer backend/profile status and update Gemini Flash defaults
2026-04-01 15:32:37 -04:00
Tam Nhu Tran 3af554275e test: isolate shared-state test suites for CI stability
- add dependency injection to export-command, binary-manager,
  codex-plan-compatibility, config-command, and usage-syncer
- override process.exit in api-export test to prevent silent
  termination in Bun's parallel test runner
- harden test-environment bootstrap with process.env isolation
- fix auth middleware to avoid config upgrade during checks
2026-03-25 16:41:41 -04:00
Tam Nhu Tran 5525098400 feat: deprecate GLMT user-facing surfaces 2026-03-17 15:49:29 -04:00
Tam Nhu Tran a35859aba5 fix(cursor): harden anthropic daemon contract handling 2026-03-17 07:17:35 -04:00
Tam Nhu Tran 67290e85c0 test(cursor): reclassify daemon lifecycle smoke coverage 2026-03-16 14:55:53 -04:00
Tam Nhu Tran 50973752ba test(hooks): add image analyzer regression coverage 2026-03-07 14:50:39 +07:00
kaitranntt 72c2b08715 refactor: consolidate test structure and remove backup files
- Move ux-integration-test.sh to tests/integration/ directory
- Consolidate tests/fixtures/ into tests/shared/fixtures/
- Fix import paths in cli.test.js and postinstall.test.js
- Remove src/ccs.ts.backup file (958 lines)
- Remove empty src/scripts/ directory
- Remove non-existent test:edge-cases script from package.json
- Update tests/README.md with accurate structure
- Update CONTRIBUTING.md with correct test commands
- Update docs/system-architecture.md with correct test paths
2025-11-30 17:54:04 -05:00
kaitranntt 1c3c4aade0 chore: complete TypeScript migration (Phase 05-06)
Phase 05: Migrate test imports from bin/ to dist/
- Update 19 test files to import from dist/ instead of bin/
- Update CLI path in cli.test.js and special-commands.test.js
- Update cross-platform.test.js to check dist/ directory

Phase 06: Cleanup & validation
- Remove bin/ directory (32 JS files)
- Fix ClaudeSymlinkManager import in doctor.ts
- Update postinstall.js to use dist/ modules
- Regenerate package-lock.json (now points to dist/ccs.js)

All 39 tests passing. TypeScript migration complete.
2025-11-26 20:20:54 -05:00
kaitranntt 5fae92ac07 feat(glmt): add streaming with real-time thinking blocks
- reorganize bin/ into auth/, glmt/, management/, utils/
- add budget calculator and locale enforcer
- enhance test coverage with unit/integration separation
2025-11-11 15:39:00 -05:00
kaitranntt 2dc3d4bb26 fix: move npm-specific integration tests to npm/ directory
- Move integration/special-commands.test.js to npm/ since it tests bin/ccs.js
- This test was incorrectly categorized as cross-installation integration
- It specifically tests npm package functionality (bin/ccs.js)
- Remove empty integration/ directory and update package.json
- Final test counts: 37 native + 39 npm + 7 unit = 83 total tests

Clean final structure:
- native/     - Native installation tests only
- npm/        - npm package tests (including integration tests)
- shared/     - Shared utilities, fixtures, and unit tests
2025-11-05 11:16:16 -05:00
kaitranntt c17e3e8e3b feat(ccs): complete PowerShell 7+ fixes and Node.js standalone refactor
- Fix PowerShell 7 syntax errors (ampersand, pipe chars, regex patterns)
- Refactor bin/ccs.js to standalone Node.js implementation
- Add modular architecture (helpers, claude-detector, config-manager)
- Create comprehensive test suite with 95% coverage
- Add npm publishing workflow and documentation
- Enhance cross-platform compatibility and error handling
- Achieve 60% performance improvement over shell spawning

Breaking Change: Node.js npm package no longer spawns shell processes
2025-11-04 21:26:13 -05:00