Files
codex/codex-rs/core/src
Curtis 'Fjord' Hawthorne d6c8186195 Clarify js_repl binding reuse guidance (#13803)
## Summary

Clarify the `js_repl` prompt guidance around persistent bindings and
redeclaration recovery.

This updates the generated `js_repl` instructions in
`core/src/project_doc.rs` to prefer this order when a name is already
bound:

1. Reuse the existing binding
2. Reassign a previously declared `let`
3. Pick a new descriptive name
4. Use `{ ... }` only for short-lived scratch scope
5. Reset the kernel only when a clean state is actually needed

The prompt now also explicitly warns against wrapping an entire cell in
block scope when the goal is to reuse names across later cells.

## Why

The previous wording still left too much room for low-value workarounds
like whole-cell block wrapping. In downstream browser rollouts, that
pattern was adding tokens and preventing useful state reuse across
`js_repl` cells.

This change makes the preferred behavior more explicit without changing
runtime semantics.

## Scope

- Prompt/documentation change only
- No runtime behavior changes
- Updates the matching string-backed `project_doc` tests
2026-03-06 15:19:06 -08:00
..
2026-03-04 09:41:29 +00:00
2026-03-03 23:11:28 -08:00
2026-03-06 00:03:39 +00:00
2026-03-04 16:41:54 +00:00
2026-03-03 23:11:28 -08:00
2026-03-03 23:11:28 -08:00
2026-03-06 00:03:39 +00:00
2025-11-28 11:34:57 +00:00
2026-02-21 20:08:02 -08:00