Skip to content

fix(mimo): preserve canonical data when injecting status hooks - #9133

Closed
BluesYoung-web wants to merge 7 commits into
stablyai:mainfrom
BluesYoung-web:fix/mimocode-config-overlay
Closed

BluesYoung-web wants to merge 7 commits into
stablyai:mainfrom
BluesYoung-web:fix/mimocode-config-overlay

Conversation

@BluesYoung-web

@BluesYoung-web BluesYoung-web commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace the native MiMo MIMOCODE_HOME hook sandbox with a PTY-scoped MIMOCODE_CONFIG_DIR overlay
  • preserve MiMoCode's canonical auth, sessions, memory, cache, state, and SQLite ownership while retaining /hook/mimo-code status reporting
  • keep user config/plugins visible, fail open to the original config, and harden overlay construction/cleanup against aliases, symlinks, stale entries, and concurrent PTYs
  • prevent native host overlay metadata from leaking into SSH or WSL; target-host MiMo overlay installation remains for follow-up integration with fix: restore worktree status and resource indicators #9048

Fixes #9132.

Related to #9048, which adds MiMo lifecycle and WSL/SSH plugin materialization. That PR should reuse this config-only ownership contract rather than creating complete temporary MIMOCODE_HOME directories with fresh data/cache/state.

Root cause

MiMoCode 0.1.6 resolves credentials from <Global.Path.data>/auth.json. Orca currently sets MIMOCODE_HOME only to install a config plugin, which also redirects data, cache, and state into an Orca-owned home. The current materializer mirrors config but leaves the new data directory without the canonical credential.

The UI can start normally while the first provider request fails because the redirected process no longer sees the canonical auth store.

Architecture

The native integration now owns only:

<Orca userData>/mimocode-config-overlays/<pty-id-hash>/
├── <mirrored user config entries>
└── plugins/
    ├── <mirrored user plugins>
    └── orca-mimocode-status.js

It exports the overlay through MIMOCODE_CONFIG_DIR. It does not set or clean MIMOCODE_HOME, and excludes auth/runtime-state names from config-root mirroring.

Each PTY receives a hashed directory. Ownership records bind the PTY to the real overlay root identity, make repeated construction idempotent, and ensure teardown cannot delete aliased user paths or a target whose ancestor was replaced.

Scope

This draft implements and verifies native local/daemon behavior. It deliberately does not create a MiMo overlay for SSH or WSL yet:

  • SSH keeps the remote host's canonical MiMo environment and strips host-only overlay markers.
  • WSL does not receive a Windows-host MiMo overlay; daemon-inherited host values are removed while an explicitly supplied guest config remains intact.

PR #9048 has the target-host relay/WSL plumbing needed for full coverage. The intended integration is to materialize this same config-only overlay on the execution host.

Security audit

  • no auth.json, API key, provider token, data directory, memory, session store, or SQLite file is copied, logged, or committed
  • config-root runtime names and SQLite sidecars are excluded case-insensitively
  • writable overlay directories must be real directories, not symlinks/junctions
  • source/target equality, nesting, and realpath aliases fail open to user config
  • best-effort cleanup must leave an empty target before any writes
  • teardown only deletes an overlay recorded as owned by that PTY and still rooted at the same real directory

Testing

Fresh verification after merging current upstream main (1.4.144-rc.4):

  • pnpm typecheck passed
  • targeted Vitest matrix: 8 files, 613 tests passed
  • real MiMoCode 0.1.6 contract probe passed:
    • overlay plugin loaded
    • provider status unchanged
    • canonical data/config/state paths unchanged
    • canonical credential path unchanged
    • real model request succeeded
    • no canonical runtime state appeared in the temporary overlay
  • git diff --check passed
  • pnpm lint reaches the upstream type-aware switch gate with 0 regular lint errors, then reports two current-main exhaustiveness errors in files untouched by this PR:
    • src/renderer/src/components/native-chat/native-chat-session-option-labels.ts
    • src/renderer/src/components/skills/skill-freshness-group.tsx

Probe command:

node config/scripts/probe-mimocode-config-dir.mjs

The probe never reads or prints credential contents.

ELI5

MiMo agent status hooks were overwriting MiMo’s real config and session data. Orca now uses a safe temporary overlay for hooks so auth, sessions, and cache stay intact while status reporting still works.

@nwparker

Copy link
Copy Markdown
Contributor

Thanks @BluesYoung-web — your report and this PR shaped the fix. #9132 is now fixed by #33668 (merged, with you credited as co-author). Closing as superseded. If you can retest on the next release, a quick confirmation on #9132 would be great.

@nwparker nwparker closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MiMo agent home overlay hides canonical auth and runtime data

2 participants