Skip to content

feat: add deprecated btca config model compatibility alias#195

Open
bmdavis419 wants to merge 1 commit intocodex/pr-e-auth-robustness-docsfrom
codex/pr-f-cli-compat-alias
Open

feat: add deprecated btca config model compatibility alias#195
bmdavis419 wants to merge 1 commit intocodex/pr-e-auth-robustness-docsfrom
codex/pr-f-cli-compat-alias

Conversation

@bmdavis419
Copy link
Collaborator

@bmdavis419 bmdavis419 commented Feb 28, 2026

Summary

  • add backward-compatible btca config model alias
  • keep contextual help/dispatch behavior validated by tests
  • document deprecation path

Issues

Greptile Summary

This PR adds a btca config model backward-compatible alias command that delegates to the same updateModel path as btca connect, prints a deprecation notice on success, and documents the removal path. The registration in index.ts is clean and the --help test covers the new nested subcommand correctly. No plan files were found in the repository.

Key changes:

  • New apps/cli/src/commands/config.ts exposes a config model subcommand as a deprecated shim over updateModel.
  • apps/cli/src/index.ts registers configCommand in the configuration commands block.
  • apps/cli/src/index.test.ts adds a --help smoke test for the nested subcommand.
  • apps/docs/guides/cli-reference.mdx documents the compatibility alias and corrects the --branch option description ("default main""auto-detected when omitted").

Issues found:

  • In config.ts, server.stop() is only reached if updateModel succeeds. If updateModel throws, the auto-started server is never stopped, which can cause port conflicts for subsequent CLI invocations.

Confidence Score: 3/5

  • Safe to merge after fixing the server resource leak in the error path of the new config command.
  • The change is small and well-scoped, but the server leak in config.ts — where server.stop() is skipped when updateModel throws — is a real functional bug that can leave a dangling process behind.
  • apps/cli/src/commands/config.ts — the server.stop() call needs to be moved into a finally block.

Important Files Changed

Filename Overview
apps/cli/src/commands/config.ts New file adding the deprecated btca config model compatibility alias. Contains a server resource leak — server.stop() is not called if updateModel throws.
apps/cli/src/index.ts Imports and registers configCommand. config is correctly included in knownCommands before the unknown-command check, so typo-suggestion logic works properly for the new command.
apps/cli/src/index.test.ts Adds a test verifying btca config model --help exits with code 0 and outputs the expected usage line. No issues found.
apps/docs/guides/cli-reference.mdx Adds the btca config model section and updates the --branch description from "default main" to "auto-detected when omitted". No issues found.

Last reviewed commit: 66b4cd8

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +22 to +23
const updated = await updateModel(server.url, options.provider, options.model);
server.stop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server not stopped on updateModel failure

If updateModel throws, server.stop() on line 23 is never reached because the exception propagates out of the tryPromise callback immediately. This leaves an auto-started server running and can cause port conflicts for subsequent commands.

Consider wrapping the server.stop() call in a try/finally block:

Suggested change
const updated = await updateModel(server.url, options.provider, options.model);
server.stop();
try {
const updated = await updateModel(server.url, options.provider, options.model);
console.warn(
'Deprecation: "btca config model" will be removed in a future release. Use "btca connect --provider ... --model ...".'
);
console.log(`Model updated: ${updated.provider}/${updated.model}`);
} finally {
server.stop();
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/cli/src/commands/config.ts
Line: 22-23

Comment:
**Server not stopped on `updateModel` failure**

If `updateModel` throws, `server.stop()` on line 23 is never reached because the exception propagates out of the `tryPromise` callback immediately. This leaves an auto-started server running and can cause port conflicts for subsequent commands.

Consider wrapping the `server.stop()` call in a `try/finally` block:

```suggestion
			try {
				const updated = await updateModel(server.url, options.provider, options.model);

				console.warn(
					'Deprecation: "btca config model" will be removed in a future release. Use "btca connect --provider ... --model ...".'
				);
				console.log(`Model updated: ${updated.provider}/${updated.model}`);
			} finally {
				server.stop();
			}
```

How can I resolve this? If you propose a fix, please make it concise.

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