Skip to content

KIMI_CODE_LEGACY_FLAG silently ignored by interactive TUI and print mode in 0.43.1 #3820

Open

Description

@Fanshb

Summary

KIMI_CODE_LEGACY_FLAG=1 is silently ignored by both the interactive TUI and kimi -p in 0.43.1 — sessions start on the agent-core-v2 engine regardless of the flag. In 0.41.0 the same setup correctly falls back to the legacy engine. The changelog documents this removal only for kimi acp (0.40.0); the TUI and print-mode removals are not documented anywhere.

Environment

  • Windows 11, native single-binary install (~/.kimi-code/bin/kimi.exe)
  • Launch env: KIMI_CODE_LEGACY_FLAG=1, KIMI_CODE_HOME set explicitly
  • Model via KIMI_MODEL_* env (provider type kimi, model kimi-k3)

Expected (0.41.0, same launcher)

Session evidence markers:

  • wire.jsonl line 1: "protocol_version":"1.4"
  • session log line 1: provider=kimi
  • [[permission.rules]] fully honored: allow-listed literal commands run without prompts; deny rules hard-refuse.

Actual (0.43.1, same launcher)

Both a new interactive TUI session and a kimi -p session show:

  • wire.jsonl line 1: "protocol_version":"1.5"
  • session log line 1: provider=openai

i.e. the v2 engine despite KIMI_CODE_LEGACY_FLAG=1.

Consequence (consistent with #2100, which is still open): under v2 the user [[permission.rules]] are not loaded —

  • allow rules dead: an allow-listed literal command (date) triggered a manual approval prompt;
  • deny rules dead: git push origin master (in an isolated test repo) was NOT refused by the configured deny rule (it was only stopped by an external PreToolUse hook we run ourselves).

So 0.43.1 removes the last fallback for users who depend on permission.rules: previously the legacy engine provided a working path; now every surface (acp since 0.40.0, and TUI/-p as of this release) forces v2, where rules are ignored.

Changelog gap

  • 0.40.0 changelog: "The kimi acp subcommand no longer honors KIMI_CODE_LEGACY_FLAG" — documented.
  • 0.42.0 / 0.43.0 / 0.43.1 changelog: no mention of TUI or print mode dropping the flag.

Request

  1. Confirm whether dropping KIMI_CODE_LEGACY_FLAG for TUI and -p is intentional.
  2. If intentional: please document it in the changelog and publish the migration path / sunset timeline for deployments that rely on [[permission.rules]] (which require the legacy engine today, cf. kimi web Manual mode ignores user-configured [[permission.rules]] allow rules (over-prompts) #2100).
  3. If unintentional: please restore the flag for TUI and -p.

Happy to provide wire logs, session logs, or a minimal repro script if useful.

Activity

  1. Comandante-Supremo commented on Sep 19, 2026

    @Comandante-Supremo

    Confirming the deny-rules-dead half on 0.43.0 (darwin arm64, native install) with a controlled repro that isolates the effect from the git push shape #3820 used.

    Setup

    • ~/.kimi-code/config.toml: default_permission_mode = "yolo", [permission].dangerous_command_guard = false.

    • 19 [[permission.rules]] deny entries (positions 1–19), 9 allow entries after (positions 20–28), catch-all pattern = "Bash" last.

    • Probe rule added at position 1:

      [[permission.rules]]
      decision = "deny"
      pattern = "Bash(echo kimi-deny-probe-target*)"
      reason = "TEMPORARY probe — deny-fires-in-loaded-process verification"
    • Nothing earlier in the rules list matches echo kimi-deny-probe-target. The catch-all Bash allow at the end is documented as reachable only when no earlier rule matches.

    Repro

    Launched a fresh kimi in tmux (rules loaded at session start per docs; status bar confirmed "Ask When Needed"). Prompt:

    Run this exact bash command via the Bash tool: echo kimi-deny-probe-target
    

    Result

    ● Ran a command · $ echo kimi-deny-probe-target
      kimi-deny-probe-target
    

    The tool executed. No approval prompt, no rejection.

    Wire timeline for the turn (~/.kimi-code/sessions/<workdir>/session_<id>/agents/main/wire.jsonl, filtered to the interesting rows):

    23:59:42  agent.message.appended     role=user, text="Run this exact bash command..."
    23:59:48  content.part / think       "...probe to test deny behavior. It's a harmless echo command. I should just run it..."
    23:59:48  tool.call                  name=Bash  args={"command":"echo kimi-deny-probe-target"}  toolCallId=tool_AT7CgQeuAadL3YVB0zX1b3pw
    23:59:48  tool.result                parentUuid=(same id)  output="kimi-deny-probe-target\n"
    23:59:52  content.part / text        "Ran it — output: `kimi-deny-probe-target`"
    

    Zero permission-check events between tool.call and tool.result. Full event-kind census for the turn contains exactly one permission event — the initial permission.set_mode → yolo at row 3 — and no rule-evaluation record of any kind. Consistent with the "rules never made it into the session" reading you and others have traced: the policy chain is being skipped, not just mismatching.

    Also reproduced in auto mode: the same probe under kimi -p "..." produces the same outcome. Note this session auto-transitions from yolo to auto early in the turn (per #2099), so it's an auto-mode datapoint, not yolo-via--p.

    Not tested: manual mode (would need a human at the approval prompt to distinguish "deny fires before prompt" from "prompt appears" cleanly).

    Adds vs the existing #3820 evidence: #3820's deny evidence is a git push refusal that came from an external hook — the native deny path was inferred as dead from the absence of a rule-side refusal. This adds an isolated Bash probe on a hook-free command (echo) with a rule at position 1 that exactly matches, plus the wire showing no permission events fired. Same conclusion, tighter isolation.

    Happy to share the full wire.jsonl on request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions