Repository navigation
fix(engine): reject indirect task re-entry - #941
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Session guard and task execution crates/engine/src/lib.rs, crates/engine/src/cmd/items.rs |
Session now tracks whether a task is running. run_task rejects re-entry, catches panics, clears the guard after execution, and delegates step execution to run_task_steps. |
Re-entry, cleanup, and rollback tests crates/engine/src/tests.rs, crates/engine/src/tests/task_reentry.rs |
The registered tests cover script and notebook re-entry, task validation, panic cleanup, project replacement, transaction rollback, and undo and redo behavior. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant run_task
participant run_task_steps
participant ScriptOrNotebook
run_task->>run_task_steps: Execute task steps
run_task_steps->>ScriptOrNotebook: Run script or notebook path
ScriptOrNotebook->>run_task: Attempt nested task execution
run_task-->>ScriptOrNotebook: Return already-running error
run_task->>run_task: Clear task_running after execution
Suggested labels: ci:windows
Suggested reviewers: giswqs
Merge Risk: 
Minimal · up to 1d32d
-
No merge-blocking issue was identified; merge after normal checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 3 files. (1 skipped: 1 too large.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the task is clear,
Then hops through steps with care.
If scripts call back, the guard says no,
And clears its mark when runs are through.
Undo keeps the map in view.
Comment @coderabbitai help to get the list of available commands.
Code reviewI read the diff and the surrounding What I checked
Quality (minor, low confidence)
Change sizeCompared: the whole PR against main (merge base 096e60e to PR head 1d32db1)
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
A locally created task can run a script that calls
task.runagain. Task stepsreject direct
task.*commands, but this indirect path repeatedly invokes thecommand function pointers until the process overflows its stack. The outer
Session::runtransaction does not bound that call chain.Add a session-local task-running guard, following the existing notebook guard.
Indirect re-entry returns an error with the task-step and script-line context;
the marker clears on success, error or a caught panic and stays active across
project replacement. Command IDs, parameters, project files and imported-task
restrictions stay unchanged.
This extends the existing task-to-task restriction to indirect calls: even a
finite Task A → Script → Task B chain is refused. Ordinary Script → Task and
Task → nonrecursive Script remain supported. The existing outer undo/rollback
and notebook cell-error behavior are preserved; this adds no atomicity guarantee
for external I/O.
Minimal reproduction using public commands:
Testing
step, project/edit-count rollback, existing refusals, panic cleanup, project
replacement and notebook paths. Also ran 8 existing related regressions,
including
hostile_params_never_panic.reproduced baseline stack overflow (
0xC00000FD). After the fix, that casereturns the expected command error; it and three control cases exit normally.
-D warnings, Engine formatting,cargo xtask layersand the Engine wasm32 library check pass.These results apply to the patch based on
096e60e0. Full workspace CI,macOS/Linux runtime tests and the complete Web App build have not been run.
No UI or dependency changes.
Related issue
None. No directly overlapping open issue or pull request was found in the latest
check. Maintainer review is welcome on extending the existing no-nested-tasks
policy to indirect calls, including finite chains between distinct tasks.
Summary by CodeRabbit