fix(kimi-code): honor --agent-file and --agent at TUI launch - #2770
fix(kimi-code): honor --agent-file and --agent at TUI launch#2770mohidmakhdoomi wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 88b43b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ec11430ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
7ec1143 to
957bee6
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 957bee61eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The interactive TUI runs on the agent-core-v2 engine by default, and that engine's SDK client dropped both agent options at session creation: it read only the session id, work dir, additional dirs, model, thinking, permission and metadata, then bound the default profile. The startup session therefore started on the built-in agent with no warning, while print mode — which takes a different path — bound the requested one. Register explicit agent files on the client's engine bootstrap, the way skill directories already are and the way print mode already registers the same flag, and pass a requested profile into the bind the client already performs for the model and thinking effort. That bind deliberately stays where it is, after the session is wired: it publishes the oversized AGENTS.md and tool-pattern warnings, the agent event bus has no replay, and the tool-pattern warning is emitted once per pattern, so binding any earlier would drop them. Binding that late means the session already exists by the time an unusable profile name is caught, and creating a session runs the SessionStart hook and records the start as its last step. So the name is resolved against the workspace's agent catalog before anything is created, the way the legacy engine resolves it before its store write, and deleting the session is kept only as a backstop for a bind that fails after that check passes. The CLI hands the files to the harness, which is built before any session exists and is the only place a launch-wide registration can happen. Selecting a profile stays per-session, so a session created later still starts on the default agent — though a file named after a built-in agent keeps replacing that built-in for the rest of the launch, which the docs now state.
957bee6 to
88b43b1
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Related Issue
Resolve #2767
Problem
See linked issue: launching the interactive TUI with
--agent-fileor--agentsilently starts the session on the built-in default agent. The same flags work in-pprint mode, so there is no error — just the wrong agent.What changed
The interactive TUI runs on the agent-core-v2 engine, whose SDK client dropped both agent options at session creation and always bound the default profile. Print mode takes a different path and was unaffected.
--agent-fileto the harness, which forwards it to the engine'sBootstrapInput.args.agentFilesthe same way--skills-diris already forwarded. The SDK gains a matchingagentFilesharness option (createKimiHarnessV2only; the option's docs say so).SessionStarthook runs orsession_startedis recorded — same order as the legacy engine. The rejection also carries the legacy engine's public error shape (KimiErrorwithagent.not_found) on both engines, keeping one error contract for SDK consumers.Tests: nine agent-path tests across the SDK client and CLI suites, each failing without the fix.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.