Skip to content

[Bug]: ocx models new-policy / new-arrivals are documented and implemented but unreachable (models.ts dispatch omits them) #3094

Description

@atlastimed

Client or integration

Other

Area

CLI

Summary

ocx models new-policy and ocx models new-arrivals are documented in the docs site and implemented in the CLI's models runtime module, but they are unreachable: handleModels in src/cli/models.ts never routes them to handleModelsRuntimeCommand, so both fall through to handleConfiguredModels and fail with Unexpected argument(s).

Evidence (paths relative to repository root, verified on main at ebb4d55 and on npm 2.38.0):

  • docs-site/src/content/docs/guides/model-routing.md (around lines 88-89) documents: "Use ocx models new-policy off globally, add --provider <name> for an override, and inspect ocx models new-arrivals [--json]."
  • src/cli/models-runtime.ts implements both handlers (newPolicy, newArrivals; dispatch at handleModelsRuntimeCommand) and lists them in its USAGE text.
  • src/cli/models.ts line 448 dispatches only ["live", "edit", "enable", "disable", "provider", "selected", "preset", "context", "shadow"] to the runtime module. new-policy and new-arrivals are absent, so any invocation reaches handleConfiguredModels, which rejects unknown arguments.

The underlying feature works through the management API (GET/PUT /api/model-discovery, POST /api/model-discovery/acknowledge) and the dashboard Models page, so the impact is CLI-only: the documented commands cannot be executed headlessly.

Suggested fix: add "new-policy" and "new-arrivals" to the dispatch array in handleModels (models.ts).

Reproduction

  1. Install 2.38.0 from npm (npm i -g @bitkyc08/opencodex) or build main at ebb4d55.
  2. Run ocx models new-policy status --json.
  3. Run ocx models new-arrivals --json.

Both commands fail with Unexpected argument(s) and exit 1 instead of reaching the implemented runtime handlers. No configuration or provider setup is needed; the failure is in CLI dispatch and reproduces with or without the proxy running.

Version

2.38.0 (npm @bitkyc08/opencodex); also present on main at commit ebb4d55.

Operating system

Windows 11

Provider and model

Not provider-specific.

Logs or error output

> ocx models new-policy status --json
Unexpected argument(s): new-policy, status
Usage: ocx models [--provider <name>] [--json]
(exit 1)

> ocx models new-arrivals --json
Unexpected argument(s): new-arrivals
Usage: ocx models [--provider <name>] [--json]
(exit 1)

Screenshots and supporting files

None.

Redacted configuration

None required.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bugSomething isn't working
    cliCLI, config inject, packaging flags
    proxyHTTP proxy, routing, reverse-proxy / management auth
    on Aug 31, 2026
  2. lidge-jun commented on Aug 31, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 67 / 80

    이 이슈는 문서와 구현이 있는데, CLI 입구가 그 명령을 안 받아 주는 구멍입니다. 지금 dev HEAD는 a0d386b49 입니다. 패키지는 2.39.0입니다.

    라운드2 본선은 아닙니다.

    그래도 문서에 나온 명령이 바로 거절되면, 헤드리스로 새 모델 정책을 못 켭니다. 대시보드와 관리 API는 이미 됩니다. CLI만 막혀 있습니다.

    흐름은 짧습니다. src/cli/models.ts 의 handleModels 가 첫 단어를 보고 갈 곳을 고릅니다.

    add / remove / list-custom 은 커스텀 모델 쪽입니다.

    live, edit, enable, disable, provider, selected, preset, context, shadow 아홉 개는 handleModelsRuntimeCommand 로 넘깁니다.

    그 배열에 new-policy 와 new-arrivals 가 없습니다. 그래서 두 명령은 handleConfiguredModels 로 떨어집니다.

    거기는 제공자 목록을 찍는 자리라서, 모르는 단어가 있으면 Unexpected argument(s) 를 내고 끝냅니다. 작성자가 붙인 로그와 같은 문장입니다.

    실제 동작 코드는 이미 있습니다. src/cli/models-runtime.ts 의 USAGE 27-28줄에 두 명령이 적혀 있습니다.

    handleModelsRuntimeCommand 332-333줄이 newPolicy / newArrivals 로 연결합니다.

    newPolicy 는 GET/PUT /api/model-discovery 를 치고, newArrivals 는 같은 GET에서 recentArrivals 를 보여 줍니다.

    문서 docs-site/src/content/docs/guides/model-routing.md 88-89줄도 두 명령을 안내합니다. 구현과 문서와 입구가 셋인데, 입구만 빼먹은 상태입니다.

    고치는 내용은 디스패치 배열에 문자열 두 개를 넣는 일이 거의 전부입니다.

    재현 명령에는 작은 함정이 있습니다. 이슈 본문은 new-policy 뒤에 status 를 붙였습니다.

    USAGE는 new-policy [on|off] 입니다. 상태를 안 주면 GET으로 지금 값을 보여 줍니다. status 라는 단어는 없습니다.

    디스패치를 고쳐도 new-policy status 는 new policy must be on or off 로 거절됩니다.

    확인용은 인자 없는 new-policy --json 과 new-arrivals --json 입니다. 켜고 끄는 예는 문서대로 new-policy off 입니다.

    테스트가 이 구멍을 못 본 이유도 분명합니다. handleModels 를 부르는 테스트는 커스텀 add/list 쪽입니다.

    new-policy / new-arrivals 디스패치를 잠근 테스트는 없습니다. 입구 배열이 빠져 있으면 핸들러로 한 번도 안 갑니다.

    고칠 때 그 배열을 잠그는 테스트가 같이 와야 같은 실수가 다시 안 납니다. types.ts/config.ts 분할과 무관합니다. 같은 주제의 열린 PR은 지금 목록에 없습니다.

    라인 448 (src/cli/models.ts handleModels 디스패치 배열) - new-policy 와 new-arrivals 가 없습니다. 그래서 구현된 핸들러에 도달하지 못하고 handleConfiguredModels 의 382줄 Unexpected argument(s) 로 떨어집니다.

    라인 332-333 (src/cli/models-runtime.ts handleModelsRuntimeCommand) - 핸들러는 이미 있습니다. 입구만 열리면 됩니다. 여기 로직을 다시 쓸 필요는 없습니다.
    라인 236 (src/cli/models-runtime.ts newPolicy) - 첫 단어가 on/off가 아니면 거절합니다. 이슈의 new-policy status 는 디스패치 수정 뒤에도 여기 걸립니다.
    경로 tests/ - handleModels 가 두 단어를 런타임으로 넘기는지 잠근 테스트가 없습니다. 배열에서 두 단어를 빼면 지금처럼 조용히 다시 깨집니다.
    경로 docs-site/src/content/docs/guides/model-routing.md 88-89 - 문서가 안내하는 명령이 지금 트리에서 실행되지 않습니다. 고친 뒤에는 로케일 페이지도 같은 문장인지 한 번 보면 됩니다.

    메인테이너의 판단이 필요한 지점

    • 지금 바로 두 문자열만 넣고 랜딩할지, 디스패치 가드 테스트를 같은 PR에 묶을지
    • new-policy status 별칭을 추가할지, USAGE대로 인자 없음=조회만 유지할지
    • 이 구멍을 라운드2 본선과 별개의 작은 CLI PR로 받을지

    너의 추천
    받습니다. src/cli/models.ts 448줄 배열에 new-policy 와 new-arrivals 를 넣고, 그 두 단어가 런타임 핸들러로 가는 테스트를 같이 넣으세요.

    status 별칭은 넣지 마세요. 조회는 인자 없는 new-policy 가 이미 있습니다. 관리 API와 GUI는 건드리지 않습니다. types/config 분할 무관, 중복 닫기 불필요. 라벨은 바꾸지 않습니다.

    이 댓글은 grok-bot이 작성했습니다

  3. atlastimed commented on Aug 31, 2026

    @atlastimed
    Author

    Thanks for the detailed review — analysis matches, and good catch on the repro nuance.

    Correcting for anyone following along: new-policy takes no subcommand word. The valid verification commands after the dispatch fix are:

    • ocx models new-policy --json (no argument = GET current policy)
    • ocx models new-arrivals --json
    • ocx models new-policy off [--provider <name>] to mutate

    new-policy status in my original repro was wrong usage and would be rejected by the handler even after the fix ("new policy must be on or off") — the underlying dispatch failure stands regardless, since both commands never reach the handler today.

    Agreed with the recommendation: add the two strings to the dispatch array plus a test locking the routing, no status alias, no management-API/GUI changes.

  4. added a commit that references this issue on Sep 1, 2026
    e92aa33
  5. lidge-jun commented on Sep 1, 2026

    @lidge-jun
    Owner

    Fixed by #3171, landed on dev as e92aa33.

    Root cause was duplication rather than a missing name: handleModelsRuntimeCommand and handleModels each carried their own list of runtime subcommands, and only the first was updated when these two were added. The fix moves the set into a leaf module both sides consult, so a future runtime subcommand cannot be implemented without also being routed. tests/cli-models-runtime-dispatch.test.ts parses the runtime module's own USAGE and fails if the two ever drift again.

    Closing manually because pull requests target dev rather than the default branch.

  6. github-actions commented on Sep 1, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  7. added a commit that references this issue on Sep 14, 2026
    e66358c
  8. added a commit that references this issue on Sep 17, 2026
    36da7fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliCLI, config inject, packaging flagsproxyHTTP proxy, routing, reverse-proxy / management auth

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions