refactor js_repl to reuse managed child process infra#13266
Closed
fjord-oai wants to merge 1 commit intofjord/js_repl_seq---4hwa73o5rjfj-vfrom
Closed
refactor js_repl to reuse managed child process infra#13266fjord-oai wants to merge 1 commit intofjord/js_repl_seq---4hwa73o5rjfj-vfrom
fjord-oai wants to merge 1 commit intofjord/js_repl_seq---4hwa73o5rjfj-vfrom
Conversation
This was referenced Mar 2, 2026
git-stack-id: fjord/js_repl_seq---4hxc_-tczpgzls git-stack-title: refactor js_repl to reuse managed child process infra
34d55ba to
d502cb1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change pushes the
js_replrefactor further toward the naturalunified_execreuse boundary without trying to collapse two different execution models into one abstraction.The result is:
js_replnow reuses shared sandbox selection / transformjs_replnow reuses shared managed child process lifecycleunified_execnow has a small internal cleanup so merged-output and split-output exec-env spawns share one private implementationThis keeps
js_repl’s kernel protocol, per-exec_idpolling, and async tool-call handling intact, while removing low-level process/sandbox duplication.What Changed
SandboxAttempt::initial_for_turn(...)use_linux_sandbox_bwrapjs_replkernel startupExecRequestthrough the shared sandbox pathunified_exec_managerUnifiedExecProcesslifecycle handlingManagedSplitProcessjs_replaccess to the shared managed child layer without forcing it into the merged-output APIunified_execexec-env spawn helpersopen_session_with_exec_env(...)open_split_pipe_session_with_exec_env(...)Rationale
The original
js_replimplementation duplicated logic that already exists in or adjacent tounified_exec:Those are the parts that are expensive to get right and worth centralizing.
At the same time,
js_replis not just “anotherunified_execsession”:exec_ids over one processRunToolrequests while an exec is runningSo the goal here is not “make
js_repla thin wrapper overexec_command/write_stdin”.The goal is “reuse the shared substrate where the abstractions actually match”.
Why Not Reuse All of
unified_exec?We can reuse the managed-child substrate, but not the whole
unified_execprocess model.unified_execis process-centric:js_replis exec-centric inside a persistent kernel:exec_ids within one kernellogs,output,content_items,done,error)ExecResultRunToolround-trips while an exec is still activeThat means:
write_stdinpolling / generic unified-exec completion semantics: not a good fitTrying to force
js_replthrough that API would likely produce an abstraction that is technically shared but harder to reason about on both sides.git stack
1Add feature-gated js_repl polling flow #106732Add multimodal outputs to js_repl polling #130813refactor js_repl to reuse managed child process infra #13266