Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
bdb04e9
docs(managed-agent): design H3 background Shell and Monitor runtime
wenshao Oct 3, 2026
2d70954
feat(core): add managed child_run (kind shell) record body for H3
wenshao Oct 3, 2026
3582607
feat(managed-agent): mirror child_run shell record body in Java store
wenshao Oct 3, 2026
8173837
test(core): commit and rebuild child_run shell chains through the ses…
wenshao Oct 3, 2026
007289f
feat(managed-agent): close child_run reference closure and add stop-r…
wenshao Oct 3, 2026
0c14259
feat(core): add named cgroup unit attach and managed child-run superv…
wenshao Oct 3, 2026
cddd231
feat(cli): admit v3 background shell under the supervised worker regi…
wenshao Oct 3, 2026
b144c4e
Merge branch 'main' into docs/h3-shell-monitor-design
wenshao Oct 3, 2026
72c5e2c
feat(core): add open-ended shell stream capture with manifest revisions
wenshao Oct 3, 2026
5a606b7
Merge remote-tracking branch 'origin/docs/h3-shell-monitor-design' in…
wenshao Oct 3, 2026
5cf54e8
fix(core): type-narrow stream capture finalize and refused publish do…
wenshao Oct 3, 2026
9c1437d
fix(cli): close background shell type gaps after the main merge
wenshao Oct 3, 2026
4fb9f0a
fix(managed-agent): answer the R1 review round on the child_run contract
wenshao Oct 3, 2026
b6dc42a
fix(managed-agent): repair the CI-only cgroup root and env-guard fail…
wenshao Oct 3, 2026
a13e7db
feat(managed-agent): inject the child-run supervisor at worker boot
wenshao Oct 3, 2026
24dba6a
docs(managed-agent): pin the two-row ledger shape for background proc…
wenshao Oct 3, 2026
424a79a
feat(managed-agent): commit child_run shell lines from the hosted side
wenshao Oct 4, 2026
fd47530
feat(managed-agent): add the detached capture family to Tool v3 results
wenshao Oct 4, 2026
184dd6a
fix(managed-agent): answer the R2 review round on worker, capture and…
wenshao Oct 4, 2026
44af8cb
feat(managed-agent): thread the child-run orchestrator and the detach…
wenshao Oct 4, 2026
210847d
test(cli): type the background-shell capture double
wenshao Oct 4, 2026
9b8d875
feat(managed-agent): admit background Shell starts from the hosted to…
wenshao Oct 4, 2026
797f8f7
feat(managed-agent): admit background Tool v3 dispatches and acknowle…
wenshao Oct 4, 2026
d976609
feat(managed-agent): answer shell-status and shell-terminate from the…
wenshao Oct 4, 2026
3c074ce
feat(managed-agent): admit the background process row and answer its …
wenshao Oct 4, 2026
bdfcfbe
fix(managed-agent): answer maintenance views under the target identity
wenshao Oct 4, 2026
151d765
feat(managed-agent): run the background exit leg through the record
wenshao Oct 4, 2026
8979766
feat(managed-agent): close monitor_run revisions over their cited Ses…
wenshao Oct 4, 2026
d00ec4f
feat(managed-agent): gate monitor_run behind the managed-session/2 re…
wenshao Oct 4, 2026
1e3b6b0
feat(managed-agent): funnel monitor_run revisions through a hosted or…
wenshao Oct 4, 2026
e090205
feat(managed-agent): drive monitor observations through a debounced loop
wenshao Oct 4, 2026
4724f31
feat(managed-agent): notify from monitor observations in the same tra…
wenshao Oct 4, 2026
1c9dae7
fix(managed-agent): keep a finished background Shell's receipt answer…
wenshao Oct 4, 2026
555130d
fix(managed-agent): settle provable background exits before release's…
wenshao Oct 4, 2026
b21e5f4
fix(managed-agent): check the journaled receipt before attaching a ba…
wenshao Oct 4, 2026
dde1183
fix(managed-agent): backpressure the background Shell output pipes
wenshao Oct 4, 2026
fd31234
feat(managed-agent): promote the Shell publisher to Session scope
wenshao Oct 4, 2026
7b63430
feat(managed-agent): drain a Session's background Shells ahead of rel…
wenshao Oct 4, 2026
aaaa8a2
docs(managed-agent): sync the H3 design's status line with landed slices
wenshao Oct 4, 2026
b20dbdb
feat(managed-agent): spawn Monitor watches through a cgroup watcher
wenshao Oct 4, 2026
61fb973
feat(managed-agent): answer monitor status and stop from a worker reg…
wenshao Oct 4, 2026
1a59457
feat(managed-agent): admit monitor watches into the open-ended captur…
wenshao Oct 4, 2026
ce04b21
feat(managed-agent): admit Monitor watches through the v3 executor
wenshao Oct 4, 2026
b8a5bff
feat(managed-agent): admit Monitor watches through the hosted tool turn
wenshao Oct 4, 2026
bf60c9b
feat(managed-agent): fan a monitor watch's observations into the host…
wenshao Oct 4, 2026
c205831
feat(managed-agent): rebuild a read-only Monitor after its Runtime is…
wenshao Oct 4, 2026
d17163b
feat(managed-agent): serve the task events routes with their SQL journal
wenshao Oct 4, 2026
71bb5e7
docs(managed-agent): add the task events lane's build report
wenshao Oct 4, 2026
e44ca7c
feat(managed-agent): build the monitor wake envelope and the pending-…
wenshao Oct 4, 2026
46b899f
merge: bring the task events SQL journal lane into the H3 branch
wenshao Oct 4, 2026
5b41e53
feat(managed-agent): deliver the Legacy notification envelope on moni…
wenshao Oct 4, 2026
4777beb
feat(managed-agent): run the monitor wake through an embedded scheduler
wenshao Oct 4, 2026
bd653de
fix(managed-agent): keep every new Session on the managed-session/1 r…
wenshao Oct 4, 2026
36cbe1c
fix(managed-agent): keep monitor output byte-true and advance only fo…
wenshao Oct 4, 2026
04ea968
feat(managed-agent): drain a busy background Shell at release, and an…
wenshao Oct 4, 2026
c745d31
fix(managed-agent): re-assert the output pause behind every flushed c…
wenshao Oct 4, 2026
1d0455d
Merge remote-tracking branch 'origin/main' into docs/h3-shell-monitor…
wenshao Oct 4, 2026
0485bd7
merge: absorb main's latest into the H3 branch, task journal at V40
wenshao Oct 4, 2026
518cac5
test(integration): expect the monitor tool on the hosted shell profile
wenshao Oct 4, 2026
375082f
fix(managed-agent): read the whole journal when deriving pending moni…
wenshao Oct 4, 2026
5969410
fix(managed-agent): stop a full task journal from wedging record commits
wenshao Oct 4, 2026
f647866
refactor(managed-agent): drop the shell view's never-set error field
wenshao Oct 4, 2026
66bb438
fix(managed-agent): let a replayed output advance pass instead of ref…
wenshao Oct 4, 2026
707c2a9
chore(managed-agent): keep the task-events lane report out of the PR …
wenshao Oct 4, 2026
6f6b227
merge: absorb main's #13388 and retool the H8 lock discipline onto it
wenshao Oct 4, 2026
325cf02
fix(managed-agent): quiet the wake pump's consume guard at a blocked …
wenshao Oct 4, 2026
7647596
fix(managed-agent): meld a monitor watch through one terminal step
wenshao Oct 4, 2026
2c6c596
fix(managed-agent): settle the process row when the Runtime proves no…
wenshao Oct 4, 2026
accedcf
fix(managed-agent): attribute wake receipts to their own turn and sto…
wenshao Oct 4, 2026
f38c7db
fix(managed-agent): read the task event floor after the events, not b…
wenshao Oct 4, 2026
eb90f96
fix(managed-agent): move the task artifact references by compare-and-set
wenshao Oct 4, 2026
8e27858
test(managed-agent): straighten three small voice and fixture drifts
wenshao Oct 4, 2026
d19c178
fix(managed-agent): admit named cgroup units and keep fast-exit evidence
wenshao Oct 4, 2026
a31ddca
fix(managed-agent): account capture pages from the batch they publish
wenshao Oct 4, 2026
5bb9641
fix(managed-agent): answer the detached capture family in the validator
wenshao Oct 4, 2026
c548e1f
fix(managed-agent): harden the admission, capture and hold edges of t…
wenshao Oct 4, 2026
bf2d497
test(managed-agent): pin the unproven-end, early-line and settled-res…
wenshao Oct 4, 2026
ac20c21
fix(managed-agent): ground the release sweep on physical stops
wenshao Oct 4, 2026
46d633a
fix(managed-agent): never step a terminal run line back to life
wenshao Oct 4, 2026
4ace7d5
Merge remote-tracking branch 'origin/main' into docs/h3-shell-monitor…
wenshao Oct 5, 2026
a1e9730
Merge remote-tracking branch 'origin/main' into docs/h3-shell-monitor…
wenshao Oct 5, 2026
225f355
fix(managed-agent): close the wake path's lost-turnup and haunted turns
wenshao Oct 5, 2026
12916c3
fix(managed-agent): straighten two slice-D indentation slips
wenshao Oct 5, 2026
e2b401f
fix(managed-agent): let refused finalizes retry and commit ownerless …
wenshao Oct 5, 2026
fecfb78
fix(managed-agent): keep monitor wake turns off prompt claims and rec…
wenshao Oct 5, 2026
47a14bc
fix(managed-agent): settle unstarted background siblings on reconcile…
wenshao Oct 5, 2026
b18571e
Merge remote-tracking branch 'origin/main' into docs/h3-shell-monitor…
wenshao Oct 5, 2026
4b339c9
fix(managed-agent): renumber the task journal migration past main's V40
wenshao Oct 5, 2026
2dea416
fix(managed-agent): classify wake recovery exceptions by type, never …
wenshao Oct 5, 2026
c900927
fix(managed-agent): re-drive a refused background settle once the rec…
wenshao Oct 5, 2026
370d933
test(managed-agent): opt token-bearing store fixtures into non-loopba…
wenshao Oct 5, 2026
a0fd230
fix(managed-agent): own the background capture lane in publication mode
wenshao Oct 5, 2026
2a3688d
fix(managed-agent): demand unit emptiness before settling a natural end
wenshao Oct 5, 2026
b95765d
fix(managed-agent): let only the same capture's lineage advance a rec…
wenshao Oct 5, 2026
ce870e6
fix(managed-agent): admit the native Monitor payload through the v3 gate
wenshao Oct 5, 2026
5986e18
Merge remote-tracking branch 'origin/main' into docs/h3-shell-monitor…
wenshao Oct 5, 2026
5815784
fix(managed-agent): prove, refuse and resume correctly at the v3 admi…
wenshao Oct 5, 2026
be54aab
fix(managed-agent): count pending turn, truncate and register resumes…
wenshao Oct 5, 2026
058ff3a
fix(managed-agent): answer the natural end's evidence when its settle…
wenshao Oct 5, 2026
9fca22b
fix(managed-agent): let foreground and background captures pick their…
wenshao Oct 5, 2026
edcbe0e
fix(managed-agent): enable the Monitor line on the publication lane
wenshao Oct 5, 2026
68ff69a
fix(managed-agent): retry a thrown record forward and refuse before a…
wenshao Oct 5, 2026
954d9c5
Merge branch 'main' into docs/h3-shell-monitor-design
wenshao Oct 5, 2026
3cd92c3
fix(managed-agent): settle a started monitor wake in the cancelled Ho…
wenshao Oct 5, 2026
3951037
fix(managed-agent): admit a Monitor only where its own validation adm…
wenshao Oct 5, 2026
c19022c
Merge remote-tracking branch 'origin/docs/h3-shell-monitor-design' in…
wenshao Oct 5, 2026
abf9687
Merge remote-tracking branch 'origin/main' into docs/h3-shell-monitor…
wenshao Oct 5, 2026
78e461a
fix(managed-agent): settle the admitted run records the recovery catc…
wenshao Oct 5, 2026
17cf17c
fix(managed-agent): sweep durable background rows the fresh broker ne…
wenshao Oct 5, 2026
b5c0766
fix(managed-agent): name the isolation cause in the recorded start re…
wenshao Oct 5, 2026
82e0dea
fix(managed-agent): share the capture status rule and announce a blin…
wenshao Oct 5, 2026
cafc7ec
fix(managed-agent): narrow the shared status rule at the result envel…
wenshao Oct 5, 2026
bd35049
fix(managed-agent): redrive a refused final forward on an attached re…
wenshao Oct 5, 2026
601c6bd
Merge remote-tracking branch 'origin/main' into docs/h3-shell-monitor…
wenshao Oct 5, 2026
b883b66
fix(managed-agent): renumber the task journal migration past main's V44
wenshao Oct 5, 2026
15ec440
fix(managed-agent): restore monitor-bearing sessions and pin the clos…
wenshao Oct 5, 2026
b618077
test(managed-agent): cover the write-arm forward retry on the next ed…
wenshao Oct 5, 2026
117e011
fix(managed-agent): keep the publication-installed flag on the publis…
wenshao Oct 5, 2026
0e01478
test(managed-agent): de-race the redrive witness behind fake timers
wenshao Oct 5, 2026
3a700a3
fix(managed-agent): bound the refused-finalize redrive and wait it in…
wenshao Oct 5, 2026
2033aca
fix(managed-agent): forward a blind-capture revision to the record as…
wenshao Oct 5, 2026
8d88d6f
fix(managed-agent): freeze each stream at its flush boundary and fly …
wenshao Oct 5, 2026
2c9a696
fix(managed-agent): admit the one settled leg over a fully sealed man…
wenshao Oct 5, 2026
74a907a
fix(managed-agent): stop every monitor observation loop before the Se…
wenshao Oct 5, 2026
dad53cb
fix(managed-agent): resolve the background Shell environment for its …
wenshao Oct 5, 2026
95cb1fc
test(managed-agent): pin the created-only cleanup of a failed cgroup …
wenshao Oct 5, 2026
3b51fe1
fix(managed-agent): flush every stream's page on its own boundary bef…
wenshao Oct 6, 2026
c4d68c7
fix(managed-agent): wait every re-drive that starts inside the publis…
wenshao Oct 6, 2026
c370c55
fix(managed-agent): verify a detached capture by its own record linea…
wenshao Oct 6, 2026
b732391
fix(managed-agent): resolve the background environment for the tool s…
wenshao Oct 6, 2026
6c264cb
fix(managed-agent): park an unconfirmed stop on runtime_lost instead …
wenshao Oct 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(cli): close background shell type gaps after the main merge
  • Loading branch information
wenshao committed Oct 3, 2026
commit 9c1437ddd6a1d97a8480084f49730d735058b2b0
4 changes: 2 additions & 2 deletions packages/cli/src/serve/managed-background-shell-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ export class ManagedBackgroundShellRegistry {
// event may lead it, so wait for each end first.
const eof = { stdout: false, stderr: false };
Comment thread
wenshao marked this conversation as resolved.
await Promise.allSettled([
process.child.stdout?.ended
process.child.stdout && process.child.stdout.readableEnded
? Promise.resolve((eof.stdout = true))
: once(process.child.stdout!, 'end').then(() => {
eof.stdout = true;
}),
process.child.stderr?.ended
process.child.stderr && process.child.stderr.readableEnded
? Promise.resolve((eof.stderr = true))
: once(process.child.stderr!, 'end').then(() => {
eof.stderr = true;
Expand Down
32 changes: 18 additions & 14 deletions packages/cli/src/serve/managed-background-shell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import type { ChildProcess } from 'node:child_process';
import { managedToolDigest } from '@qwen-code/qwen-code-core/tools/managed-tool-protocol.js';
import type { ToolResultEnvelope } from '@qwen-code/qwen-code-core/managed-runtime/managed-tool-result.js';
import type { ToolResultExpectedIdentity } from '@qwen-code/qwen-code-core/managed-runtime/managed-tool-result-store.js';
import type { ChildRunExitEvidence , ManagedChildRunProcess } from '@qwen-code/qwen-code-core/managed-runtime/managed-child-run-supervisor.js';
import type {
ChildRunExitEvidence,
ManagedChildRunProcess,
ManagedChildRunSupervisor,
} from '@qwen-code/qwen-code-core/managed-runtime/managed-child-run-supervisor.js';
import { HookCommandIsolationUnavailableError } from '@qwen-code/qwen-code-core/managed-runtime/managed-child-run-supervisor.js';
import {
ManagedToolExecutor,
Expand All @@ -31,24 +35,24 @@ afterEach(async () => {
await rm(directory, { recursive: true, force: true });
});

function fakeChild(
unitName: string,
): ChildProcess & {
function fakeChild(unitName: string): ChildProcess & {
emitExit: (code: number | null, signal: string | null) => void;
} {
const child = new EventEmitter() as ChildProcess & {
emitExit: (code: number | null, signal: string | null) => void;
};
(child as unknown as { pid: number }).pid = 4242;
child.stdout = new PassThrough() as ChildProcess['stdout'];
child.stderr = new PassThrough() as ChildProcess['stderr'];
child.stdout!.resume();
child.stderr!.resume();
child.stdout!.write(`out:${unitName}\n`);
child.stderr!.write('');
const stdout = new PassThrough();
const stderr = new PassThrough();
child.stdout = stdout as ChildProcess['stdout'];
child.stderr = stderr as ChildProcess['stderr'];
stdout.resume();
stderr.resume();
stdout.write(`out:${unitName}\n`);
Comment thread
wenshao marked this conversation as resolved.
stderr.write('');
child.emitExit = (code, signal) => {
child.stdout!.end();
child.stderr!.end();
stdout.end();
stderr.end();
child.emit('exit', code, signal ?? null);
};
child.kill = (signal) => {
Expand Down Expand Up @@ -176,7 +180,7 @@ function rig(options: { withSupervisor?: boolean } = {}): Rig {
sessionId: 'runtime-session-1',
directory,
tools: new Map([['run_shell_command', tool]]),
admitsDirectory: (each) => each.startsWith(directory),
admitsDirectory: (each: string) => each.startsWith(directory),
} as unknown as ManagedToolSet;
const executor = new ManagedToolExecutor(
async () => tools,
Expand All @@ -185,7 +189,7 @@ function rig(options: { withSupervisor?: boolean } = {}): Rig {
undefined,
options.withSupervisor === false
? undefined
: (supervisor as unknown as { start: never }),
: (supervisor as unknown as ManagedChildRunSupervisor),
);
return {
executor,
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/serve/managed-runtime-tool-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,16 @@ export class ManagedToolExecutor {
entry.acknowledgement = receipt;
entry.v3Result = {
...entry.v3Result,
capture: { ...actual, deliveryStatus: receipt.deliveryStatus },
capture:
actual === null
? null
: {
captureStatus: actual.captureStatus,
captureReason: actual.captureReason,
manifest: actual.manifest,
previewTruncated: actual.previewTruncated,
deliveryStatus: receipt.deliveryStatus,
},
};
return v3View(entry);
}
Expand Down
Loading