Commit Graph
729 Commits
Author SHA1 Message Date
Tam Nhu Tran 40512fe338 fix(codex): stabilize code review window labeling 2026-02-14 06:28:48 +07:00
Tam Nhu Tran b3d9dce6e1 fix(codex): reduce quota timeout flakes in dashboard 2026-02-14 06:23:31 +07:00
Tam Nhu Tran 1d2ee827fe fix(codex): infer code review cadence from reset window 2026-02-14 06:09:36 +07:00
Tam Nhu Tran f8af5a8c3c fix(codex): align quota display to 5h and weekly windows 2026-02-14 05:57:06 +07:00
Tam Nhu Tran 6c2083949f fix(cliproxy): mark Kiro as device_code flow for dashboard auth
CLIProxyAPIPlus uses device code flow for Kiro authentication, returning
{method: "device_code", state, status} without an immediate URL. The URL
is provided via polling the /get-auth-status endpoint.

Previously, Kiro was configured as authorization_code flow, causing
dashboard auth to fail with "No authorization URL received from CLIProxyAPI"
because the web-server routes expected synchronous URL response.

Changes:
- provider-capabilities.ts: kiro.oauthFlow = 'device_code', callbackPort = null
- provider-config.ts: Add 'kiro' to DEVICE_CODE_PROVIDERS array
- provider-capabilities.test.ts: Update test expectations

This routes Kiro through /start endpoint which properly handles device code
flow via WebSocket events (deviceCodeReceived, deviceCodeCompleted, etc).

Closes #552
2026-02-13 19:33:33 +07:00
Tam Nhu Tran bdec15f2fd chore(merge): resolve dev conflicts for pr 537
- merge latest origin/dev into feat/506-composite-provider-variant

- keep path-stable test assertions for update-checker and GLMT debug logs
2026-02-13 08:36:10 +07:00
Tam Nhu Tran 7bb9ceb4af fix(cliproxy): keep variant updates atomic and persisted
- require model when changing single-variant provider to avoid mixed config

- rewrite provider-specific core env when provider changes while preserving custom fields

- preserve custom composite settings path and return persisted composite PUT state
2026-02-13 06:19:12 +07:00
Tam Nhu Tran 1a23f912a4 fix(cliproxy): harden composite validation and runtime safeguards 2026-02-13 05:34:30 +07:00
Tam Nhu Tran 36a67c4837 fix(cursor): close ReadableStream controller on abort to prevent consumer hangs
When abort fires after streaming begins, onAbort closed HTTP/2 handles
but never closed the ReadableStream controller. Consumers waiting on
reader.read() could hang indefinitely since end/error handlers were
gated by streamClosed flag.

Hoist controller reference to outer scope so abort handler can close it.
2026-02-13 05:33:56 +07:00
Tam Nhu Tran 27badb2584 fix(cursor): validate fetch status before streaming fallback and register abort early
- Check response.status before calling transformProtobufToSSE in fetch fallback
- Move abort signal registration before response headers to handle early cancellation
2026-02-13 04:21:13 +07:00
Tam Nhu Tran 4e5b502fc9 feat(cursor): namespace FIELD constants and implement true streaming SSE (#531, #535) 2026-02-13 04:12:29 +07:00
Tam Nhu Tran 2816c6652d chore(merge): resolve conflicts with origin/dev 2026-02-12 16:25:25 +07:00
Kai (Tam Nhu) TranandGitHub a2520d2ed8 Merge pull request #543 from kaitranntt/kai/feat/538-stream-d-hardening
chore(hardening): add debt inventory and async I/O kickoff (stream D)
2026-02-12 16:21:18 +07:00
Kai (Tam Nhu) TranandGitHub db94e7223a Merge pull request #544 from kaitranntt/kai/feat/538-stream-c-provider-cliproxy-web
refactor(cliproxy): centralize provider capability registry (stream C)
2026-02-12 16:21:05 +07:00
Tam Nhu Tran ae83be1590 fix(format): align image analysis check with pinned prettier 2026-02-12 15:22:37 +07:00
Tam Nhu Tran 9585f0664d chore(format): apply prettier fixes for validate gate 2026-02-12 15:20:09 +07:00
Tam Nhu Tran 0a8adb22fc fix(cliproxy): harden composite variant routing and validation 2026-02-12 15:18:33 +07:00
Tam Nhu Tran b98335c162 fix(commands): await async command validation 2026-02-12 14:18:48 +07:00
Tam Nhu Tran e914fe9778 fix(cliproxy): fix thinking off regression and composite error handling
- P1: Thinking "off" now fully disables all tier thinking
  When thinkingValue === 'off' AND no per-tier config, return early
  Preserves behavior for "off" with per-tier config (skips main, processes tiers)
  Fixes regression where tier defaults were applied despite explicit off setting

- P2: Handle composite-create thrown errors in POST route
  Wrap createCompositeVariant() in try/catch
  Returns 400 instead of generic 500 when function throws (e.g., legacy mode)
2026-02-12 13:34:17 +07:00
Tam Nhu Tran 924e3686c8 refactor(cliproxy): centralize provider capability registry 2026-02-12 12:59:17 +07:00
Tam Nhu Tran fc4b77bc52 refactor(commands): add command contract and migrate shell completion 2026-02-12 12:59:17 +07:00
Tam Nhu Tran cefb564948 chore(hardening): add debt inventory and async io kickoff 2026-02-12 12:57:46 +07:00
Tam Nhu Tran 8e6b67bf99 fix(cliproxy): fix edit dialog empty model and composite guidance
- P2: Edit dialog no longer seeds empty model string
  Changed `variant.model || ''` to `variant.model ?? undefined`
  Added payload filtering to exclude undefined/empty values before API call
  Prevents unintended model overwrites when user only changes other fields

- P3: Composite --config guidance now uses variant name
  Added profileName to ExecutorConfig interface
  Error message now shows correct variant name instead of default tier provider
  e.g., "ccs cliproxy edit my-mix" instead of "ccs cliproxy edit gemini"
2026-02-12 12:56:57 +07:00
Tam Nhu Tran 399d7e163a fix(cliproxy): address 3 code review issues in composite variants
- P1: Remove premature variant deletion in --force mode
  Fix destructive overwrite path - old variant preserved if user
  cancels auth or creation fails (createVariant handles overwrite)

- P2: Validate all composite tier providers at runtime
  Backend gating now checks all providers in composite, not just
  default tier. Prevents kiro/ghcp on non-default tiers bypassing
  Plus backend requirement.

- P2: Preserve tier thinking when default tier is off
  Early return skipped tier processing when default thinking was
  "off". Now uses flag-based approach - only main model skipped,
  tier loop continues with per-tier thinking config.
2026-02-12 12:29:43 +07:00
Tam Nhu Tran 27d22e836f fix(cliproxy): address 4 functional regressions in composite variants
- P1: Remote composite env now uses remote endpoint/auth
  Add CompositeRemoteConfig parameter to getCompositeEnvVars()
  Pass remote config when useRemoteProxy is true

- P2: Tier thinking uses tier-specific provider
  Extract tier provider from compositeTiers for supportsThinking()
  Fix mixed-provider composite thinking config

- P2: Force variant removal checks result
  Fail fast if removeVariant fails in --force mode

- P2: Guard composite validation against missing tiers
  Add null check before Object.entries(variant.tiers)
2026-02-12 12:08:20 +07:00
Tam Nhu Tran a99180fa22 fix(cliproxy): restore POST tier validation and guard null payloads
- Add requireAllTiers parameter to validateCompositeTiers (default false)
- POST/create passes true to enforce all 3 tiers required
- PUT/update passes false (default) to allow partial updates
- Guard against null tier values that would throw at runtime
2026-02-12 11:45:20 +07:00
Tam Nhu Tran 4b7de69d9b fix(config): serialize cursor section in generateYamlWithComments
- Add cursor section serialization after copilot, before global_env
- Fixes P1 data loss: cursor settings now persist to config.yaml
- Previously cursor was merged in memory but never written to disk
2026-02-12 11:35:39 +07:00
Tam Nhu Tran 61f46e738d fix(cliproxy): address 3 functional regressions in composite variants
P1 (Critical): Remote composite execution now correctly uses remote endpoint
- Reorder condition to check useRemoteProxy before isComposite
- Composite variants now work with remote CLIProxy instances

P2a (Medium): Tier deep-merge preserves optional fields during updates
- Use spread merge instead of ?? to preserve fallback/thinking/account

P2b (Medium): API accepts partial tier updates in PUT endpoint
- Skip validation for tiers not present in request
- Aligns with updateCompositeVariant's merge behavior
2026-02-12 11:22:43 +07:00
Tam Nhu Tran c35de7ec9a test(cliproxy): add thinking suffix test and document exit 0 behavior
- Add test case for comma-separated thinking params (32768,extended)
- Add clarifying comment to isProviderError() about exit 0 handling
2026-02-12 11:04:37 +07:00
Tam Nhu Tran ef77607c41 fix(cliproxy): add circular fallback and empty model validation in API
- Validate fallback doesn't point to same provider+model (circular)
- Reject empty/whitespace model strings in composite tiers
- Add TODO comment for concurrent modification race condition
2026-02-12 11:02:11 +07:00
Tam Nhu Tran 74868972dd fix(cliproxy): add session check on delete and atomic settings writes
- Block variant deletion when CLIProxy has active sessions
- Use temp file + rename pattern for atomic settings writes
- Prevents partial writes on crash/interruption
2026-02-12 11:01:49 +07:00
Tam Nhu Tran 6ff17d8480 fix(cliproxy): improve multi-provider auth with continue-on-error pattern
- Continue to remaining providers on auth failure instead of throwing
- Aggregate failures and show summary of succeeded/failed providers
- Improves UX when one provider fails in composite variant
2026-02-12 11:01:27 +07:00
Tam Nhu Tran 1d8d3d7671 chore: sync with dev after PR #527 merge 2026-02-12 11:01:10 +07:00
Tam Nhu Tran 0c7dc398f7 fix(cliproxy): add defensive null checks for composite tier config
- Add optional chaining for tier access in env-resolver
- Throw error if default tier model missing in env-builder
- Add null checks for composite.tiers in profile-detector
2026-02-12 11:01:00 +07:00
Tam Nhu Tran 4c002caee1 fix(cliproxy): address code review feedback (attempt 4/5)
- Add default_tier and provider validation in POST/PUT routes
- Extract shared validateCompositeTiers() helper for DRY
- Validate providers against CLIPROXY_SUPPORTED_PROVIDERS
2026-02-12 08:46:38 +07:00
Tam Nhu Tran 6cfbdd649b fix(cliproxy): address code review feedback (attempt 3/5)
- Allow partial composite updates in PUT endpoint (|| -> &&)
- Map service validation errors to 400 status, not 404
- Widen 4xx regex to cover full 400-499 range
2026-02-12 08:39:46 +07:00
Tam Nhu Tran bfc9361701 fix(cursor): fix router fall-through, add daemon marker, use random test port
- Route all `ccs cursor *` to handleCursorCommand (no profile-switching)
- Add --ccs-daemon marker to spawned process for stable PID validation
- Use random port in lifecycle integration test to prevent CI conflicts
- Remove unnecessary .toFixed(1) on integer tokenAge
2026-02-12 08:37:01 +07:00
Tam Nhu Tran 760a5c3ca4 fix(cursor): harden stopDaemon PID validation, tighten regex, add lifecycle test
- Validate PID belongs to cursor daemon via /proc before signaling
- Tighten detectProvider regex to avoid over-matching o-prefixed models
- Add integration test for daemon start→health→stop lifecycle
- Add void cast on discarded handleHelp() return value
- Update model catalog date comment
2026-02-12 08:28:32 +07:00
Tam Nhu Tran ac574e0baf fix(cliproxy): address code review feedback (attempt 2/5)
- Add tiers shape validation in variant-routes POST/PUT endpoints
- Use process.exit(1) for blocked --config on composite variants
2026-02-12 08:26:03 +07:00
Tam Nhu Tran 934238740e fix(cursor): export missing symbols, eliminate subcommand sync risk, improve tests
- Export detectProvider and formatModelName from barrel index
- Export CURSOR_SUBCOMMANDS from cursor-command.ts, import in ccs.ts
- Use getCcsDir() in tests instead of manual path construction
- Add handleCursorCommand routing test for unknown subcommand
2026-02-12 08:21:39 +07:00
Tam Nhu Tran 854b198b64 fix(cliproxy): address code review feedback (attempt 1/5)
- Add composite fields to UpdateVariant type (default_tier, tiers)
- Handle forceAuth (--auth) for composite multi-provider variants
2026-02-12 08:15:27 +07:00
Tam Nhu Tran cda037e7e5 fix(cursor): clean up PID file on startDaemon failure and improve daemon robustness
- Add removePidFile() in safeResolve on failure to prevent stale PIDs
- Only send SIGKILL in stopDaemon if SIGTERM wait loop exhausted
- Check isDaemonRunning before model fetch to avoid 5s timeout
- Add port validation unit tests for startDaemon
2026-02-12 08:11:41 +07:00
Tam Nhu Tran d7e0d1cacf fix(cursor): pass all args to handler, use getCursorConfig in routes
- Route all cursor args to handler for proper unknown-subcommand reporting
- Replace loadOrCreateUnifiedConfig + fallback with getCursorConfig()
2026-02-12 08:04:42 +07:00
Tam Nhu Tran 887efa4069 fix(cursor): show auto-detect error message, add subcommand sync comment 2026-02-12 07:59:39 +07:00
Tam Nhu Tran f9834c81c9 fix(cursor): add enabled field to tests, simplify cursor routing
- Add missing enabled field to CursorConfig in test assertions
- Consolidate duplicate dynamic import in ccs.ts cursor routing
2026-02-12 07:55:35 +07:00
Tam Nhu Tran ce1915366d fix(cursor): use stdio ignore, sequential polling, move CursorConfig to types
- Change spawn stdio from piped to 'ignore' preventing buffer deadlock
- Replace setInterval with sequential setTimeout polling
- Fix TOCTOU in SIGKILL escalation (send directly without probing)
- Move CursorConfig interface to types.ts
- Change detectProvider default from 'openai' to 'unknown'
- Remove redundant removePidFile() when PID is null
2026-02-12 07:51:22 +07:00
Tam Nhu Tran 6af718626f fix(cursor): align daemon routes, add enabled field, handle bare command
- Change /start and /stop to /daemon/start and /daemon/stop matching copilot convention
- Add enabled field to CursorConfig for dashboard toggle parity
- Simplify getCursorConfig() to trust mergeWithDefaults()
- Handle bare 'ccs cursor' to show help instead of reserved-name error
2026-02-12 07:43:27 +07:00
Tam Nhu Tran efd3f21e29 fix(cliproxy): strip thinking suffix in detectFailedTier matching
Model names with thinking suffixes like "model(high)" now match stderr
that contains the base model name without the suffix.
2026-02-12 07:40:15 +07:00
Tam Nhu Tran 94789676b9 fix(cursor): use process.execPath and add safeResolve to model fetcher
- Replace 'node' with process.execPath for cross-platform reliability
- Add safeResolve guard in fetchModelsFromDaemon matching startDaemon pattern
2026-02-12 07:37:20 +07:00
Tam Nhu Tran 2ba826bb72 fix(cursor): use getCursorConfig(), fix help text and stub messages 2026-02-12 07:31:02 +07:00