Code-mode cell edits never reach the editor, and the stale editor code overwrites them

Aperta
#11,166 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@manzt ci sta già lavorando.

Dal 9/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug
Describe the bug

Context: the edits are made by an AI coding agent (Claude Code, through the marimo-pair skill). It runs code in the kernel's scratchpad and changes cells with marimo._code_mode. A person has the same notebook open in the browser at the same time.

Steps to reproduce

  1. Open nb.py in the browser.
  2. From the scratchpad, edit and run an existing cell:
async with cm.get_context() as ctx:
    ctx.edit_cell(cid, code=new_code)
    ctx.run_cell(cid)
  1. Reload the browser tab.

Expected: the cell editor shows new_code, both after the edit and after the reload.

Actual

  • After step 2: the output, the file on disk, ctx.cells[cid].code and ctx.graph.cells[cid].code all reflect new_code. The cell editor in the browser still shows the old code.
  • After step 3: the editor still shows the old code. ctx.cells[cid].code has gone back to the old code, while ctx.graph.cells[cid].code keeps new_code.
  • Running or saving from the tab: this writes the old code back to the kernel and the file, silently undoing the agent's edit.
  • Workaround: only a server restart fixes it, since the new session loads from disk.

It happens on every attempt and has repeated over several sessions.

Will you submit a PR?
  • Yes
Environment

marimo 0.25.1, Python 3.14, macOS, Chrome Version 154.0.8037.98 (Official Build) (arm64). It happens with marimo edit nb.py, with or without --watch, with or without watchdog installed.

Code to reproduce

No response

Lingua principale
Python
Stelle
22.9k
Fork
1.3k
Merge medio
1g 10h
PR unite (30g)
380

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di marimo-team/marimo

Tutte le issue di marimo-team/marimo

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.