Repository navigation
Conversation
🦋 Changeset detectedLatest commit: c660a12 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f956d2f36
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| User rules are loaded from the user `config.toml` at session startup. For compatibility, legacy `turn-override` and `session-runtime` rules in the user config are silently ignored without a warning. | ||
|
|
||
| If the user `config.toml` cannot be read or parsed, sessions continue with no user rules on initial load or the last-known-good rules after a reload, and the error remains visible in config diagnostics. Invalid permission rules still block session startup, and config writes remain blocked until the file is readable again. |
There was a problem hiding this comment.
Qualify which sessions survive an unreadable config
This promise is broader than the implemented behavior: when callers omit environmentId—including the normal KimiHarness.createSession({ workDir }) path—the environment declaration reader still calls assertValid(ENVIRONMENTS_SECTION) without the new tolerance and rejects with config.invalid. The changed SDK test explicitly preserves that rejection at packages/node-sdk/test/sdk-rpc-client-v2.test.ts:342-360; only an explicit environmentId: 'local' session and resume are demonstrated to continue. Please either extend the recovery to ordinary implicit-local creation or document the explicit-local limitation here and in the changeset.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3df2c7dda0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| export function readUserPermissionRules(config: IConfigService): readonly PermissionRule[] { | ||
| config.assertValid(PERMISSION_SECTION); | ||
| config.assertValid(PERMISSION_SECTION, { tolerateReadError: true }); |
There was a problem hiding this comment.
Surface config errors before ignoring permission rules
When config.toml is unreadable or malformed, this tolerance lets explicit-local sessions continue without the configured user permission rules. For kimi --print --environment local, only warning diagnostics are written (apps/kimi-code/src/cli/v2/run-v2-print.ts:188-192), and kap-server likewise publishes only warnings (packages/kap-server/src/start.ts:416-424); because the read failure is an error, neither headless path signals that custom deny/ask policy was discarded, potentially allowing actions under a weaker policy. Surface the tolerated error before these paths continue.
AGENTS.md reference: AGENTS.md:L130-L132
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc696d2284
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ): Promise<EnvironmentDeclarationSet> { | ||
| await config.ready; | ||
| config.assertValid(ENVIRONMENTS_SECTION); | ||
| const user = config.get<EnvironmentsSection | undefined>(ENVIRONMENTS_SECTION); |
There was a problem hiding this comment.
Keep rejecting invalid implicit environment configs
When an implicit SDK session is created with an invalid [environments] section—such as default = "missing" or one incomplete declaration—ConfigService omits the entire invalid section, so this lookup returns no declarations and SessionManagerService.openCreation silently selects the local host. The changed test at packages/node-sdk/test/sdk-rpc-client-v2.test.ts:326-363 now explicitly accepts this path, whereas the parent returned config.invalid; callers expecting the configured remote can therefore execute commands locally, and createSession does not surface the diagnostic unless the SDK consumer separately requests it. Preserve validation for implicit resolution and limit recovery to explicitly local sessions or another fail-safe path.
AGENTS.md reference: AGENTS.md:L130-L132
Useful? React with 👍 / 👎.
|
|
||
| export function readUserPermissionRules(config: IConfigService): readonly PermissionRule[] { | ||
| config.assertValid(PERMISSION_SECTION); | ||
| const rules = config.get<PermissionConfig | undefined>(PERMISSION_SECTION)?.rules ?? []; |
There was a problem hiding this comment.
Retain valid permission rules when one entry is invalid
If a valid permission configuration containing deny rules is reloaded with one schema-invalid entry, ConfigService.buildValidated drops the whole section and this getter now returns an empty rule set instead of failing closed. Because running agents evaluate this getter dynamically, their previously active user restrictions disappear immediately and an action can proceed under the weaker defaults; this also contradicts the new documentation's promise to use the last-known-good validated configuration. Retain the last valid permission section on validation failure, or continue rejecting permission-rule use until it is repaired.
AGENTS.md reference: AGENTS.md:L130-L132
Useful? React with 👍 / 👎.
| if (configService.diagnostics().length > 0) { | ||
| publishConfigWarnings(configService.diagnostics()); |
There was a problem hiding this comment.
Replay startup config errors to kap-server clients
When kap-server starts with an unreadable or malformed config.toml, this callback publishes the diagnostic before listenWithPortRetry makes the WebSocket endpoint available, so SessionEventBroadcaster.sendGlobal has no targets and discards the event; it neither stores nor replays global config warnings when a target is later added. Consequently desktop/web clients never receive the advertised error while sessions continue without the configured permission policy. Fresh evidence beyond the prior comment is the current broadcaster behavior at sessionEventBroadcaster.ts:189-191,685-712, together with the new test covering only a reload after the server and subscriber are already active. Cache the current diagnostics for new connections or publish them as part of connection setup.
AGENTS.md reference: AGENTS.md:L130-L132
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b81f3ebbb0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ): void { | ||
| const previous = this.effective; | ||
| this.validated = this.buildValidated(this.raw); | ||
| this.validated = this.buildValidated(this.raw, this.validated); |
There was a problem hiding this comment.
Preserve the seeded config after an initial read failure
When seedInitialLoad() successfully reads a valid file but the subsequent asynchronous load('load') fails—for example, because the file is replaced or becomes malformed between the two reads—fileData remains {} and this rebuild discards every seeded section. Passing this.validated does not help because buildValidated() only retains previous values for domains present in raw; with an empty raw, sessions now continue using defaults, potentially losing configured permission rules or a remote default despite having already obtained a valid snapshot. Preserve the seeded raw/effective values on this initial-error path just as reload errors do.
AGENTS.md reference: AGENTS.md:L110-L112
Useful? React with 👍 / 👎.
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
* fix(agent-core-v2): tolerate config read failures for permission rules * chore: add changeset for permission config recovery * docs: document permission config recovery * docs: qualify permission config recovery scope * fix(config): surface read error diagnostics * fix(config): allow sessions with invalid user config * fix(config): preserve valid values and replay diagnostics * fix(config): remove startup diagnostic replay
* fix: resume sessions with removed default models (#4982) * fix(node-sdk): resume sessions with missing default model * fix(cli): check auth for the resumed session model * chore: add changeset for unavailable model recovery * fix(agent-core-v2): stop rebuilding mismatched session indexes (#4980) * fix(agent-core-v2): reject repeated model responses (#4977) * fix(agent-core-v2): reject repeated model responses * chore: add changeset for repeated model responses --------- Co-authored-by: 7Sageer <[email protected]> * fix(agent-core-v2): inline deferred tools without dynamic loading (#4971) * fix(agent-core-v2): record restored task notifications without model requests (#4949) (#4989) * fix(agent-core-v2): record restored task notifications without model requests - queue restored task notifications as prompt-only turns after loop initialization - preserve interrupted and queued turns during resume and fork - complete reconciliation before initialization and reset return to keep Wire reads ordered - run loop and container cleanup when reconciliation fails - surface restored notification persistence failures * chore: add changeset for restored task notifications * fix(agent-core-v2): restore overflow recovery after LLM retries (#4950) (#4990) * fix(agent-core-v2): restore step state after LLM retries * test(agent-core-v2): scope retry event to overflow regression * fix(config): allow sessions with invalid user config (#4951) (#4991) * fix(agent-core-v2): tolerate config read failures for permission rules * chore: add changeset for permission config recovery * docs: document permission config recovery * docs: qualify permission config recovery scope * fix(config): surface read error diagnostics * fix(config): allow sessions with invalid user config * fix(config): preserve valid values and replay diagnostics * fix(config): remove startup diagnostic replay * fix(agent-core-v2): ignore non-user prompts during Tower wake (#4952) (#4992) * fix(agent-core-v2): ignore non-user prompts during Tower wake * chore: add Tower notification fix changeset * fix(agent-core-v2): preserve slash prompts during Tower wake * fix(agent-core-v2): route foreground shell events by origin (#4954) (#4994) * fix(agent-core-v2): route foreground shell events by origin * test(agent-core-v2): expect tool event origins in snapshots * fix(klient): accept tool events from pre-origin hosts * fix(agent-core-v2): run external Stop hooks after turn completion (#4956) (#4995) * fix(agent-core-v2): run external Stop hooks after turn completion * chore: add changeset for external Stop hooks * docs: clarify post-turn Stop hook timing * fix(agent-core-v2): wait for subagent quiescence (#4953) (#4993) * fix(agent-core-v2): reject incomplete model streams (#5006) * fix(agent-core-v2): preserve choice-level OpenAI token usage (#5017) * fix(capability): confirm stopping WebBridge before Windows updates (#4999) * fix(capability): confirm stopping WebBridge before Windows updates * fix(capability): harden WebBridge update recovery * fix(capability): restore WebBridge after startup failure * fix(capability): wait for WebBridge process exit * fix(capability): handle WebBridge confirmation edge cases --------- Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: kimi-agent-bot <[email protected]> * chore: sync release 2.6.3 back to main * chore: finish release 2.6.3 backsync * chore: sync node-sdk lockfile importer * fix(sdk): preserve main core type dependencies * fix: complete release 2.6.3 backsync --------- Co-authored-by: Haozhe <[email protected]> Co-authored-by: 7Sageer <[email protected]> Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: kimi-agent-bot <[email protected]>
Requirement or Bug
Users whose user
config.tomlis unreadable, contains malformed TOML, or has invalid sections can be blocked from creating or resuming sessions. This PR makes implicit and explicit session creation and resume continue with default or last-known-good validated config while keeping the errors visible through diagnostics.Bug Reproduction Steps
The existing SDK scenario now covers three user-config states end to end: an invalid environment entry, an invalid default environment reference, and malformed TOML.
config.tomlfiles.KimiHarness.createSession({ workDir })without anenvironmentId, then close and resume that session. Also create an explicit local session throughISessionManagerwithenvironmentId: 'local'.config.invalid. With this PR, implicit creation, resume, and explicit-local creation all succeed. Malformed TOML retains anerrordiagnostic; invalid sections retain awarningdiagnostic.Root Cause
Session loading used
assertValidin bothreadUserPermissionRulesandresolveWorkspaceEnvironmentDeclarations. The permission reader was added by #4550, and the environment reader rejects implicit creation before it can fall back to the local environment. These calls reject file-level read errors and schema errors instead of using the config service's fallback behavior.This is a fundamental fix: both readers now use
ConfigService.get()directly. Initial failures produce defaults, read or schema failures on reload retain the last valid section values, and invalid sections no longer block session loading. Environment declarations use the previous valid declarations when available; without them, implicit creation falls back to local with a warning rather than failing.Headless CLI and kap-server previously surfaced only
warningdiagnostics. They now surface bothwarninganderrorthrough their existing channels, so falling back cannot silently discard configured permission policy.Code Changes
assertValidcalls from permission-rule and environment-declaration readers; rely on the config service's validated effective values..kimi-code/local.tomlsemantics and the block on persisting user config while it cannot be read or parsed.Behavior Changes and Affected Users
config.invalidwarningdiagnostics are surfacedwarninganderrordiagnostics are surfaced through existing channels.kimi-code/local.tomlis invalidAffected modules and coverage:
agent-core-v2: config and permission tests passed, 126/126, including last-valid-section recovery after schema failure.node-sdk: all three config-state scenarios passed for implicit creation, close, resume, and explicit-local creation.agent-core-v2and kap-server package typecheck passed; scoped type-aware oxlint reported zero errors on the changed source and test files.suggestFilesassertion concerns.gitignorefiltering, does not exercise config recovery, and was not changed by this PR.Checklist