MiMo-Code icon indicating copy to clipboard operation
MiMo-Code copied to clipboard

Bug: Image Read cross-wires paths (global, graded) — main session terminal after compaction+volume; sub-agents intermittent

Open NMDX0721 opened this issue 2 months ago • 2 comments

## SummaryIn a single MiMo Desktop main session, the image Read tool progressively corrupts: parallel batch reads return the wrong image for a given path, then single reads return wrong images, and finally any image path (including brand-new files generated moments earlier) replays a small set of previously read images from that session. The session had undergone a provider-overflow compaction.Sub-agents (actor) spawned from the same session read images correctly (user-confirmed), so this is session-level state corruption, not a global renderer outage.## Environment- App: MiMo Desktop (win32)- Session: 「校外」 (AP Physics C 笔记还原) — experienced compaction (provider overflow) earlier in the session- OS: Windows- Date: 2026-09-25## Symptom progression (same session)1. Early: normal.2. Mid: parallel batch Read of multiple images — returned images do not match requested file paths (request A → get B; multi-image calls systematically swapped).3. Worse: even a single Read returns the wrong image.4. Terminal: Read of any image path — including a file just written by Python and never read before — loops the same few old images previously read in this session (cropped variants, etc.) and never loads the requested file.## Key evidence| Observation | Implication ||---|---|| Child agents spawned from this session read images correctly | Failure is session-scoped, not process-wide render service || New file paths still hit old images | Request likely never reaches the render path; session replays recent image attachments under a wrong cache/route key || One step: 4× 1500px images in parallel × multiple batches | Race may have corrupted the session's image slot table || Same path overwritten → Read returns old content | Cache does not invalidate on mtime / content hash |Timeline reference: early session (parallel batch of 22 photos) OK → batch QA screenshots began mis-association → finally any new image read returns old crops.## Impact- Cannot perform any visual verification in the main session.- Workaround: spawn sub-agents to read images, or ASCII rendering.## Expected- Read returns the bytes for the requested path.- Parallel multi-image calls do not cross-associate results.- Overwriting a file at the same path invalidates any prior image cache (mtime/hash).- After compaction, image routing/cache keys remain consistent.## ActualCross-wired images, then sticky stale images for all paths including brand-new files.## Suggested investigation1. Session-level image attachment cache key and routing table (especially after compaction).2. Invalidation policy on parallel multi-image tool calls (race on shared slots).3. Invalidation on same-path overwrite (mtime / content hash), not path alone.4. Whether compaction rebuilds message parts but leaves a stale image index.## Reproduction materialsThis session (AP Physics C 笔记还原 / 「校外」) contains the full mis-association history.## Labelsbug, desktop, tools

⚠️ Correction (see also comment): sub-agents also affected

Sub-agents are NOT fully OK. Cross-wiring also occurs in spawned actors, with graded severity:

  • Main session (post-compaction, high parallel image volume): terminal — any path replays old images.
  • New sub-agent (clean context): intermittent — first read often correct; retries may return previous file; recoverable via retry / size cross-check. Some check agents abandoned Read for Python pixel/ASCII.

Revised root-cause fit: global cache/routing key-mismatch that worsens with image-call volume; compaction likely accelerates, not sole cause. Same-path stale-cache clue unchanged.

NMDX0721 avatar Sep 25 '26 13:09 NMDX0721

Correction (2026-09-25): sub-agents are NOT fully OK

Earlier report said child agents read images correctly. That was too strong. Sub-agents also show cross-wired Reads, just milder than the main session.

Sub-agent reports (verbatim, translated context)

Check group Report
Group 1 Read tool returned images that did not match the filename (crop / re-read photo mix-up); first full-image read was trustworthy
Group 2 Repeated Reads of different PNGs may return the previous file’s content; had to cross-check with file size / repeated reads
Group 4 Cross-wiring severe enough to abandon Read; switched to Python pixel stats / ASCII rendering

Revised failure profile — global defect, graded severity

Context Severity
Main session (after compaction + hundreds of parallel large-image reads) Terminal: any new path replays a small set of old images; Read unusable
Newly spawned sub-agent (clean context, low image volume) Intermittent: first read often correct; mismatch appears on retries; recoverable via retry / size cross-check

Impact on investigation

  • Do not treat this as only “session state corrupted after compaction.”
  • Better fit: image cache/routing has a key-mismatch bug that accumulates with image-call volume in a conversation; compaction may accelerate degradation rather than being the sole root cause.
  • Stale content on same-path overwrite (no mtime/hash invalidation) still holds as a separate clue.

Please update triage accordingly (#2544 body’s “sub-agents OK” claim is obsolete).

NMDX0721 avatar Sep 25 '26 14:09 NMDX0721

Additional clues from sub-agent workarounds (high diagnostic value)

Two new reproducible patterns observed while working around the bug:

1. “One-behind” / FIFO skew (strong evidence of off-by-one delivery)

  • First Read of a new path often returns the previous request’s image.
  • Immediately Read the same path again → correct image arrives.

This is not random cache hits — it looks like request/result queues shifted by one slot (results delivered to the wrong waiter). Matches classic FIFO / promise-pairing off-by-one.

2. Correlates with image size / encode time

  • Larger JPEGs (> ~150KB compressed) cross-wire more often.
  • Downscaling with PIL to < ~120KB before Read markedly improves success rate.

Hypothesis: mis-pairing happens on the async completion path — slow encode/render results get attached to later requests. After many skew events the main session’s queue is fully desynced (terminal “replay last N images” loop); a fresh sub-agent has a short queue so only intermittent lag.

3. Practical mitigations verified (sub-agent workflow)

  1. Shrink image (<120KB) before Read.
  2. Discard first Read; re-read same path (absorbs one-behind skew).
  3. Cross-check with in-image watermark / file size / pixel stats.

Suggested impact on triage

If root cause is queue index skew or promise mis-pairing, these two signatures (off-by-one + size/latency correlation) should point fairly directly at the result-delivery code path rather than at compaction-only session state.

NMDX0721 avatar Sep 25 '26 14:09 NMDX0721