Repository navigation
sync: upstream/main (2443 commits) and full pnpm adoption - #64
Merged
Merged
Conversation
…nLM#14169) * feat(web-shell): add file creation and confirmed folder deletion * fix(web-shell): address file tree review and transcript regression --------- Co-authored-by: 钉萁 <[email protected]> Co-authored-by: Shaojin Wen <[email protected]> Co-authored-by: 易良 <[email protected]>
) * fix(managed-agent): bound retry loops with terminal states Asynchronous retry loops across the managed-agent stack had no terminal state, and the message projection wedged permanently on a sequence gap. Issue QwenLM#13182. - Projection: a sequence gap observed under the session row lock is provably permanent, so materializeNextBatch now logs once per gap and skips ahead instead of throwing on every scan at 10Hz forever. - Turns: a new maxPostAdmissionRetries budget (default 10) terminates an admitted turn as hosted_harness_unavailable_after_admission once spent, distinct from the pre-admission code because the turn may already have run. - Operations: a new maxOperationRetries budget (default 10) completes an unsettleable close/delete unconfirmed (java_durable) after a best-effort drain, and completes an undeliverable action response FAILED with action_response_delivery_failed instead of retrying forever. A committed decision seen on the projection re-check still wins over the budget. - Scheduler: a memory-blocked pump arms a 1s recheck wake so a missed capacity notification no longer starves queued activations; transient store failures on claim/renew/release abandon only the affected activation instead of halting the worker, which still halts when the store reports consistency damage. - Store: persist() repairs a torn journal tail (truncate to the last synced byte, like the open() loader) and only fails closed when the repair itself fails. - Session close seals the writer in a finally; a failed HTTP seal keeps the grant renewed and retries the seal on the renewal cadence until sealed, bounded so a broken seal endpoint eventually lets the grant lapse for takeover instead of wedging the session. * fix(managed-agent): record honest terminal failures on exhausted retry budgets Address the PR review: the lifecycle exhaustion arm no longer reuses the success-path completion write — a new fenced failOperation terminates the operation FAILED with the settle's failure code kept, leaving the Session in its pending status (a live journal writer keeps the operation waiting instead). The gap heal settles orphaned items as failed, guarded to never touch a turn whose terminal event is in the journal or whose turn row is still live. The materializer backs off per session and surfaces a stuck projection once. The embedded scheduler retries transient renewal/release failures within the lease, halts on a consecutive-failure streak, and converges per-activation via a transient-failure budget. Pending HTTP seals now abandon after two lease durations, and a FAILED action response whose Action is still requested is re-admitted on the caller's retry. Docs, the OpenAPI descriptions, and the generated client match. * chore: retrigger CI after a dropped pull_request synchronize event * fix(managed-agent): key the writer gate on the writer, not the admitted status Round-4 audit fixes. The exhaustion gate now checks hasLiveWriter for every delivered shape — a delete of a closed Session whose retention retirement keeps refusing on a residual live writer waits instead of terminating into an unrecoverable DELETING row. The terminal arm mirrors settle()'s routing exactly: a closed-Session delete makes zero Runtime calls. A retried action answer re-admits only while the Session still accepts responses; the post-admission turn terminal keeps the Runtime Broker's own failure code; the scheduler prunes budget entries for activations that can never re-queue; and the seal bounds, blocked-fallback and fencing comments now state what the code does. * docs,test(managed-agent): align the writer-exception wording and pin the round-4 gates Round-5 audit follow-ups: the design docs' writer exception now covers every admitted status (matching the gate that keys on the writer itself, in both languages); the blocked-fallback test comment states the scanner's real re-drive condition; and the two round-4 gates that lacked witnesses gain them — a closed-Session delete terminating without any Runtime call (red when the terminal arm's short-circuit is removed) and a replayed FAILED action response staying terminal on an inactive Session. * docs(managed-agent): state the closed-Session delete's zero-call terminal routing The budget-exhausted paragraph claimed the terminal arm always releases the binding through the workspace close pair; for a delete of an already closed bound Session settle() — and now the terminal arm — deliberately makes no Runtime call at all. Both languages. * fix(managed-agent): stop the budget terminals from certifying falsehoods Round-5 bot review (R2) Critical fixes. The lifecycle terminal arm now fires only when settle() never returned — a completion-write failure after a successful settle retries instead of recording session_lifecycle_delivery_failed for a close that actually settled. The action terminal exempts the shape where the Harness answered 200 and only Java's projection lags (a dedicated DecisionNotYetProjected failure), so a committed decision is never recorded as an undelivered one. Action re-admission narrows to the delivery-budget terminal: a definitive Harness 400 keeps replaying its recorded row instead of re-sending the refused body. The scheduler's release retry re-checks liveness after its sleep, so a dispose racing the retry no longer writes a terminal release on a stopped worker. Each fix is pinned by a test verified red under its mutant. * fix(managed-runtime): keep scheduler error paths total when the store clock fails R3-1: store.getCurrentTime() validates its clock, and the renewal/release error paths called it outside any try — a throwing injected clock escaped as an unhandled rejection and leaked the active slot forever (pump skips keys in active, so the activation could neither run nor re-queue, and the worker silently stopped claiming once every slot leaked). Read the clock through a helper that treats a throw as no-headroom/lease-expired, move the slot cleanup and trailing pump into execute()'s finally, and turn any escaping execute/renewal rejection into a loud halt. Pinned by a broken-clock test verified red (timeout + unhandled rejection) against the pre-fix source. * test(managed-agent): give bound Session fixtures the tool profile main added Merging main brought QwenLM#13301, which adds a toolProfile component to SessionRecord and turns a null profile on a bound Session into an invalid state: QwenHostedHarnessConnector throws "Hosted Workspace Session tool profile is missing". The bound fixtures in the two retry-terminal suites still used the 16-argument shape, so the module stopped compiling after the merge. The value is inert for these tests - both suites mock HarnessConnector, and toolProfile() is read only inside the real connector - but a bound fixture without a profile now describes a state production rejects, so it follows main's own HarnessCoordinatorTest fixtures. * fix(managed-agent): keep the named load refusal code past Turn admission The post-admission exhaustion arm this branch adds recorded the generic hosted_harness_unavailable_after_admission for every error except a Runtime Broker failure, so a named load refusal (QwenLM#13349) reaching that arm lost its own code and blamed Harness availability for a Session the Harness had deliberately refused to open. The arm is reachable with a refusal because submissionAttempted is seeded from the claim: a Turn an earlier dispatch already submitted, re-driven while a mixed-version fleet refuses its load, exhausts this budget with a refusal in hand. Within a single dispatch the load precedes the submission marker, so the pre-admission arm keeps handling the common case. Mirrors the pre-admission arm's precedence and logs the refusal code through failureLabel rather than the exception class name. Mutant-verified: deleting the new branch turns namedLoadRefusalsHonourThePostAdmissionBudget red, recording hosted_harness_unavailable_after_admission where managed_session_open_failed is wanted. * fix(managed-agent): close round-4 review findings in the terminal-outcome paths Consolidate the embedded scheduler's terminal-outcome handling into execute(): every abandon path now converges after the handler settles, where the scheduler records the handler's own outcome with the budget spent — re-claiming a lapsed lease so the write fences live, yielding one commit turn so a racing dispose/halt cancels it, and guarding the failure classification so a stopped worker never latches a bogus halt. Stale-ended runs now count the dropped run against the activation budget, bounding re-runs of an activation whose store calls keep resolving past the lease edge, and a terminally recorded activation still reports its handler error through onActivationError. The activation journal repair now observes the file length before truncating: truncate() extends a shorter file with NULs and reports success, so a journal that lost synced bytes out of band must classify fatal, not transient. On the Java side, the action-response re-admission gate no longer resurrects a FAILED delivery row whose Action has expired (a fresh admission would refuse 409 action_expired, and the resurrected PENDING row wedged every later lifecycle command via requireNoOpenOperation), and HostedHarnessClient.submitTurn probes GET /session/:id/status once before refusing a different pinned prompt, so an outcome-unknown admission entry left behind by a terminal failure stops locking the Session forever (from the maintainer's stack-validated candidate patch). * fix(managed-agent): close round-5 review findings in the terminal-outcome paths The embedded scheduler's spent-budget terminal record could not tell "the handler settled and we could not release it" from "we aborted the handler ourselves": a cooperative handler returns normally on abort, so a scheduler-induced cancellation was durably written as outcome 'completed' — a final, non-reclaimable false success. Track whether the abandon preempted the handler and record 'failed' for that shape; a run that genuinely settled before the abandon keeps the handler's own outcome. ActionResponseCoordinator's budget terminal inferred "the Harness never answered" from the exception type, so a Java-side store fault after resolveAction's 200 — the decision is already committed then — was recorded as action_response_delivery_failed with harness_confirmed false. Track the answer fact (200 return or the definitive 400) and gate the terminal on it instead of the type. HarnessCoordinator's post-admission budget terminal failed a Turn the Hosted Harness may still be executing, and failTurn clears the dispatch owner, so nothing could later cancel the admitted Turn or re-attach to journal its output. Reconcile before terminating: best-effort cancel through the Session's bound Harness, then record the failure. The action-response re-admission gate healed a budget-terminal action_response_delivery_failed row only while the Action was still requested; once the projection showed the Action decided with this very response's decision — the delivery did land and only Java's record was wrong — the replay returned the stale failure forever. On a digest match the replay now settles the row in place (COMPLETED, harness-confirmed, with the decision receipt), fenced on the terminal FAILED state; every other end state keeps replaying the recorded failure, and the row is never resurrected to PENDING, so a second vote stays impossible. * fix(managed-agent): close round-6 review findings in the terminal-outcome paths * chore(managed-agent): republish round-6 fixes after the lint-gate rejection The deterministic gate rejected the round-6 commit at npm run lint: eslint scanned untracked maven javadoc output (packages/sdk-java/*/ target/reports/apidocs/*.js, plus runtime-broker test-classes *.mjs) left behind by the local verification runs. That output is git-ignored build product, not part of the fix, and the only committed-tree lever (the workspace-root eslint config) is verification machinery outside this PR's footprint. The build output is removed and the round-6 commit is preserved unchanged; this empty follow-up re-publishes it with a workspace that passes build, typecheck, and lint. Co-authored-by: Qwen-Coder <[email protected]> * fix(managed-agent): close round-7 review findings in the terminal-outcome paths - SubmitTurn's busy-turn status probe no longer leaks its own DaemonHttpException/DaemonProtocolException types: a failed probe keeps the plain retryable busy-turn refusal instead of terminal-failing a Turn whose prompt was never submitted (R7-2). - The action-response answered fact is durable in the row's budget-exempt watermark: answered attempts reschedule budget-exempt and the terminal gate reads the watermark, so a mid-projection-lag failure after an answered attempt never records action_response_delivery_failed; the re-admission UPDATE resets the watermark so a re-clicked row keeps a terminable budget (R7-3). - A delete admitted on an ACTIVE Session now publishes its live-writer wait as recovery_blocked/session_close_writer_live once the budget is spent, and the recovery scan re-drives every blocked lifecycle shape, matching the published design contract (R6-2). - Reformat the two durable-lifecycle design-doc tables with Prettier so the lint lane passes (R7-1). * chore(managed-agent): republish round-7 fixes after the lint-gate rejection The deterministic gate rejected the round-7 commit at npm run lint: eslint scanned untracked maven report output (packages/sdk-java/*/ target/site/jacoco/jacoco-resources/*.js) left behind by the local verification runs. That output is git-ignored build product, not part of the fix, and the only committed-tree lever (the workspace-root eslint config) is verification machinery outside this PR's footprint. The build output is removed and the round-7 commit is preserved unchanged; this empty follow-up re-publishes it with a workspace that passes build, typecheck, and lint. Co-authored-by: Qwen-Coder <[email protected]> * fix(managed-agent): renumber the budget-exempt migration to V46 past main's V41 Main's QwenLM#13289 landed V41__workspace_csi_reservation.sql while this branch carried V41__managed_operation_budget_exempt.sql, so the merge made two migrations claim version 41. Flyway fails migrate() on duplicate versions, which took down the Flyway uniqueness gate and both DB-backed jobs that boot the server (MariaDB integration and hosted fault gates). Co-authored-by: Qwen-Coder <[email protected]> * test(managed-agent): pin cwd probe retries against the lifecycle terminal budget Follow-up to the main merge: widen the two OperationRecord construction sites in OperationRetryTerminalStateTest to the merged 18-component shape (the merge commit's staged copies predated this fix), and add coordinatorNeverAppliesTheLifecycleTerminalBudgetToACwdChange — with the lifecycle budget configured below the probe budget, a transiently failing cwd probe keeps its plain reschedule (RUNNING/PENDING, zero budget-exempt watermark, untouched binding) instead of taking the close/delete terminal arm or the writer-live wait. Mutation probes: deleting the terminal-arm gate turns the pin red with state FAILED; deleting the writer-live gate turns it red with RECOVERY_BLOCKED. Co-authored-by: Qwen-Coder <[email protected]> * fix(managed-agent): renumber the budget-exempt migration to V48 Merging main brought QwenLM#13497, which took V47 for managed_channel_route_delivery. This branch's budget_exempt_attempt migration was also V47, so Flyway refused to resolve the schema at all: Found more than one migration with version 47 -> V47__managed_channel_route_delivery.sql -> V47__managed_operation_budget_exempt.sql Every Spring-context test then errored — 740 of 1112 locally — which reads as a catastrophic regression but is one duplicated version number. The column is this branch's own: main ships no budget_exempt migration and its Java has zero references to budget_exempt_attempt, so V48 is simply the next free version and nothing depends on the old number (no test pins a migration count or version, and the column is referenced by name only). scripts/check-flyway-migrations.js now reports 48 migrations, all versions unique. * fix(managed-agent): stop renewing a failed close-time seal; bound the writer wait by retryability (QwenLM#13182) R1-38: the pending-seal cadence kept a failed-seal writer's grant live, and the backend replays the same writer generation to a same-credential re-acquire during a live lease, so the stale client could seal the journal out from under a freshly re-attached session. Drop the cadence: the grant lapses, a post-lapse re-acquire bumps the generation and fences the stale client, and a later close() still retries the seal (accepted without a live lease). R1-30: the live-writer wait exempted every settle failure from the terminal budget, so a permanent refusal thrown before the Harness was asked to stop (e.g. workspace_close_identity_unverified) re-blocked the operation forever while the Harness kept the writer. The wait now keys on the failure being retryable, so a permanent refusal terminates with its code even while the writer is live. * fix(managed-agent): publish the stale-Harness wait instead of hiding it The generation-mismatch wait was budget-exempt and invisible. The terminal arm is vetoed by !staleBoot, and the exempt reschedule writes budget_exempt_attempt = attempt_count, so the effective budget stayed at zero and the row read RUNNING/PENDING with error_code NULL — byte-identical to a healthy retry — for as long as this replica kept its stale Harness boot, which only a Java restart clears. The writer wait, the other unbounded external wait, already publishes recovery_blocked with its code past the budget; there was no reason for this one to be the invisible half, and an operator cannot restart the replica that a row does not name. Publishes it the same way, as hosted_harness_generation_mismatch. The wait stays unbounded and the recovery scan still re-drives it, so nothing terminates earlier than before — the row is only legible now. Gated on !cwdChange because a cwd change never reaches settle() and is bounded by its own CWD_CHANGE_ATTEMPT_BUDGET. Contract and docs follow: the failure_code description on both OpenAPI surfaces and the regenerated client, and the durable-lifecycle design doc in both languages, which also claimed "the one exception" and then described a second one four lines later. Pinned by aStaleHarnessViewPublishesItsWaitPastTheBudget (renamed from ...KeepsTheOperationWaitingPastTheBudget, which asserted the invisible retry) plus aStaleHarnessViewReschedulesExemptlyBelowTheBudget, so publication stays budget-gated rather than becoming the first response to a generation error. Mutant-verified: deleting the new branch turns the first test red. * fix(managed-agent): bound the answered action response by its Action's expiry Round 7 made "the Harness already answered" a row-level watermark: once budget_exempt_attempt is set, `answered` is true on every later attempt, so the terminal gate `!answered && ...` became unreachable and the only reset was a client replay. Java keeps no expiry scanner for managed_agent_action — only the journal projection writes it — so an answer whose decision never projected retried forever. That is not merely a spin: hasOpenOperation counts ACTION_RESPONSE rows and requireNoOpenOperation gates close, archive, delete, rename and unarchive, so one such row refuses every later lifecycle operation on its Session with 409 session_operation_active while reading as a healthy RUNNING/PENDING with a NULL error_code — the wedge this PR exists to remove, reintroduced. Bounds the exemption by the Action's own life, which is the condition the exemption exists for: waiting only helps while the Action can still be decided. Admission validates expiresAt as a required number greater than createdAt, so a real Action always carries that deadline; once it has passed while the Action is still `requested`, the operation completes FAILED with `action_response_decision_expired`. The code is its own rather than action_response_delivery_failed because the Harness did answer, and the record stays java_durable because with no projection Java cannot certify what was committed. An absent expiry is not read as a deadline, so a row this code should not judge keeps waiting instead of terminating on an invented one. Contract and docs follow: the failure_code description on both OpenAPI surfaces and the regenerated client, and the actions design doc in both languages — which also still described re-admission as needing only `requested` plus a Session that accepts responses, omitting the expiry condition the code has checked since round 4. Pinned by anAnsweredResponseTerminatesOnceItsActionExpired. Round 7's aLaterFailureAfterAnAnsweredAttemptStaysBudgetExempt stays green unchanged: its Action carries no expiry, so the exemption it pins still applies. Mutant-verified: removing the bound leaves the new test red with "wanted but not invoked", i.e. the row retries forever. * chore: retrigger CI after two dropped pull_request synchronize events The pushes of 9989e1c and d80cc92 each fired the pull_request_target workflows (assign owner, self-report label, force-push reminder, review) but created no pull_request run at all, so Qwen Code CI, SDK Java and Web-shell Visuals never started on either head — the checks panel showed ten checks instead of the usual thirty, with no failure and nothing to rerun. Same symptom this branch hit before (d594b2c). No run exists to rerun and no approval is pending, so the only lever is another synchronize event. Content is unchanged; the code these two commits carry is verified locally (Java 1117 tests with only the known-exempt pair and the QwenLM#13386 flake, core managed-runtime 2202/2202, web-shell managed 347/347, typecheck and Checkstyle clean). * docs(managed-agent): document the recovery scan's BLOCKED population The scan re-drives every non-ACTION_RESPONSE operation in PENDING or BLOCKED once its available_at has passed, and claimOperation accepts the same two states — the widened predicate is what keeps the published writer-live and stale-boot waits alive, since a restricted one would strand exactly the rows the publication creates (including a delete of an active Session waiting on a residual writer). recovery_blocked labels a row that is still being retried; it is neither terminal nor a pause. * fix(managed-agent): close review findings in the retry terminal-state paths Seven correctness fixes from the latest review of the retry terminal-state work: - The budget-exempt column now counts exempt attempts instead of watermarking attempt_count, so a wait after charged failures no longer refunds them into an endless retry. - The scheduler only resets its transient store-failure streak when an enqueue actually wrote (a duplicate performs no I/O), and no longer records a bogus store halt when a disposal races a failing streak. - The action-response digest-match heal also settles rows that terminated as action_response_decision_expired; resurrection stays closed to them. - The action-response attempt renews its operation lease across resolveAction, whose cold-load duration can outlive the claim lease, so the answered watermark can no longer be silently dropped. - The post-admission retry budget honors the lease-bounded 409 exemption instead of terminally failing a Turn whose predecessor writer lease is still lapsing. - Permanent daemon refusals (capability mismatch, protocol error) are non-retryable: they consume the budget and terminate with their own failure codes instead of waiting forever on a writer their settle never reaches. Co-authored-by: Qwen-Coder <[email protected]> * fix(managed-agent): preserve lifecycle budgets and admitted turn cleanup * test(daemon): report active replacement prompts in detach fixture * fix(managed-agent): keep the await-action approval wait exempt from the retry budget (QwenLM#13182) The await_action recovery decline routed to transientFailure with the exemption flag unset, so a Turn parked on a pending user approval met the post-admission budget (default 10 retries, about 303 s of capped backoff) and was cancelled and terminally failed while the approval timeout bounds that wait at up to 24 h. The exemption now applies, keyed on the exact await_action reason; every other decline reason still terminates. The witness is parameterized over retryCount 5, 10 and 42 with the terminal path's cancel made observable: it goes red at 10 and 42 without the exemption and stays green with it (review R3-9). Co-authored-by: Qwen-Coder <[email protected]> Co-authored-by: Qwen-Coder <[email protected]> * fix(managed-agent): close terminal-release and writer-wait gaps from review (QwenLM#13182) - retryable() whitelists the retention retirement's writer code managed_session_writer_active, raised under exactly the predicate hasLiveWriter reads, so a delete of a closed Session waits on its writer instead of burning the terminal budget (R5-2) - the terminal arm releases a bound protocol-v1 Session through the workspace close alone — requestHarnessDrain would flip the fence row without the lifecycle store's claim checks (R5-3) - failOperation flips the LIFECYCLE_ONLY claim mirror to DRAINING in the terminal transaction, the release the completion path already performs, so a dead operation cannot hold harness admission closed (R5-5) - a generation error wins the publication overlap with a live writer: that writer is the old boot's unexpired lease, not what bounds the close (R1-30) - the pre-admission terminal cancel gates on the re-read Turn record, so a submission mark that landed after the claim still reconciles the admitted Turn first (R4-1) - the named-recovery-refusal rows move out of the post-admission budget test into the pre-admission method they exercise (R5-1) * fix(managed-agent): stop terminal writes from certifying unearned outcomes (QwenLM#13182) Review round 6 follow-ups: - ActionResponseCoordinator: pass the missing harnessConfirmed=false at the non-retryable workspace_unavailable arm; the five-argument call did not compile (R6-1). - ManagedAgentStore.failOperation: release the lifecycle claim mirror by clearing the dead operation's claim instead of flipping the fence row to DRAINING — the phase alone authorizes drainHarnessSession, and the terminal fail never verified the worker stop (R5-5). - HarnessCoordinator.cancelAdmittedTurnBeforeTerminalFail: restore the recorded-admission (event epoch) precondition before the session-scoped cancel, re-reading the row; a bare submission mark can belong to a Turn the daemon refused while another Turn is live (R6-3). - ManagedSessionOperationStoreTest: wrap the claim-mirror test's session insert in a TransactionTemplate — resolveForCreation requires a creation transaction and the suite builds the store without Spring proxies (R6-2) — and pin the fence row's post-fail shape. * fix(managed-agent): close the round-7/8 terminal-state review findings (QwenLM#13182) - Rename the budget-exempt migration V53 -> V54: main merged its own V53 (workspace roles) first, and the duplicate version broke every Flyway startup (R8-1). The migration-order IT now expects "54", and the operation-store test fixture uses the post-roles role column (R8-2). - V54 backfills budget_exempt_attempt = attempt_count for in-flight non-ACTION_RESPONSE operations: those attempts predate the budget regime and were never classified, so charging them would terminate long-retrying operations on their first post-upgrade failure (R7-5). The retention IT's operation column count bumps to +6 (R7-6). - Split the Turn retry budget from the pacing counter: the three fenced cursor updates (admission, recovery admission, journaled events) now zero the new consecutive_failures column instead of retry_count, which keeps pacing the backoff — a crash loop that keeps making progress still converges to the terminal arm with growing delays (R8-3). - settle() reports its irreversible Harness-facing step out of band and the terminal arm skips a settle that reached it: a close that answered the Harness but failed the workspace close no longer records "the settle never happened" (R7-2). - The terminal arm consults the journal writer independently of the failure's retryability and never releases the Runtime binding under a live writer; the terminal record itself still stands (R7-3). - The action-response resurrection arm now requires the session's storage to be unfenced, so a migration in flight keeps replaying the recorded terminal failure until the fence lifts (R7-4). - The embedded scheduler's transient-store-failure halt bound scales with maxActiveSlots: one shared journal blip charges the streak once per concurrent run and must not exhaust it (R7-1). * fix(managed-agent): close the round-9 terminal-state review findings (QwenLM#13182) - Raise the v1 harnessSettled latch where the irreversible step actually completes: settleLifecycle answered. A receipt write that refuses after the Harness settled is no longer recorded as "the settle never happened" (R7-2). - Never terminate under a live journal writer: the terminal record would stand while the Runtime binding's release it owes never ran, stranded behind a row nothing re-drives. The refusal's wait is published instead — budget-exempt, recovery_blocked with its own code — and the terminal arm fires once the writer stops (R7-3). - Bound the post-settle wait with its own larger budget: past four times the operation budget, a settle that reached the Harness terminates with session_close_completion_unsettled, which names what stayed unsettled, instead of retrying forever behind the open-operation barrier (R9-4). - Re-admit the same lifecycle kind when the Session sits in its pending status with no operation open and a terminally failed operation of that kind: the new operation carries the failed one's pre-operation status forward and rebinds the released v1 fence row, so a budget-terminated close or delete is no longer un-recoverable without database surgery (R9-3). - Repair the activation journal tail only when a torn tail exists: a failed no-op truncate on a read-only filesystem no longer halts a healthy store (R9-5). The OpenAPI error_code descriptions, the regenerated WebShell client, and both design-document languages track the new terminal code and the writer-wait semantics. * fix(managed-agent): advance the contract version past main's 1.38.0 (QwenLM#13182) The API contract uniqueness guard (QwenLM#13804) fails a PR whose changed contract document declares a version equal to or below latest main's. Round 9 extended the error_code descriptions but kept 1.38.0, which main already declares; bump to 1.39.0. Co-authored-by: Qwen-Coder <[email protected]> * test(managed-agent): expect the merged schema's eight post-V31 operation columns (QwenLM#13182) The round-10 main merge kept both parents' textually identical hasSize(+7) on the post-upgrade managed_agent_operation row, while the containsEntry list unioned to eight: each parent was correct alone (branch: V46 x3 + V51 x2 + V56 + its own budget column; main: the same plus V62 task_id instead), but the merged schema carries both V62 and V65, so the row gained eight columns and the MariaDB-lane assertion failed. Expect +8 and record the column arithmetic so the next merge recomputes it. * fix(managed-agent): close the round-11 review findings (QwenLM#13182) Four Criticals from review round 11, each pinned by a mutant-verified test: - R11-1 (ActionResponseCoordinator): the retry-budget terminal sat above the non-retryable workspace_unavailable terminal, so a permanently refusing Workspace authority recorded the generic action_response_delivery_failed once the budget was spent — a code that ManagedActionStore's re-admission allowlist resurrects, letting a client retry resurrect the operation and burn another full budget on a refusal that can never succeed. The named-refusal arm now sits above the budget arm, so the refusal keeps its own (non-re-admissible) code at every attempt count. aWorkspaceUnavailableCompletesTerminallyWithoutHarness Confirmation is parameterized over attempts below, at, and above the budget, with a negative pin on the generic code. - R7-2-fix-induced (SessionLifecycleCoordinator + qwencode): the harnessSettled latch was set only after harness.settleLifecycle() returned normally, so a settle the Harness answered 200 but Java failed to decode (an invalid-JSON body or a receipt identity mismatch) was read as "never reached the Harness" and terminated with the plain budget and the raw protocol code instead of the settled budget and session_close_completion_unsettled. HostedHarnessClient now marks the post-answer failures with a dedicated HostedHarnessSettleAnsweredException (DaemonException, since DaemonProtocolException is final), and the coordinator sets the latch on it before rethrowing; the pre-send protocol-1 refusal never carries the marker and stays unlatched. aSettleAnsweredButUndecodableKeepsTheSettledBudget pins the budget edge at 10 (still reschedules) and 40 (terminates unsettled). - R11-2 (SessionLifecycleCoordinator): the recovered-receipt branch equated "a durable effects receipt exists" with "a prior attempt reached the Harness", but WorkspaceLifecycleStore.recoverEffects synthesizes and persists a neverInitialized receipt for a Session the Harness never booted, with zero Harness contact. The latch now sets only for a real receipt: `!recovered.path("neverInitialized").asBoolean(false)`. aNeverInitializedReceiptDoesNotReachTheSettledBudget pins it. - R11-3 (hosted-harness-session): a rejected close whose finally sealed the writer left the Session stranded in memory — deregistered never ran, and every later request resolved a dead journal. The close route now deregisters the Session whenever close() was attempted (its own finally either sealed the writer or failed trying), while a pre-close hook or admission refusal — which left the writer open — keeps the Session. deregisters the Session when the close sealed the writer but the release failed pins the 404-after-503 path; the existing "keeps the Session usable" case (a pre-close admission failure) stays green. * fix(managed-agent): close the round-12 review findings (QwenLM#13182) * fix(managed-agent): key the close-route eviction on the seal outcome (QwenLM#13182) Review round 13 (R13-1): the R11-3 eviction was keyed on close() having been attempted, but close() has pre-seal failure arms (the early throws in sealForHandoffOnce) that reject with the writer still open — the route then stopped the streams and deregistered a Session whose writer was still live, stranding it with no handle to retry through. The eviction now keys on the seal outcome. ManagedSessionJournalHandle gains a writerSealed query — the local JSONL handle reads the lease's isReleased, the HTTP store reads its own sealed flag, the read-only snapshot-inspection handle reports true — surfaced through LocalManagedSessionAuthority.writerSealed. The close route deregisters when close() settled or the seal landed, and keeps the Session on a pre-seal rejection. Pinned by keeps the Session when the close rejected before the writer seal landed (503, then the retained entry answers 503 again rather than 404). Mutant-verified: negating the writerSealed disjunct turns both it and the R11-3 deregistration test red. Verified: build + typecheck clean, hosted-harness-session 446/446, the three touched core modules 178/178, eslint and prettier clean. * fix(managed-agent): resume terminal-failed workspace lifecycle operations (QwenLM#13182) A terminally failed workspace DELETE parked the Session in DELETING, which the workspace status gate refused before the resume branch could run, and a settle that had saved its effects moved the fence to DRAINING with the dead operation still named, so the resume rebind matched nothing and the resumed operation was fenced out of its own recovery. Recognize the permitted failed-operation resume before the workspace status/protocol gates with the failed operation's protocol pinned up front, rebind both parked fence shapes (LIFECYCLE_ONLY claim-released and DRAINING still naming the failed operation), carry the validated effects receipt to the resumed operation, and verify carried receipts against the receipt's own hook-execution namespace. * fix(managed-agent): repair the merge-resolution fallout in the retry terminal-state tests (QwenLM#13182) * test(serve): widen the hosted cancel waitFor windows for CI contention (QwenLM#13182) The verification gate rejected the previous round on four tests in hosted-harness-session.test.ts whose default 1s vi.waitFor windows span fsync-backed journal commits (prompt admission to model call, and the cancelled turn's settle before the active flag clears). Same flake class as QwenLM#14101, which widened two sibling windows in this file for a loaded CI runner. Assertions are unchanged; only the polling windows move to the file's established 10s contention budget. * fix(ci): restore the Linux-correct NOTICES.txt from main (QwenLM#13182) My local build regenerated packages/vscode-ide-companion/NOTICES.txt against a pre-install node_modules on macOS, and the result diverged from the CI-fresh regeneration (is-fullwidth-code-point 3.0.0 vs 5.1.0 block). The branch adds no dependencies, so the correct content is main's; take it verbatim. * fix(managed-agent): close the round-14 review findings (QwenLM#13182) Four Criticals from review round 14, each pinned by a mutant-verified test: - R14-1 (SessionLifecycleCoordinator): the terminal arm's drain-route guard excluded only protocol v1 (lifecycleProtocolVersion() != 1), so a v2 (SHELL/MCP) bound operation minted the DRAINING fence authorization itself and closed the Workspace on the strength of it — the exact thing the adjacent R5-5 comment says this path must never do. The guard now keys on the codebase's own operationIsLifecycle predicate (which covers v1 and v2 alike), so only the non-lifecycle (v0) route — the one settle() actually calls requestWorkspaceClose on — takes the drain request. boundV2SessionExhaustionSkipsTheV0Drain Request pins it (reverting to != 1 turns it red). - R14-2 (WorkspaceLifecycleStore + SessionLifecycleCoordinator): the recovered-receipt branch treated every non-neverInitialized receipt as proof the settle reached the Harness, but recoverEffects also synthesizes and persists receipts itself — with zero Harness contact — for a booted Session whose definition has no hookCatalog. The store now marks both synthesis branches with storeSynthesized: true and the coordinator's latch excludes it alongside neverInitialized. aStoreSynthesizedReceiptDoesNotReachTheSettledBudget pins it at both budget edges (removing the new disjunct turns it red); the existing hookReceiptsUseCompactProtocolIdentities test's expected receipt gained the marker in its recover branch. - R14-3 (ActionResponseCoordinator + ManagedAgentStore + AgentStateStore): the answered watermark that makes action_response_delivery_failed unreachable after a Harness 200 is per-attempt state, and its durable half (budgetExemptAttempt > 0) was written only by retryOperation(..., true) — the last statement in the catch block — so a throw anywhere earlier escaped with no DB write and the watermark never landed. The new AgentStateStore.markOperationAnswered (with its ManagedAgentStore impl) writes the watermark at the top of the catch block, before any recovery read, so a re-claimed attempt reads budgetExemptAttempt > 0 for a decision the Harness committed. The answer is durable, not per-attempt. anAnsweredAttemptPersistsTheWatermarkBeforeTheCatchBlocksReads pins it (removing the call turns it red). - R14-4 (session-writer-lease): the assembly's finally-seal ran even when releaseActivation() rejected, and sealForHandoff memoized a failed seal permanently (terminalPromise ??= with no catch/clearing), so every later close() replayed the same rejection and the DELETE route's retention gate kept an entry that could never be closed. The seal now gets the same retryable-clearing treatment release() already had: on a retryable failure the memoized promise AND the terminal operation are cleared, so a later close() retries the seal rather than replaying the rejection. retries a retryable seal failure instead of memoizing the rejection pins it (reverting to ??= turns it red); the terminalOperation reset keeps release() from reading a cleared promise as a seal in flight. Verified: the touched Java classes 147/147 green, assembly + lease 124/134, hosted-harness-session 463/463, full npm build exit 0, typecheck 0 errors, checkstyle SUCCESS, prettier clean. * style(managed-agent): satisfy the Managed Agent Server Checkstyle on this branch's files main's qwen-code-checks.xml now enforces import order and duplicate imports, and the daily Managed Agent Server Checkstyle lane would fail on the files this branch adds or edits: regroup their imports (others, javax, java, then static), drop duplicate imports, collapse three empty lambda bodies, brace two single-line ifs and drop a blank line after a class brace. No behaviour changes. --------- Co-authored-by: wenshao <[email protected]> Co-authored-by: qwen-code-ci-bot <[email protected]> Co-authored-by: qwen-code-autofix <qwen-code-autofix@localhost> Co-authored-by: Qwen-Coder <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]> Co-authored-by: qwen-code-autofix <[email protected]> Co-authored-by: yiliang114 <[email protected]> Co-authored-by: qwen-code[bot] <qwen-code[bot]@users.noreply.github.com> Co-authored-by: qwen-code-dev-bot <[email protected]> Co-authored-by: Qwen Autofix <[email protected]> Co-authored-by: qwen-autofix <qwen-autofix[bot]@users.noreply.github.com>
Co-authored-by: gtdd123 <[email protected]>
…wenLM#14036) * feat(core): separate app launcher and JS interpreter runtime boundary Establishes the runtime boundary the Bun migration (MYWO-8 S1) needs before workers, hooks, sandbox helpers and the code-mode host spawn JavaScript children under a future compiled-app flavor: arbitrary-JS child processes resolve their interpreter through one accessor (package manifest first, process.execPath fallback) instead of reading process.execPath directly, Bun detection has a single seam, and the app-launcher contract is documented alongside the full call-site inventory in a bilingual design doc. Adds the same-fixture Node/Bun regression matrix (stdio framing, exit codes, SIGTERM, IPC channel, --expose-gc, --input-type=commonjs --eval). * fix(core): anchor interpreter resolution to the trusted install root Arbitrary-JS child resolution no longer walks upward looking for a manifest: the only trusted location is the standalone package root — the parent of the caller's bundle directory, which must hold both a manifest.json and the standalone entry marker lib/cli-entry.js — so an unrelated ancestor manifest in npm, source or SDK layouts can never be read. Declarations are validated before use: runtime must be exactly 'bun' or 'node', and the interpreter must be an existing executable regular file; any invalid or missing declaration falls back to process.execPath without throwing (non-string interpreter, directory, non-executable file, unknown runtime, absent binary, missing marker). Adds the regression matrix for unrelated ancestor manifests (npm bundle and deep SDK layouts), object/number/directory interpreters, unknown runtime, missing and non-executable interpreters, and the trust anchor; syncs both design-doc language versions with the validated contract. * docs(design): complete the migration inventory handoff Adds the three interpreter-identity call sites the re-review found missing from the call-site inventory (hook-command-cgroup launcher, bwrap-execution and landlock-execution allowlist staging), marks the unwired rows as owned by the S3 migration sweep, and notes platform applicability: the cgroup/bwrap/landlock rows are Linux-only mechanisms validated against the Linux targets of the platform matrix, while the mem0 and pem rows apply on every platform. Both design-doc language versions are updated; no product or test code changes. * style: apply prettier to the bun boundary docs and runtime tests Fixes the failing Lint & Static lane: `prettier --experimental-cli --check .` ([email protected], the lockfile resolution) rejects the two bun-runtime-boundary design docs and the two runtime-info test files introduced by the runtime boundary change. Formatting only — markdown table alignment, emphasis markers and code line wrapping; no content or behavior changes. * test(core): harden runtime boundary fixtures and document validation scope * test(core): reject stderr errors while awaiting fixture identity * test(core): expose Bun version and complete runtime call-site inventory --------- Co-authored-by: Shaojin Wen <[email protected]> Co-authored-by: gary.gq <[email protected]>
…indings by Runtime Session (QwenLM#14339) PR2 of QwenLM#14211. Add HarnessOwnership.sharesRuntimeSessions and give every site that derived the owning Harness Session from the binding's isolation key an additive branch: on a Workspace-isolated, managed-context local-process binding of the Workspace profile, admission, tombstones, execution admission, original-owner recovery and release, saved-Session release, activation, the server transport context and operator recovery answer each Runtime Session for its own Harness Session; every other binding runs the unchanged expression. No such binding can be placed until PR3 widens the isolation policy, so behaviour reachable today is unchanged. Updates the design to revision 3: the Workspace-isolated close evidence is accepted, idle retirement and the generation budget are deferred, and the slices are reordered.
* fix(acp): preserve cancellation intent across session recovery Co-authored-by: Qwen-Coder <[email protected]> * test(acp): provide continuation history and attempt recording mocks Co-authored-by: Qwen-Coder <[email protected]> * refactor(core): move turn_result payload shape to a leaf module `session-api-history` imported `isTurnResultRecordPayload` from `chatRecordingService`, which already imports `getApiHistoryPromptId` back from `session-api-history` — closing a value-level cycle that was type-only before. Move the `turn_result` payload shape (type guard, payload types and their length caps) into `turn-result-record.ts` and re-export it unchanged from `chatRecordingService`, so both writers and readers import it from a leaf. No behavior change. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuv5xnnu7c * fix(acp): settle forwarded prompt interruptions as cancellations The bridge classifies a non-user cancel as `qwen:prompt-interrupted` (bridgeTypes.ts), but only `USER_CANCEL`/`SESSION_DISPOSE` were listed in the controlled-cancellation gates and in the Goal pause ladders. A client detach or a prompt deadline therefore settled the turn as an error -- StopFailure hooks firing, `turn_result{state:'error'}`, a rejected prompt RPC -- and journaled a Goal turn as a provider failure, a phantom completed iteration, or a requeued turn, where base settled `{stopReason:'cancelled'}` and paused. Interruption stays distinct from user intent: `cancelledAt` is still stamped only for `qwen:user-cancel`, so the recovery gate this PR adds is unchanged. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuvismcx82 * fix(serve): abort the acp-http cancel with user intent `session/cancel` bare-aborted the in-flight prompt controller right before `bridge.cancelSession`, so the reason became the default `AbortError` and the first (memoized) `craft/cancelPendingPrompt` forward carried `qwen.cancelReason: 'interrupted'`. An explicit user Cancel over that transport was never stamped as a user cancellation -- the behaviour this PR exists to restore -- while the daemon's REST cancel route already recorded user intent. Detach (`connection-registry`) and prompt supersede keep aborting without a reason, so they still classify as interruptions. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuvismcx82 * fix(acp): mark infrastructure cancels as interruptions Five in-tree callers cancel a session for infrastructure reasons - the channel quarantine drain deadline, a tightening workspace fence, a fenced Goal turn, the agent-run stall timeout and workspace teardown - and all of them supplied no `_meta`. The child therefore decoded them as an explicit user cancel and stamped the settled turn with `cancelledAt`, which this branch promotes to the authoritative recovery gate, so the cancelled turn was durably excluded from recovery. Each caller now carries the same interruption provenance the daemon's own cancel path already understands. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuvn2xwu8a * fix(acp): write retry ownership before the lap abort check The ownership link was written only for a re-attempt lap that reached the model send, while the terminal is written for every settled re-attempt lap. A Retry/Continue cancelled before its first send therefore persisted a cancelled `turn_result` with no `turn_attempt`, and the next restore read the ORIGINAL attempt's outcome and re-offered the work the user had stopped. Move the write to lap entry, above the abort check, so the link lands as unconditionally as the terminal it owns. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuvn2xwu8a * fix(core): treat turn_attempt as a neutral tail record `turn_attempt` is a content-free bookkeeping system record written by the new pre-send ownership link, and its terminal sibling `turn_result` is already registered as a neutral tail subtype. It was registered in the other subtype registries but not this one, so `inspectConversationBranches` reports the attempt as a branch's semantic leaf and counts it in `recordCounts.system`. Refs review thread PRRT_kwDOPB-92c6pIz4J (R1-31). Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuvp83ny8e * test(core): pin the idle-compaction cancellation guard `markLastTurnCancelled()` stamps unconditionally, so without the `cancelledLastTurn` guard a routine timer-driven idle compaction on a cleanly finished turn would make `isLastTurnCancelled()` true and suppress continuation. The one existing compact_history case pre-marks the chat, which makes the guard a no-op inside it, so reverting the guard to an unconditional re-mark kept the suite green. Refs review thread PRRT_kwDOPB-92c6pIz3G (R1-27). Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuvp83ny8e * test(cli): expect the interrupted cancel reason on workspace opt-out The opted-out teardown now stamps `qwen.cancelReason: 'interrupted'` on the agent-session cancel, so `workspace-agents.test.ts` must assert the CancelNotification payload instead of a bare session id. The stale one-arg expectation was red on CI in `Test (ubuntu-latest, Node 22.x)` ("cancels agent sessions before stranding runs when a workspace opts out"). Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-conflict/jmuvov8oo8d * fix(acp): pin cancel provenance and honour a declared cancel reason The acp-http session/cancel handler hardcoded the user-cancel reason on its local prompt controller, and that abort wins the cancel-forward memo, so a client-declared interrupted reason was restamped as user intent before it could reach the wire. Derive the reason from the same metadata the handler already forwards; an absent key still returns the user-cancel default. Also pin the stall-timeout cancel notification to its exact two-argument shape, and pin that an ordinary prompt writes no turn_attempt ownership link (the guard that keeps the strict append off the normal prompt path). Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuw4884i9a * fix(cli): stamp budget-enforcement cancels as interrupted AgentDispatchPort.cancel forwarded a one-argument cancelSession, so the bridge's absent-key arm stamped an over-budget teardown as an explicit user cancel and durably suppressed recovery for a turn no person stopped. Forward the interruption metadata the same file already sends from the stall watchdog. The two ChannelAgentBridge sites named in the same finding need an interface widening and stay out of this PR. Co-authored-by: Qwen-Coder <[email protected]> * docs(design): record the two accepted cancellation-provenance losses Review left two decisions open that the doc's own rules already imply but never wrote down: pre-change transcripts stamped cancelledAt for non-user aborts too, so they now read as explicitly cancelled and permanently lose recovery; and the unmarked-entry rule is fail-open across four named producers, so a restart can re-offer work the user stopped. Both are recorded as accepted, with the reason closing them is not a mechanical repair. Co-authored-by: Qwen-Coder <[email protected]> * fix(acp-bridge): keep the declared cancel provenance on the pre-dispatch abort cancelSession forwarded the caller's `_meta` on the dispatched branch but pinned the abort to USER_CANCEL_ABORT_REASON. `onAbort` re-derives the forwarded `qwen.cancelReason` from that abort reason, so an infrastructure cancel landing before dispatch (direct-forward gate false) reached the child as `'user'` and was durably recorded as an explicit user cancellation nobody made, which then excludes the turn from recovery. Derive the abort reason from `notif._meta`. An absent `_meta` still yields USER_CANCEL_ABORT_REASON, so plain user cancels, the metadata-less HTTP body and removePendingPrompt are unchanged. Co-authored-by: Qwen-Coder <[email protected]> * test(serve): make the cross-agent cancel assertion arity-insensitive `cancelSession` now takes a provenance argument and `toHaveBeenCalledWith` matches the argument list exactly, so `not.toHaveBeenCalledWith('alice-session')` passed unconditionally after the widening: a regression that cancels another agent's session with the two-argument shape no longer tripped it. Assert on the recorded session ids instead. The sibling `closeSession` assertion still discriminates and keeps its shape. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuxhiwywbh * fix(daemon): preserve interruption provenance and cancelled turn ownership Co-authored-by: Qwen-Coder <[email protected]> * docs: align cancelled turn attempt admission translation Co-authored-by: Qwen-Coder <[email protected]> * test(cli,channels): align cancel assertions with interruption provenance The daemon now passes { cancelReason: 'interrupted' } to cancelSession and returns _meta['qwen.promptCancelled'] on cancelled prompt results, so the three assertion sites left behind by that change are updated here: the two channel spies pin the new second argument, and the Session cases relax toEqual to toMatchObject because the new _meta carries wall-clock fields. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-conflict/jmuxv3lk3c4 * fix(acp): replay interrupted turn cancellation markers Co-authored-by: Qwen-Coder <[email protected]> * docs: distinguish recovery limitations from accepted policy Co-authored-by: Qwen-Coder <[email protected]> * test(sdk): align interrupted transcript projection with replay Verify the display marker uses endedAt without changing persisted provenance, while retaining malformed-terminal controls. Co-authored-by: Qwen-Coder <[email protected]> * fix(acp): preserve cancellation intent across recovery Carry interruption provenance through SDK and channel cancellation, permit one-way user upgrades, and fence all in-flight cancellation handshakes. Keep explicit intent per admission, resolve prompt identity through automatic tails, and preserve the cancellation basis when setup rolls back. Co-authored-by: Qwen-Coder <[email protected]> * fix(core): honor recorded notification boundaries in recovery Keep authoritative cold-record notification counts, including zero, ahead of live notification heuristics when resolving cancellation ownership. Co-authored-by: Qwen-Coder <[email protected]> * fix(acp): keep upgraded user cancels and restore attempts consistent - bridge: latch an explicit user cancel that lands on an already-aborted, not-yet-dispatched prompt so the post-dispatch forward carries 'user' - session: follow a turn signal back to its admission signal when checking user cancel intent, so the pre-send lap-top marks an upgraded cancel - session: write a restore prompt's turn attempt after the restore no-op bail instead of before it, so a no-op restore writes no phantom attempt * fix(channels): normalize provenance-string prompt aborts to AbortError DaemonSessionClient rejects an aborted prompt with signal.reason, which is now a provenance string; rethrow it as the AbortError callers classify and render, keeping the string on the signal for the daemon. * docs(design): disclose session close as an unrecorded cancellation intent * fix(acp): preserve user intent when closing active sessions Co-authored-by: Qwen-Coder <[email protected]> * fix(channels): normalize abort sentinel on the attachment-upload leg DaemonChannelBridge.prompt() aborts its controller with a provenance string ('qwen:user-cancel' / 'qwen:prompt-interrupted'), and the session client rejects with signal.reason verbatim. The session.prompt catch already normalized that back into an AbortError, but the attachment-upload catch in the same method rethrew it raw, so a cancel landing while an upload was in flight made prompt() reject with a bare string. Downstream ChannelBase.lifecycleError is `err instanceof Error ? err.message : String(err)`, so the internal provenance token became user-visible failure text and emitTaskLifecycle certified a cancellation as a failure. Share one local helper between both catch legs so they cannot drift again, and pin the upload leg with a test covering both sentinels. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmuzbyw3ref * fix(acp): carry the session-agent stop reason to the bridge The session-agents runtime aborted its run signal bare, so the adapter cancelled the session without provenance and the bridge decoded a stall or a shutdown as a person's stop: the cancelledAt it stamped then suppressed continuation after a restart. Abort with the shared reason constants and forward them as `qwen.cancelReason` - the encoding the workspace-agents twin and the SDK transports already use - so only a real person's stop is read as one. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmv0goxwkgj * fix(core): require explicit cancellation provenance on recovery Preserve legacy timestamp-only cancellation records as unknown intent. Persist an explicit user marker at reason-aware Session settlement and require it alongside the cancellation timestamp in both full and selective recovery. Co-authored-by: Qwen-Coder <[email protected]> * fix(acp): confirm legacy cancellation recovery Require explicit confirmation for the current legacy cancellation boundary across restore, daemon controls, SDK and WebShell. Reject missing or stale confirmation again at final dispatch while preserving ordinary interruption recovery and proven user cancellation. Co-authored-by: Qwen-Coder <[email protected]> * test(web-shell): align continuation fixtures with confirmation checks Keep the coalesced failure probe at admission rejection and assert the default continuation options. Co-authored-by: Qwen-Coder <[email protected]> * fix: retain cancellation provenance through retry and restore Preserve remote Stop provenance without treating restart fencing as user intent. Keep server-owned recovery identities through unchanged history restore and move retry ownership after successful setup. Preserve cancellation during fast compression and cancel SDK turns for both connecting and connected SSE aborts. Co-authored-by: Qwen-Coder <[email protected]> * docs(acp): make the retry acceptance step executable Retry admission arms only after a turn error, so "retry a cancelled prompt" was silently admitted as an ordinary new prompt and never exercised the turn_attempt supersession it exists to accept. Co-authored-by: Qwen-Coder <[email protected]> * fix: preserve cancellation confirmation across SDK and removal Forward SDK confirmation identities, retain unknown-intent recovery boundaries, and carry explicit removal provenance through pending and dispatched cancellation. Co-authored-by: Qwen-Coder <[email protected]> * fix: keep cancellation provenance across teardown and compression Round-10 review fixes for QwenLM#13436: - closeAgentSessions forwards 'interrupted' cancel provenance so a collaboration-disable teardown is not durably recorded as a user stop (R10-2), with the route regression pinning the bridge payload. - tryCompressChat captures the cancellation basis before tryCompress (whose setHistory clears it) and re-marks the replacement chat after the swap (R10-3), with regressions for both the user and unknown-intent confirmation carriers. - The acceptance recipe's restart step now reattaches the persisted session (POST /session/:id/resume) before requesting continuation, in both language versions, so the two arms exercise the recovery classification instead of an identical 404 (R10-1). * fix(core): re-mark the cancelled turn after tryCompress's history rewrite R10-3's second half: tryCompressChat's client-side capture/re-mark (cc8132d) covers the chat-swap path, but direct LlmChat.tryCompress callers (auto-compaction in sendMessageStream, reactive compaction) lose the per-instance cancellation basis when tryCompress's setHistory replaces the history array. Capture the reason and confirmation id before the rewrite and re-mark after, mirroring compressFast, with two regression pins in llm-chat.test.ts. Co-authored-by: Qwen-Coder <[email protected]> * style(core): satisfy the pinned Prettier gate in client.test.ts Lint & Static failed at head cc8132d in the `Run Prettier` step with `[warn] packages/core/src/core/client.test.ts` / `Code style issues found in 1 file`. Reformat that one assertion with the repo-pinned [email protected]. Formatting only, no behaviour change. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-conflict/jmv2mkftd17 * fix: carry cancellation through hard-rescue rollback and pre-send preserve Round-11 review fixes for QwenLM#13436: - LlmChat.sendMessageStream's hard-rescue rollback is the third setHistory rewrite; capture the cancellation reason and confirmation id before it and re-mark after, mirroring the two compression sites, so a failed oversized send no longer drops the cancelled-turn basis (R11-2). Red-verified: removing the re-mark turns the new hard-rescue rollback regression red. - A user cancel landing mid-preparation (after the loop's entry guard, before the model request) never moves userContentPushCount, so bindCancelledHistory's guard could not see it; the pre-send preserve path now marks the re-preserved user content as cancelled (R11-3). Red-verified: removing the mark turns the new preserve regression red. - The acceptance recipe's paired control now names its single variable: omit the Cancel and SIGKILL while the second provider response is still held; a SIGKILL after an explicit Cancel keeps the flushed cancelled terminal on disk (R11-1), in both language versions. * fix(acp): keep cancelled-turn provenance through replay and live paths A cancelled turn now carries `reason` ('user' | 'interrupted') end to end: derived from the persisted `cancelReason` marker in transcript replay, stamped on the live `qwen.promptCancelled` notice, forwarded by the daemon UI normalizer and the restored-block merge, and rendered by the WebUI prompt-cancelled notice, which keeps the user-cancel copy only when the turn was actually cancelled by the user and otherwise reports an interruption. * test(web-shell): re-measure the transcript entry ceiling The interrupted-turn copy in this PR adds turn.interrupted to the shared i18n table every entry ships, so the transcript bundle now measures 1,325,202 UTF-16 code units against the 1,325,000 ceiling. Raise the ceiling to 1,326,500, following the re-measure convention documented in the guard's own docblock. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-conflict/jmv3rahlp2y * fix(cli): check the recovery confirmation only for a real continuation The `--continue-interrupted` confirmation gate landed above the pre-existing no-op bail, and `clean`/`degraded_history` plans carry no `cancellationConfirmationId`. A caller that passed the confirmation it read for a turn that had since settled therefore compared two unrelated things and got `Recovery confirmation does not match the current turn` with exit 1, where the same state answered `No interrupted turn to continue.` with exit 0 before this PR. Keying the gate on `recoveryPlan.continuation` keeps the rule that a missing, stale or mismatched confirmation starts no model request, and restores the no-op for the two kinds that have nothing to confirm. * fix(acp): name a host-cancelled Goal turn as a prompt interruption `#settleGoalTurn` folded `INTERRUPTED_PROMPT_ABORT_REASON` into `GOAL_PAUSE_REASON_USER_INTERRUPT` at both the pre-model and the post-model settlement site. That abort reason is what `getPromptCancelAbortReason` records for any prompt cancellation whose meta names a reason other than `'user'` -- a host teardown, a client disconnect, a takeover -- so the pause card told the person reading it that they had interrupted a turn they never touched. Both cancels still pause alike; only the name splits. The interrupted reason now records `GOAL_PAUSE_REASON_PROMPT_INTERRUPTED`, which states the cancellation's provenance without asserting the user acted. * refactor(acp): trim cancellation recovery changes Co-authored-by: Qwen-Coder <[email protected]> * fix(acp): narrow cancellation recovery to owned terminal outcomes Keep unknown legacy cancellations closed and move confirmation and display flows to a follow-up. Reuse execution ownership instead of history snapshots. Co-authored-by: Qwen-Coder <[email protected]> * feat(acp): confirm legacy cancellations and clarify interruption notices Stack the optional confirmation protocol and SDK/UI display changes on the cancellation recovery safety fix. Keep rejected continuation from changing terminal ownership. Co-authored-by: Qwen-Coder <[email protected]> * fix(acp): limit cancellation recovery to the daemon boundary Remove remote Host and channel attribution expansion, reuse existing history identity, and keep SDK cancellation deduplication instead of a second client state machine. Preserve durable cancellation veto and genuine crash recovery. Co-authored-by: Qwen-Coder <[email protected]> * fix(acp): keep recovery status available without transcript evidence Keep context reads total while continuation remains fail closed, preserve unknown cancellation provenance through history merges and trajectory views, and pin the affected contracts. Reuse main Goal pause behavior instead of adding another pause reason. Co-authored-by: Qwen-Coder <[email protected]> * refactor(acp): narrow legacy confirmation to daemon recovery Reuse the existing terminal identity and Continue path. Restore cancellation notices, transcript projections and stream-json behavior to main, and expose confirmation IDs only in recovery status. Keep explicit user cancellation, ambiguous records and stale confirmation blocked at admission and execution. Co-authored-by: Qwen-Coder <[email protected]> * fix(web-shell): scope the confirmation owner re-check to the dialog path The unconditional confirmationOwner.isCurrent() on the Continue click path tripped DaemonSessionProvider's coalesced-failure case, which pins that no owner-guard isCurrent() runs before the continuation failure is observed. The re-check only matters when the blocking window.confirm was actually shown, so move both the capture and the check inside that branch. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmv95mdhc6u --------- Co-authored-by: Qwen-Coder <[email protected]> Co-authored-by: yiliang114 <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]>
…k budget, and release a relay hold that never took (QwenLM#14061) * test(managed-agent): size the member command ITs' timeouts above their waits, and drop a relay hold that never took Both cases' @timeout sat below the sum of the bounded waits they wrap (the restart case: 180 s against ~465 s), so a stall on a loaded runner could end as a bare JUnit timeout before the stalled phase's own atMost reported it. Raise each bound above that sum plus the Spring start. holdMessageRelay asserted the hold before handing back its release latch, so a hold that never took stayed queued with nobody left to release it: once it ran it parked the relay's only thread, and the context close then waited out its 30 s shutdown phase on it. Release it on that path (an interrupted wait included), so the queued task returns as soon as it runs. The restart case's note on the relay-attach race now states only what was observed: the takeover's load is refused with 409 hosted_session_already_attached and deferred a full backoff step. * test(managed-agent): keep the member command IT inside the Hosted fork budget, and pin its relay hold's release The Hosted*IT classes share one failsafe fork. Raising this class's ceilings to 360 + 540 s put it 350 s outside the fork-budget model in scripts/tests/hosted-process-ci.test.js, and nothing in CI checked this class against it. The ceilings go back to 240 + 180 s. A case cut by its @timeout still reports the wait it was in: every wait goes through waiting(), whose failFast fails on the interrupt, and JUnit attaches that failure, with the line of the wait, to its TimeoutException. The budget test's summed-ceiling row, so far run only for HostedTeamLeadMySqlIT, now runs for this class too. The relay hold moves into SchedulerHold so that SchedulerHoldTest can pin the release of a hold that never took: with the release removed, the probe task queued behind it never runs. * test(managed-agent): pin the interrupted relay hold, and keep its files checkstyle-clean SchedulerHoldTest pinned the took and timeout paths of the hold's release guard, not the interrupted one: dropping the try/finally (the timeout branch unchanged) kept both cases green. A third case interrupts the caller while its hold is still queued, the way a case's @timeout does, and checks that the scheduler's only thread is left free. That mutant now fails it, and only it. The board case's budget comment said every wait goes through waiting(). The Awaitility waits do; the raw waits left (Process.waitFor, the relay hold's latch, HttpClient.send) throw on the same interrupt, which the comment now says. Main's qwen-code-checks.xml (QwenLM#14186) covers test sources, so the two new files take its import order and braces; checkstyle:check on the module is clean. --------- Co-authored-by: 易良 <[email protected]>
…wenLM#14265) * feat(managed-agent): read-only snapshot children (QwenLM#13753 I3) A hosted parent can launch a child agent with isolation "snapshot": the child reads a frozen copy of the parent's working tree, taken when it starts, and nothing it does reaches the parent's Workspace. This is the last slice of QwenLM#13753, and it records as final that serialized sharing needs no value of its own: the storage lease already admits one holder at a time. The copy is a child Workspace prepared as a worktree child's is. The child bound to it gets a new hosted profile, hosted-workspace-read/1, which declares read_file and glob and nothing else, whatever lanes, orchestration or MCP the Session has. The store sets that profile from the row's mode in the transaction that checks the copy is ready, so no caller can bind a copy to a profile that writes; the tool turn refuses every undeclared call before the Broker is acquired. A snapshot's child Workspace records its mode in the request of its child Workspace operation, written once and never rewritten; a request that names none is a worktree's, so worktree rows read exactly as before and no schema change is needed. A snapshot never merges: the relay asks only its discard and holds no settlement for it, the store records a stray merge ask as a discard, and its result commits with no workspace member. A relay that meets a mode it does not serve settles the run never started instead of creating it shared. A snapshot child has no message lane, so send_message refuses it while it runs and a later message continues it as a new snapshot; a team member, which trades messages with its leader, cannot be a snapshot. A separate switch, child-snapshots-enabled (off by default, requires child Workspaces), adds childSnapshots to every hosted create and load; only a Session carrying both flags offers or admits snapshot. A replica from before this change would create a snapshot run as a shared writer, so the switch goes on only after every replica runs this version; the design gives the rollback procedure. The I1 and I2 designs gain notes, and the I2 design's decisions 5 and 8 now name the give-up of an unbound row as the one relay discard of completed work (QwenLM#13905 item 1). * fix(managed-agent): resume a snapshot child's committed reads after Runtime replacement Review follow-up for QwenLM#14265 (QwenLM#13753 I3). - The G3 step-3 path (QwenLM#14059) resumes a results_ready checkpoint without reacquiring a retired Runtime owner, but it accepted only hosted-workspace-files/1. A snapshot child's read profile fell through to acquire(), which failed with "Cleanup Runtime owner changed.", so a load driving runtime recovery returned 503. The read profile now takes the same path: its batch is always read_file and glob, the batch that path already resumes without file history. - isHostedWorkspaceSearchProfile is back to the /2 profiles only; approval pre-approves glob through the new isHostedWorkspaceGlobProfile. - HOSTED_WORKSPACE_READ_TOOLS takes read_file by name, not by position. - A team member launched as a snapshot is told only of the isolation the host serves. - The Java profile literal moves to WorkspaceToolProfiles.READ. - Docs: the I3 design and the G3 step-3 recovery note name the read profile. * fix(managed-agent): address the second review of snapshot children Pin the new Row.snapshot() accessor in the lock-order audit's exact exemption set, which main's stricter pin turned red after the merge. A running snapshot on a closing Session now gets the closing refusal, so nothing promises a continuation that admission would refuse. The read profile's read_file lookup now throws at module load when the file tools lose read_file; spreading the failed lookup would have declared a tool with no name. Add the tests the review found missing: both sides of the glob predicate, a launch body naming shared, the snapshot flag without child Workspaces, unqualified launches on a snapshot-capable host, the legal boot configuration, and foreground, folded and notified snapshot results carrying no workspace line. Update the design's file inventory, its post-merge lanes and the replaced-Runtime validation wording. * fix(managed-agent): give a snapshot child no skill catalog Main's static Skills put skill instructions into every Session whose agent definition publishes Skills. The read profile declares only read_file and glob, so a snapshot child would be told to use a skill tool it refuses, and an undeclared call fails the Turn. A read-profile Session now drops the catalog once its profile resolves, on create and on load. The design records the exclusion and that a snapshot child still inherits its agent definition's hooks.
…llable (QwenLM#14217) * fix(web-shell): keep dialogs over the mobile drawer touch-scrollable The phone-width drawer installs a document-level touchmove blocker whose allowlist only covered its own subtree. Dialogs portal outside that subtree, so every dialog opened from the drawer had all touch scrolling prevented — Add Workspace included, which left its confirm buttons unreachable. Rotating to landscape tripped the max-width media query, closing the drawer and unregistering the blocker, and rotating back did not reopen it. That is why scrolling appeared to come back only after a rotation round-trip. Exempt [data-web-shell-dialog] in the blocker's allowlist, and carry that marker in the DialogShell test mock so the exemption is covered. Refs QwenLM#14184 * test(web-shell): pin the dialog touch-scroll guard's closest() walk The regression test only dispatched touchmove on the element carrying [data-web-shell-dialog], making closest() and matches() indistinguishable to it — while real phone gestures start on a descendant of the panel. Dispatch on the panel's first child as well; verified by mutation that narrowing the guard to matches() turns this test red. --------- Co-authored-by: wenshao <[email protected]>
) Co-authored-by: 钉萁 <[email protected]>
…wenLM#14316) * feat(web-shell): integrate Managed session workflow * docs(managed-agent): align model-switch acceptance translations * fix(managed-agent): reconcile WebShell integration checks * fix(managed-agent): address WebShell review feedback * fix(managed-agent): align schema projections and CI probes
* feat(web-shell): add confirmed file deletion from file tree * test(serve): include file deletion in capability baseline * fix(web-shell): address file deletion review suggestions * test(cli): synchronize child cancellation tests * test(web-shell): refresh transcript budget after file actions --------- Co-authored-by: 钉萁 <[email protected]> Co-authored-by: Shaojin Wen <[email protected]>
…4364) Co-authored-by: Qwen-Coder <[email protected]>
… pointer (QwenLM#11774) * docs(design): state the permission field as it behaves and fix a dead pointer Three accuracy defects in committed design content (QwenLM#11712), none of which affects runtime behaviour. The DingTalk permission-card design contradicted itself: the non-goals called the field "single-choice", the controller section called it a checkbox group. The implementation is both — `type: 'CHECKBOX_GROUP'` in `permission-card-controller.ts`, whose `parseDecision` returns `undefined` for any submission that is not exactly one value, so `handleCallback` answers `ignored` and the record stays unclaimed. Both sentences now say that, because a checkbox group that silently rejects a multi-selection is a user-facing contract, not an implementation branch. `agent-frontmatter-schema.ts` pointed at §9.3 of the web-shell backend design for the `executor` extension; that document ends at §7. The field is specified in §2, which states the executor selection rule and requires invalid explicit definitions to be rejected — what the schema implements. The capacity baseline said its 80-second idle window covers "the 60-second reaper/sweep and the first PR scan" without naming either, so a reader could not check it. Both are real and now linked: the session reaper's 60000 ms default, and `session-pr-refresh.ts`'s `FIRST_RUN_DELAY_MS`, which fires one sweep 60 s after the daemon starts and every 5 min afterwards. * docs(design): scope the ignored rule to submit, and name the third idle interval The reworded single-choice sentence stated the ignored rule for every callback, but PermissionCardController.claim() takes the cancel branch before parseDecision and returns accepted with terminal state cancelled - which the same document already says nine lines below and in its terminal table. Scoped to submit, with the cancel case stated. The idle-window sentence accounted for two of the three resident intervals this document enumerates: the 60-second ACP connection sweep also fires inside the 80-second window and was neither claimed nor excluded. Named, reusing the anchor the document already fixes for it. Its session-reaper anchor was itself dead: bridge.ts#L2730 is unrelated code today; the interval is created at #L4103. * docs(design): repoint five line anchors that no longer resolve Review found the replacement anchor for the session reaper landing on `withWorkspaceControl` instead of the reaper. It resolved at the merge base and `main` moved it, which is the same failure this PR was opened for, one revision later. So the anchors were not spot-checked this time, they were resolved. Every `#L<n>` link in the document was opened against the current tip and printed next to the line it lands on. Four more were already dead: bridge.ts#L4103 -> #L4149 `sessionReaper = setInterval(` scheduled-task-keepalive#L454 -> #L455 `fileWatcher = fsSync.watch(` server.ts#L738 -> #L742 `KEEPALIVE_MAX_INTERVAL_MS = 10 * 60_000` workspace-management.ts#L1160 -> #L1166 `const publishRuntime = async () =>` run-qwen-serve.ts#L465 -> #L4311 `opts.maxTotalSessions ??= deriveDefault...` The other eight resolve onto the line their text names and are left alone. * docs(design): pin the baseline's code links to its experiment commit, mirror the wording in zh-CN The capacity baseline states it ran on 1a73f5b. Its code links were relative, so they followed main and went stale again after QwenLM#11916 moved bridge.ts. They are now permalinks to that commit, with each line checked there. The DingTalk permission-card design gained a zh-CN version on main; it now carries the same single-choice wording as the English one. --------- Co-authored-by: 易良 <[email protected]>
Co-authored-by: 易良 <[email protected]>
* fix(web-shell): polish files and trim preview resources * test(cli): observe pending child Hook promises * fix(web-shell): address Files browser review findings * fix(vscode): sync Pierre modification notices * chore: ignore the repo-local .pnpm-store fallback directory pnpm falls back to a project-local store at .pnpm-store/ when the global store directory is not writable (e.g. sandboxed CI runners). It is a regenerable cache that node_modules hard-links into; its thousands of untracked files otherwise dirty the working tree and fail deterministic workspace-clean verification. Co-authored-by: Qwen-Coder <[email protected]> * fix(web-shell): address Pierre preview and file display review findings - getPreviewLanguage folds case on the extension only, so README.MD and config.YML highlight while whole-name detector keys (Gemfile, BUILD) keep their case-sensitive behavior - formatFileName strips the full Default_Ignorable_Code_Point class so zero-advance Hangul fillers and variation selectors cannot desync the tree search projection from the rendered name - pin the previously unwitnessed pierre-build guards: redirected Shiki subpaths count toward the 4 MiB budget, getModuleInfo may return null for redirected ids, emitted assets are skipped, and entry-module resolveId calls carry no importer - pin the theme name->module mapping with exact token colors and give the formatFileName display sites discriminating coverage with repeated-space names --------- Co-authored-by: 钉萁 <[email protected]> Co-authored-by: qwen-code[bot] <qwen-code[bot]@users.noreply.github.com> Co-authored-by: Qwen-Coder <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]>
…hing (QwenLM#14323) * feat(web-shell): integrate Managed session workflow * docs(managed-agent): align model-switch acceptance translations * fix(managed-agent): reconcile WebShell integration checks * fix(managed-agent): address WebShell review feedback * fix(managed-agent): align schema projections and CI probes * feat(managed-agent): add Shell Full Access and approval switching Freeze approval selection per Turn, preserve legacy retry identity, and allow owner-authorized idle policy changes with durable WebShell confirmation. Co-authored-by: Qwen-Coder <[email protected]> * feat(web-shell): integrate Managed session workflow * docs(managed-agent): align model-switch acceptance translations * fix(managed-agent): reconcile WebShell integration checks * fix(managed-agent): address WebShell review feedback * fix(managed-agent): align schema projections and CI probes * feat(web-shell): integrate Managed session workflow * docs(managed-agent): align model-switch acceptance translations * fix(managed-agent): reconcile WebShell integration checks * fix(managed-agent): address WebShell review feedback * fix(managed-agent): align schema projections and CI probes * fix(web-shell): scope Local approval overlays to the active backend * test(web-shell): refresh transcript size evidence after main sync * feat(web-shell): integrate Managed session workflow * docs(managed-agent): align model-switch acceptance translations * fix(managed-agent): reconcile WebShell integration checks * fix(managed-agent): address WebShell review feedback * fix(managed-agent): align schema projections and CI probes * fix(web-shell): scope Local approval overlays to the active backend * test(web-shell): refresh transcript size evidence after main sync --------- Co-authored-by: Qwen-Coder <[email protected]>
) Co-authored-by: Qwen-Coder <[email protected]>
…enLM#14293) * fix(ci): route post-merge classifier to ECS * fix(ci): let CLI workers drain RPC replies between tests Yield with a captured real timer so synchronous test batches cannot starve progress acknowledgements, even when fake timers are installed. Keep unhandled errors fatal on Linux. * test(cli): clean up mounted replay fixtures
…enLM#14356) * fix(hooks): gate headless file and skill prompts before expansion Headless ran a custom command's or skill's action before UserPromptSubmit, so a blocking hook could not stop embedded shell commands or a skill's tool and hook registration, and the hook saw the expanded template. Run UserPromptSubmit on the raw input before a file command or skill (stacked skills included) expands, once per submission, and hand the verdict to that submission's first model request instead of running the hook again on the expanded text. The verdict is a single-use token bound to the client, session, prompt id and hook owner; any other use throws. A refused command is not expanded and the request blocks through the existing UserPromptSubmit block path, so output and cleanup are unchanged. * test(core): reject a prompt admission after the session changes
…14268) * feat(mods): support commands in interactive terminals (PR4a) * fix(mods): preserve terminal recovery after startup failures * fix(mods): guard terminal session transitions and startup failures --------- Co-authored-by: qqqys <[email protected]>
…M#14341) (QwenLM#14342) The "Approve release PR (second bot)" step fails when CI_BOT_PAT resolves to the same GitHub user as CI_REVIEW_BOT_PAT (the PR author), because GitHub rejects self-approval at the API level. This has broken every stable release since v0.25.1, blocking auto-merge and requiring manual intervention. Make the step continue-on-error so that auto-merge can still proceed when branch protection only requires one approval or a human has already approved. Add a warning step that surfaces the root cause in the run log and links to the tracking issue.
… read (QwenLM#14299) The send-order hold reads each older owed message's body to learn its run. A body not readable yet, or not JSON, threw into work()'s catch and charged the younger message an attempt, although the hold is meant to cost none. Such a body cannot prove its run, so it now holds like one to the same run, at no attempt. The older message's own step fails the same read, and its give-up ends the hold.
… Sessions (QwenLM#13918) * fix(managed-agent): tenant-wide InnoDB locks must not wedge unrelated Sessions A Session marked recovery_blocked wedged later foreground turns of every other Session on the same hosted-harness daemon: hot-path admission and write routes took the two per-tenant InnoDB guard rows (qwen_tool_publication_tenant, qwen_runtime_placement_guard) unconditionally, so one long holder froze every Session of the tenant behind innodb_lock_wait_timeout (50 s), past the client's 30 s request timeout, with no terminal event and the model never called. Ordinary per-turn traffic now fences only per Session (drain + head row). Admission paths that must serialize across the tenant take the guard rows with a 5 s per-statement bound and degrade to a named 503 tenant_guard_contended instead of a silent freeze; the hosted harness surfaces transport/5xx store failures as managed_session_store_unavailable in the settled turn result. requireIdleJournal re-verifies the scanned journal against the head revision read under the held head lock, failing closed with workspace_lifecycle_journal_unverified when a concurrent commit landed after the transaction snapshot. Witnesses: ManagedSessionGuardConvoyIT (held tenant guards no longer wedge unrelated Sessions; bounded acquisition and lifecycle authorization fail fast with the named error, the blocked Session keeps its own state), idleJournalCheckReVerifiesARevisionItsSnapshotCannotSee, the rewritten ordinaryAuthorizationFencesOnlyWithinOneSession contract, and a hosted-harness transport-failure settle test. References QwenLM#13800 * fix(managed-agent): restore replay and guard ordering after R1 review (QwenLM#13918) Address three findings from the R1 review of QwenLM#13918: - Keep the idempotent-replay read snapshot strictly after the head row lock: findHeadForUpdate now executes the head SELECT ... FOR UPDATE first, so a duplicate commit released by the lock sees the winner's committed transaction and replays instead of surfacing 409 managed_session_head_conflict. - Move bounded acquisition to the first tenant-wide touch on every publication lane: ToolPublicationStore.applyLocked, ToolPublicationStore private lockTenant helper, ToolPublicationDataStore.lockTenant(key), ToolPublicationAdmissionStore.commitReceipt's placement guard and its private lockTenant(key), and the retention read-lease opener (ToolPublicationRetentionStore.lockSessionHead) all acquire with the shared 5-second-per-statement bound and the tenant_guard_contended mapping, with lockBounded and GUARD_ACQUIRE_TIMEOUT_SECONDS turned package-visible. - Take placement before the drain admission check in acquireWriter, matching the begin paths' placement-before-drain order and removing the drain-gap/placement deadlock that InnoDB used to dissolve by killing the writer. Witnesses (all in ManagedSessionGuardConvoyIT, mutation-checked to go red when each mechanism is restored): duplicateCommitReplaysAfterWaitingForTheHeadLock, heldTenantGuardsBoundPublicationLaneEntries, writerAcquisitionOrdersPlacementBeforeTheDrainFence. * fix(managed-agent): serialize record commits with lifecycle admission, pin snapshot after CAS The two Java/MySQL CI lanes went red after the R1 push; SHA-level reproduction at the pre-R1 head pins both mechanisms to the D1 decoupling, not the R1 changes. - commit() re-acquires the placement guard through the bounded wrapper right after checkLifecycleWriter, so a begin/lifecycle admission still serializes behind an in-flight record commit (pins ManagedAgentMySqlIT#serializesDeletionBehindTheRecordCommit); the convoy witness's committed arm flips from completing to a fast named tenant_guard_contended. - acquireWriter moves requireSessionOpen behind the CAS acquisition: the first consistent read is pinned after the guard waits, so a retirement committed underneath is visible to requireLive (pins WorkspaceSessionRetentionMySqlIT#retirementSerializesQueuedWriterAndProjectionCompletion and O4MySqlGate#writerReallyWaitsOnRetirementTransactionAndThenIsRejected). - The duplicate-commit replay witness now parks at the placement guard (the commit's first lock) instead of the head row, is renamed accordingly, and rolls back the winner on failure paths so removeSchema cannot hang on a leaked transaction. Dead bounded overloads in WorkspaceMigrationAdmission are removed. Design docs updated in both languages with an R2 corrections section (QwenLM#13800). Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): surface named store failure on blocked session status A turn whose terminal journal write dies against the store latches the session authority's writer: every later settlement write fails as ManagedSessionWritesStoppedError without reaching the store again, and the caller-visible status degraded to a bare recoveryBlocked boolean, losing the managed_session_store_unavailable classification (QwenLM#13800 R2 review, design D4). Keep the named failure in memory on the HostedSession and answer it as recoveryReason from /session/:id/status while the block holds. The reason is preserved, not re-classified: the prompt-route settle retry takes it from the original store error or from the recorded turn stopReason, the continuation fallback keeps its already-computed failureReason, and every site that clears session.blocked (including redrive adoption) clears recoveryReason with it. The uncertain-write recovery constraint is unchanged — the latch stays armed and no persisted terminal state is claimed. Witness: preserves the named store failure on session status when turn_result cannot commit — a real journal-append failure against the local JSONL store on the turn.settled batch ends the turn recovery-blocked with the named reason on status, and the next prompt is still refused with 409 hosted_turn_recovery_required. The witness also exposed a scope defect in the first cut (storeFailure was declared inside the retry try block but read in the catch), fixed by hoisting. Design doc D4 (EN + zh-CN) now names the recoveryReason field. * fix(cli): classify store failures on the continuation settle path The continuation route's outer catch only kept a named store failure when the inner model-stage catch had already computed it (failureReason was pre-set there). But toolTurn.finish(), the consumed-runtime flush, and the terminal turn.settled journal write sit outside that catch: a store-side failure thrown from them landed with failureReason still at its 'error' initial value, the fallback settlement then died on the authority's write latch, and /session/:id/status degraded back to a bare recoveryBlocked boolean with no recoveryReason (QwenLM#13800 R3 review). Classify the outer catch's cause with namedStoreFailure once, folding the named reason into failureReason before the fallback record/state surface read it. The named reason is preserved from the original failure — no re-classification of ManagedSessionWritesStoppedError — and the uncertain-write constraints stand unchanged: the write latch stays armed and no persisted terminal state is claimed. Witness: preserves the named store failure on session status when the continuation settle cannot commit — a real /managed-runtime/continue drive with the model completing successfully and the turn.settled journal batch dying once with a synthetic exhausted 503 now surfaces recoveryReason: managed_session_store_unavailable while the block holds, and the replay is still refused with 409 hosted_turn_recovery_required. * fix(cli): preserve named store failure on session status for bare-load recovery The automatic bare-load recovery drives the resumed turn entirely inside startHostedRecoveredTurn, bypassing the prompt-route and manual-continue fallbacks that already mirror the named store failure into the in-memory recoveryReason. Classify the original cause in its resumed.catch too, so a turn.settled journal append that cannot commit still surfaces its name on /session/:id/status while the write latch stays armed. The witness parks a publication Session mid-round, lets the next bare load answer the model, and kills the settlement batch with a synthetic exhausted 503: status carries recoveryReason while the same block keeps refusing new turns (QwenLM#13800 R4 P2). * fix(cli): keep the turn-computed store failure name for bare-load recovery The automatic bare-load recovery classified only the raw cause reaching its resumed.catch. When the assistant record's commit died with the store failure first, the terminal turn write failed on the armed write latch, and the cause read back only as ManagedSessionWritesStoppedError — never matched by namedStoreFailure — so /session/:id/status lost the named reason the turn itself had already computed. Capture the turn result through onTurnResult, whose callback fires before the commit is attempted, and fall back to its recorded stopReason exactly like the prompt route does. The new witness drives a bare-load recovery, kills only the assistant record's message.committed batch with a synthetic exhausted 503, and asserts recoveryBlocked plus recoveryReason=managed_session_store_unavailable while the same block keeps refusing new turns with 409 hosted_turn_recovery_required; without the fallback the witness never converges (QwenLM#13800 R5 P2). * fix(managed-agent): keep the v2 probe off the guarded transaction's snapshot The merged v2 probe ran as a plain consistent read before the placement and publication guards. It pinned the transaction's REPEATABLE READ snapshot ahead of those waits, so a retry that waited for the winner kept reading the pre-wait snapshot: findTransactionByCommand missed the winner's commit and validateHead answered 409 managed_session_head_conflict instead of replaying, and the queued writer retirement variants failed with managed_session_not_writable instead of tool_output_session_retired. A locking probe is no answer: MariaDB rejects FOR SHARE outright, and any row lock taken on the Session's own operation row ahead of the guard order deadlocks against the claim below. Read the flag on a dedicated connection instead — committed-state correct, nothing pinned, nothing locked (QwenLM#13800 R5 P1). * fix(managed-agent): classify ordinary v2 fencing with an admission-time read instead of a pre-guard probe The independent-connection probe I shipped for the v2 fence deadlocked the production pool: every @transactional caller already holds one connection, and borrowing a second from the same pool self-deadlocks once concurrent acquires reach max-active (R6 P1 — 20/20 probes threw GetConnectionTimeoutException with zero database lock waits). The two alternatives are both unusable here — a plain consistent read pins the REPEATABLE READ snapshot before the guard waits (the R5 P1 replay regression), and a row-locking probe inverts against the claim order (guards then operation), which the retirement variants surface as tenant_guard_contended instead of tool_output_session_retired. Move the classification out of checkLifecycleWriter entirely. Ordinary traffic keeps its early return there — no probe above the guards — and every ordinary path calls requireNoLifecycleClaim after its own guard or head row is taken: the read stays on the caller's transaction connection, locks nothing, and only names the refusal (workspace_lifecycle_claim_fenced) for a session claimed under lifecycle protocol v2. The saturation witness reproduces the pool deadlock with two pooled connections and four callers; the claim-ordered regression groups and the classification matrix in WorkspaceProfileLifecycleTest all stay green (QwenLM#13800 R6 P1). * fix(core): retry named tenant-guard contention within the request budget The client's withRetry cap of three attempts ends a held-guard window in about 15 s while the server bounds each placement/CAS wait at 5 s: a commit that could have outlasted 20-40 s of guarded contention gets armed behind a ManagedSessionWritesStoppedError latch instead of completing. Classify the named tenant_guard_contended 503 as a definite non-commit — the store rolled the transaction back before writing anything — and keep retrying it every 250 ms, on any route, for the rest of the existing 30 s request budget (QwenLM#13800; adopts the real-stack verified candidate). The three witnesses fail without the change and settle it: - a read route keeps retrying past the attempt cap inside one request budget (six calls where the cap allowed three); - a non-retryable POST gets the same classification because the store rolled the statement back independently of the route's retryable flag; - a persistently contended guard still gives up at the request deadline with the named error, after more than three attempts. * fix(managed-agent): lock the Session root before the head on ordinary paths On the consolidated schema, ordinary writers lock the per-Session ma_session root and then the head, and they do it without a tenant guard (QwenLM#13800). Two entry points still took these locks in a different order: - authorizeOrdinary read the drain admission off the head row (lifecycleFenced, FOR UPDATE) before findHeadForUpdate locked the root. Against an ordinary writer holding the root and waiting for the head, that is a head/root inversion and deadlocks on MySQL and MariaDB. It now locks the root first. - ensureSessionRoot (writer acquisition, lifecycle authorization) took a shared lock with INSERT IGNORE and upgraded it with its UPDATE. On MariaDB, upgrading behind an ordinary writer's queued exclusive request is a 1213 deadlock. It now takes the root exclusively first. Two witnesses pause the call right after its first root/head statement while an ordinary blockRecovery of the same Session queues, then assert both complete with no InnoDB deadlock. With either change reverted, its witness fails with "Deadlock found" on MariaDB 10.11 (the mysql-integration lane). MySQL 8.4 lets the shared holder upgrade ahead of the queue, so only the head/root witness fails there. * docs(managed-agent): map the tenant-guard design onto the consolidated schema The 32-table baseline (QwenLM#14069) landed while QwenLM#13800's decoupling was in review. Record how the guard rows, the merged head/drain row and the new per-Session root row map onto it, and the order every ordinary writer now takes them in. Both languages carry the same section. * test(serve): widen the bare-load compensation test's recovery waits The recovered turn settles across fsync-backed journal commits, and its active prompt clears only after the turn's cleanup and remaining commits finish. The last two waits used the default 1s waitFor window, which flaked in the sandboxed verifier (3 of 4 parameterizations red in one isolated run). Widen them to 10s, as QwenLM#14101 did for the sibling recovery tests. A real hang still fails. * fix(managed-agent): bind the latest-environment row comparison as identity bytes findLatestEnvironmentEvents compares (session_id, turn_id) rows. H2 reports row-comparison parameters as VARCHAR, so ManagedSchemaJdbcTemplate bound them as strings. That works until H2 recompiles the command after binding. Any new session or SET between binding and execution forces the recompile, and the row check then refuses VARBINARY rows against VARCHAR ones (BadSqlGrammarException, "not comparable"). On this branch the bounded guard statements call setQueryTimeout(5), which H2 turns into SET QUERY_TIMEOUT each time a pooled connection switches between 5 and 0. In the shared Spring test context that made the recompile common: ManagedWorkspaceAdmissionTest failed 4 of 16 class runs on this branch and 0 of 18 on main. Binding the identities as bytes removes the H2 hazard and compares the same on MySQL 8.4 and MariaDB 10.11 (checked case-sensitive and non-ASCII keys on both). The new ManagedTurnQueryTest case opens a fresh H2 session right before the statement executes. It fails with the string binding and passes with the byte binding. With the fix, ManagedWorkspaceAdmissionTest passed 12/12 class runs under CPU stress. * fix(managed-agent): keep ordinary Sessions off the CSI continuation's tenant guards QwenLM#13996's lockCsiContinuation runs on every writer path (acquire, renew, seal, blockRecovery, commit, tool-result and publication writes, owner reads). Inside a transaction it took the placement guard (10 s) and the unbounded output_publication guard, then locked CSI slots and bindings, before it learned whether the Session was CSI at all. That re-coupled ordinary traffic of unrelated Sessions to the tenant rows this branch decouples. ManagedSessionGuardConvoyIT failed on the merge: a held guard timed out an unrelated Session's write after 10 s, and four acquires in different tenants deadlocked on the ma_session insert. csi_guard is generated from tool_profile and runtime_request_key, and both are written only when the Session row is created. A plain read of it decides whether the Session can carry CSI authority, so ordinary Sessions return before any tenant-wide lock. CSI Sessions keep main's placement, publication, Session order. On the tool-result lane the check now runs after the bounded placement wait, so its read does not pin the snapshot ahead of that wait. ManagedSessionGuardConvoyIT 7/7, WorkspaceLifecycleMySqlIT 66/66 and ToolPublicationLockOrderMySqlIT 5/5 on MySQL 8.4. * fix(managed-agent): pre-check every CSI marker without locks, not just csi_guard 494fdb6 decided CSI-ness from ma_session.csi_guard alone. That skipped main's fail-closed check for legacy Sessions whose CSI identity lives only in runtime slots or bindings (a CSI-profile slot, or an ordinary slot that references a foreign CSI binding). WorkspaceCsiSessionGuardTest caught it: 3 cases expected csi_original_binding_unavailable and got none. JdbcCsiFilesRetirementGuard.mayCarryCsi now runs the same pin, slot and binding reads as lockManagedSession, without FOR UPDATE. Only a Session with no CSI marker at all returns before the tenant-wide guard rows and the slot/binding range locks. Any marker takes main's locked path, which re-reads everything under its locks and fails closed. All 12 WorkspaceCsi* test classes pass (265 tests). * fix(managed-agent): read the CSI pin under the Session root lock The CSI gate decided with plain reads. In a REPEATABLE READ transaction that has already read, they reuse its snapshot, so a CSI Session committed after it looked ordinary and its writer skipped the original runtime admission (review on QwenLM#14177, same gate). The plain read also pinned the snapshot ahead of the root and head waits that requireLive relies on. The gate now locks the Session root first, materialized and by primary key so no gap is taken that another tenant inserts into, and reads the pin under that lock. Only an unpinned root goes on to read its runtime slots and bindings, plainly, for legacy markers: a CSI slot or binding is only created under a pinned root, and a pin never changes. The two publication paths now take their output_publication guard before the gate, keeping the CAS row ahead of the Session root as retention reads do. A pinned Session on a path that holds no placement guard now takes the tenant guards behind its root. Adds a warmed-snapshot IT through acquireWriter. On 695fcf5 it lets the writer in under REPEATABLE READ; with this change it is refused. * fix(managed-agent): bound the remaining per-turn guard waits and fence duplicate commits Review round R1 on f668634: - A CSI-pinned Session's continuation check took placement with a 10 s timeout and the publication row with none, outside the named mapping. Both now go through lockBounded with the hot-path bound, so a held row answers tenant_guard_contended instead of freezing renew, commit and recovery state for the full lock wait. - The Turn submit admission (insertTurnCommand) takes the placement row through a bounded WorkspaceMigrationAdmission.lockTenant overload. - A duplicate ordinary commit no longer replays against a v2-claimed Session: the replay branch runs requireNoLifecycleClaim too. - The CSI runtime-marker probe's plain reads carry the class's 10 s query timeout; ensureSessionRoot drops a backfill UPDATE that lockSessionRoot made a no-op. - Store client: a commit spends one tenant-guard contention budget across its three attempts, guard retries no longer use up the transient retry allowance, and a contended 503 past its window stays a contended 503. - Hosted harness: a bounded tenant-guard refusal is not named managed_session_store_unavailable; a settlement write that meets the store names the block; an already-named model failure keeps its name; recovery-block lifts clear the reason in one helper. - Witnesses: CSI pinned-session guard bounds, Turn submit arm, tool-result publication arm, duplicate-commit claim fence, queued renewal behind a retirement, same-Session authorisation fence, marker probe timeout, recompile hook counter, and the TS classifier, contention-budget and transient-allowance cases. The convoy IT rolls back its holds in finally, collects its writer future, uses a fixed 15 s failure ceiling and counts deadlocks on MySQL 8.4 too. - Design doc (both languages): this change does not implement QwenLM#13800's W1/W2 (mount lease, QwenLM#13816); the invariant, goals and D2 are scoped to the covered lanes, the remaining ManagedAgentStore acquisitions are listed as follow-ups, and the CI-coverage, F5, D1 and D5 statements are corrected. * fix(core): stop restarted commit attempts at the shared contention deadline (QwenLM#13800) * test(managed-agent): realign lifecycle fixtures with the epoch columns and recompile marker * fix(managed-agent): map deadlock-loser and lock-wait guard waits to the bounded contention code * fix(managed-agent): take the Session root before the tenant CAS row on the retention lane (QwenLM#13800) * fix(core): name budget-closing guard aborts after their earlier contended refusal (QwenLM#13800) * fix(managed-agent): name both victims of the pinned CSI root/guard cycle (QwenLM#13800) A pinned CSI Session's continuation takes its Session root before the tenant guards, while every other lane on that Session takes the guards first. InnoDB may roll back either side of that cycle. The continuation's guard waits were already named; a root wait behind a guard (lockSessionRoot, the legacy isPrivate probe) now answers tenant_guard_contended for a 1213 as well. The victim is recognized by its vendor code, because this stack's default translator reports a deadlock as CannotAcquireLockException and the error-code translator as DeadlockLoserDataAccessException. This replaces the earlier answer that moved the retention side to root-first. Publication, lifecycle authorization and writer acquisition take the tenant CAS row before the root on every Session, so a root-first retention lane deadlocked against them on ordinary Sessions too. ordinaryPublicationBesideARetentionOwnerDoesNotDeadlock pins that. The MySQL witnesses now share one lock-wait and deadlock probe. * fix(managed-agent): reread a stale idle-journal scan under a lock (QwenLM#13800) beginWorkspaceLifecycle pins its REPEATABLE READ snapshot with plain reads before requireIdleJournal takes the head lock, so a revision a writer commits in between is invisible to the unlocked journal scan. Refusing with workspace_lifecycle_journal_unverified in that case answered 409 for an idle Session whose last Turn had just committed. When the snapshot scan stops short of the locked head's revision, the scan is now repeated as a locking read and the verdict is taken from that. Only a journal that still falls short of its own head fails closed. * test(managed-agent): require the pinned CSI guard wait to reach its bound (QwenLM#13800) The witness now asserts a floor as well as the ceiling, and the waiting transaction raises its own innodb_lock_wait_timeout past the test's wait, so the server's lock timeout cannot answer first and pass for the 5 s bound. * fix(core): keep a commit restart's own request budget (QwenLM#13800) Guard retries stay inside the commit's shared contention deadline, but a call's first attempt now keeps its own requestTimeoutMs. Before, a restart earned after a stall or an early contended refusal was issued with the already-spent deadline as its timeout, aborted at once, and the commit failed as a transport error. The restart tests' fakes now honour the abort signal the way a real fetch does. Also pins the transient backoff's de-escalation after guard retries with an elapsed-time bound, asserts that a deadline abort after a contended refusal stops the commit at the shared deadline, and corrects the withRetry doc block, which said commits are never retried there. * docs(managed-agent): record the 2026-10-16 tenant-guard review corrections (QwenLM#13800) Qualifies goals G1 and G2 to what ships, describes the locking rescan in D3 and R4, updates the requireIdleJournal witnesses, and adds the review corrections for the deadlock mapping, the pinned CSI cycle and the client contention budget, in both languages. * fix(cli): name every store-outage recovery block and pin the reason's lifecycle (QwenLM#13800) runSettleProjection's catch and the recovered-turn route's committed-call fold exits blocked the Session without a reason, so a store outage there left no name, or an earlier block's stale one, on /session/:id/status. They now go through one helper that sets the block and its current reason together; writer conflicts and harness-shape failures stay unnamed, and HostedToolRecoveryRequiredError exits are unchanged. Tests: a status read after a lift asserts the reason is cleared; the transport case joins the store-failure classification table; the continuation and bare-load store-failure tests count their settlement attempts; the model-failure contrast test reads the status surface; the bare-load test asserts no turn.settled was persisted; new witnesses cover the projection catch and both fold exits. * test(managed-agent): move two lifecycle witnesses onto the epoch columns (QwenLM#13800) writerAcquisitionOrdersPlacementBeforeTheDrainFence still inserted the drain head with created_at/updated_at, and retirementSerializesAQueuedWriterRenewal wrote a TIMESTAMP into the epoch-millisecond writer_lease_until, which read as a live lease. Both broke when QwenLM#14185 landed through main. --------- Co-authored-by: Qwen-Coder <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]>
…ers, activator, core tools and runtime broker (QwenLM#13297) * fix(core): reject '..' in file-history keys on both separators PR QwenLM#12691 R2-1/R1-13: the traversal guard split on path.sep, which passes '../outside' on Windows while the suite's own rejection case expects a throw. Split on both separators and add the backslash case so the guard is pinned on POSIX lanes too. Also replace the duplicated snapshot-cap literal with the shared MAX_SNAPSHOTS constant. * fix(cli): harden managed worker lifecycle and env sanitization PR QwenLM#12691 follow-ups: - close() drains the registry even when a worker stop rejects (Promise.allSettled + always shutdown, first failure rethrown). - stop() frees the capacity slot in a finally so a failed cleanup no longer wedges same-key activation forever. - managedWorkerEnvironment matches the env allowlist case-insensitively so Windows workers still receive PATH/SystemRoot. - Mark LocalProcessRuntimeActivator as the provisional surface landed ahead of its daemon-side consumer. - Tests: end-to-end secret-leak observation through a real spawned worker, table-driven handshake rejection coverage (forged lease/ epoch/incarnation, non-http, non-loopback, credentialed/query URLs), startup timeout, and any-case allowlist coverage. * refactor(cli): drop production-dead v1 managed-runtime scaffolding PR QwenLM#12691 R1-9: the v1 route prefix, three request parsers, the protocol error class and three request/response types had zero production read sites (the live wire contract is v2), and the only tests exercising them tested dead exports. * fix(cli): repair managed-runtime provider release and retry invariants PR QwenLM#12691 follow-ups: - RemoteManagedRuntimeProvider.getToolV2Client rolls back the v2 marker and evicts the entry when cold-start preparation fails, so one failed prepare no longer converts the session into a permanently closed one (R1-1, Critical). - LocalManagedRuntimeProvider.finishRelease drops a transport-failed warmup from the release record so the retried release takes the resume-then-close path instead of rethrowing the cached rejection forever (R2-4, Critical). - prepareRetryWindowMs: 0 no longer passes validation; it now falls back to the default window instead of arming a 0 ms abort deadline (R2-6, Critical). - waitForLocalSession surfaces the cleanup failure of a post-abort invalid attachment through the debug log instead of dropping it on a settled promise (R1-10). - Drop the dead second retryWindowMs parameter of Remote prepare(); the constructor option is the single configuration path (R1-12). - Tests: provider-level cancel identity forwarding, mismatched-expected rejection and empty-state false (R1-11); failed v2 cold start re-prepare; zero retry window fallback; release retry past a failed warmup. Also removes the dead-parser test block from the previous commit's scaffolding deletion. * fix(cli): honor broker retry semantics and release confirmation PR QwenLM#12691 follow-ups: - submitExecution rethrows when the broker declares the failure non-retryable instead of re-sending by status class alone (R1-2). - A rejected execution reservation is evicted from the entry cache so status/execute/cancel re-prepare under the stable idempotency key instead of rethrowing forever (R1-3). - release() checks the provider lifetime before its map lookups, matching both siblings' throw-after-dispose contract (R1-5). - A broker release answering released:false now rejects (matching the remote provider) instead of silently returning false; the entry stays retryable (R2-5). - Tests pin all four behaviors. * fix(core): keep managed tool outcomes cloneable and normalized PR QwenLM#12691 follow-ups: - ManagedToolRuntime.run() no longer wedges on a non-cloneable hook payload: the final structuredClone falls back to dropping hook payloads with a recorded hookError while keeping the terminal outcome (R2-8, Critical). - runtimeLocalOutcome normalizes ProceedOnceAndSwitchToDefault to ProceedOnce like its five siblings, so the tool callback never sees a mode-changing decision (R1-16). - Tests: media-context binding whitelist and undefined-param projection (R1-24), switch-to-default normalization, non-cloneable hook recovery. * fix(acp-bridge): guard session-store URL and correct sendPrompt contract PR QwenLM#12691 follow-ups: - parseBridgeManagedSessionStore rejects cleartext non-loopback baseUrl like every sibling URL validator, via a local loopback predicate (acp-bridge cannot import the CLI helper). - The sendPrompt JSDoc no longer advertises PromptIdConflictError and same-promptId dedup as live behavior; both are now marked as a reserved contract the follow-up admission change must implement. - New collocated test pins every rejection branch of the store parser, the trailing-slash normalization, and the loopback exception. * fix(runtime-broker): close observe() guards and pin broker wire contract PR QwenLM#12691 follow-ups: - observe() now rejects handle schema versions other than 1, matching the sibling ensureResource() guard instead of attesting READY under a version this provider never interprets (R1-17). - observe() reporting NOT_FOUND for a provably dead worker now reaps its ownership entry instead of leaking it for the broker's lifetime; a repeat read observes UNKNOWN (R2-3, Critical). - The issued tombstone set stores the SHA-256 of the canonical identity encoding instead of the full bearer-token material already released (R1-18). - The broker HTTP javadoc now documents that progress streaming is unavailable: afterSeq is validation-only and every status answers an empty progress list with firstAvailableSeq equal to lastSeq (R1-20). - Tests: observe() READY / NOT_FOUND(+reap) / CONFLICT arms against the real provisioner with the fake attestation worker (R1-19); settled execution full-envelope assertion, invalid afterSeq and duplicate query-field 400s, and the 413 branch over HTTP (R1-21). * test(cli): use an HTTPS store fixture on the parsed session-store route The PR QwenLM#12691 P2 guard rejects cleartext non-loopback session-store URLs, and hosted-harness-session.ts already parses the request field through it (wired by the later hosted harness work). The fixture's http://store.test baseUrl therefore 400s at session create on the real route; switch it to https://store.test, which is the same fake identity and never fetched. * test(runtime-broker): drive the 413 branch over a raw header-only socket Streaming a 9 MiB body races the server's Content-Length fast reject: on Windows the in-flight write aborts (WSAECONNABORTED) before the 413 can be read, and a half-open client lets the server drain forever. Send headers only, EOF the write side, and assert the status line — the branch is pinned deterministically on every OS. * fix(cli,core): close round-3 review regressions on the 12691 follow-ups - waitForLocalSession: an abort landing after the success handler detached onAbort left no settler; log the bridge failure with its real error and reject with the cleanup wrapper instead of returning un-settled (round-3 Critical R1-1, plus the dropped-cause log call). - broker executions: evict a transiently rejected start as well as the reservation (started half of the original finding), and tombstone the failed digest so a changed-args retry still fails the identity guard on an empty cache (R1-4/R1-5). - activator admission: count the registry's committed children too, so an unreclaimed child keeps holding its slot after the map entry is freed by the R2-9 finally (R1-6). - managed tool clone fallback: replace only the hook that actually ran and preserve its shouldStop directive (R1-3). - Tests: abort-during-cleanup settlement race with logger spy; start- failure re-drive and changed-args-conflict broker cases; admission accounting witness; hook narrowing/payload/command survivors; canonicalized plus confusable loopback hosts; positive delivery half of the env leak test; 9 more handshake clauses incl. dedicated non-string case; derived modality view assertion. * fix(runtime-broker): make the reaped verdict reproducible and map store failure to retryable - observe(): keep the reaped worker's pid under the tombstone digest so a repeat reconcile re-derives the same NOT_FOUND with the same evidenceId after a discarded observation, instead of one-shot-ting into UNKNOWN retries that can never reach LOST (round-3 Critical R1-2); stop()/close() keep the map bounded. - createExecutionReceipt: wrap the stage in mapFailure so an unmapped store outage surfaces as 503 retryable:true instead of the unclassified 500 catch-all (R1-7). - Tests: store-failure 503->retryable->200 round trip via an injected repository proxy; repeat NOT_FOUND with identical evidenceId plus stop()-then-UNKNOWN; value assertions for the settled wire envelope; conflict-must-not-touch-the-owner positive control. * fix(cli,runtime-broker): answer the second round-3 review batch - activator stop(): the map delete moves out of finally to land after terminate has proven the tree down, so an unproven terminate failure keeps the entry (retiring, capacity, workspaceActivity) instead of silently admitting a second worker onto the same cwd (R1-29); a cleanup failure is recorded on instance state and close() aggregates it after the registry drain, since a pre-settled failure is no longer in the map (R1-25). - broker eviction is gated on the protocol-level retryability flag ( only): a broker-declared refusal stays cached across execute/status/cancel instead of re-POSTing (R1-24). - media test asserts the bound instance's derived modality view directly (R1-17). - LocalProcessRuntimeProvisioner.tombstone is pinned package-visible: 64-hex, deterministic, carries no token/endpoint, and stays a function of every ownership-key component (R1-26). - HTTP tests: non-degenerate (lastSeq=7) settled envelope pins firstAvailableSeq == lastSeq + progressGap on the gap arm (R1-18), and afterSeq=0/5 are accepted with the full settled status (R1-20). Mutation arms run on this tree: delete-before-terminate reddens the admission test; the shared-definition refutation keeps the managed close() wire-order invariant. * fix(cli): close the round-4 review follow-ups on the 12691 follow-ups - Gate the failed-cold-start eviction on the in-flight release promise instead of the never-cleared `releasing` flag, so a failed release of a failed cold start no longer turns the release retry terminal (R2-1). - Simplify the post-abort cleanup branch to its observable effect (the log); the chained catch already settles the promise identically (R2-8). - Pin the start-arm refusal cache, the registry-committed admission term, and the close() registry drain with dedicated regression tests (R2-2, R2-4, R2-5); skip the permission-based cleanup test as root (R2-3). - runtime-broker: pin the reaped NOT_FOUND verdict against a foreign seed and the tombstone digest against every ownership-key component (R1-10, R2-9). - acp-bridge: document and pin the deliberate refusal of IPv4-mapped loopback without HTTPS (R1-11). - Fix the cleartext store fixture in the issue-13328 test brought in by the main merge, matching the daemon's HTTPS-outside-loopback guard. Co-authored-by: Qwen-Coder <[email protected]> * fix(cli): close the round-3/4 review follow-ups on the 12691 follow-ups - Broker executions: a transiently evicted start failure now tombstones the resolved executionCallId, and status()/cancel() resolve read-only — they surface the recorded failure or address the reserved call id instead of re-POSTing executions:prepare, so a draining cancel can terminalize the broker-side PREPARED receipt and unblock the release. - Eviction is restricted to failures a retry can outrun (retryable 5xx, broker-declared retryable 4xx, transport aborts/timeouts); declared refusals, unclassified 4xx, and client-side protocol failures stay cached instead of being re-driven forever. - A release the broker does not confirm now rejects with a classified, retryable ManagedRuntimeProviderError, and the test pins that the retry re-POSTs rather than short-circuiting on a phantom seal. - A failed cold start no longer drops an entry's recorded terminal intent (a failed terminal release re-sends as protocolVersion 2 and seals), while the v2 marker is dropped even when a release is in flight so a doomed cold start cannot convert the next release into a terminal one. - close() now tracks in-flight stops past the map delete so a hanging rm surfaces through close() instead of being lost, and keeps only the first cleanup failure instead of an unbounded list it only read [0] of. - The admission count drops its registry-term: the registry-counted-but- unmapped state it defended is unreachable (terminate() releases the child before the generation can leave the map), and the surviving unreclaimed-child test now genuinely pins retention. - Java: the dead-worker tombstone pin asserts the repeat read carries the live read's pid-keyed hostDomain, the cursor test asserts the full settled status content, and the afterSeq rejections pin their client-facing messages. Co-authored-by: Qwen-Coder <[email protected]> * fix(cli,acp-bridge,runtime-broker): close the round-5/6 review follow-ups on the 12691 follow-ups * fix(runtime-broker): align the cancel route's store-outage mapping with its siblings cancelExecution returned a bare safeStage while createExecutionReceipt, prepareExecution, startExecution and getExecution map an execution-store outage to a retryable 503 runtime_broker_store_unavailable, so the same IllegalStateException escaped cancel as a 500 runtime_broker_internal_error with retryable:false. Wrap the cancel stage in the same mapFailure call; existing RuntimeBrokerException verdicts (404/409/503 reconciliation) pass through unchanged. Extend answersAStoreFailureAsRetryableServiceUnavailable so the injected repository gate now witnesses every store-reading route: prepare, read, start (both payload variants) and cancel each answer 503 retryable, the failed prepare leaves no reservation, the replayed record is asserted after the healed retry, the stored row is untouched by the failed legs, and the gate records exactly the intended interception per route and no other repository call. Co-authored-by: Qwen-Coder <[email protected]> * fix(cli,runtime-broker): answer the post-merge review round on the 12691 follow-ups Blockers: - RuntimeBrokerHttpServerTest: give the start-body List.of an explicit witness type; the enhanced-for header had no target type, so the mixed Integer/String Map.of arguments inferred an intersection that is not Map<String, Object> and every Java lane red at testCompile. - hosted-harness-session: switch the two store-identity fixtures to https:// so they reach the 409 identity check; the new cleartext non-loopback transport guard (surfaced by the main merge) answers 400 first. Both fail pre-fix, pass post-fix. Review batch (broker provider): - ensureExecution regains its leading assertEntry: a cached execution no longer resolves after dispose() while every sibling surface refuses. - A non-abandoned 409 execution_unknown is reconcilable, so it re-drives instead of freezing for the session; the abandoned (runtime_lost) variant stays cached. Both halves pinned. - BrokerWireError splits: an undecodable body stays transient, an over-limit body (declared or streamed) is a deterministic property of the response and stays cached instead of re-driving a doomed cycle. - The start-path eviction moves inside the settling continuation, so a retry begun in the rejection's own continuation re-prepares instead of replaying the stale rejection. - Witnesses added: request-timeout (DOMException) re-drive, and the live-execution-over-tombstone read precedence after a successful re-drive. Activator tests: - Pin that a failed rm still frees the capacity slot (the delete/rm reorder): a second workspace is admitted where the old order refused with managed_runtime_capacity_exhausted. - Reset the armed rm stub in place so the close()-window test survives vitest --retry re-invoking the same registered function. Each new guard and witness was mutation-probed red before this commit. * fix(cli): honor the over-limit classification on every Broker path (QwenLM#13297) Review round on QwenLM#13297 found the retryableByRedrive classification honored only on the success path: - An over-limit body on a 5xx was folded into an unclassified BrokerResponseError, graded transient, and re-prepared — re-streaming up to 8 MiB — on every later execute; requestJson now lets the BrokerWireError propagate out of the !response.ok branch, while an undecodable error body keeps its deliberate transient swallow. - submitExecution's in-band retry gate read the bit only for BrokerResponseError, re-transferring a doomed body once per execute; the gate now also throws on BrokerWireError with retryableByRedrive false. - The DOMException fixture claimed a request-timeout shape the real path cannot produce (a real timeout aborts the composite signal first); re-labeled as a transport fault on a live signal, with a new dispose-aborted witness pinning the gate's signal.aborted disjunct. Each new guard and witness was mutation-probed red before this commit. * fix(cli): keep cancel/status reachable on every Broker reservation state (QwenLM#13297) Review round on QwenLM#13297 found the read-only paths wedged behind the cached reservation and the retry taxonomy restated per consumer: - resolveReadOnlyExecution returned a cached execution unconditionally, so once a re-drive left a reservation whose prepare was refused (or hung), cancel and status replayed the refusal and never reached the receipt the Broker still counts as active — release then stayed refused for the life of the process. A digest-checked tombstone fallback now supplies the call id when the live reservation rejects, and a hop-balanced race keeps an already-settled reservation ahead while never awaiting a pending one. - The retry classification lived at three sites with opposite failure directions (the submitExecution skip-list gate, the isTransientBrokerFailure allow-list, the error-body catch whitelist); one brokerRetryPolicy(error) now derives both axes — none | in-band | redrive | both — beside the error classes, and every consumer asks it. - The declared content-length guard only covered the ok arm, so an over-limit error body was buffered up to 8 MiB and re-driven instead of classified like its sibling; the guard is hoisted above the status split, and the error-body read moved out of the classification try so a typed error can no longer be erased into an unclassified refusal. - Witnesses: the refused and hung re-drive cancel/status cases, a settled re-driven reservation winning over the stale tombstone, the 503 declared-length matrix cell, and the undecodable 502 drain-page re-drive. Each new guard and witness was mutation-probed red before this commit. * fix(cli,runtime-broker): close the round-7 review Criticals on the 12691 follow-ups - hosted-harness-session.test.ts: convert the one cleartext store fixture the https sweep missed to https://another-store.test; the off-loopback guard rejects it during parsing, so the load answered 400 before the store-identity comparison could answer 409 (R4-1). - LocalProcessRuntimeProvisioner: reap a dead worker under stop()'s monitor and only when the owned.remove lands, so a release racing a reconcile can no longer resurrect a tombstone stop() already cleared and permanently certify a deliberately released lease as JOURNAL_LOST (R5-1). - RuntimeBrokerService/JdbcRepositorySupport: classify store outages at the JDBC source with a StoreFailureException subtype and map only that subtype to a retryable 503 on the execution routes, so client-input errors, permanent invariant violations, and JVM errors keep the non-retryable 400/500 mapping they had before (R7-1). * test(core): stub getFileSystemService in the managed-tool-runtime media test (QwenLM#13297) * fix(runtime-broker): map the :acknowledge and :publisher store outage as a retryable 503 (QwenLM#13297) * fix(runtime-broker): map the private CSI prepare and read-batch store outage as a retryable 503 (QwenLM#13297) prepareCsiExecution and readCsiBatch returned their stages unwrapped, so a JDBC outage on POST /executions:prepare (the inputBytesBase64 branch) or POST /executions:read-batch reached sendError as a raw StoreFailureException and answered 500 runtime_broker_internal_error with retryable=false, while a plain prepare over the same outage answered 503 runtime_broker_store_unavailable with retryable=true. Wrap both stages in mapStoreFailure, keeping the gate on StoreFailureException so a permanent invariant violation still answers the non-retryable 500. The new HTTP test drives both routes against a JdbcRuntimeBindingRepository whose DataSource refuses every connection with a real SQLException, then with a non-SQL IllegalStateException. Removing either wrapper, or widening it to mapFailure, turns it red. * fix(runtime-broker): map the private-CSI prepare and read-batch store outage as a retryable 503 (QwenLM#13297) Co-authored-by: Qwen-Coder <[email protected]> * fix(cli,core,acp-bridge,runtime-broker): land the queued round-1 review suggestions on the 12691 follow-ups (QwenLM#13297) AutoFix accepted these on 2026-10-10 but never landed them. - acp-bridge: type-check allowInsecureHttp before the HTTPS transport gate, so a mistyped opt-in is reported as invalid rather than as a missing one (R1-20). - core: move MAX_SNAPSHOTS into a dependency-free leaf, so the managed-tool file-history protocol no longer pulls in fileHistoryService, diff and the git utilities (R1-12). Keep a hook's string fields in the non-cloneable fallback (R1-13). - cli: log the after-abort cleanup failure only when the abort actually settled the caller's promise, and stop calling that debug-only log the only surviving trace (R1-9, R1-10). Witness the cold-start entry eviction without an intervening release (R1-11). Cover mixed-case proxy keys and a relative trusted-folders path in the worker env allowlist (R1-18, R1-19). - runtime-broker tests: fail the prepare and cancel write legs and the :publisher route under a store outage, and unwrap the gate's InvocationTargetException (R1-24). Count the reconcile attestation round trip (R1-26). Build the tombstone lease directly instead of spawning a worker (R1-27). - docs: describe all three session-store transport gates, their loopback sets and the IPv4-mapped decision, in both languages (R1-22). * chore(runtime-broker): re-arm deterministic verification with a clean tree (QwenLM#13297) The previous round's commit was rejected only because mvn clean verify left the gitignored JaCoCo HTML report (target/site/jacoco/jacoco-resources/*.js) in the working tree, and the root eslint flat config lints those generated files (139 errors: no-useless-escape, no-undef, no-redeclare). The generated output has been removed; the source fix mapping the private-CSI prepare and read-batch store outage to a retryable 503 is unchanged from the rejected commit. Co-authored-by: Qwen-Coder <[email protected]> --------- Co-authored-by: qwen-code-dev-bot <[email protected]> Co-authored-by: Qwen-Coder <[email protected]> Co-authored-by: qwen-code-autofix <[email protected]> Co-authored-by: qwen-code-dev-bot <[email protected]>
…mmand relay fault gates (QwenLM#14164) (QwenLM#14333) * test(managed-agent): add the FG9a/FG9f session_message and session_command relay fault gates (QwenLM#14164) Co-authored-by: Qwen-Coder <[email protected]> * test(managed-agent): account the FG9 letters in the Hosted fork budget (QwenLM#14164) * test(managed-agent): witness proxy holds before FG9f releases and prove each mint delivered (QwenLM#14164) * test(managed-agent): prove each FG9 mint consumed through the receiver session journal (QwenLM#14164) --------- Co-authored-by: Qwen-Coder <[email protected]>
…14703) Co-authored-by: 钉萁 <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]> Co-authored-by: yiliang114 <[email protected]>
…enLM#14704) Co-authored-by: Qwen-Coder <[email protected]>
…enLM#14338) Co-authored-by: qqqys <[email protected]>
…on (QwenLM#14684) Co-authored-by: 易良 <[email protected]>
…wenLM#14697) (QwenLM#14711) * test(managed-agent): stabilize the FG12b released store fault gate (QwenLM#14697) Drive the idempotent settle until the injected rejection fires instead of capping the attempts, raise the per-request timeout above the class's recorded ambient run, and assert the resend count rather than the total owner-release calls. * test(managed-agent): keep the per-release idempotency check and scope the FG12b timeout (QwenLM#14697) Restore the allSatisfy block the previous commit deleted: it asserts a per-entry property, so relaxing the count to >= 2 did not require it. Pull the failing gate log instead of inferring. The assertion message was recoverable: job 117935251724 reports 'the store wrapper fired: expected 0 to be greater than 0' from waitForRejection, i.e. the 30-attempt drive loop gave up while every settle answered 200 and no released-commit fault fired, then the passive Awaitility poll burned its own 120 s. The 30 s request timeout was not in that path, so the class-wide 120 s bump is reverted and only the drive loop takes the longer ceiling. Keep the drive budget at 90 s rather than 5 minutes so the kill/reload/settle tail still fits @timeout(600), and keep every settle answer so the next stall names the phase instead of a bare count. --------- Co-authored-by: qwen-code autofix <[email protected]> Co-authored-by: yiliang114 <[email protected]>
* test(managed-agent): add G3 approval fault-point E2E arms Step 3's packaged gates crossed the approval path without a fault. Four new arms layer one failure on the Allow arm: a crash after the decision commits, a crash after the approved execution reaches PREPARED behind a held Runtime Broker start, a lost decision reply retried under the same Idempotency-Key, and a lost Turn admission reply retried the same way. Part of QwenLM#14481 (step 2). * test(managed-agent): gate the approval crash on the committed decision The response endpoint's 202 only admits the response operation; the Action row stays requested until delivery commits. The after-decision arm now holds the Runtime Broker start and waits for state=decided with a decision receipt and digest before SIGKILL, and a predicate test rejects the admitted-only answer. Also add the four fault arms to the hosted-process-ci inventory and raise its step/ceiling expectations to 190/205. * fix(managed-agent): scope the approval decision barrier query The after-decision arm's durable-decision wait referenced actionFilter, a const inside the earlier approval-setup block, so the new arm threw ReferenceError before it could crash the Harness. Build the same predicate from the in-scope sessionFilter and the record/action columns instead. --------- Co-authored-by: 易良 <[email protected]>
) Drive each failed claim through an explicit capacity notification and await its rejection without advancing the lease renewal clock. Preserve the final injected failure for release after disposal. Co-authored-by: Qwen-Coder <[email protected]>
…ck (QwenLM#14635) * feat(managed-agent): ship a configuration template in the reference distribution The reference archive carried no application.yml, so the Runtime credential key ring — which cannot be expressed through QWEN_MANAGED_AGENT_* variables because relaxed binding normalises map keys — forced every rotating deployment to create a file and pass --spring.config.additional-location by hand. Ship config/application.example.yml and have both launchers load config/application.yml from the bundle root when it exists, leaving an operator-supplied SPRING_CONFIG_ADDITIONAL_LOCATION in effect. * feat(managed-agent): add a read-only --check preflight The reference distribution listed its prerequisites in prose, but the server evaluated them only at startup or on the first Turn: MySQL grants, the credential key ring, auth/bind combinations, Harness reachability, broker credentials, directories and ports. Intercept --check before Spring starts and report each input as PASS/WARN/FAIL/SKIP, exiting 1 on any failure. The command binds the same configuration as the server, probes /capabilities, and compares the Flyway version with the release manifest when one is present. * feat(managed-agent): ship systemd units for the single-host topology The server reference required a supervisor that leaves Runtime workers running across a Broker restart, but the reference distribution shipped no unit that did so. Add control-plane and Hosted Harness units, environment templates, and an install guide. The control-plane unit uses KillMode=process and StateDirectory; the Harness uses KillMode=mixed. Include the templates in the archive and guard their required directives with a structural test. * feat(managed-agent): bootstrap the shared deployment credentials Every deployment had to mint a Harness token, a capability digest, a broker token and a 32-byte credential key, then keep the token and digest identical across two files and the key ring in a third. Add bin/qwen-managed-agent-bootstrap, which generates all four values and writes harness.env, server.env and application.yml with mode 0600, refuses to overwrite without --force, and prints paths only. Ship it in the archive. * fix(managed-agent): reject an incomplete Workspace tool path in --check --check reported PASS for Workspace files whenever the Harness, Session Store and Broker were enabled, but startup also requires session isolation and a configured mount, creation root or SSH node. A deployment that omitted runtime-broker.workspace-mounts therefore passed the preflight and failed at boot. Mirror those startup rules in tool-path and report other provisioners as not evaluated instead of passing them. * fix(managed-agent): pass the distribution config through the environment The shared launcher injected --spring.config.additional-location before the operator's arguments, so the operator-recovery entry, which dispatches on args[0] and the exact argument count, could no longer run inspect, prepare or complete. Export SPRING_CONFIG_ADDITIONAL_LOCATION instead and leave the argument vector untouched for both launchers. Also make the template's active key pair use the mapped placeholders, so a copied example still honours the documented environment override. * docs(managed-agent): match the preflight design to the launcher fix The preflight design still said the launcher adds a command-line config option. The launcher now exports SPRING_CONFIG_ADDITIONAL_LOCATION, so update both language versions. * test(managed-agent): isolate the launcher test from an ambient config variable The test spread process.env, so a machine that already exported SPRING_CONFIG_ADDITIONAL_LOCATION changed the launcher's behaviour and failed the new assertions. Remove the variable from the base environment; the explicit operator-override case still sets it. * fix(managed-agent): align the preflight with startup validation The preflight could report PASS for a database without the performance_schema grant, ignored command-line overrides, dropped earlier external YAML files when several were listed, and could not find the release manifest in the repackaged executable JAR. It also hand-copied auth and Workspace tool-path rules that disagreed with the startup validators. Delegate auth to BrokerSecurity, mirror the Workspace tool-path admission, fail on a missing grant, load command-line arguments and every external YAML with unique property sources, and resolve the manifest from the outer JAR. * fix(managed-agent): reject the static provisioner for Workspace files validateWorkspaceFiles refuses Workspace files on the static provisioner, but tool-path reported only WARN. Make it FAIL and keep the not-evaluated warning for other provisioners. * fix(managed-agent): close the remaining preflight review gaps Resolve relative class-path entries before locating the manifest, bind the full server and spring.mvc properties before the auth guard, and require durable local-process execution plus verified recovery for a Workspace creation root. * fix(managed-agent): wire the Harness Broker flags and keep EnvironmentFile semantics Expose QWEN_HOSTED_HARNESS_BROKER_ARGS in the Harness unit so the tool path can pass the Broker URL and token, and run the preflight through systemd-run so it reads the same EnvironmentFile as the service. * fix(managed-agent): harden the bootstrap entry point and writes Resolve symlinked entry points before running main, quote the configuration path for shell sourcing and reject paths that cannot be quoted, and hold an exclusive lock across the existence check and the three writes. * fix(managed-agent): run the startup validation in the preflight The preflight bound ManagedAgentProperties with Binder, which never runs the @PostConstruct startup validation. Configurations that the server rejects at startup -- an approval timeout below the ten-second floor, an unknown bound-session isolation class, SSH enabled without Workspace files -- printed PASS and exited 0. ManagedAgentProperties now exposes the validation as a callable method and the preflight reports its verdict as a `validation` row. * fix(ci): keep the systemd READMEs on the full profile The packaging test names distribution/systemd/README.md and its Chinese counterpart, so classify-profile.test.mjs requires them in TEST_READ_MARKDOWN. Without the entry the helper battery failed with both files listed as unregistered lightweight Markdown, reddening Lint & Static for the systemd stack. * fix(managed-agent): boot the systemd template and authenticate the preflight The shipped server.env.example enabled the Hosted Harness without the Managed Session Store, which startup refuses, so following the README restart-looped. The template now enables the store and sets its base URL and the Runtime workspace ID. The preflight probed /capabilities without the Harness token, so --check printed FAIL 401 against a healthy authenticated Harness. It now sends the configured bearer token and reports a rejected token separately from an unreachable Harness. The README installs application.yml as 0600 owned by the service account instead of 0640 root:group: the control plane reads it as that account and the preflight rejects group-readable secret files. It also documents the ProtectHome constraint on the CLI location and the port-advance case. * fix(managed-agent): close the systemd review gaps The Harness unit expands QWEN_HOSTED_HARNESS_BROKER_ARGS into argv, so the broker token is readable through /proc/<pid>/cmdline. Say so in the env template and the unit comment, and keep that path to single-tenant hosts. KillMode=process means `systemctl stop` signals only the main process: the unit reports inactive while Runtime workers keep the state directory and Workspace. Document the symptom and the reap command in both READMEs and the deployment guide. Derive the archive's required systemd entries from systemdFiles, so a dropped env template or Chinese README fails packaging instead of only breaking install step 3. * fix(managed-agent): point the generated store at the server and reject commas The bootstrap generator's server.env still omitted the Managed Session Store, so the generated deployment failed the preflight's validation row. It now emits the store enablement, its base URL and the Runtime workspace ID. The store URL is this Java control plane's listener, not the Harness: the template and the generator now use http://127.0.0.1:8080, matching the server reference. The systemd READMEs name both variables so a Harness port change does not leave the store behind. A comma in --directory splits SPRING_CONFIG_ADDITIONAL_LOCATION into two locations; the guard now rejects it with the quote and newline cases, and tests pin the generator's store lines and the 8080 value. * fix(managed-agent): align the tool-path row with startup in two corners toolPathCheck returned SKIP when a creation root was configured while Workspace files were off, and PASS when SSH was enabled without nodes but a mount was present. The startup validator refuses both, so the row could disagree with the boot gate. Both rules now run before the disabled-files early return, and the SSH node requirement mirrors validateWorkspaceFiles. Three tests pin the two corners and the previously uncovered isolation rejection. * test(managed-agent): make the SSH witness observe its own guard rejectsSshWithoutNodes configured a creation root, so the creation-root guard failed first and disabling the SSH guard left the test green. The witness now configures a workspace mount plus ssh.enabled without nodes, and asserts the failure detail names the SSH requirement.
* feat(workflow): authorize daemon ancestor workflows * fix(workflows): fence ancestor trust across policy and cwd changes Preserve the actual admission publication through reconciler rebuilds. Reject in-flight and stale-directory replies throughout physical cwd changes, including partial failures. Refs QwenLM#14646 * fix(workflows): retain ancestor trust after context clear * fix(workflows): normalize restored ancestor trust session ID * test(workflows): use native cwd for restore trust fixture --------- Co-authored-by: qqqys <[email protected]>
… through to a 406 (QwenLM#13995) (QwenLM#13997) * fix(cli): hold pre-runtime /acp WebSocket upgrades instead of falling through to a 406 (QwenLM#13995) A fast-path `qwen serve` boot (no --open) listens with a deferred runtime, but the ACP WebSocket upgrade listener is only registered when the deferred runtime finishes. An /acp upgrade arriving in that window has no 'upgrade' listener, so Node routes it to Express as a plain GET; the delegating app holds it until the runtime is ready and forwards it to the SSE GET /acp handler, which answers a misleading 406. The first WS connection to a fresh daemon therefore always failed, and E2E tests that connect immediately after "listening" flaked red on main when the window outlasted their retries. Install a pre-listen upgrade guard on the primary server that holds early upgrades, lets them trigger the deferred runtime start (the same start-on-request the delegating app gives REST), and replays them once the ACP transport attaches — replayed upgrades go through the real listener, so auth and path routing are unchanged. Once no transport can still arrive (runtime settled without one, startup failed, or the daemon is shutting down) the gate closes and late upgrades get a retryable 503 with Retry-After, matching the not-ready postures elsewhere on this surface. * fix(cli): restore the upgrade fall-through for handle-less serve apps (QwenLM#13995) The pre-transport upgrade gate registered unconditionally and answered a retryable 503 for every WebSocket upgrade once the runtime had settled without an ACP transport. Handle-less apps (the hosted-harness profile, QWEN_SERVE_ACP_HTTP=0) never attach one, so their upgrades lost the Express fall-through their routes rely on (hidden 404, SSE 406): the no-AK hosted-harness boundary test saw "http 503" where it pins a bare 404 for a /acp WebSocket probe. The guard now steps aside when the runtime settles without a transport, restoring the pre-gate fall-through for later upgrades. Upgrades that raced the startup window still get the gate's retryable 503, and startup failures keep the 503 gate. * fix(cli): harden the pre-transport /acp upgrade gate (QwenLM#13995) Address review findings on the deferred-boot upgrade gate: sink errors from parked sockets so a mid-boot reset no longer crashes the daemon, restore the Express fall-through when a handle-less boot fails, make the terminal 503s non-retryable, release parked upgrades only once the runtime fully settles, cap the pre-auth park queue with eviction for departed peers, and log the park/flush/restore transitions. * fix(cli): drain parked /acp upgrades on shutdown and stale transport (QwenLM#13995) --------- Co-authored-by: qwen-code-dev-bot <[email protected]> Co-authored-by: Shaojin Wen <[email protected]>
…QwenLM#14701) * test(managed-agent): replay a denied Hook decision after a lost reply The deny fixture mode writes a real deny decision; the dropped hook-execute reply must resolve through hook-status to the same decision, leaving one physical call, a blocking result, and a tool that never runs. The shared fork grows by 150 s: healthy 7959 s, fork 8559 s, Verify 153 minutes and the job 246. * test(managed-agent): drop a settled deny reply, not the running receipt The proxy gains a response-aware one-shot drop; the deny cell now drops the first settled hook-status reply and settles the same operation through the harness status route. The design docs and PR claims match the exercised fault. * test(managed-agent): match the stored deny shape after a lost reply The persisted deny is outcome=success with output.hookSpecificOutput.permissionDecision=deny, not blocking. The drop predicate and the terminal assertions now use that shape, matching the measured E2 run.
QwenLM#14689) * fix: align DeepSeek reasoning controls across official and MaaS routes * fix(core): preserve DeepSeek reasoning for explicit profiles and aliases * fix(core): align final-model reasoning and default display * fix: align reasoning controls with the final request model --------- Co-authored-by: qqqys <[email protected]>
…QwenLM#14725) The review finding format records an acceptance criterion beside each suggested fix — the test that must go red if the fix is removed — and the CLI round-trips it into the saved artifact. The web-shell viewer read the sibling `witness` field and rendered it, but never read `fixWitness`, so someone fixing a finding from the browser saw the reviewer's evidence and the suggested fix without ever seeing what the fix owed. Read and render it where the finding format puts it, after the suggested fix, with a row in each locale. Closes QwenLM#9679. Co-authored-by: Qwen-Coder <[email protected]>
…wenLM#14728) * feat(web-shell): show per-model TTFT and output speed in Token Usage Count a tool-call preparation as the first visible output, so a response that only calls a tool no longer reports its whole duration as TTFT. Measure output speed between the first and the last visible chunk with a new optional generation_ms on the API response event; a response whose visible output arrives in one chunk counts toward TTFT but not TPS. Aggregate generation timing per model in the stats-route model totals and return it as an optional generation object per model from GET /session/:id/stats. Token Usage shows the average first token time and output speed under each model. Closes QwenLM#14722 * feat(web-shell): split model latency into first token and generation Label the timing line as first-token latency and add the average generation time over the same timed requests, so the two add up to those requests' latency. The header's average latency still counts every request, including failed, internal and non-streamed ones. Refs QwenLM#14722
…wenLM#14716) PR QwenLM#14570 replaced the latching of an unknown-outcome store commit with a settle-and-retry cycle: the Session keeps the append unsettled instead of stopping its writes, settles against the durable head on the next append, and retries a revision the head proves absent. The Hosted fault gates that ran only in the full CI tier still pinned the old latch semantics, so the Managed Agent gate fails on main. Update the four affected gates to the new contract: FG9b watches for ManagedSessionAppendUnsettledError and treats the refusal fire count as a lower bound; FG11b expects the same-key retry to heal without a Harness restart once the refusal drops; FG10c accepts the extra batch the settle retries; the FG6B driver counts the landed result reply as committed exactly once. Refs QwenLM#14699
…4735) * test(cli): pin the FG13d pre-dispatch cancel in a unit test The intent window is one acquisition wide and the first-turn executionBroker makes no network call, so the test blocks that method, cancels while the Hook execution record is still intent, and asserts cancelled/not_started_proven with zero hook-execute requests. * test(cli): give the pre-dispatch witness a reachable dispatch_started The executionBroker mock now returns a broker with a runtime, so the mutation witness (removing the post-acquisition cancel check) advances the record to dispatch_started and surfaces a hook-execute request instead of throwing on an undefined broker. * test(cli): pin the pre-dispatch checkpoint with a commit spy The cell spies on the child's extension-record commit and asserts no dispatch_started commit; the plan marker is excluded. The broker stub carries workspaceGeneration so removing both checks also surfaces a hook-execute request.
…ies (QwenLM#13930) (QwenLM#14719) * test(managed-agent): witness the durable hold sweep across both families (QwenLM#13930) The restart sweep discovers hold rows through the repository, not the process-local index, and the widened filter must carry both the Shell and Monitor families. Only the Shell durable-only case and the in-memory arm were pinned: reverting to a shell-only filter, or stopping on a JDBC page whose rows are all settled, would silently wedge a live Monitor watch past Session close. Add the durable-only Monitor sweep, the JDBC parity case that pages one row at a time so a fully-filtered page must still advance, and the drain arm for a hold re-acquired after a Broker restart, including the unproven-stop busy answer. Refs QwenLM#13930 (R1-47, R1-48). * test(managed-agent): make the JDBC filtered-page cursor witness real (QwenLM#13930) The contract case only had SETTLED rows beside the two live families, and the scan's SQL already excludes that state, so every page carried a hold and the row-level family filter never saw an empty page. Add a PREPARED non-hold row so a page is fully filtered at the family level; the mutant that stops on such a page now reddens on both the H2 and Flyway arms. Refs QwenLM#13930 (R1-47).
…indows (QwenLM#14729) (QwenLM#14741) Co-authored-by: qwen-code-autofix <qwen-code-autofix@localhost> Co-authored-by: Qwen-Coder <[email protected]>
* feat(managed-agent): add original CSI application retirement * fix(runtime): compare CSI retirement handle values * style(runtime): satisfy CSI activation Checkstyle
…14731) * docs(managed-agent): scope the FG11d lifecycle and cancellation gates FG11d is the part of the FG11 tracker that QwenLM#14526 did not discharge: retire, disable, close, and the round-level cancellation matrix. The design keeps both slices in HostedAutomationFaultGatesIT. None of these cells runs a Workspace tool, so they avoid the execution-authority gap that blocks FG11f. * docs(managed-agent): drop the FG11d cell FG11a already pins FG11a's retire-reply case already drops the retire's 202, asserts the retry answers the committed retire, and checks that no slot after the retire fires. Keeping a second cell for it would grow the suite without adding a property. FG11d now covers only what neither a nor b answers: a claim parked at intent, a disabled span, a Session closing over a queued input, and the round-level cancellation matrix. * test(managed-agent): gate a disabled automation span (FG11d) A definition created with `enabled: false` must record no fired occurrence and no run across two due slots, and the first slot after enabling must fire exactly once. The case runs the packaged stack (in-JVM Spring with the scanner, the real Harness behind the relay, real MySQL and the model stub) and passed on MySQL 8.0.46 with JDK 21 in 168.1 s. * docs(managed-agent): record why retire-at-intent needs a different hold The cell needs a claim to exist. Holding fire_run in the relay before the Harness means Spring never commits an automation_run, so the first construction observed an empty run list and had nothing to settle cancelled. Staging it needs a hold between the run commit and the wake turn, which the fixture does not expose yet. Disable-span stays green and is shipped. * docs(managed-agent): record why the FG11d close cell needs a workspace Closing a workspace Session in this fixture answers workspace_unavailable (the same execution-authority gap FG11f records), while the automation API refuses a Session that carries no workspace at all with session_not_found. So close-queued-input cannot be staged until that authority exists; the design now says so instead of leaving the cell looking implementable. * docs(managed-agent): record why the FG11d cancel cell needs another hold The public task id is the projection's id, not the run record id: passing arun_ answers task_not_found, while the id from GET /sessions/{id}/tasks is accepted. With the wake turn parked on the model, that cancel then left the run unsettled for 120 s while the Harness connection closed with socket EOF, so staging the cell needs a different hold point. * docs(managed-agent): add the missing cross-links and record the delivered cell `docs/design/README.md` requires both versions to link each other directly under the title; the FG11d pair had neither link. The Status line also still said neither slice was implemented, while this PR delivers `disable-span`. Both versions now say slice 1 is partially delivered: that cell is green, the other three cells and slice 2 are scoped but not implemented. * docs(managed-agent): correct the FG11d cell count and fixture scope Audit round 1 found two inconsistencies in both languages. Slice 1 has three cells, so one delivered leaves two outstanding, not three. The Fixture section also claimed these cells never run a Workspace tool and need no new fixture, while Limits records that `close-*` hits the same execution-authority gap as FG11f and `retire-at-intent` needs a hold the fixture does not expose. The section now says only `disable-span` runs on the stock fixture and points at Limits for the other two. * docs(managed-agent): attribute the close refusal to the managed check Audit round 2 found the `close-*` bullet claiming "the same execution-authority gap FG11f records". The close probe answers `workspace_unavailable` with "Hosted Workspace execution is not available.", which comes from the managed Session's workspace-execution check, while FG11f ends in `WorkspaceExecutionStore.unavailable()` with a different message. Both languages now name the managed check instead of merging the two refusals. * docs(managed-agent): describe the disable-span setup as the case implements it * test(managed-agent): pin the re-arm slot and recompose the hosted fork budget Verification found the cell stayed green with the re-arm dropped: the occurrence it accepted was due before the enable, so the disabled span was back-filled. The cell now asserts the fired slot is not older than the enable, which is the property it claims to pin. Recomposes the shared fork budget for the measured 168.1 s: the healthy sum moves 7809 -> 8145 (2x), the hosted-harness-mysql fork 8409 -> 8745, the Verify step 151 -> 156 minutes and the job ceiling 244 -> 249. Verified locally: the cell is 1/1 in 167.1 s with the new assertion, and scripts/tests/hosted-process-ci.test.js is 58/58.
…14736) * test(managed-agent): replay a denied Hook decision after a lost reply The deny fixture mode writes a real deny decision; the dropped hook-execute reply must resolve through hook-status to the same decision, leaving one physical call, a blocking result, and a tool that never runs. The shared fork grows by 150 s: healthy 7959 s, fork 8559 s, Verify 153 minutes and the job 246. * test(managed-agent): drop a settled deny reply, not the running receipt The proxy gains a response-aware one-shot drop; the deny cell now drops the first settled hook-status reply and settles the same operation through the harness status route. The design docs and PR claims match the exercised fault. * test(managed-agent): match the stored deny shape after a lost reply The persisted deny is outcome=success with output.hookSpecificOutput.permissionDecision=deny, not blocking. The drop predicate and the terminal assertions now use that shape, matching the measured E2 run. * docs(managed-agent): propose the remaining FG13f decision-delivery arms Stack layer 2/2 on the FG13f deny branch; the deny arm is in the base and these cells are planned until each test lands. * docs(managed-agent): sharpen the remaining FG13f design * docs(managed-agent): rebase the FG13f remaining layer on landed main * docs(managed-agent): correct the FG13f remaining coverage accounting
2443 commits merged, 24 conflicts resolved. Notable resolutions: - skill-manager.test.ts needed a real merge, not a side. Upstream parameterized the test with a root variable and asserts 2 dirs, which is only correct for the project level; the fork adds .claude user-skill discovery, so the user level returns 3. Kept upstream's parameterization with a per-level count and preserved the fork's .claude assertion as its own test. - transport.test.ts took theirs on all three hunks. Upstream observes the single-flight join via lookup().status where ours counted lookup calls, which is the weaker claim and still racy. - AppContainer.tsx exposed damage outside any conflict hunk. Upstream deleted useGeminiStream.ts in favour of use-llm-stream.ts, but the fork's terminal-to-mobile handoff still named the dead symbol. Took neither side wholesale: kept the fork's injectable useStream prop, which DaemonAppContainer.tsx passes the daemon adapter through, and rebound the type, default and import to useLlmStream. - .github/workflows/ci.yml and its guard test were restored byte-identical to HEAD. A per-hunk take-ours produced a frankenstein that dropped the fork-only desktop_shell job and ran the full suite twice under two names. Cost: upstream's disk floor gate, disk-pressure sampling, hosted process suite and new helper tests are not adopted. The dependency tooling moved to pnpm with this merge: package-lock.json is removed, pnpm-lock.yaml, pnpm-workspace.yaml and .pnpmfile.mjs are added, and scripts/build.js drives corepack pnpm.
…anes The fork adopted pnpm as its package manager, but ci.yml still installed with `npm ci` against a root package-lock.json that no longer exists. Move all 13 installs, and the 13 caches and lockfile paths that feed them, to pnpm and pnpm-lock.yaml. Upstream's single monolithic unit step carries three guarantees the fork's seven per-package lanes lost when the layout was split: a bounded step timeout so a hang fails instead of burning the whole job budget, --retry so a flaky vitest attempt under worker contention does not redden the run, and dropped DAC capabilities so the permission-denial fixtures cannot silently skip on a root-run lane. Port all three into every lane, and repoint the package-scripts guards at the lanes rather than at upstream's step names, so a guarantee dropped from any one lane reddens the suite.
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.
What this is
The 2026-10-19 upstream sync (2443 commits) plus the fork's move from npm to pnpm. The fork now installs, caches, and resolves through pnpm 11.24.0 end to end.
pnpm adoption
packageManager: [email protected],pnpm-workspace.yaml(nodeLinker: 'hoisted',packageImportMethod: 'clone-or-copy',linkWorkspacePackages: true),.pnpmfile.mjsrewrites internal deps toworkspace:*, rootpackage-lock.jsonremoved in favour ofpnpm-lock.yaml.ci.yml: all 13 installs move fromnpm citocorepack pnpm install --frozen-lockfile, with the 13 matching caches andcache-dependency-pathswitched topnpm-lock.yaml. Script execution stays onnpm run, as upstream does.proxy-addr,shell-quote) had to be re-declared inpnpm-workspace.yaml: npm reads rootoverrides:inpackage.json, pnpm reads only theoverrides:block inpnpm-workspace.yaml, so a pin left only inpackage.jsonis silently dropped.!packages/launcher-appexclusion mirrored intopnpm-workspace.yaml; as a workspace member its electron devDeps failcheck-desktop-isolationon every PR.better-sqlite3: trueadded toallowBuilds(npm ran install scripts by default; pnpm does not).packages/vscode-ide-companion/NOTICES.txtregenerated: it is generator output and CI has a hardexit 1gate on it being current. Verified by re-running the generator, which reproduced the committed bytes exactly.Unit-step guards ported into the 7 lanes
Upstream runs one monolithic unit step carrying three guarantees that the fork's seven per-package lanes lost when the layout was split. All three are ported into every lane:
timeout-minutes: 50on the unit step, under each lane's 60-minute job cap, so a hang fails instead of burning the whole job budget.--retryfromQWEN_CI_VITEST_RETRYso a flaky vitest attempt under worker contention does not redden a run.setprivdrop ofdac_override/dac_read_search, so permission-denial fixtures cannot silently skip on a root-run lane.VITEST_MAX_FORKS/VITEST_MAX_THREADS) gated onecs-qwen-*runner names, matching upstream.scripts/tests/package-scripts.test.jsis repointed from upstream's step names at the seven lanes, so a guarantee dropped from any one lane reddens the suite. Each of the three guards was mutation-tested by injecting the failure it should catch into one lane and confirming it fails, then restoring.Verification
package-scripts.test.js: 51 passed | 1 skipped.ci.ymlparses as YAML (16 jobs); all 7 lane bodies passbash -n; zeronpm ciand zeropackage-lockreferences remain in it.scripts/testssuite, these changes add no failures and fix 7 (83 to 76).Not resolved here
The
scripts/testssuite still has 76 failures. They are merge-introduced, not pnpm regressions: the failing test files mostly do not exist atmain, and they assert upstream's CI architecture (alint_and_staticjob, a post-merge push lane, platform-lane schedules, hosted worker counts) against this fork's divergent lane layout. Fixing them means either reshaping the fork's CI to upstream's form or adapting roughly a dozen upstream-owned test files, so it is left for maintainer decision.