Skip to content

Skip cells marked disabled when building the execute-cells request (#154)#603

Merged
manzt merged 1 commit into
marimo-team:mainfrom
lazizbekravshanov:fix-issue-154-disabled-cells
Jun 24, 2026
Merged

Skip cells marked disabled when building the execute-cells request (#154)#603
manzt merged 1 commit into
marimo-team:mainfrom
lazizbekravshanov:fix-issue-154-disabled-cells

Conversation

@lazizbekravshanov

@lazizbekravshanov lazizbekravshanov commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Why

Cells authored as @app.cell(disabled=True) are executed by the VS Code extension, even though marimo's own frontend respects the flag. @manzt confirmed in #154 that disabled cells "aren't currently supported" in the extension and welcomed a contribution.

Root cause: extension/src/lib/extractExecuteCodeRequest.ts assembles the execute-cells request for both execution paths (NotebookControllerFactory and SandboxController), but its loop only skips cells without a stable id — it never consults the disabled config. The flag does survive the pipeline (marimo file → LSP deserialize → NotebookSerializer → cell metadata.options.disabled); I confirmed the wire format by running the server's own deserialize path, where a disabled cell arrives as options: { "disabled": true }.

What

  • Add an isDisabled getter on MarimoNotebookCell (metadata.options?.disabled === true), mirroring the existing isStale getter. No schema change — CellMetadata already types options as Record<string, unknown>.
  • Skip disabled cells in extractExecuteCodeRequest, fixing both call sites at the single choke point (rather than per-call-site, which would let a future call site silently reintroduce the bug).
  • Fix a latent bug the filter exposes: the if (codes.length === 0) branch called Option.none() without returning, so a selection of only-disabled cells would have sent an empty execute-cells request. It now returns Option.none(), which the controller already handles by stopping ("Empty execution request").

Evidence

extension/src/lib/__tests__/extractExecuteCodeRequest.test.ts (4 tests):

  • excludes cells disabled via @app.cell(disabled=True) (issue #154)fails before (expected [...'cell-disabled'] to not include 'cell-disabled'), passes after.
  • returns none when every selected cell is disabled — covers the empty-request branch.
  • 2 sanity cases (enabled cells included; id-less cells skipped).

Full just test-ts green (466 passed / 1 skipped, +4 from this PR), just lint (ruff + ty + TS) clean, just test-vscode integration suite green.

Manual (F5): in the Extension Development Host, a notebook with a normal cell and a @app.cell(disabled=True) cell, run all → the disabled cell produces no output while the enabled cell runs. Matches marimo's own frontend.

Issues

Closes #154.

Open question

Enforce at the extension layer (where the request is assembled, as here) or the LSP server layer? I chose the extension layer since that's where the request is built and this was framed as a missing extension feature — happy to move it if you'd prefer the server side.

Checklist

  • Unit tests added (regression + empty-request edge case)
  • just test-ts and just lint pass locally
  • just test-vscode integration suite passes
  • Manual end-to-end (F5) verified

@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@lazizbekravshanov lazizbekravshanov force-pushed the fix-issue-154-disabled-cells branch 2 times, most recently from c769c4b to f63bc4e Compare June 17, 2026 23:20
…cells request

Cells authored as `@app.cell(disabled=True)` were executed by the VS Code
extension, even though marimo's own frontend respects the flag.

`extractExecuteCodeRequest` assembles the execute-cells request for both the
notebook and sandbox controllers, but its loop only skipped cells without a
stable id -- it never consulted the disabled config, which does survive the
pipeline as `metadata.options.disabled`.

- Add an `isDisabled` getter on MarimoNotebookCell (`metadata.options.disabled`),
  mirroring the existing `isStale` getter.
- Skip disabled cells in `extractExecuteCodeRequest`, fixing both call sites at
  the single choke point.
- Return `Option.none()` from the empty-codes branch (it previously called
  `Option.none()` without returning), so a selection of only disabled cells no
  longer produces an empty execute request.

Covered by a regression test and an only-disabled edge-case test in
`extractExecuteCodeRequest.test.ts`.

Closes marimo-team#154
@lazizbekravshanov lazizbekravshanov force-pushed the fix-issue-154-disabled-cells branch from f63bc4e to cf5a2c7 Compare June 22, 2026 03:26
@lazizbekravshanov lazizbekravshanov marked this pull request as ready for review June 22, 2026 22:27
@lazizbekravshanov lazizbekravshanov requested a review from manzt as a code owner June 22, 2026 22:27
@lazizbekravshanov

Copy link
Copy Markdown
Contributor Author

Hi @manzt — opening this for #154 (disabled cells executing in the extension) as a first contribution. I traced it to extractExecuteCodeRequest, where the request loop never checked the disabled config; the fix skips disabled cells at that single choke point and adds a regression test, plus a fix for a latent empty-request branch it exposed.

One open question in the description: would you prefer this enforced at the extension layer (where I put it) or the LSP server layer? I didn't find a PR template or a PR-format note in CONTRIBUTING.md — happy to follow any convention you'd like. Thanks for taking a look!

@manzt manzt 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.

Sorry, I've been out on jury duty. I think this fix looks great.

In a follow up, we probably want some to reflect the disabled nature of the cells in the UI (and allow for enabling/disabling) but that can be a follow up.

@manzt manzt merged commit 619188e into marimo-team:main Jun 24, 2026
7 of 10 checks passed
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.

Extension runs cells marked as disabled

2 participants