Skip to content

refactor(acp): move the opencode session code off AcpClient into OpencodeAcpClient - #37602

Merged
chenmingwei23 merged 1 commit into
mainfrom
refactor/opencode-out-of-acpclient
Nov 15, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
refactor/opencode-out-of-acpclient

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: AcpClient holds no opencode-only code; an opencode session runs exactly as before from a class of its own.

AcpClient is the per-session client every non-KAS backend shares, and it carried opencode's session contract: holding a shell permission back until the tool_call_update that carries its command has filled the security cache, refusing a session left on opencode's hosted fall-back model before its first prompt, and building opencode's MCP array. Those sat behind _is_opencode and self.backend == ACP_BACKEND_OPENCODE branches in the shared turn, model-selection and start code, and behind a seam on OpencodeLaunch.

Why it matters

opencode dashboard chats are next to share one ACP process under the runtime sharing preview, the way KAS, codex, claude and goose chats can. That needs opencode's per-session checks to be a unit the shared runtime can run per session. This is the first of three PRs, split the way goose was (#37535, #37562, #37567). Users see no change from this PR.

Not a goal

  • No behaviour change for any backend, opencode included.
  • No opencode chat sharing yet; that lands in the two follow-up PRs.
  • The spawn-time routing seed, read-back, version gate and deny settlement stay on OpencodeLaunch (acp/harness/opencode.py): they run once per process, not per session.
  • MiMo Code keeps its own shell-permission deferral on AcpClient.

What changed (motivation -> approach -> change)

opencode code was spread across the shared client -> it now lives in OpencodeAcpClient(AcpClient) (acp/client_opencode.py), bound from one owner module (acp/client_opencode_session.py) -> AcpClient keeps one hook per step with what every other backend already did, and the subclass fills it.

  • The class. AcpClient(acp_backend="opencode", ...) builds an OpencodeAcpClient through the __init_subclass__(serves=...) registry, so no caller changes. A class that defers no shell permission is refused the opencode backend before any process exists (_SHELL_PERMISSION_DEFERRAL_BACKENDS), so an edition subclass cannot start opencode with a permission judged before its command is cached.
  • Hooks on AcpClient. _defers_shell_permission (False) with _defer_shell_permission (returns False): the turn loop reads the flag before the await, so every other backend makes no call. _refuse_harness_default_model (no-op) on the non-kiro branch of _ensure_served_default and after a refused model pin; kiro-cli takes the other branch and never reaches it. The MCP array uses the existing _harness_session_mcp_servers hook in place of the seam on OpencodeLaunch, so the array sent on session/new and session/load is unchanged.
  • Moved verbatim: _defer_opencode_shell_permission (from client_turn; it is now the _defer_shell_permission hook itself, so the frame it reads is read under the prompt loop's claim on stdout), _refuse_opencode_hosted_fallback (from client_model_selection), _opencode_session_mcp_servers (from client_mcp_array). _is_opencode is removed.
  • ProcessSession no longer lists _opencode_session_mcp_servers. Doc lines in acp-client.md, agent-host-contract.md and two code comments name the new home.

Backwards compatibility

Compatible: AcpClient(acp_backend="opencode") still builds an opencode client, and the turn, model refusal and session start run the same code in the same order.

Reader: src/kiro_crew/acp/harness/opencode.py:OpencodeLaunch.session_mcp_servers -- removed; the array now comes from OpencodeAcpClient._harness_session_mcp_servers on the same two call sites -- test_only_the_claude_goose_and_opencode_clients_fill_the_harness_mcp_seam
Reader: src/kiro_crew/acp/client_class.py:AcpClient._is_opencode -- removed; its readers were two model-selection branches and the MCP binding, now hooks -- test_a_resumed_session_is_not_gated_on_a_kiro_transcript
Reader: src/kiro_crew/acp/client_turn.py:_defer_opencode_shell_permission -- moved to client_opencode_session as OpencodeAcpClient._defer_shell_permission, called only from _prompt_loop -- test_every_read_message_caller_claims_stdout, test_mimocode_permission_waits_for_matching_command_refinement

Tests

  • test_client_bindings.py: an OpencodeAcpClient inventory, each member bound from client_opencode_session; the new hooks join the AcpClient inventory; test_the_backend_picks_the_client_class now checks opencode builds OpencodeAcpClient and that a subclass without the deferral is refused opencode (red if the refusal is removed).
  • test_harness_parity.py: OpencodeAcpClient fills _harness_session_mcp_servers with its own array; OpencodeLaunch asks no MCP seam.
  • test_acp_opencode_backend.py, test_acp_mimocode_turn.py: follow the members.
  • Run locally, one file at a time: the files above plus test_acp_opencode_hosted_fallback.py, test_acp_opencode_effort.py, test_opencode_session_mcp.py, test_acp_mcp_startable.py, test_acp_refactor_facade.py, test_acp_bindings.py, test_acp_client_prompt_turn.py, test_acp_session_mcp.py, test_member_dispatch_mount.py, test_acp_goose_backend.py, test_acp_harness_contract.py, test_campaign_facades_base_public_names.py, test_acp_client_tool_hooks.py, all pass. mypy over src/kiro_crew/ is clean; flake8, black and isort are clean on the changed files.

Proof: not provable -- other: refactor with no behaviour change; tests follow the moved members

Manual verification

N/A -- no behaviour change; unit coverage of the moved members and the new refusal is sufficient. opencode chat sharing, which these hooks prepare for, gets a real opencode run in the PR that routes it.

Screenshots / video

N/A -- no UI change.

Related Issues

Part of #5033

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 7b80a45729ab04d571ee299eb46ae43000d65503 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 7b80a45

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 7b80a45729ab04d571ee299eb46ae43000d65503 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 7b80a45729ab04d571ee299eb46ae43000d65503 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 7b80a45729ab04d571ee299eb46ae43000d65503 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this follows the goose split pattern, the order of the MCP array on session/new and session/load is unchanged, and the hooks do nothing on every other backend.

[DESIGN-REVIEWED] 7b80a45

Description read

[DESCRIPTION-READ] f31296025c7a2f90ec5eeb2d26c7ad1056b67e9fb4ce55e8465bf87a0e925318

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 7b80a45729ab04d571ee299eb46ae43000d65503 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: every member moves verbatim behind hooks that already have peers, and the one new refusal guards a permission check that has a named cause.

Notes

  • Item 4 — one consumer, generalized: _SHELL_PERMISSION_DEFERRAL_BACKENDS = frozenset({ACP_BACKEND_OPENCODE}) is a one-entry set. Its only support is that the two refusals beside it (_SESSION_MODE_READ_BACK_BACKENDS, ACP_BACKENDS_SEED_LOCAL_SETTINGS) are written the same way, which is the symmetry form of inherited. Subtraction: replace the set with backend == ACP_BACKEND_OPENCODE in AcpClient.__new__.

What this change ships

Inventory (6 items) — 5 justified

Intent: let opencode's per-session checks run as their own unit, so a later PR can put several opencode chats on one shared ACP process. This is an ADDITION (a refactor with no behaviour change).

  1. An opencode session is now served by its own OpencodeAcpClient class; callers build it the same way as before — justified
  2. The shell permission hold-back runs through the _defers_shell_permission/_defer_shell_permission hook instead of a backend branch in the turn loop — justified
  3. The refusal of opencode's hosted fall-back model runs through the _refuse_harness_default_model hook — justified
  4. A client class that holds no shell permission back is refused the opencode backend before any process starts — one consumer, generalized: one-entry backend set
  5. opencode's MCP array comes from the existing _harness_session_mcp_servers hook; the seam on OpencodeLaunch is removed — justified
  6. Two spec docs and two code comments name the new home — justified

[FIRST-PRINCIPLES-REVIEWED] 7b80a45

Description read

[DESCRIPTION-READ] e1bcbf8df4439bf5e0182bfe42efdcb05acd68db9cf4f4da22676e77578354df

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 7b80a45729ab04d571ee299eb46ae43000d65503 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 7b80a45

Verdict parsed from the review's SHA-scoped output markers for commit 7b80a45729ab04d571ee299eb46ae43000d65503.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 7b80a45729ab04d571ee299eb46ae43000d65503 false-positive: <reason, 20 to 500 characters>

@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 493 lines, more than the 400 it may approve on its own.

This is a behaviour-preserving refactor and can merge. Opencode's shell-permission hold, hosted fall-back refusal and MCP server list now live on OpencodeAcpClient, reached through hooks on AcpClient. The bodies moved verbatim, the order of the MCP server list on session/new and session/load is the same (client-class list, then adapter list), MiMo Code's own deferral is untouched, and no code still references the removed _is_opencode or OpencodeLaunch.session_mcp_servers. The new refusal for subclasses that don't hold back shell permissions has a test that would fail without it, and the existing behaviour tests still cover the moved code. The remaining issues are doc drift and process steps, listed in the notes.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 514047205b · 493 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@chenmingwei23
chenmingwei23 force-pushed the refactor/opencode-out-of-acpclient branch from 647bc5a to 5140472 Compare November 15, 2026 13:05
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 5140472
  • What rule changed: security_posture.NON_EGRESS_REDACTION_MODULES gains one entry, acp/client_opencode_session.py. No rule, sink, ratchet count or redactor changed.
  • Before -> after (what was allowed/blocked, now): Before, the opencode hosted fall-back refusal scrubbed its model id with redact_exfiltration_urls + redact_credentials inside acp/client_model_selection.py, which is already on this list. This PR moves that function verbatim to acp/client_opencode_session.py, so the same scrub now runs in the new module; the entry classifies it exactly as its old home was classified (not an egress sink; the refusal reaches the browser through the chat's existing sinks). Nothing that was blocked is now allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): The new module would be miscounted on the security posture panel as non-egress. The scrub itself still runs either way, so no secret leaks and no command breaks.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox rule is touched. Checked instead: test/test_security_posture.py passes on this head (57 passed), including test_every_redactor_call_site_is_a_registered_sink_or_allowlisted, which failed on the previous head with exactly this module named.
  • No regression:
    • Tools still work (which tools/commands were run, result): N/A, refactor with no behaviour change; the opencode client tests (test_acp_opencode_backend.py, test_acp_opencode_hosted_fallback.py, test_acp_opencode_effort.py) pass, the hosted fall-back refusal among them.
    • Backward compatible (old config / old data / old callers still work, how checked): yes; no config, data or caller changes. AcpClient(acp_backend="opencode") still builds an opencode client (test_client_bindings.py::test_the_backend_picks_the_client_class).
    • Existing tests (which suites passed on this head): test_security_posture.py, test_error_code_contract.py, test_crew_log_exc_info_sites.py, test_pid_reader_ratchet.py, test_ci_fleet_routing_expression_parity.py, test_backend_cards.py, test_fold_catalogue.py, plus the client tests listed in the PR body.
  • How to undo: revert the four added lines in src/kiro_crew/security_posture.py (and the move, if the whole PR is reverted).

…codeAcpClient

AcpClient carried opencode's session contract: holding a shell permission
back until the update carrying its command reaches the security cache,
refusing a session left on opencode's hosted fall-back model, and building
opencode's MCP array, behind `_is_opencode` and backend checks in the shared
turn, model-selection and start code and a seam on the process adapter.

OpencodeAcpClient (acp/client_opencode.py) now holds all of it, bound from
the new owner module client_opencode_session. AcpClient keeps one hook per
step (`_defers_shell_permission` + `_defer_shell_permission`,
`_refuse_harness_default_model`, and the existing
`_harness_session_mcp_servers`) with the behaviour every other backend
already had, and the subclass fills it. AcpClient(acp_backend="opencode")
builds OpencodeAcpClient, so no caller changes; a class that defers no
shell permission refuses the opencode backend.

Behaviour is unchanged. The tests follow the members to the new class.
@chenmingwei23
chenmingwei23 force-pushed the refactor/opencode-out-of-acpclient branch from 5140472 to 7b80a45 Compare November 15, 2026 14:00
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 7b80a45
  • What rule changed: security_posture.NON_EGRESS_REDACTION_MODULES gains one entry, acp/client_opencode_session.py. No rule, sink, ratchet count or redactor changed. Unchanged from the review on 5140472; this head only renames the moved opencode shell-permission deferral to the _defer_shell_permission hook it fills (no security file touched by that).
  • Before -> after (what was allowed/blocked, now): Before, the opencode hosted fall-back refusal scrubbed its model id with redact_exfiltration_urls + redact_credentials inside acp/client_model_selection.py, which is already on this list. This PR moves that function verbatim to acp/client_opencode_session.py; the entry classifies the new module exactly as the old one (not an egress sink; the refusal reaches the browser through the chat's existing sinks). Nothing that was blocked is now allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): The new module would be miscounted on the security posture panel as non-egress. The scrub itself still runs either way, so no secret leaks and no command breaks.
  • Evidence checked (which sandbox result proves it): N/A, no sandbox rule is touched. Checked instead: test/test_security_posture.py passes, including test_every_redactor_call_site_is_a_registered_sink_or_allowlisted.
  • No regression:
    • Tools still work (which tools/commands were run, result): N/A, refactor with no behaviour change; test_acp_opencode_backend.py, test_acp_opencode_hosted_fallback.py, test_acp_mimocode_turn.py and test_acp_client_agent_started_turns.py (which failed on backend group 8 for the previous head) pass on this head.
    • Backward compatible (old config / old data / old callers still work, how checked): yes; no config, data or caller changes. AcpClient(acp_backend="opencode") still builds an opencode client (test_client_bindings.py::test_the_backend_picks_the_client_class).
    • Existing tests (which suites passed on this head): test_client_bindings.py, test_harness_parity.py, test_acp_client_agent_started_turns.py, test_acp_mimocode_turn.py, test_acp_opencode_backend.py, test_security_posture.py.
  • How to undo: revert the four added lines in src/kiro_crew/security_posture.py (and the move, if the whole PR is reverted).

@chenmingwei23
chenmingwei23 enabled auto-merge (squash) November 15, 2026 15:11
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 15, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved. On this head the review checked that the three moved functions match their originals on main body for body, apart from docstrings. _refuse_opencode_hosted_fallback still applies both redactions. The prompt loop now gates the shell-permission deferral on a class flag that only OpencodeAcpClient sets, which is the same condition as the old backend name test. The opencode MCP entries moved from the adapter slot to the harness slot of the same array, so the wire array and its order do not change. The existing opencode tests build their client through AcpClient(acp_backend="opencode"), so they now run through the new class. The new __new__ refusal has a test that fails without it.

Done well: this follows the merged goose split (#37535) closely. A subclass that does not defer shell permissions now gets an error before any process starts, where before it would have lost the reorder without any sign.

Optional:

  • docs/system-specs/modules/agent-host-contract.md line 462 still says opencode's MCP array is "spliced by its own _is_opencode arm". You could reword it to match the goose cell: "spliced by its client class (OpencodeAcpClient._harness_session_mcp_servers, acp/client_opencode.py)".
  • In test/test_acp_opencode_backend.py around line 829, the assertion message still mentions the MCP-array splice exemption, which no longer exists. Something like "an opencode identity test sits on the shared init path (harness-parity H13)" would match the stricter check.
  • #37629 conflicts with this PR in client_model_selection.py. Whichever PR merges second should build its MiMo refusal on the new _refuse_harness_default_model hook and not on _is_opencode.

@chenmingwei23
chenmingwei23 merged commit 721f71d into main Nov 15, 2026
102 of 107 checks passed
@chenmingwei23
chenmingwei23 deleted the refactor/opencode-out-of-acpclient branch November 15, 2026 15:53
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 2026
iamwhatever pushed a commit that referenced this pull request Nov 15, 2026
…odel unsigned

MiMo Code 0.1.17 is built on opencode and has the gap #37480 closed there. With no sign-in, no key and no model in its config, session/new puts the session on xiaomi/mimo-v2.6-pro-ultraspeed and the first prompt goes to Xiaomi's API with no Authorization header. Crew did not stop it: the start-time refusal ran for opencode only.

Following #37602's split, a new MimocodeAcpClient (acp/client_mimocode.py, bound from client_mimocode_session) fills the _refuse_harness_default_model hook; AcpClient(acp_backend="mimocode") now builds it. It refuses when the session's model and every advertised model are xiaomi/ ones, the harness config names no model, and no Xiaomi credential is present. A signed-in host advertises the very same models, so MiMo Code's read-back records that last fact: the sign-in file the auth declaration names (under XDG_DATA_HOME or HOME), XIAOMI_API_KEY or MIMOCODE_AUTH_CONTENT in the child's environment, or a provider.xiaomi.options.apiKey in the resolved config. The file is checked for existence only and never opened; the key is checked for presence and never logged. A signed-in host, a model named in mimocode.json, a Crew pin, or a provider of the operator's own is left alone.
@LuisBrel LuisBrel mentioned this pull request Nov 15, 2026
5 tasks done
iamwhatever pushed a commit that referenced this pull request Nov 16, 2026
…odel unsigned

MiMo Code 0.1.17 is built on opencode and has the gap #37480 closed there. With no sign-in, no key and no model in its config, session/new puts the session on xiaomi/mimo-v2.6-pro-ultraspeed and the first prompt goes to Xiaomi's API with no Authorization header. Crew did not stop it: the start-time refusal ran for opencode only.

Following #37602's split, a new MimocodeAcpClient (acp/client_mimocode.py, bound from client_mimocode_session) fills the _refuse_harness_default_model hook; AcpClient(acp_backend="mimocode") now builds it. It refuses when the session's model and every advertised model are xiaomi/ ones, the harness config names no model, and no Xiaomi credential is present. A signed-in host advertises the very same models, so MiMo Code's read-back records that last fact: the sign-in file the auth declaration names (under XDG_DATA_HOME or HOME), XIAOMI_API_KEY or MIMOCODE_AUTH_CONTENT in the child's environment, or a provider.xiaomi.options.apiKey in the resolved config. The file is checked for existence only and never opened; the key is checked for presence and never logged. A signed-in host, a model named in mimocode.json, a Crew pin, or a provider of the operator's own is left alone.
KiroCrewCaptain pushed a commit that referenced this pull request Nov 16, 2026
…odel unsigned (#37629)

MiMo Code 0.1.17 is built on opencode and has the gap #37480 closed there. With no sign-in, no key and no model in its config, session/new puts the session on xiaomi/mimo-v2.6-pro-ultraspeed and the first prompt goes to Xiaomi's API with no Authorization header. Crew did not stop it: the start-time refusal ran for opencode only.

Following #37602's split, a new MimocodeAcpClient (acp/client_mimocode.py, bound from client_mimocode_session) fills the _refuse_harness_default_model hook; AcpClient(acp_backend="mimocode") now builds it. It refuses when the session's model and every advertised model are xiaomi/ ones, the harness config names no model, and no Xiaomi credential is present. A signed-in host advertises the very same models, so MiMo Code's read-back records that last fact: the sign-in file the auth declaration names (under XDG_DATA_HOME or HOME), XIAOMI_API_KEY or MIMOCODE_AUTH_CONTENT in the child's environment, or a provider.xiaomi.options.apiKey in the resolved config. The file is checked for existence only and never opened; the key is checked for presence and never logged. A signed-in host, a model named in mimocode.json, a Crew pin, or a provider of the operator's own is left alone.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
buluoray pushed a commit that referenced this pull request Nov 19, 2026
…odel unsigned (#37629)

MiMo Code 0.1.17 is built on opencode and has the gap #37480 closed there. With no sign-in, no key and no model in its config, session/new puts the session on xiaomi/mimo-v2.6-pro-ultraspeed and the first prompt goes to Xiaomi's API with no Authorization header. Crew did not stop it: the start-time refusal ran for opencode only.

Following #37602's split, a new MimocodeAcpClient (acp/client_mimocode.py, bound from client_mimocode_session) fills the _refuse_harness_default_model hook; AcpClient(acp_backend="mimocode") now builds it. It refuses when the session's model and every advertised model are xiaomi/ ones, the harness config names no model, and no Xiaomi credential is present. A signed-in host advertises the very same models, so MiMo Code's read-back records that last fact: the sign-in file the auth declaration names (under XDG_DATA_HOME or HOME), XIAOMI_API_KEY or MIMOCODE_AUTH_CONTENT in the child's environment, or a provider.xiaomi.options.apiKey in the resolved config. The file is checked for existence only and never opened; the key is checked for presence and never logged. A signed-in host, a model named in mimocode.json, a Crew pin, or a provider of the operator's own is left alone.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
(cherry picked from commit c7c9357)
buluoray pushed a commit that referenced this pull request Nov 19, 2026
…odel unsigned (#37629)

MiMo Code 0.1.17 is built on opencode and has the gap #37480 closed there. With no sign-in, no key and no model in its config, session/new puts the session on xiaomi/mimo-v2.6-pro-ultraspeed and the first prompt goes to Xiaomi's API with no Authorization header. Crew did not stop it: the start-time refusal ran for opencode only.

Following #37602's split, a new MimocodeAcpClient (acp/client_mimocode.py, bound from client_mimocode_session) fills the _refuse_harness_default_model hook; AcpClient(acp_backend="mimocode") now builds it. It refuses when the session's model and every advertised model are xiaomi/ ones, the harness config names no model, and no Xiaomi credential is present. A signed-in host advertises the very same models, so MiMo Code's read-back records that last fact: the sign-in file the auth declaration names (under XDG_DATA_HOME or HOME), XIAOMI_API_KEY or MIMOCODE_AUTH_CONTENT in the child's environment, or a provider.xiaomi.options.apiKey in the resolved config. The file is checked for existence only and never opened; the key is checked for presence and never logged. A signed-in host, a model named in mimocode.json, a Crew pin, or a provider of the operator's own is left alone.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
(cherry picked from commit c7c9357)
buluoray pushed a commit that referenced this pull request Nov 19, 2026
…odel unsigned (#37629)

MiMo Code 0.1.17 is built on opencode and has the gap #37480 closed there. With no sign-in, no key and no model in its config, session/new puts the session on xiaomi/mimo-v2.6-pro-ultraspeed and the first prompt goes to Xiaomi's API with no Authorization header. Crew did not stop it: the start-time refusal ran for opencode only.

Following #37602's split, a new MimocodeAcpClient (acp/client_mimocode.py, bound from client_mimocode_session) fills the _refuse_harness_default_model hook; AcpClient(acp_backend="mimocode") now builds it. It refuses when the session's model and every advertised model are xiaomi/ ones, the harness config names no model, and no Xiaomi credential is present. A signed-in host advertises the very same models, so MiMo Code's read-back records that last fact: the sign-in file the auth declaration names (under XDG_DATA_HOME or HOME), XIAOMI_API_KEY or MIMOCODE_AUTH_CONTENT in the child's environment, or a provider.xiaomi.options.apiKey in the resolved config. The file is checked for existence only and never opened; the key is checked for presence and never logged. A signed-in host, a model named in mimocode.json, a Crew pin, or a provider of the operator's own is left alone.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
(cherry picked from commit c7c9357)
buluoray pushed a commit that referenced this pull request Nov 19, 2026
…odel unsigned (#37629)

MiMo Code 0.1.17 is built on opencode and has the gap #37480 closed there. With no sign-in, no key and no model in its config, session/new puts the session on xiaomi/mimo-v2.6-pro-ultraspeed and the first prompt goes to Xiaomi's API with no Authorization header. Crew did not stop it: the start-time refusal ran for opencode only.

Following #37602's split, a new MimocodeAcpClient (acp/client_mimocode.py, bound from client_mimocode_session) fills the _refuse_harness_default_model hook; AcpClient(acp_backend="mimocode") now builds it. It refuses when the session's model and every advertised model are xiaomi/ ones, the harness config names no model, and no Xiaomi credential is present. A signed-in host advertises the very same models, so MiMo Code's read-back records that last fact: the sign-in file the auth declaration names (under XDG_DATA_HOME or HOME), XIAOMI_API_KEY or MIMOCODE_AUTH_CONTENT in the child's environment, or a provider.xiaomi.options.apiKey in the resolved config. The file is checked for existence only and never opened; the key is checked for presence and never logged. A signed-in host, a model named in mimocode.json, a Crew pin, or a provider of the operator's own is left alone.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
(cherry picked from commit c7c9357)
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.

2 participants