Skip to content

feat(robot_simulation): show createPythonCSE's code in the tab's editor - #989

Merged
martin-henz merged 4 commits into
masterfrom
robot-simulation-show-control-code
Oct 8, 2026
Merged

martin-henz merged 4 commits into
masterfrom
robot-simulation-show-control-code

Conversation

@martin-henz

@martin-henz martin-henz commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Closes #988.

What changed

  • createPythonCSE(code) now also sends code to the RobotSimulation tab over the state channel (new editor-code message). The embedded editor shows it, overwriting whatever it held, including text restored from localStorage.
  • The module remembers the latest text and replays it on request-replay, so a tab that connects after setup ran still gets it.
  • Running code from the embedded editor ($runReplCode) now stops the createPythonCSE program, so the editor shows what is running instead of a second program driving the robot alongside it.
  • createPythonCSE keeps its name and call shape: addControllerToWorld(createPythonCSE(CODE), world).
  • A robot runs one program at a time, so createPythonCSE may only be called once per simulation; a second call throws. (Addresses the Codex review.)
  • run_robot_code (the repl-module hook) and the now-unused $focusTab RPC are removed, so there is one way to run robot code: createPythonCSE (runs on init_simulation, shown in the editor) or the tab's embedded editor. Breaking: set_evaluator(run_robot_code) no longer works.

Testing

  • robot_simulation tests: 135 pass, including 5 new ones (message sent, replay on reconnect, second call rejected, nothing sent before a program exists, editor Run stops the setup program).
  • Bundle tsc passes. ESLint is unchanged from master for the touched directories.
  • Not tested: the tab side (no tab tests exist) and the real app. The tab change is a useEffect that copies the pushed text into the editor and a localStorage write.
  • Bundle yarn build currently fails on master as well, with an acorn SyntaxError, so I couldn't build it. The tab's tsc reports errors that come from the missing bundle build output.

🤖 Generated with Claude Code

martin-henz and others added 3 commits October 7, 2026 14:38
createPythonCSE now sends its program text to the RobotSimulation tab,
which shows it in the embedded editor (overwriting any text restored from
localStorage), so the editor shows what is running. The module replays the
latest text to a tab that connects after setup. Running code from the
embedded editor now replaces the createPythonCSE program instead of
driving the robot alongside it.

Closes #988

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
With createPythonCSE running its code on init_simulation and showing it in
the tab's editor, run_robot_code (the repl-module hook) is a second way to
do the same thing. Code is now run either via createPythonCSE or from the
tab's embedded editor. $focusTab was only ever sent from run_robot_code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@martin-henz

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T06:51:56.833457Z 0d8299a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d8299a295

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/bundles/robot_simulation/src/index.ts
A robot runs one program at a time. Tracking only the latest createPythonCSE
Program meant an earlier one kept running next to editor code. A second
call now throws instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@martin-henz
martin-henz merged commit 6ad0fd5 into master Oct 8, 2026
12 checks passed
@martin-henz
martin-henz deleted the robot-simulation-show-control-code branch October 8, 2026 11:11
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.

robot_simulation: no way to show or preset the robot's control code in the RobotSimulation tab

1 participant