mixdog 0.9.40 → 0.9.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/package.json +2 -1
  2. package/scripts/anthropic-oauth-refresh-race-test.mjs +338 -0
  3. package/scripts/compact-pressure-test.mjs +128 -0
  4. package/scripts/compact-trigger-migration-smoke.mjs +8 -8
  5. package/scripts/internal-comms-smoke.mjs +66 -25
  6. package/scripts/max-output-recovery-persist-test.mjs +81 -0
  7. package/scripts/max-output-recovery-test.mjs +222 -0
  8. package/scripts/provider-toolcall-test.mjs +32 -0
  9. package/src/agents/reviewer/AGENT.md +4 -0
  10. package/src/rules/lead/lead-brief.md +11 -3
  11. package/src/rules/lead/lead-tool.md +0 -2
  12. package/src/rules/shared/01-tool.md +4 -0
  13. package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +20 -2
  14. package/src/runtime/agent/orchestrator/context/collect.mjs +7 -3
  15. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +144 -7
  16. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +15 -2
  17. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +2 -2
  18. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +57 -25
  19. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +54 -12
  20. package/src/runtime/agent/orchestrator/session/context-utils.mjs +4 -3
  21. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +106 -8
  22. package/src/runtime/agent/orchestrator/session/loop/steering-ladder.mjs +12 -1
  23. package/src/runtime/agent/orchestrator/session/loop/termination.mjs +22 -7
  24. package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +26 -1
  25. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +2 -1
  26. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +31 -4
  27. package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +11 -2
  28. package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +45 -0
  29. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +22 -21
  30. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +1 -1
  31. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +9 -10
  32. package/src/workflows/bench/WORKFLOW.md +51 -27
  33. package/src/workflows/default/WORKFLOW.md +29 -24
@@ -500,6 +500,7 @@ export function execShellCommand({
500
500
  onProgress,
501
501
  clientHostPid,
502
502
  backgroundOnTimeout,
503
+ promotedTimeoutMs = 0,
503
504
  }) {
504
505
  return new Promise(async (resolve) => {
505
506
  const taskId = `shell_${randomUUID().slice(0, 8)}`;
@@ -741,9 +742,8 @@ export function execShellCommand({
741
742
  // BACKGROUND_MS opt-in) — an EARLIER promotion before the timeout, and
742
743
  // 2. the foreground timeout deadline (backgroundOnTimeout) — the default
743
744
  // promote-on-timeout that replaces the old tree-kill.
744
- // Either way the adopted job runs UNLIMITED (timeoutMs 0, matching the
745
- // async default): the original foreground timeout no longer bounds it, and
746
- // the adopted-job cap poll still enforces the 100 MB output ceiling.
745
+ // A capped explicit foreground timeout supplies its remaining deadline to
746
+ // the adopted job; otherwise adoption remains unlimited as before.
747
747
  // Mutually exclusive with settle() via the autoBackgrounded flag set
748
748
  // synchronously at the top before any await.
749
749
  const _autoBackground = async ({ reason = 'threshold' } = {}) => {
@@ -754,8 +754,7 @@ export function execShellCommand({
754
754
  if (child.exitCode != null || child.signalCode != null) return;
755
755
  autoBackgrounded = true;
756
756
  // The foreground capture is over; stop the local watchdogs/timers so
757
- // they cannot treeKill the now-adopted child. The adopted job runs
758
- // unlimited; refreshShellJob only enforces the output cap.
757
+ // they cannot treeKill the now-adopted child.
759
758
  if (timer) { clearTimeout(timer); timer = null; }
760
759
  _clearProgressTimer();
761
760
  if (sizeWatchdog) { clearInterval(sizeWatchdog); sizeWatchdog = null; }
@@ -777,14 +776,13 @@ export function execShellCommand({
777
776
  const stdoutPath = taskOutput.spilled ? taskOutput.stdoutPath : null;
778
777
  const stderrPath = taskOutput.spilled ? taskOutput.stderrPath : null;
779
778
  let job = null;
779
+ const adoptedTimeoutMs = reason === 'timeout' ? promotedTimeoutMs : 0;
780
780
  try {
781
781
  job = adoptForegroundShellJob({
782
782
  command,
783
783
  cwd,
784
784
  pid: child.pid,
785
- // Unlimited: the promoted job is no longer bounded by the foreground
786
- // timeout (matches the async omitted-default behavior).
787
- timeoutMs: 0,
785
+ timeoutMs: adoptedTimeoutMs,
788
786
  mergeStderr: false,
789
787
  stdoutPath,
790
788
  stderrPath,
@@ -854,9 +852,10 @@ export function execShellCommand({
854
852
  outputCaptureError: taskOutput.writeError,
855
853
  backgrounded: true,
856
854
  jobId,
855
+ backgroundTimeoutMs: adoptedTimeoutMs,
857
856
  backgroundMessage: jobId
858
- ? `${_verb}; still running — completion will be delivered as a background task notification. Use task with task_id:${jobId} only for manual wait/status/read/cancel.`
859
- : `${_verb}; still running`,
857
+ ? `${_verb}; still running. Waiting is a decision, not a default: judge from the partial output whether this will finish within your remaining budget if progress looks slow or stalled, diagnose the cause and pursue an alternative instead of waiting. Completion will be delivered as a background task notification; use task with task_id:${jobId} only for manual wait/status/read/cancel.`
858
+ : `${_verb}; still running — judge from the partial output whether waiting can finish in budget, or diagnose and pursue an alternative.`,
860
859
  }),
861
860
  );
862
861
  };
@@ -1,36 +1,60 @@
1
1
  ---
2
2
  id: bench
3
3
  name: Bench
4
- description: "Autonomous benchmark workflow loop to completion without user approval."
4
+ description: "Autonomous headless benchmark workflow with directed execution and parallel cross-verification."
5
5
  hidden: true
6
6
  agents: worker, heavy-worker, reviewer, debugger, maintainer
7
7
  ---
8
8
 
9
9
  # Bench
10
10
 
11
- Autonomous: no user. Never wait for approval or ask questions; decide/proceed.
12
- Loop until verified complete or provably blocked.
13
-
14
- Lead supervises, delegates, coordinates, judges, decides. Lead directly handles
15
- simple 1–2-step work, coordination, pre-planning, config, final git deployment.
16
- Worker: several-step implementation; Heavy Worker: high-complexity multi-step
17
- implementation; Reviewer: implementation diff/regression/missing-check review;
18
- Debugger: very high complexity or root cause already failed once.
19
-
20
- 1. Plan: form it and execute immediately; no approval step.
21
- 2. Delegate: split to the maximum independent scopes. Parallelize independent
22
- implementation/analysis/review/debugging, spawning every scope in one turn.
23
- Shared/cross-cutting code does not justify merging: split by path and verify
24
- shared parts yourself. A single scope needs a genuinely inseparable
25
- dependency; state it. Within one complex scope, sequence steps with a
26
- build/test-green gate between them. Briefs follow the Lead brief contract.
27
- After async spawn, end turn: no polling, guessing, or dependent work until
28
- completion notification.
29
- 3. Review: one Reviewer per implementation scope, spawned 1:1 in the same turn,
30
- never deferred/batched; wait. Fact-check agent responses and cross-check
31
- implementation/review yourself before acting. Return fixes to the original
32
- scope; loop verify -> fix -> re-verify until clean. Skip only simple,
33
- low-risk review. If a bug survives 2+ fix cycles, Debugger investigates
34
- before another fix round.
35
- 4. Finish: verify final state yourself; stop only verified complete or hard
36
- blocked. Final states outcome and evidence.
11
+ Autonomous headless run: no user exists. Never ask questions, propose plans
12
+ for approval, or end the turn waiting — decide and proceed. Standing
13
+ pre-approval covers every action: edits, state mutation, delegation, builds.
14
+ Loop until the task is verified complete or provably blocked.
15
+
16
+ The pipeline has exactly three stages. Lead directs and verifies it, but NEVER
17
+ executes the work itself: no edits, answers, or artifact generation, regardless
18
+ of task size, perceived simplicity, or number of steps.
19
+
20
+ ## 1. Lead analysis and direction
21
+ Lead performs real analysis first on EVERY task: task structure, required
22
+ deliverables, boundaries, the task's own verification means, and solution
23
+ direction. Convert it into clear execution direction and delegation briefs
24
+ following the Lead brief contract.
25
+
26
+ Hand the direction and briefs to executors. Analysis is not permission for
27
+ Lead to implement any portion of the result: all edits, answer production, and
28
+ artifact generation belong to executor sessions.
29
+
30
+ ## 2. Executors perform the work
31
+ Use Worker sessions, or Heavy Worker sessions for broad scopes, to execute the
32
+ directed work. Multiple workers MAY fan out in parallel, one per independent
33
+ scope. Keep ownership clear for each assigned deliverable.
34
+
35
+ Executors build the answer or artifact and perform basic does-it-run checks.
36
+ They are not a verification role and do not own acceptance, requirements
37
+ judgment, or final correctness. Each executor reports its result to Lead.
38
+
39
+ ## 3. Lead and Reviewer verify
40
+
41
+ When executors report, Lead and Reviewer start cross-verification IN PARALLEL,
42
+ never serially. Lead personally runs the task's own verification means, such
43
+ as its test suite, grader script, simulator, or self-checkable output.
44
+ Reviewer independently judges the result against every task requirement,
45
+ including intent, correctness, boundaries, and deliverables.
46
+
47
+ Judgment-type answers with no direct ground truth still require parallel
48
+ cross-verification, even for a single small deliverable. Lead evaluates against
49
+ available criteria while Reviewer independently judges requirements;
50
+ perceived simplicity is no exemption.
51
+
52
+ Merge any finding into a clear fix delta and return it to the SAME executor
53
+ session owning the affected scope. The executor applies it and reports again.
54
+ Lead and Reviewer repeat the same parallel cross-verification until both legs
55
+ are clean; Lead never fixes or completes the work directly.
56
+
57
+ Before declaring completion, Lead personally runs the task-required
58
+ verification one final time and checks that every deliverable is present.
59
+ Never end with a question, approval request, or proposed next step. Continue
60
+ until verified complete or stop only when completion is provably blocked.
@@ -13,33 +13,38 @@ Approval is a later explicit user message after the latest plan ("do it",
13
13
  approval with a scope change needs a revised plan and fresh approval. Before
14
14
  approval: no edits, state mutation, or delegation.
15
15
 
16
- Lead supervises, delegates, coordinates, judges, decides. After approval,
17
- delegate by default; Lead only coordinates, does git, or an obvious 1-edit/
18
- 1-check change. Route other implementation/research/debugging to its matching
19
- agent. Worker: bounded established path, low local risk/coupling/verification,
20
- clear local check. Heavy Worker: high risk/coupling/verification (including any
21
- high-risk scope), or coupled staged work needing coordinated verification.
22
- Architecture, contracts, storage, concurrency, security, lifecycle are
23
- indicators, not automatic categories. Reviewer verifies an implementation;
24
- Debugger handles requested debugging or root cause after a failed fix.
16
+ Lead orchestrates and verifies. Lead-direct work is allowed only for pure
17
+ read/analysis, git/configuration, or when the user explicitly supplies both the
18
+ exact target and exact replacement/output. Never infer an exemption from a task
19
+ name, file count, or perceived difficulty. Every other implementation, reverse
20
+ engineering, debugging application, or artifact generation delegates to the
21
+ matching agent. Debugger owns diagnosis and reverse engineering; Worker applies
22
+ an established bounded change or fully specified artifact; Heavy Worker owns
23
+ implementation that must establish the change through investigation or staged
24
+ delivery. Applying a Debugger result is implementation, not diagnosis.
25
25
 
26
26
  1. Plan: draft before any implementation; settle scope/plan, ask if ambiguous,
27
27
  then await the gate.
28
- 2. Delegate: maximize useful fan-out—one suitable Worker/Heavy Worker per ready
29
- independent scope whose parallel gain exceeds coordination/merge cost; spawn
30
- all in one turn, with no count cap. Serialize only a real dependency,
31
- overlapping write, or inseparable coupling. Briefs follow the Lead brief
32
- contract. After async spawn, end the turn.
33
- 3. Review: after approval, complete delegation, review, self-verification, and
34
- in-scope fixes without reapproval. Every delegated implementation gets one
35
- Reviewer (all ready reviewers in one turn) and Lead integration/cross-scope
36
- verification in parallel. Reviewer independently judges risk, intent,
37
- boundaries; Lead checks acceptance/interactions, not duplicate same-scope
38
- work. High-risk scopes add distinct lenses. Synthesize one verdict; send
39
- merged fixes to the original live session; loop fix -> re-verify (same
40
- Reviewer + Lead re-check) until clean. Debugger first for requested debugging
41
- or a bug surviving 2+ fix cycles. Agent reports relay scope, verdict, next
42
- work as in-progress, never conclusions.
28
+ 2. Delegate: one agent per ready independent scope; spawn all ready scopes in
29
+ one turn, with no count cap. Serialize only a real dependency, overlapping
30
+ write, or inseparable coupling. Briefs follow the Lead brief contract.
31
+ After async spawn, end the turn.
32
+ 3. Review: review is exempt only for pure read/analysis with no edit, artifact,
33
+ or state mutation; git/configuration; or a request where the user explicitly
34
+ supplies both the exact target and exact replacement/output. Every
35
+ non-exempt mutation or artifact, whether produced or applied by Worker,
36
+ Heavy Worker, Debugger, or Lead, gets one Reviewer (all ready reviewers in
37
+ one turn) and Lead
38
+ integration/cross-scope verification in parallel. Debugger analysis cannot
39
+ substitute for implementation review: applying a Debugger result triggers
40
+ the same Reviewer + Lead verification. Reviewer independently judges risk,
41
+ intent, boundaries; Lead checks acceptance/interactions, not duplicate
42
+ same-scope work. High-risk scopes add distinct lenses. Synthesize one
43
+ verdict; send merged fixes to the original live session; loop fix ->
44
+ re-verify (same Reviewer + Lead re-check) until clean. Debugger first for
45
+ requested debugging or a bug surviving 2+ fix cycles. Exempt mutations still
46
+ require shell self-verification before report. Agent reports relay scope,
47
+ verdict, next work as in-progress, never conclusions.
43
48
  4. Report: final (not interim) report compares work to approved plan and gives
44
49
  verified result; never forward raw agent output. Ask about ship/deploy when
45
50
  relevant. Build/deploy/commit/push require an explicit user request after