Skip to content

refactor: centralize DEFAULT_MODEL constant, fix remaining kimi-k2.5-free references (#208)#210

Merged
konard merged 4 commits intomainfrom
issue-208-db6310ccb7a1
Mar 4, 2026
Merged

refactor: centralize DEFAULT_MODEL constant, fix remaining kimi-k2.5-free references (#208)#210
konard merged 4 commits intomainfrom
issue-208-db6310ccb7a1

Conversation

@konard
Copy link
Contributor

@konard konard commented Mar 4, 2026

Summary

  • Root cause (primary): hive-mind's agent.lib.mjs passes agentArgs as a single template-interpolated string (e.g., --model opencode/minimax-m2.5-free --verbose) to command-stream's $ tag. The command-stream quote() function wraps this space-containing string in single quotes, making the agent receive it as one argument — so yargs and getModelFromProcessArgv() never see --model as a separate flag, and the agent falls back to the yargs default.
  • Root cause (secondary): The yargs default in index.js was still opencode/kimi-k2.5-free, so the fallback was wrong.
  • Fix (Phase 2): Updated yargs default in index.js from kimi-k2.5-free to minimax-m2.5-free.
  • Fix (Phase 3): Centralized the default model as DEFAULT_MODEL constant in js/src/cli/defaults.ts — all places that reference the default now import from this single source.

Changes

  • js/src/cli/defaults.tsNew file: exports DEFAULT_MODEL = 'opencode/minimax-m2.5-free', DEFAULT_PROVIDER_ID, and DEFAULT_MODEL_ID constants as the single source of truth
  • js/src/index.js — Updated --model yargs default from opencode/kimi-k2.5-free to DEFAULT_MODEL (via import from defaults.ts)
  • js/src/cli/model-config.js — Updated --use-existing-claude-oauth default-model check and error messages to use DEFAULT_PROVIDER_ID/DEFAULT_MODEL_ID (via import from defaults.ts); previously referenced kimi-k2.5-free
  • js/src/tool/task.ts — Updated fallback model for sub-agent tasks to use DEFAULT_PROVIDER_ID/DEFAULT_MODEL_ID (via import from defaults.ts); previously referenced minimax-m2.5-free as a literal
  • js/tests/models-cache.test.js — Fixed echo provider test to explicitly pass --model link-assistant/echo
  • docs/case-studies/issue-208/ — Added second failing run analysis with correct root cause (command-stream quoting bug), Phase 2/3 documentation, and the second log file

Test plan

  • npm run check (eslint + prettier) passes
  • bun test tests/models-cache.test.js — 5 pass, 0 fail
  • bun test tests/model-fallback.test.ts tests/model-not-supported.test.ts tests/output-response-model.test.js tests/model-validation.test.ts tests/models-cache.test.js — 41 pass, 0 fail

Fixes #208

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #208
@konard konard self-assigned this Mar 4, 2026
)

The yargs CLI default in `js/src/index.js` still referenced
`opencode/kimi-k2.5-free` (discontinued model). When the yargs caching
bug (#192) caused the `--model` CLI argument to be silently dropped,
`argv.model` fell back to the stale default and the agent immediately
failed with HTTP 401 "Model kimi-k2.5-free not supported".

Also update the `--use-existing-claude-oauth` default-model check in
`js/src/cli/model-config.js` from `kimi-k2.5-free` to `minimax-m2.5-free`,
and fix the echo provider test to explicitly request `link-assistant/echo`
instead of relying on the unavailable-model fallback behavior.

- js/src/index.js: update --model yargs default to opencode/minimax-m2.5-free
- js/src/cli/model-config.js: update oauth default-model check and comments
- js/tests/models-cache.test.js: explicitly pass --model link-assistant/echo
- docs/case-studies/issue-208/: add second failing run analysis and log

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Agent CLI was not able to finish its work fix: update default model from kimi-k2.5-free to minimax-m2.5-free (#208) Mar 4, 2026
@konard konard marked this pull request as ready for review March 4, 2026 11:59
@konard
Copy link
Contributor Author

konard commented Mar 4, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $2.898786
  • Calculated by Anthropic: $4.761121 USD
  • Difference: $1.862335 (+64.25%)
    📎 Log file uploaded as Gist (5095KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 4, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit them.

Uncommitted files:

?? gist-log.txt

Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback.

…free refs (#208)

- Add `js/src/cli/defaults.ts` with `DEFAULT_MODEL`, `DEFAULT_PROVIDER_ID`,
  and `DEFAULT_MODEL_ID` constants as single source of truth
- Update `js/src/index.js` to use `DEFAULT_MODEL` constant for yargs default
- Update `js/src/cli/model-config.js` to use `DEFAULT_PROVIDER_ID` /
  `DEFAULT_MODEL_ID` constants in OAuth fallback check and error messages
- Update `js/src/tool/task.ts` to use `DEFAULT_PROVIDER_ID` /
  `DEFAULT_MODEL_ID` constants as the fallback model for sub-agents
- Update case study README with corrected root cause analysis:
  the command-stream quoting bug in hive-mind passes agentArgs as a
  single quoted string, preventing yargs/process.argv from seeing --model
- Update changeset to describe the new DEFAULT_MODEL centralization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title fix: update default model from kimi-k2.5-free to minimax-m2.5-free (#208) refactor: centralize DEFAULT_MODEL constant, fix remaining kimi-k2.5-free references (#208) Mar 4, 2026
@konard
Copy link
Contributor Author

konard commented Mar 4, 2026

🔄 Auto-restart 1/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $6.208658
  • Calculated by Anthropic: $4.575421 USD
  • Difference: $-1.633237 (-26.31%)
    📎 Log file uploaded as Gist (8541KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 4, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit a58848b into main Mar 4, 2026
8 checks passed
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.

Agent CLI was not able to finish its work

1 participant