Files
hx/docs/adr/0025-codemode-execution-model.md
T
johannesandClaude Sonnet 5.5 a94632ea3d chore: delete code comments, add ratchet lint and ADRs
Classify every comment as tautology, stale, excuse or decision record.
Tautology/stale/excuse comments are deleted (excuses filed as issues
#196-#236), decisions moved to docs/adr/0001-0034.

- scripts/lint-comments.sh + .comment-baseline: per-file comment count
  may only go down; wired into tests/all.sh
- .claude/skills/delete-comment: repeatable audit workflow
- cargo fmt applied to touched crates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 13:37:32 +01:00

905 B

Codemode execution model

Status: accepted

Context

The model writes JS run in QuickJS; only script output reaches the model. QuickJS values are not Send. The interrupt handler only fires while JS runs, not while awaiting tools.

Decision

Inner calls go through Registry::call so the permission gate and shared State (read-before-edit, edit log) apply. Each script runs on its own thread with a local runtime. Waiting for a free worker counts toward the timeout; time spent awaiting tools is bounded separately. The run stops when the script settles and unawaited calls are cancelled. Store writes apply only to successful scripts. MCP tools are listed first so builtins cannot push them out of the listing budget.

Consequences

Scripts cannot bypass permissions; failed scripts leave no partial store state.

Code: crates/hx-tools/src/codemode.rs (module, run, tool listing, store handling)