Skip to content

fix(runtime): preserve execution and context continuity - #1236

Merged
XuPeng-SH merged 1 commit into
mainfrom
fix/1234-execution-continuity
Nov 8, 2026
Merged

XuPeng-SH merged 1 commit into
mainfrom
fix/1234-execution-continuity

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Capability assessment: Updated: Web omits shell task controls that the edge-owned registry cannot serve; the MOI Gate contract is unchanged.

Long-running commands and large conversations could lose continuity: work was difficult to observe and stop, context pressure could end a turn without useful compaction, and a late background notification could restart a run after Astra had answered. This change extends the existing task, context and run owners so observations, continuation and cancellation stay coherent.

Changes

  • Keep one shell process and task identity through foreground waits, background handoff, input, output and cancellation. Continue bounded live output even if the retained capture reaches its limit or encounters an I/O error; indicate when history is incomplete. Preserve useful unterminated diagnostics with credential redaction and a warning for lossy text.
  • Compact measured context pressure while retaining the current tool continuation, user constraints and canonical context recovery.
  • Deliver task updates to an active turn at its next model boundary. After a final answer, show late updates and carry them into the next user message; only an explicit Work start schedules its own continuation.
  • Normalize typed interruption facts before the canonical terminal transaction, so durable receipts, cancellation races, replay and client projections agree. Preserve classified provider errors and meaningful child-failure details.
  • Reconcile subagent receipts, live events and snapshots by immutable run identity. Waiting for a result does not itself create or cancel a child; unknown identities do not change another run.
  • Keep child capabilities within the parent's authority, preserve existing plan/session ownership and leave the MOI Gate contract unchanged. The Web capability surface does not advertise shell controls the edge-owned registry cannot serve.
  • Test the real two-stage interactive script through the existing offline executor, including fragmented output and revision-based waits. Align the live harness prompt with the specific tool settings required by its unchanged six-step witness.
  • Run the existing PR metadata workflow locally before creating or editing a PR, and teach the repository development skill to preserve and validate the required capability assessment.

Related to #1234. Do not close it on merge: distributed 1,000-user active-load and multi-Server callback acceptance remain unverified.

Validation

  • The previous head passed MOI fresh-Astra compatibility and online integration. The shared CLI test job failed two draw tests whose result fixtures omitted the now-required run identity; corrected fixtures verify both identity and completed status. The live interactive-shell case also failed; its safe CI artifact cannot establish why the model missed the third witness step. Six local runs with the original prompt and three with the clarified prompt passed the unchanged strict six-step witness. This small sample does not establish the CI failure cause or guarantee future model behavior. The clarified prompt tests use of the specified API, with less coverage of autonomous tool-setting discovery.
  • Local regression: 207 affected tests from the prior update and 194 draw, agent and interactive tests for this update passed, covering identity/event ordering, concurrent children, fragmented output, real interactive processes, I/O errors, cancellation and credential redaction. The harness same-task witness and negative checks passed.
  • macOS arm64 ThreadSanitizer: 176 agent/TUI tests, 14 streaming-redaction tests and 11 capture-owner tests passed, including concurrent streams, quota exhaustion and injected I/O failure. The real 53 MB interactive case also passed with temporarily extended test-only deadlines; the committed deadlines are unchanged and the original test passed in normal mode.
  • Local formatting and workspace clippy checks, plus the directly affected final tests, are run against this update. Earlier PTY, MatrixOne, compaction and interruption validations remain listed in the PR's review history; they are not a distributed capacity benchmark.

@XuPeng-SH XuPeng-SH left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deep review of e8431ec8d8cc8249f2eb7784dc1eda9d12965459 (self-review of the follow-up): no further confirmed correctness defect found in the reviewed execution, planning, context recovery or tool-binding paths. The following findings from the review and CI investigation were fixed in this commit:

  • The 15 shared Linux CLI failures came from the libtest supervisor fixture leaking its own startup banner into the target's output, a process identity assertion using the supervisor PID, and treating an unknown outcome as a workspace-wide quarantine. Fixture filtering is test-only and handles chunk boundaries; user-visible identity is the stable task ID; an unknown effect remains explicit and non-retryable while unrelated inspection remains possible.
  • Local Auto planning now follows the same approval policy as Server and still honors explicit review; keeping an existing permission mode no longer stages an unnecessary mode change. The Server's plan-write diagnostic now describes the actual policy.
  • A process launched without stdin no longer exposes an input API that panics. Native and shell callers handle the actual capability.

The implementation reuses the existing process owner and task registry; it removes old execution/adoption paths and adds no hot-path SQL. Relative to current main, the PR changes 89 files (+5,989/-6,846); test and documentation additions do not explain away the implementation changes. There were no pre-existing PR review comments to reconcile.

Validation on this source: complete CI-equivalent CLI inventory 5,174 passed / 20 skipped; sandbox 218 passed; Server plan gate 6 passed; all 15 original failing cases plus two controls passed; three tests used the production supervisor; workspace all-target check, relevant strict Clippy and formatting passed. The current CLI and Edge passed six fresh-Server integration scenarios against isolated MatrixOne 4.2.8 and Memoria with a mock provider. The new-head GitHub CI completed with 37 successful, four skipped and one neutral check run; none failed or remained pending.

Remaining validation gap: the 1,000-waiter observation exercises one physical process, and the separate 1,024-waiter test uses 32 synthetic registry tasks. Neither establishes the issue's requested 1,000 independent sessions/tasks or multi-server capacity. That broader scalability acceptance remains unverified.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deep review of e8431ec8d8cc8249f2eb7784dc1eda9d12965459. This review supersedes my previous statement that there were no further confirmed correctness defects. CI is green, but these user-facing and concurrency problems should be fixed before merging:

  1. [P1] Do not advertise background continuity without an owner that survives the turn. The non-TUI stream constructs a per-turn executor and only attaches a shared task registry when p.background_tasks is supplied, while the capability is now advertised unconditionally and one-shot/print contexts supply None. The private registry owns the JoinSet, so dropping that executor aborts its live task. I reproduced this at the public executor boundary: after bash(stdin=false, yield_time_ms=0) started sleep 0.4; ..., dropping the executor prevented the marker from being written and a successor executor returned not_found; retaining the original executor completed the same command. This is an executor-lifetime reproduction, not a full live CLI end-to-end run. A non-TUI user can receive a running-task receipt and then lose the work when the turn/process ends. The advertised capability must have a real owner through settlement, or this entrypoint must wait/report the unsupported lifetime truthfully.

  2. [P1] Align saved-output lifetime with the user-visible receipt and the retention owner. Every completed shell capture is retained, but registry pruning unlinks its files, including a full-output path already returned with instructions to reuse it. A public executor probe produced a 588,895-byte result with a saved-path receipt; after 130 subsequent small commands the same path no longer existed and read_file failed. Conversely, dropping three standalone executors left all three 1 MiB output files in their temporary namespaces: the per-registry quota no longer has a live owner to reclaim them. This can both discard evidence the model is relying on and accumulate orphan captures across short-lived sessions. Define one consistent lifetime for published results and temporary captures; a bounded quota must not silently invalidate a still-advertised path or stop accounting when the executor disappears.

  3. [P2] Avoid serializing unrelated task-output reads behind full-file projection. The process-wide cache mutex stays held while a cache miss reads and redacts the whole file, together with a process-wide two-slot admission queue. In a public-executor probe, four independent 16 MB outputs caused an unrelated already-cached 13-byte result to take 297 ms instead of 1 ms; the four large observations completed at 79/156/233/308 ms, consistent with serialization. A growing output invalidates the cache, so subsequent bounded tail requests repeatedly read and redact the entire generation. The existing 1,000-waiter test covers one shared projection and does not exercise unrelated active tasks or sessions. Keep bounded/redacted output, but avoid making one session's expensive projection block every other session.

  4. [P2] Distinguish an interactive task starting from one without stdin. A task ID can be returned before its process input is placed in the OnceLock, but an immediate task_input treats an empty slot as permanently unavailable and tells the model to launch a new interactive shell. On a two-worker runtime this occurred once in 200 immediate launch/input attempts; after 50 ms the same task accepted the same input. The current tests explicitly wait for the internal input slot before calling the public tool, so they miss this race. Do not suggest restarting potentially state-changing work when stdin is merely starting.

The PR's net change is 89 files, +5,989/-6,846. By file path, implementation/config is approximately +4,795/-6,444, separately named tests/fixtures +1,104/-395, and docs +90/-7; inline tests make the first category approximate. The ownership consolidation is directionally useful, but net deletion and green CI do not resolve the failures above. There were no new inline threads to reconcile. The previous review's 1,000-independent-session/multi-server capacity gap also remains unverified.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deep review of 1c1d97e2b0a198067a4849171038819a60c0da3e. The current checks, including regression / harness and MOI compatibility, are green, but the following user-facing problems should be resolved before merge.

  1. [P1] A background shell monopolizes the workspace for its whole lifetime. The invocation retains the workspace observation lease in the owned shell, and each other Bash request first acquires the same exclusive workspace lease. I launched a session-owned background command that waits on a file, then invoked printf other-command in the same workspace with a one-second timeout. It waited 1,002 ms and was rejected as workspace_unavailable without running, while the first task remained alive. Thus a long test/build can continue after yielding but prevents the parent or another session from starting even unrelated shell work, including work that would let the first task advance. This defeats the concurrent user journey in #1234. Reconsider the attribution/coordination boundary so background execution and independent work can coexist without weakening ownership or adding a command-name allowlist. The existing 1,024-waiter test uses synthetic registry tasks rather than concurrent real commands in one workspace.

  2. [P1] Interactive prompts without a newline disappear until the child exits. A live projection discards the entire unfinished last line. I launched a real stdin=true shell that printed Confirm? without a newline and then waited for input. Its captured file contained the prompt, but task_output returned No output yet, zero bytes and a running task. The user/model cannot determine what to answer; the command waits until timeout. Also, the blocking wait only waits for terminal completion or parent release, although the schema promises to wake for required input. The old redaction rule became an actual interaction blocker when this PR introduced targeted shell stdin. Provide an observable prompt/input path that preserves the existing secret-redaction boundary, and make the wait contract match its actual wake events.

  3. [P2] Incremental output can silently skip later stdout when stderr already exists. The combined projection inserts all stdout before the existing stderr section, while the updated schema explicitly recommends reusing next_offset for live incremental reads. In a real running-shell probe, the first snapshot was first\n\n<stderr>\nwarning\n\n</stderr> with offset 34. After the shell appended LATE_RECORD\n to stdout, observing from offset 34 returned only g\n\n</stderr>; the new record was never returned. A successful cursor therefore does not mean the caller saw the intervening output. Use an actually append-stable observation/cursor or stop advertising the existing rendered offset as an incremental cursor. Tests currently cover paging a settled, static projection, not interleaved live growth.

Previous review: the prior headless owner, published-output retention and stdin-readiness findings have corresponding changes. The cache change removes the mutex-held scan and separates warm/small reads from large cold reads, but a growing file still requires a full redacted projection for each generation; representative 1,000-independent-session/multi-server capacity remains unverified. The three findings above were exercised locally using the current execution owner; the cursor probe called the registry observation used by the public tool. The temporary review probes were removed afterwards.

Design and delta: reusing the process owner is the right direction and no normal Bash hot-path SQL was added. Nevertheless, carrying the exclusive workspace lease through the new background lifetime conflicts with the intended independent-work UX, and the output contract currently exposes an incremental and interactive capability that its projection cannot provide. Against current main, the PR is +7,653/-6,997 across 90 files. By path, implementation/config plus inline tests is +6,325/-6,676; separately named tests are +1,210/-305; documentation is +118/-16. These categories are approximate because many production files contain inline tests. Net deletion alone does not justify the remaining coordination and projection complexity.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deep review of cec7d22d71be4970a229151838472af626b502b8, against main at bebb535cef44c9b2a226b9cc57df75e9e778e0a8. Please do not merge yet: the interaction and failure-evidence paths below still strand the user/model. The local probes exercised the real ToolExecutor tools and process owner, not a live-provider end-to-end run.

  1. [P1] Interactive output with no trailing whitespace cannot be observed. The live projection exposes only text through the last whitespace. A real bash(stdin=true) running printf 'Password:'; IFS= read -r value had Password: in its capture and was waiting for input, but task_output(max_bytes=65536) returned only [Partial output withheld until the token is complete.]. No further output will arrive until the unknown input is sent, so this can last until the execution deadline. The existing journey test uses Confirm? with trailing whitespace and misses this boundary. task_output(block=true) also explicitly does not wake on prompt/output, so the original input-notification goal has been narrowed in documentation rather than fully demonstrated. Preserve credential-redaction guarantees while providing a general usable interaction path; do not special-case this particular prompt.

  2. [P1] A live stderr history can permanently hide newer stdout. The rendered projection concatenates all stdout before all stderr, but the default live observation selects the tail of that projection. In a real shell that first writes 96,000 bytes of warnings to stderr, then prints READY? on stdout and waits for input, even a 65,536-byte current snapshot contains no prompt. An explicit live offset=0 is rejected, and the live reference is only the task ID. The process cannot complete without input, so terminal pagination is not a practical escape. This is independent of finding 1: the prompt here ends with whitespace. Provide bounded observations of both streams, or a genuinely ordered bounded view, without restoring the incorrect live cursor.

  3. [P2] Incomplete capture is confused with an output stream that may still grow. For every terminal timeout/cancellation, output_settled stays false if the capture receipt says complete=false, so the same trailing-token rule applies permanently to final task output and diagnostic search. With printf 'failure-detail'; sleep 4 and a 1-second timeout, the captured artifact contains failure-detail, the task is terminal, yet task_output(offset=0) shows only the withheld marker and tells the model to search this task's captured output. Search uses the same unsettled projection and cannot find that text. A published file path exists, so this is not a claim of lost bytes; the advertised observation/diagnosis path omits the evidence that explains the failure. Distinguish the completeness of a process's output from whether the captured bytes can still change, while maintaining the redaction boundary.

CI / tests. The latest shared CLI job ran 5,194 tests: 5,192 passed and two failed. I reproduced both on this exact head locally: background_task_output_projection_reports_total_lines still expects a live next_offset, and current_snapshot_never_invites_live_log_pagination expects a historical offset from a fixture whose task is still running. These are deterministic test/contract mismatches, not a runner failure. The five Test: astra-cli (...) checks relay that shared failure. Separately, the real DeepSeek-v4.1-flash harness completed 17/18: flash_model_name_is_output passed the final-text check but failed its one-child adoption criterion with child_count_mismatch. The sanitized artifact does not establish whether this is extra model delegation, incorrect evidence, or a runtime regression; investigate the actual child identities before attributing it. It is not a model-502 failure.

Earlier comments. The lifetime-held workspace lock was removed and a real eight-executor overlap test was added. The headless owner, published-capture lifetime and stdin-readiness findings have corresponding changes. The old incremental cursor is no longer advertised on a running shell, but its replacement has finding 2; no-whitespace prompts leave the earlier interaction finding only partially fixed. There are no inline review threads.

Design and scale. One process/task owner, explicit failure facts and removing the workspace-wide lifetime lock are aligned with recent main's simplification. The redacted projection, separate stream concatenation, cache and snapshot rules currently add complexity without providing a reliable model/tool feedback channel in these cases. Relative to current main: 95 files, +8,240/-7,534 (net +706). By path, implementation/config including inline tests is +6,373/-7,066; separately named tests +1,734/-449; docs +133/-19. Test growth does not justify the production behavior by itself. No new normal Bash hot-path SQL was identified; the plan-exit transaction is a separate explicit path. A growing output still invalidates its cached projection and triggers a full redaction scan. The eight-executor test and prior waiter tests do not establish the issue's requested 1,000 independent tasks/sessions or multi-server performance and resource bounds.

Validation scope. Two temporary public-tool probes reproduced findings 1–3, then were removed; local source is unchanged. The local two-test CI reproduction failed as described above. This review does not claim a fresh full local live-model harness or a 1,000-session benchmark.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deep review of 7dec1adfad1c8d86e4fb95f328c41cddbd5bdc4f, against main at bebb535cef44c9b2a226b9cc57df75e9e778e0a8. Please address the following before merging:

  1. [P1] Preserve ordinary host-and-port URLs in live output. The streaming connection-credential expression makes @ optional, so it also matches ://127.0.0.1:3000 and ://example.test:8443/path even after a newline or slash proves that the authority has no user-info. In a real session-owned bash / task_output probe, a running service printed Listening on http://127.0.0.1:3000, but the public tool returned Listening on http[REDACTED:CONNECTION_CREDENTIAL]. The URL remains unusable while the service is running, precisely when the model/user needs it to test the service. Timed-out or cancelled incomplete captures also retain the streaming projection. Preserve actual credential secrecy while distinguishing a completed ordinary authority from an unfinished credential prefix; this needs general URL-boundary coverage, not an allowlist for localhost.

  2. [P2] Make subsequent interactive output waitable. wake_on_output returns immediately whenever any previous output exists, and live offset is rejected. In a real shell that prints first>, accepts input, waits two seconds and prints second>, the next task_output(block=true,wake_on_output=true,timeout_ms=4000) returned the old first> in 1.19 ms. The only other blocking option waits for terminal status, while this command is waiting for the second input. Consequently a multi-step interaction must busy-poll snapshots or miss the next prompt. The existing test explicitly asserts the repeated snapshot, so it does not cover this journey. The existing capture already exposes an output-activity revision; a caller-supplied last-observed revision or an equivalently simple race-safe contract could wait for new output without a per-observer state machine or SQL.

  3. [P2] Avoid scanning a ranged file twice on the async tool path. The new line-window implementation scans all redaction patterns over the full source, while read_file has already constructed a full redacted projection that the range branch does not use. With the exact old and new functions, one local debug-process comparison of the same benign 11 MB / 200,000-line file and a five-line range took approximately 1.09 s full + 0.10 s range on main, versus 1.11 s full + 1.13 s range on this head; a second run was comparable. This is a synthetic single-process measurement, not a production throughput benchmark. The path is synchronous inside the async read_file executor, so repeated range reads needlessly occupy a worker longer. Reuse one context-aware projection or avoid producing the unused full result while preserving cross-line credential protection.

Earlier feedback. The preceding review's ordinary unterminated first prompt, independently bounded stdout/stderr, and diagnostic visibility for a timed-out capture have corresponding fixes and targeted tests. The former lifetime-held workspace lock was removed; headless ownership, published-capture retention, and stdin startup now have owning paths. The first-prompt fix does not resolve finding 2's later-prompt wait. No inline or issue-comment threads were present at this head.

Design and scope. Consolidating shell ownership and removing the lifetime workspace lock fit the direction of recent main; the three failures above mean the user journey and its cost are not yet sound. This PR does not add normal Bash hot-path SQL; the plan-authoring transition is a separate explicit transaction. Against current main it changes 99 files, +12,654/-10,268 (net +2,386). By file location, 19 separate test/harness files are +2,086/-570, seven docs are +135/-19, and the other 73 source/config files are +10,433/-9,679; the last group includes inline tests. Neither test volume nor the net count resolves the design issues. Prior 1,000-waiter tests do not establish 1,000 independent tasks/sessions or multi-server capacity.

Evidence. Two temporary tests in a separate checkout of the exact head exercised the public CLI ToolExecutor and actual shell process; both failed as described (nextest run 9e283349-0aed-441d-a7af-bbc8402a5924). The paired redaction benchmark is described above. The current-head GitHub checks had no failures or pending jobs when inspected (four checks skipped); the previous isolated real DeepSeek regression ran 18/18. Those results do not cover the two new interaction journeys or prove the unmeasured concurrency target. The main working tree was not changed.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review: changes needed before merge

The direction of consolidating shell execution under an existing owner is useful, and I did not find a new SQL operation in the normal Bash execution path. However, the current head still loses or obscures execution evidence, and the claimed interactive regression coverage has a false-positive path. The performance design also needs evidence for independent sessions, not just many waiters on shared tasks.

  1. [P1] An unknown outcome can disappear before one-shot shutdown. The shutdown snapshot selects only executions whose completion is still pending, assuming a terminal result was already observed. A background Bash call may return only a task ID and then reach an unknown terminal outcome while the model does other work; it need not call task_output. If that happens before shutdown, the report has no unknown or unsettled entry, and the caller can treat shell settlement as confirmed. A temporary registry test using the real start/shutdown APIs and a simulated owner result reproduced an empty report. Preserve and surface unobserved unknown outcomes through the existing execution owner; a new global lifecycle or ordinary-path SQL is not needed merely to report the truth.

  2. [P2] Ordinary foreground commands can evict the only background result. Every shared foreground shell retains a task capture, and terminal retention counts these invisible foreground entries together with visible background tasks. Small completed output may have no separate published receipt. Using the public executor with the production cap of 128, one completed background task followed by 129 ordinary foreground commands made task_output for that background task return not_found. This couples unrelated work and retains needless captures. Review foreground ownership and result retention together rather than adding another registry.

  3. [P2] One slow preview blocks unrelated task previews, and active output is repeatedly rescanned. Output observations are collected with a batch-wide join, and no subsequent batch starts until that batch returns. The batch barrier predates this PR, but routing foreground shells through the shared registry and the limited large-output scan slots broadens its impact. In a controlled probe, holding both large-scan slots prevented a small READY preview in the same batch from being applied even though that small preview was independently available. This affects TUI observations; it does not establish that every direct task_output call blocks. In addition, an output-file generation change invalidates the projection cache and reads the file again, within its configured bound. This needs independent progress and measured aggregate CPU/I/O under growing output, not just bounded per-read memory.

  4. [P2] An interactive process can wait forever for input while its URL remains hidden. Pending URL authority redaction withholds an authority until a delimiter arrives. A real interactive Bash probe printed a local URL without a trailing delimiter and then waited for input; task_output showed only the pending-authority redaction, and no subsequent output can arrive until the user answers. The existing URL test covers a newline-terminated case. A general solution needs to make this state actionable while preserving credential protection: a partial authority can still become userinfo, so simply displaying it or allowlisting one hostname is not sufficient.

  5. [P2] The new CI harness case can pass when the shell actually fails. Its value-flow captures and final assertions search the complete rendered result, which includes the model-controlled, multiline task description. A real tool probe confirmed that a failed process can render the success strings in its title. A separate synthetic full-journal fixture with failed final status and those strings in the title passed the actual complete case criteria. Bind the assertions to the actual output and successful terminal status on the same task, and test that the oracle rejects a failure. This finding is a self-review of the case I added. The previously reported real DeepSeek/GLM runs did execute successfully, but their green result does not prove that this oracle would detect the failure.

Scalability, prior feedback, and change size

The prior feedback is not all resolved: the background-retention and unterminated-URL cases remain, and the shared observation barrier still has the coupling described above. The existing thousand-waiter tests cover many waiters on one process or 32 synthetic tasks, not 1,000 independent online sessions or multi-server operation. Before claiming that target, exercise idle and active workloads separately across multiple instances and measure memory, CPU, file descriptors, I/O, database activity, latency and behavior under slow tasks. The controlled slot-contention probe is not a 1,000-session load test. Avoid introducing per-session polling, duplicate ownership or extra hot-path SQL as a substitute for a scalable execution path.

Against current base, the PR changes 120 files (+15,249/-10,397, net +4,852). Approximate path-based accounting is source/config including inline tests +11,427/-9,744, dedicated tests/harness +3,669/-631, and docs +153/-22; moves inflate gross changes and inline tests limit precision. The consolidation has value, but the five remaining behaviors and the size of the affected surface justify another simplification pass, especially around capture lifetime and observation.

Validation for this review: targeted temporary tests reproduced each item above, including 129 real foreground shell executions and the real interactive URL path; the temporary probes were removed. GitHub's current regression/harness job is green, but the oracle limitation above narrows what that green means. I did not run a fresh full harness or a 1,000-independent-session/multi-instance benchmark in this review.

@XuPeng-SH XuPeng-SH left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deep review: changes needed

Reviewed head 76da93d03fb0b64a6c9963afb2a933fd88e49104 against main bebb535cef44c9b2a226b9cc57df75e9e778e0a8. Consolidating shell execution under one owner, preserving the original process during promotion, and removing the lifetime-wide workspace lock are the right direction. The current output-observation design and the new plan transaction still have concrete problems; please address these before merging.

  1. [P1] An incomplete live value can still prevent an interactive task from making progress. The output formatter replaces a trailing URL authority with URL_AUTHORITY_PENDING and suggests inspecting a local panel or making the program emit a delimiter. The existing real-shell test confirms that a program printing Open http://127.0.0.1:3000 without a newline and then waiting for input exposes neither the host nor port to the model. If the user asked the agent to use that address before answering, the program cannot supply a delimiter until it receives that answer. A headless CLI has no local task panel, and the current test sends a predetermined done before checking the URL, so it does not exercise that dependency. This is still open from the prior review. Provide a general authorized interaction/recovery path for incomplete output while preserving the credential boundary; do not special-case this example.

  2. [P2] Preserve live progress without repeatedly scanning the entire capture. Once a task exceeds 512 KiB, its TUI preview is replaced with a permanent pause message until the task ends. In a public-executor probe, a real interactive process wrote 530,016 bytes followed by READY_FOR_USER and waited for input; the task panel's current preview showed only the pause message. Its suggested task_output is a model tool, not an action in that panel, so the user must request another model turn or inspect a file outside the panel to see current progress. Meanwhile, an explicit observation of a growing file still re-reads and re-redacts the whole generation. On this machine, one real shell with 8.7 MB output took 70 ms for a cold 8 KiB snapshot, 1.4 ms for an unchanged cached snapshot, and about 69 ms after each of two tiny appends. This is a single-process debug-build comparison, not a distributed throughput benchmark. The independent-preview fix removes the old batch barrier, but disabling a user-visible feature and rescanning for explicit reads leaves the underlying observation design incomplete. Use a bounded, safely redacted observation path that preserves useful live progress without full-file work on each append.

  3. [P2] Use a consistent lock order for plan finalization and rebinding. finish_authoring locks the session row before updating the plan, while set_active_plan can update the same plan before updating that session. With two connections on a temporary MatrixOne instance, minimal tables with the same relevant primary keys and the repository's SQL order, finalizing a plan concurrently with rebinding that same plan to the same session produced ERROR 20701: deadlock detected on both transactions. This is a deterministic database-level interleaving, not a reproduction through two real CLI sessions. enter_plan_mode calls this rebinding path; the added database test exercises changed versions sequentially and does not cover the lock inversion. Establish one locking/atomicity order and add a concurrent real-database regression without adding a parallel plan owner or normal-turn SQL.

  4. [P2] Read live output from the capture that owns the task. The observation path reopens the stored filename, although the new capture owner already records the original directory and file identities. In a temporary public-executor test, after a separate operation under the same local account replaced a running task's stdout pathname with a symlink to a synthetic file outside the workspace, task_output returned that unrelated file as the command's live output with ok=true. The probe establishes the path-replacement precondition; it does not claim a cross-user attack. The old background reader on main also reopened by pathname, but the PR carries this behavior into the unified foreground/background owner. Observations should read the originally opened capture or atomically reject a changed identity, rather than trusting a second pathname lookup.

Earlier feedback and scale

The previous review's unknown-result retention, foreground eviction, and harness witness issues have corresponding fixes and targeted passing tests. Independent preview progress was fixed, but the repeated-scan concern remains as item 2. The unterminated-URL concern has a new advisory and human-panel path, but item 1 remains for headless and autonomous use. I found no unresolved inline review threads.

The requested topology is at least 1,000 users on separate CLI/Edge machines using multiple Servers. The existing single-host, 10-second idle connection simulation is not evidence of active distributed capacity or database throughput. A separate real-CLI two-Server A/B test on this head showed a callback routed to the other Server taking 54.985 s to unblock the owner, versus 153 ms when routed to the owner. The local-ledger/durable-result wait ordering and idle per-Edge SQL polling predate this PR; they are not regressions attributed to it, but they leave the stated multi-Server acceptance criterion open. Do not solve this by silently adding normal-path per-tool or per-session SQL polling.

Design, tests and documentation delta

The PR is +17,137/-10,739 across 121 paths, net +6,398. Approximate path-based accounting: source/config including inline tests +13,078/-10,169; dedicated tests and harness, including harness implementation, +3,891/-548; docs +168/-22. Moves inflate gross counts and inline tests prevent exact implementation/test separation. The added tests do not excuse the observation complexity: the current tests explicitly accept the paused preview and the predetermined-input URL path, while the negative harness fixtures do improve the earlier false-positive oracle. Documentation accurately describes those tradeoffs, but documenting them does not establish that the requested user journey works. The new plan-exit transaction is an explicit plan transition, not an added SQL operation for every ordinary Bash call.

Evidence

Five targeted CLI tests passed (nextest e2452c84-aefc-4d3a-8b19-c5f1ff60c44f), including unknown-result delivery, foreground retention, independent previews and the existing incomplete-URL test. The harness's same-task/negative-oracle test passed (nextest 3fc51380-a92c-4f35-84d8-8b4dfe0b36bd). Two temporary public-executor probes failed their intended assertions for replaced output identity and live TUI progress (nextest 0fb25874-75b0-4b8b-8618-5c6ef0fd19cf and 45ee8f53-fb8e-40b5-a105-1a5d3589e8fe); they used temporary synthetic files/processes and were removed afterwards. The MatrixOne lock-order probe used isolated temporary data, which was removed. Current-head CI has no failed checks, including the live regression harness; the earlier local GLM-5.3 result was 17/19 across two runs, not one clean 19/19 run. I did not rerun the full live harness or a multi-machine active-load test in this review.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changes requested

Reviewed head 52607d0d8f468b0082d58a5fb4a60322b29c9899 against main bebb535cef44c9b2a226b9cc57df75e9e778e0a8. The following are independently reproducible on this head and affect the stated execution/observation journey.

  1. [P1] Reconcile a recovered child's result wait with its durable run. A resumed UI can first receive the server's child row keyed by run_id, without the old spawn receipt or live start. A subsequent get_result start creates a separate row keyed by agent_id. The actual still-running timeout response contains agent_id but no run_id, so the new identity merge cannot join them. I replayed the real timeout renderer and widget reducer: after the durable snapshot changes to completed, the rows are (agent_id, no run_id, Running) and (run_id, run_id, Completed). Thus the original ghost-live symptom persists. Reuse the typed identity mapping from the owner/snapshot; cover this recovery ordering and concurrent distinct children, without inferring run IDs from display strings or adding a separate lifecycle.

  2. [P2] Do not discard a short unterminated diagnostic on timeout or cancellation. OutputPreview::finish discards the whole final line whenever capture is incomplete, even if it is short and contains no credential. Using the real public ToolExecutor without a shared task owner, printf 'specific diagnostic without newline' >&2; sleep 4 with a 0.5s timeout returned only the timeout and additional output is unavailable; the actual error was not present and no task-output reader exists. Inline-message, print and nested-script callers can take this foreground-only path. The old shell path returned captured partial output. Preserve safe evidence using the existing redaction owner and retain conservative handling of truly incomplete sensitive values; do not require replaying a possibly side-effecting command.

  3. [P2] Keep a current live tail after the capture quota is reached. CaptureWriter stops forwarding bytes to both the live redactor and activity revision once 50 MiB has been retained. A real interactive public-executor probe wrote slightly more than 50 MiB, then printed REVIEW_READY_AFTER_LIMIT and waited for stdin. A marker proved the process reached that prompt, but neither task_output nor the local task panel's raw tail contained it; both remained at the old captured prefix while the process was running. With output_complete=false, a revision-based wait also immediately reports output without new observable activity. The existing quota test checks only a process that finishes and that historical search declares incompleteness. Retain the storage cap, but keep an independently bounded, redacted recent live view and truthful activity signal so a long build or interactive process can still be inspected and advanced.

Prior comments, CI and validation

The previous plan lock-order and pinned-capture identity findings have corresponding changes and focused regression tests. The prior unterminated URL issue is not fully resolved for autonomous/headless interaction: the current test explicitly obtains the hidden value through local_input_preview, while the model-facing view withholds it. The documentation acknowledges this limitation. Whether that narrower case is deferred should be explicit; it is not evidence that all prior feedback is resolved.

The required regression / harness job failed on this exact head: 18/19 cases passed; interactive_shell_next_output did not meet its required interactive call/sequence. The available sanitized diagnostics show two Bash candidates with the required predicates split between them, but do not establish why the model chose those calls. Do not classify it as an infrastructure or flaky-model failure, or weaken the oracle, without the missing causal evidence. MOI fresh-Astra compatibility passed on this head.

The three findings were reproduced with temporary tests at the public executor/widget boundaries; the probes were removed. Six existing targeted tests for receipt merging, URL handling, terminal partial output, capture limits and file identity passed, showing why those tests do not cover the failing paths. No full live-provider harness or 1,000-independent-session/multi-Server active-load test was run for this review; the PR's stated distributed scale target remains unverified.

The change is 166 paths, +23,326/-15,878, net +7,448. Approximate path-based attribution: production/config including inline tests +18,034/-14,991; dedicated tests, harness and fixtures +5,080/-826; documentation +212/-61. Moves and inline tests limit precision. Consolidating process ownership and retaining typed outcomes are useful, but the live-output, identity and recovery paths still have avoidable correctness gaps. No new normal Bash hot-path SQL was established by this review; the plan-transition queries are a separate path.

@XuPeng-SH
XuPeng-SH force-pushed the fix/1234-execution-continuity branch from 52607d0 to 015db52 Compare November 8, 2026 15:55
Keep background work observable without starting a new turn after the assistant has answered. Normalize interruption facts before canonical terminal settlement so cancellation, replay, and child results agree.
@XuPeng-SH
XuPeng-SH force-pushed the fix/1234-execution-continuity branch from 015db52 to 4f14b80 Compare November 8, 2026 16:32
@XuPeng-SH
XuPeng-SH merged commit 5ecd944 into main Nov 8, 2026
41 checks passed
@XuPeng-SH
XuPeng-SH deleted the fix/1234-execution-continuity branch November 8, 2026 16:52
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.

1 participant