feat(cli): add global option to disable automatic session title changes#504
Open
chenbojian wants to merge 3 commits intotiann:mainfrom
Open
feat(cli): add global option to disable automatic session title changes#504chenbojian wants to merge 3 commits intotiann:mainfrom
chenbojian wants to merge 3 commits intotiann:mainfrom
Conversation
Add `enableAutoTitle` setting in `~/.hapi/settings.json` that controls whether the agent automatically renames chat sessions via the `change_title` MCP tool. When set to `false`, the title instruction is omitted from system prompts and the tool is not registered. Closes tiann#271
There was a problem hiding this comment.
Review mode: initial
Findings
- [Major]
enableAutoTitle=falsedoes not fully disable automatic title changes outside Claude. The new guard removes the HTTP-side tool incli/src/claude/utils/startHappyServer.ts:45, but Codex/OpenCode still launch the shared stdio bridge, and that bridge still unconditionally advertiseschange_titleincli/src/codex/happyMcpStdioBridge.ts:72. That leaves the tool visible and callable in the non-Claude modes this PR claims to cover.
Summary
enableAutoTitle=falsecurrently suppresses prompt text, but not end-to-end tool exposure for Codex/OpenCode.- Not found in tests: coverage for the MCP bridge/tool advertisement path when
enableAutoTitleisfalse.
Testing
- Not run (automation)
HAPI Bot
| }; | ||
| } | ||
| }); | ||
| if (shouldEnableAutoTitle()) { |
There was a problem hiding this comment.
[MAJOR] enableAutoTitle=false only removes the tool from the HTTP MCP server here. Codex and OpenCode still go through buildHapiMcpBridge(...), and cli/src/codex/happyMcpStdioBridge.ts:72 still unconditionally re-registers change_title, so those modes can still see and call the title tool.
Suggested fix:
const client = await ensureHttpClient();
const { tools } = await client.listTools();
if (tools.some((tool) => tool.name === 'change_title')) {
server.registerTool<any, any>('change_title', {
description: 'Change the title of the current chat session',
title: 'Change Chat Title',
inputSchema: changeTitleInputSchema,
}, async (args: Record<string, unknown>) => {
return client.callTool({ name: 'change_title', arguments: args });
});
}…false The STDIO MCP bridge unconditionally registered the change_title tool, leaving it visible in Codex/OpenCode even when enableAutoTitle was false.
There was a problem hiding this comment.
Findings
- No actionable findings in the updated diff.
Summary
- Review mode: follow-up after new commits
- No new diff-attributable correctness, security, or maintainability issues found.
- Residual risk: not found in repo/docs/tests, targeted coverage for
enableAutoTitle=falsethrough the non-Claude launch paths touched here, especiallycli/src/codex/happyMcpStdioBridge.ts:68,cli/src/opencode/opencodeLocalLauncher.ts:274, andcli/src/opencode/opencodeRemoteLauncher.ts:120.
Testing
- Not run (automation)
HAPI Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enableAutoTitlesetting in~/.hapi/settings.json(defaults totrue)false, the title instruction is omitted from system prompts (Claude, Codex, OpenCode) and thechange_titleMCP tool is not registeredSupport part of #271
Test plan
"enableAutoTitle": falsein~/.hapi/settings.json→ start a session → verify no title-change tool calls and no title instruction in prompttrue→ verify behavior unchangedbun run typecheckincli/— passesbunx vitest run src/claude/utils/claudeSettings.test.ts— all 11 tests pass