mixdog 0.9.63 → 0.9.64
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.
- package/README.md +3 -0
- package/package.json +9 -2
- package/scripts/code-graph-description-contract.mjs +3 -3
- package/scripts/verify-release-assets.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +11 -14
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +6 -6
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +1 -0
- package/src/runtime/agent/orchestrator/config.mjs +19 -124
- package/src/runtime/agent/orchestrator/context/collect.mjs +6 -6
- package/src/runtime/agent/orchestrator/dispatch-persist.mjs +2 -2
- package/src/runtime/agent/orchestrator/internal-agents.mjs +2 -2
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +1 -1
- package/src/runtime/agent/orchestrator/mcp/client.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +333 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-model-resolve.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -277
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +196 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +460 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +14 -593
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +5 -280
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +357 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-headers.mjs +216 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +2 -188
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/provider-catalog-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/compact/budget.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/file-reattach.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +4 -4
- package/src/runtime/agent/orchestrator/session/loop/deferred-call-through.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +17 -0
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +18 -26
- package/src/runtime/agent/orchestrator/session/loop/termination.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/delivered-completions.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +260 -0
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +72 -0
- package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +163 -0
- package/src/runtime/agent/orchestrator/session/store/write-guards.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/store.mjs +9 -561
- package/src/runtime/agent/orchestrator/session/tool-envelope.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +11 -11
- package/src/runtime/agent/orchestrator/tools/bash-policy-scan.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/bash-session.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +2 -154
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/cwd-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fs-reachability.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-locks.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/builtin/read-open.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-paths.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-process.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-spawn.mjs +519 -0
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +5 -449
- package/src/runtime/agent/orchestrator/tools/builtin/snapshot-helpers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +212 -0
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +1 -7
- package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +9 -36
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +15 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +429 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +2 -395
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/trusted-roots.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/mutation-planner.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/next-call-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/matcher.mjs +7 -7
- package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +72 -9
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/result-compression.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +2 -444
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +505 -0
- package/src/runtime/agent/orchestrator/tools/shell-exec-policy.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +1 -1
- package/src/runtime/channels/lib/backend-dispatch.mjs +20 -5
- package/src/runtime/channels/lib/scheduler.mjs +1 -1
- package/src/runtime/channels/lib/telegram-format.mjs +1 -1
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +4 -4
- package/src/runtime/channels/tool-defs.mjs +2 -3
- package/src/runtime/memory/index.mjs +1 -5
- package/src/runtime/memory/lib/core-memory-candidates.mjs +357 -0
- package/src/runtime/memory/lib/core-memory-store.mjs +7 -357
- package/src/runtime/memory/lib/cycle-signatures.mjs +1 -1
- package/src/runtime/memory/lib/embedding-model-config.mjs +1 -1
- package/src/runtime/memory/lib/embedding-provider.mjs +1 -5
- package/src/runtime/memory/lib/embedding-worker.mjs +1 -5
- package/src/runtime/memory/lib/ko-morph.mjs +2 -2
- package/src/runtime/memory/lib/memory-config-flags.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle-requests.mjs +3 -7
- package/src/runtime/memory/lib/memory-cycle1.mjs +4 -8
- package/src/runtime/memory/lib/memory-cycle2-gate.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-mutations.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-shared.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle3.mjs +1 -5
- package/src/runtime/memory/lib/memory-embed.mjs +2 -6
- package/src/runtime/memory/lib/memory-log.mjs +8 -0
- package/src/runtime/memory/lib/memory-ops-policy.mjs +4 -8
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +1 -1
- package/src/runtime/memory/lib/memory-recall-store.mjs +2 -193
- package/src/runtime/memory/lib/memory-score.mjs +1 -1
- package/src/runtime/memory/lib/memory-text-utils.mjs +2 -2
- package/src/runtime/memory/lib/memory.mjs +2 -6
- package/src/runtime/memory/lib/pg/adapter.mjs +2 -6
- package/src/runtime/memory/lib/pg/process.mjs +1 -5
- package/src/runtime/memory/lib/pg/supervisor.mjs +1 -5
- package/src/runtime/memory/lib/recall-format.mjs +2 -2
- package/src/runtime/memory/lib/recall-scoring.mjs +195 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -5
- package/src/runtime/memory/lib/trace-store.mjs +2 -6
- package/src/runtime/search/lib/http-fetch.mjs +6 -6
- package/src/runtime/search/lib/web-tools.mjs +2 -2
- package/src/runtime/shared/buffered-appender.mjs +1 -1
- package/src/runtime/shared/child-guardian.mjs +1 -1
- package/src/runtime/shared/child-spawn-gate.mjs +1 -1
- package/src/runtime/shared/config.mjs +4 -4
- package/src/runtime/shared/launcher-control.mjs +9 -10
- package/src/runtime/shared/llm/index.mjs +5 -20
- package/src/runtime/shared/markdown-frontmatter.mjs +1 -1
- package/src/runtime/shared/memory-snapshot.mjs +4 -4
- package/src/runtime/shared/pristine-execution.mjs +1 -1
- package/src/runtime/shared/process-lifecycle.mjs +0 -1
- package/src/runtime/shared/process-shutdown.mjs +1 -1
- package/src/runtime/shared/resource-admission.mjs +2 -2
- package/src/runtime/shared/schedule-session-run.mjs +1 -1
- package/src/runtime/shared/schedules-db.mjs +1 -1
- package/src/runtime/shared/service-discovery.mjs +2 -2
- package/src/runtime/shared/staged-update.mjs +6 -6
- package/src/runtime/shared/tool-execution-contract.mjs +1 -1
- package/src/runtime/shared/tool-primitives.mjs +1 -1
- package/src/runtime/shared/tool-surface.mjs +2 -2
- package/src/runtime/shared/update-checker.mjs +1 -1
- package/src/runtime/shared/user-cwd.mjs +3 -3
- package/src/runtime/shared/user-data-guard.mjs +4 -4
- package/src/runtime/shared/workspace-router.mjs +5 -5
- package/src/session-runtime/config-helpers.mjs +2 -3
- package/src/session-runtime/config-lifecycle.mjs +1 -1
- package/src/session-runtime/hitch-profile.mjs +1 -1
- package/src/session-runtime/lifecycle-api.mjs +6 -4
- package/src/session-runtime/model-recency.mjs +5 -5
- package/src/session-runtime/plugin-mcp.mjs +1 -1
- package/src/session-runtime/provider-request-snapshot.mjs +338 -0
- package/src/session-runtime/session-text.mjs +4 -4
- package/src/session-runtime/tool-catalog-schema.mjs +197 -0
- package/src/session-runtime/tool-catalog.mjs +6 -483
- package/src/session-runtime/tool-defs.mjs +1 -1
- package/src/standalone/agent-task-status.mjs +1 -1
- package/src/standalone/agent-tool/helpers.mjs +2 -2
- package/src/standalone/channel-admin.mjs +4 -4
- package/src/standalone/explore-tool.mjs +3 -3
- package/src/standalone/hook-bus/config.mjs +1 -1
- package/src/standalone/hook-bus/constants.mjs +1 -1
- package/src/standalone/hook-bus/rules.mjs +1 -1
- package/src/standalone/projects.mjs +1 -1
- package/src/standalone/provider-admin.mjs +2 -2
- package/src/tui/app/app-format.mjs +2 -2
- package/src/tui/app/clipboard.mjs +3 -3
- package/src/tui/app/input-parsers.mjs +1 -1
- package/src/tui/app/text-layout.mjs +1 -1
- package/src/tui/app/transcript-row-estimate.mjs +360 -0
- package/src/tui/app/transcript-window.mjs +5 -347
- package/src/tui/app/use-mouse-input.mjs +1 -1
- package/src/tui/app/use-prompt-handlers.mjs +1 -1
- package/src/tui/components/tool-execution/surface-detail.mjs +9 -9
- package/src/tui/components/tool-execution/text-format.mjs +2 -2
- package/src/tui/components/tool-output-format.mjs +7 -7
- package/src/tui/display-width.mjs +4 -4
- package/src/tui/dist/index.mjs +63 -97
- package/src/tui/engine/agent-envelope.mjs +5 -5
- package/src/tui/engine/notification-plan.mjs +1 -1
- package/src/tui/engine/queue-helpers.mjs +3 -3
- package/src/tui/engine/render-timing.mjs +4 -5
- package/src/tui/engine/session-api-ext.mjs +3 -3
- package/src/tui/engine/tool-result-status.mjs +5 -5
- package/src/tui/engine/tool-result-text.mjs +1 -1
- package/src/tui/engine/transcript-spill.mjs +585 -0
- package/src/tui/engine/tui-steering-persist.mjs +1 -1
- package/src/tui/engine.mjs +2 -474
- package/src/tui/lib/voice-setup.mjs +1 -1
- package/src/tui/markdown/format-token.mjs +1 -1
- package/src/tui/markdown/render-ansi.mjs +1 -1
- package/src/tui/markdown/table-layout.mjs +4 -4
- package/src/tui/paste-attachments.mjs +1 -1
- package/src/tui/prompt-history-store.mjs +3 -3
- package/src/tui/statusline-ansi-bridge.mjs +2 -2
- package/src/tui/theme.mjs +1 -1
- package/src/tui/transcript-tool-failures.mjs +2 -2
- package/src/ui/ansi.mjs +0 -9
- package/src/ui/statusline-format.mjs +2 -4
- package/scripts/_bench-cwc.json +0 -20
- package/scripts/_jitter-fuzz.jsx +0 -42
- package/scripts/_jitter-fuzz2.jsx +0 -30
- package/scripts/_jitter-probe.jsx +0 -35
- package/scripts/_jp2.jsx +0 -16
- package/scripts/_smoke_wd.mjs +0 -7
- package/scripts/abort-recovery-test.mjs +0 -175
- package/scripts/agent-dispatch-abort-compose-test.mjs +0 -31
- package/scripts/agent-live-arg-guard-smoke.mjs +0 -20
- package/scripts/agent-live-path-suffix-smoke.mjs +0 -34
- package/scripts/agent-live-toolcall-args-smoke.mjs +0 -45
- package/scripts/agent-loop-policy-test.mjs +0 -37
- package/scripts/agent-model-liveness-test.mjs +0 -763
- package/scripts/agent-parallel-smoke.mjs +0 -435
- package/scripts/agent-route-batch-test.mjs +0 -40
- package/scripts/agent-tag-reuse-smoke.mjs +0 -441
- package/scripts/agent-terminal-reap-test.mjs +0 -252
- package/scripts/agent-trace-io-test.mjs +0 -133
- package/scripts/ansi-color-capability-test.mjs +0 -90
- package/scripts/anthropic-admission-retry-integration-test.mjs +0 -119
- package/scripts/anthropic-maxtokens-test.mjs +0 -119
- package/scripts/anthropic-oauth-refresh-race-test.mjs +0 -397
- package/scripts/anthropic-transport-policy-test.mjs +0 -726
- package/scripts/apply-patch-edit-smoke.mjs +0 -71
- package/scripts/arg-guard-test.mjs +0 -93
- package/scripts/async-notify-settlement-test.mjs +0 -99
- package/scripts/atomic-lock-tryonce-test.mjs +0 -125
- package/scripts/background-task-meta-smoke.mjs +0 -38
- package/scripts/bench-run.mjs +0 -508
- package/scripts/boot-smoke.mjs +0 -137
- package/scripts/build-runtime-windows.ps1 +0 -242
- package/scripts/channel-daemon-smoke.mjs +0 -1103
- package/scripts/code-graph-aggregate-cwd-test.mjs +0 -158
- package/scripts/code-graph-disk-hit-test.mjs +0 -290
- package/scripts/code-graph-dispatch-test.mjs +0 -96
- package/scripts/code-graph-root-federation-test.mjs +0 -273
- package/scripts/compact-active-turn-test.mjs +0 -68
- package/scripts/compact-file-reattach-test.mjs +0 -88
- package/scripts/compact-pressure-test.mjs +0 -788
- package/scripts/compact-prior-context-flatten-test.mjs +0 -252
- package/scripts/compact-recall-digest-test.mjs +0 -57
- package/scripts/compact-smoke.mjs +0 -1017
- package/scripts/compact-trigger-migration-smoke.mjs +0 -261
- package/scripts/compacted-placeholder-scrub-test.mjs +0 -63
- package/scripts/context-mcp-metering-test.mjs +0 -1406
- package/scripts/debounced-skills-async-save-test.mjs +0 -57
- package/scripts/deferred-tool-loading-test.mjs +0 -250
- package/scripts/desktop-session-bridge-test.mjs +0 -1013
- package/scripts/dispatch-persist-recovery-test.mjs +0 -141
- package/scripts/embedding-worker-exit-test.mjs +0 -76
- package/scripts/execution-completion-dedup-test.mjs +0 -205
- package/scripts/execution-pending-resume-kick-test.mjs +0 -151
- package/scripts/execution-resume-esc-integration-test.mjs +0 -176
- package/scripts/explore-bench-tmp.mjs +0 -36
- package/scripts/explore-bench.mjs +0 -248
- package/scripts/explore-prompt-policy-test.mjs +0 -256
- package/scripts/explore-timeout-cancel-test.mjs +0 -345
- package/scripts/find-fuzzy-hidden-test.mjs +0 -267
- package/scripts/forwarder-rebind-tail-test.mjs +0 -67
- package/scripts/freevar-smoke.mjs +0 -98
- package/scripts/gemini-provider-test.mjs +0 -1448
- package/scripts/generate-oc-icons.mjs +0 -11
- package/scripts/grok-oauth-refresh-race-test.mjs +0 -273
- package/scripts/headless-pristine-execution-test.mjs +0 -614
- package/scripts/hook-bus-test.mjs +0 -552
- package/scripts/ingest-pure-conversation-smoke.mjs +0 -175
- package/scripts/internal-comms-bench-test.mjs +0 -226
- package/scripts/internal-comms-bench.mjs +0 -853
- package/scripts/internal-comms-smoke.mjs +0 -277
- package/scripts/internal-tools-normalization-test.mjs +0 -62
- package/scripts/interrupted-turn-history-test.mjs +0 -399
- package/scripts/lead-workflow-smoke.mjs +0 -592
- package/scripts/lifecycle-api-test.mjs +0 -137
- package/scripts/live-share-test.mjs +0 -148
- package/scripts/live-worker-smoke.mjs +0 -333
- package/scripts/log-writer-guard-smoke.mjs +0 -131
- package/scripts/maintenance-default-routes-test.mjs +0 -164
- package/scripts/max-output-recovery-persist-test.mjs +0 -81
- package/scripts/max-output-recovery-test.mjs +0 -368
- package/scripts/mcp-client-normalization-test.mjs +0 -45
- package/scripts/mcp-grace-deferred-test.mjs +0 -225
- package/scripts/memory-core-input-test.mjs +0 -167
- package/scripts/memory-cycle-routing-test.mjs +0 -111
- package/scripts/memory-meta-concurrency-test.mjs +0 -20
- package/scripts/memory-pg-recovery-test.mjs +0 -59
- package/scripts/memory-rule-contract-test.mjs +0 -93
- package/scripts/model-list-sanitize-test.mjs +0 -37
- package/scripts/mouse-tracking-restore-smoke.mjs +0 -107
- package/scripts/native-edit-wire-test.mjs +0 -152
- package/scripts/notify-completion-mirror-test.mjs +0 -73
- package/scripts/openai-oauth-refresh-race-test.mjs +0 -120
- package/scripts/openai-oauth-ws-1006-retry-test.mjs +0 -954
- package/scripts/openai-ws-early-settle-test.mjs +0 -216
- package/scripts/output-style-bench.mjs +0 -292
- package/scripts/output-style-smoke.mjs +0 -145
- package/scripts/parent-abort-link-test.mjs +0 -90
- package/scripts/patch-binary-cache-test.mjs +0 -181
- package/scripts/path-suffix-test.mjs +0 -57
- package/scripts/pending-completion-drop-test.mjs +0 -239
- package/scripts/pending-messages-lock-nonblocking-test.mjs +0 -62
- package/scripts/pretool-ask-runtime-test.mjs +0 -54
- package/scripts/process-lifecycle-test.mjs +0 -461
- package/scripts/prompt-immediate-render-test.mjs +0 -89
- package/scripts/prompt-input-parity-test.mjs +0 -145
- package/scripts/provider-admission-scheduler-test.mjs +0 -681
- package/scripts/provider-contract-test.mjs +0 -632
- package/scripts/provider-stream-stall-test.mjs +0 -276
- package/scripts/provider-toolcall-test.mjs +0 -3063
- package/scripts/reactive-compact-persist-smoke.mjs +0 -203
- package/scripts/recall-bench.mjs +0 -359
- package/scripts/resource-admission-test.mjs +0 -792
- package/scripts/result-classification-test.mjs +0 -75
- package/scripts/rg-runner-test.mjs +0 -240
- package/scripts/routing-corpus-test.mjs +0 -349
- package/scripts/sanitize-tool-pairs-test.mjs +0 -260
- package/scripts/session-bench-cache-break-test.mjs +0 -102
- package/scripts/session-bench.mjs +0 -1708
- package/scripts/session-context-bench.mjs +0 -344
- package/scripts/session-heartbeat-lifecycle-test.mjs +0 -68
- package/scripts/session-ingest-compaction-smoke.mjs +0 -279
- package/scripts/session-ingest-smoke.mjs +0 -177
- package/scripts/session-orphan-sweep-test.mjs +0 -109
- package/scripts/set-effort-config-test.mjs +0 -41
- package/scripts/shell-failure-diagnostics-test.mjs +0 -280
- package/scripts/shell-hardening-test.mjs +0 -209
- package/scripts/shell-jobs-windows-hide-test.mjs +0 -164
- package/scripts/ship-mode-test.mjs +0 -98
- package/scripts/smoke-loop-failure-summary-test.mjs +0 -38
- package/scripts/smoke-loop-failure-summary.mjs +0 -16
- package/scripts/smoke-loop-report.mjs +0 -221
- package/scripts/smoke-loop.mjs +0 -202
- package/scripts/smoke-runtime-negative.ps1 +0 -106
- package/scripts/statusline-quota-hysteresis-test.mjs +0 -62
- package/scripts/steering-drain-buckets-test.mjs +0 -467
- package/scripts/steering-fold-provenance-test.mjs +0 -71
- package/scripts/streaming-tail-window-test.mjs +0 -175
- package/scripts/submit-commandbusy-race-test.mjs +0 -257
- package/scripts/task-bench.mjs +0 -205
- package/scripts/terminal-bench-isolation-guards-test.mjs +0 -102
- package/scripts/termio-input-smoke.mjs +0 -199
- package/scripts/tool-result-hook-test.mjs +0 -48
- package/scripts/tool-smoke.mjs +0 -2453
- package/scripts/tool-tui-presentation-test.mjs +0 -286
- package/scripts/toolcall-args-test.mjs +0 -239
- package/scripts/tui-ambiguous-width-test.mjs +0 -113
- package/scripts/tui-background-failure-smoke.mjs +0 -73
- package/scripts/tui-perf-run.ps1 +0 -26
- package/scripts/tui-render-smoke.mjs +0 -90
- package/scripts/tui-runtime-load-bench-entry.jsx +0 -608
- package/scripts/tui-runtime-load-bench.mjs +0 -50
- package/scripts/tui-store-frame-batch-test.mjs +0 -99
- package/scripts/tui-transcript-jitter-harness-entry.jsx +0 -383
- package/scripts/tui-transcript-perf-test.mjs +0 -934
- package/scripts/usage-metrics-epoch-smoke.mjs +0 -114
- package/scripts/verify-release-assets-test.mjs +0 -281
- package/scripts/web-fetch-routing-test.mjs +0 -158
- package/scripts/webhook-smoke.mjs +0 -201
- package/scripts/windows-hide-spawn-options-test.mjs +0 -19
- package/scripts/worker-notify-rejection-test.mjs +0 -51
- package/scripts/write-backpressure-test.mjs +0 -147
|
@@ -1,435 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Focused parallelism smoke for the agent spawn fanout.
|
|
3
|
-
//
|
|
4
|
-
// Goals validated here (no network, fake askSession):
|
|
5
|
-
// 1. A batch of independent spawns fired together each return a task_id
|
|
6
|
-
// *immediately* (sync return is fast and never blocks on prep/model).
|
|
7
|
-
// 2. The fanout returns all task_ids well before any single agent's work
|
|
8
|
-
// finishes — i.e. spawn returns are non-blocking.
|
|
9
|
-
// 3. ensureProvider() is collapsed: N same-provider spawns trigger at most
|
|
10
|
-
// one initProviders() pass (shared in-flight + already-registered guard).
|
|
11
|
-
// 3b. A provider CONFIG CHANGE still re-runs initProviders() (the de-dup is
|
|
12
|
-
// keyed on provider + effective-config signature, not on "is registered"),
|
|
13
|
-
// while an unchanged config is skipped.
|
|
14
|
-
// 4. A wedged prep step trips the independent spawn-prep cap even when the
|
|
15
|
-
// first-response watchdog is explicitly disabled (firstResponseTimeoutMs:0).
|
|
16
|
-
// 5. spawnPrepTimeoutMs:0 disables the prep cap even when an env default cap
|
|
17
|
-
// is set (explicit per-call override beats the env default).
|
|
18
|
-
// 6. A same-tag retry after a prep timeout cannot be blocked by the original
|
|
19
|
-
// timed-out prep binding the tag during late provider-init cleanup.
|
|
20
|
-
//
|
|
21
|
-
// Run: node scripts/agent-parallel-smoke.mjs
|
|
22
|
-
import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';
|
|
23
|
-
import { join } from 'node:path';
|
|
24
|
-
import { tmpdir } from 'node:os';
|
|
25
|
-
import {
|
|
26
|
-
closeSession,
|
|
27
|
-
getSession,
|
|
28
|
-
getSessionLastProgressAt,
|
|
29
|
-
getSessionRuntime,
|
|
30
|
-
enqueuePendingMessage,
|
|
31
|
-
listSessions,
|
|
32
|
-
} from '../src/runtime/agent/orchestrator/session/manager.mjs';
|
|
33
|
-
import {
|
|
34
|
-
getProvider as realGetProvider,
|
|
35
|
-
initProviders as realInitProviders,
|
|
36
|
-
} from '../src/runtime/agent/orchestrator/providers/registry.mjs';
|
|
37
|
-
|
|
38
|
-
// Trace flush is irrelevant here and must never hold the loop open.
|
|
39
|
-
process.env.MIXDOG_AGENT_TRACE_DISABLE = '1';
|
|
40
|
-
// Set a real env prep-cap BEFORE importing agent-tool.mjs so its module-load
|
|
41
|
-
// `DEFAULT_SPAWN_PREP_TIMEOUT_MS` actually captures this value — that is what
|
|
42
|
-
// makes the "spawnPrepTimeoutMs:0 disables prep even with an env default"
|
|
43
|
-
// assertion below genuine. Kept large enough that normal (fast) prep never
|
|
44
|
-
// trips it, but small enough that a deliberately slow 200ms prep would.
|
|
45
|
-
const ENV_PREP_CAP_MS = 150;
|
|
46
|
-
process.env.MIXDOG_AGENT_SPAWN_PREP_TIMEOUT_MS = String(ENV_PREP_CAP_MS);
|
|
47
|
-
// Dynamic import AFTER the env is set (static imports hoist and would capture
|
|
48
|
-
// the default before this line runs).
|
|
49
|
-
const { createStandaloneAgent } = await import('../src/standalone/agent-tool.mjs');
|
|
50
|
-
|
|
51
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-agent-parallel-'));
|
|
52
|
-
const dataDir = join(root, '.mixdog-data');
|
|
53
|
-
mkdirSync(dataDir, { recursive: true });
|
|
54
|
-
|
|
55
|
-
function assert(condition, message) {
|
|
56
|
-
if (!condition) throw new Error(message);
|
|
57
|
-
}
|
|
58
|
-
function sleep(ms) { return new Promise((r) => setTimeout(r, ms)); }
|
|
59
|
-
function taskId(text) { return String(text).match(/agent task: (\S+)/)?.[1] || null; }
|
|
60
|
-
|
|
61
|
-
// Wrap the REAL registry so createSession()'s internal getProvider() resolves a
|
|
62
|
-
// genuine provider instance, while we still count initProviders() passes and can
|
|
63
|
-
// simulate "not yet registered" to exercise ensureProvider's collapse path.
|
|
64
|
-
let initProvidersCalls = 0;
|
|
65
|
-
let forceProviderMiss = false;
|
|
66
|
-
const reg = {
|
|
67
|
-
getProvider(name) { return forceProviderMiss ? undefined : realGetProvider(name); },
|
|
68
|
-
async initProviders(config) {
|
|
69
|
-
initProvidersCalls += 1;
|
|
70
|
-
await sleep(5); // simulate a small async cost
|
|
71
|
-
return realInitProviders(config);
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// Mutable provider config so a regression test can change it and assert the
|
|
76
|
-
// signature-keyed ensureProvider() re-runs initProviders().
|
|
77
|
-
let providerConfig = { 'openai-oauth': { enabled: true } };
|
|
78
|
-
const cfgMod = {
|
|
79
|
-
loadConfig() {
|
|
80
|
-
return {
|
|
81
|
-
providers: providerConfig,
|
|
82
|
-
agents: {
|
|
83
|
-
worker: { provider: 'openai-oauth', model: 'gpt-5.5', effort: 'low', fast: true },
|
|
84
|
-
reviewer: { provider: 'openai-oauth', model: 'gpt-5.5', effort: 'low' },
|
|
85
|
-
debugger: { provider: 'openai-oauth', model: 'gpt-5.5', effort: 'low' },
|
|
86
|
-
},
|
|
87
|
-
presets: [
|
|
88
|
-
{ id: 'fake-worker', name: 'Fake Worker', provider: 'openai-oauth', model: 'gpt-5.5', tools: 'full', effort: 'low', fast: true },
|
|
89
|
-
],
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
resolveRuntimeSpec(preset, ctx) {
|
|
93
|
-
return { lane: 'agent', scopeKey: `parallel:${ctx.agentId}`, provider: preset.provider, model: preset.model };
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const askStartedAt = [];
|
|
98
|
-
let askConcurrency = 0;
|
|
99
|
-
let maxAskConcurrency = 0;
|
|
100
|
-
async function fakeAskSession(sessionId, prompt) {
|
|
101
|
-
const session = getSession(sessionId);
|
|
102
|
-
if (session) { session.status = 'running'; session.lastStreamDeltaAt = Date.now(); }
|
|
103
|
-
askStartedAt.push(Date.now());
|
|
104
|
-
askConcurrency += 1;
|
|
105
|
-
maxAskConcurrency = Math.max(maxAskConcurrency, askConcurrency);
|
|
106
|
-
try {
|
|
107
|
-
await sleep(300); // each agent's "work" lasts noticeably longer than spawn return
|
|
108
|
-
return { content: `ack ${session?.agent || 'worker'}` };
|
|
109
|
-
} finally {
|
|
110
|
-
askConcurrency -= 1;
|
|
111
|
-
if (session) { session.status = 'idle'; session.lastStreamDeltaAt = Date.now(); }
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const mgr = {
|
|
116
|
-
getSession,
|
|
117
|
-
listSessions,
|
|
118
|
-
closeSession,
|
|
119
|
-
getSessionRuntime,
|
|
120
|
-
enqueuePendingMessage,
|
|
121
|
-
getSessionLastProgressAt,
|
|
122
|
-
askSession: fakeAskSession,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const agent = createStandaloneAgent({ cfgMod, reg, mgr, dataDir, cwd: root });
|
|
126
|
-
|
|
127
|
-
async function waitJob(out, pattern, label, tries = 60) {
|
|
128
|
-
const id = taskId(out);
|
|
129
|
-
assert(id, `missing task ID for ${label}: ${out}`);
|
|
130
|
-
let last = '';
|
|
131
|
-
for (let i = 0; i < tries; i += 1) {
|
|
132
|
-
last = await agent.execute({ type: 'read', task_id: id }, { invocationSource: 'model-tool', cwd: root });
|
|
133
|
-
if (pattern.test(last)) return last;
|
|
134
|
-
if (/status: error/.test(last)) return last;
|
|
135
|
-
await sleep(50);
|
|
136
|
-
}
|
|
137
|
-
throw new Error(`${label} did not finish with ${pattern}: ${last}`);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async function main() {
|
|
141
|
-
// Register the real provider once so createSession() can resolve it.
|
|
142
|
-
await realInitProviders({ 'openai-oauth': { enabled: true } });
|
|
143
|
-
|
|
144
|
-
// --- 1+2: parallel spawns return task_ids fast and non-blocking ---
|
|
145
|
-
const requestedBatchSize = Number.parseInt(process.env.MIXDOG_AGENT_PARALLEL_SMOKE_BATCH || '6', 10);
|
|
146
|
-
const batchSize = Number.isFinite(requestedBatchSize) && requestedBatchSize > 0
|
|
147
|
-
? requestedBatchSize
|
|
148
|
-
: 6;
|
|
149
|
-
const t0 = Date.now();
|
|
150
|
-
const outs = await Promise.all(
|
|
151
|
-
Array.from({ length: batchSize }, (_, i) => agent.execute({
|
|
152
|
-
type: 'spawn',
|
|
153
|
-
agent: i % 2 === 0 ? 'worker' : 'reviewer',
|
|
154
|
-
tag: `par${i}`,
|
|
155
|
-
cwd: root,
|
|
156
|
-
prompt: `parallel task ${i}`,
|
|
157
|
-
}, { invocationSource: 'model-tool', cwd: root })),
|
|
158
|
-
);
|
|
159
|
-
const spawnReturnMs = Date.now() - t0;
|
|
160
|
-
assert(outs.every((o) => /agent task:/.test(o)), `all spawns must return task ids: ${outs.join('\n---\n')}`);
|
|
161
|
-
assert(outs.every((o) => /status: running/.test(o)), 'spawns must report running immediately');
|
|
162
|
-
// The whole batch must return long before any single agent finishes (300ms each).
|
|
163
|
-
assert(spawnReturnMs < 250, `parallel spawn return too slow (${spawnReturnMs}ms) — fanout is blocking`);
|
|
164
|
-
|
|
165
|
-
// Wait for all to finish; they must have overlapped.
|
|
166
|
-
await Promise.all(outs.map((o, i) => waitJob(o, /ack (worker|reviewer)/, `parallel ${i}`)));
|
|
167
|
-
assert(maxAskConcurrency >= 2, `agents did not overlap; maxAskConcurrency=${maxAskConcurrency}`);
|
|
168
|
-
|
|
169
|
-
// --- 3: provider init collapsed across the first fanout ---
|
|
170
|
-
// ensureProvider has no completed-skip entry yet (first run this process), so
|
|
171
|
-
// the batch DOES init once — but the in-flight collapse must keep it to a
|
|
172
|
-
// SINGLE initProviders() pass across all 6 spawns, not one per spawn.
|
|
173
|
-
assert(initProvidersCalls === 1, `first fanout must share a single init; calls=${initProvidersCalls}`);
|
|
174
|
-
|
|
175
|
-
// Force getProvider() to report a miss across a parallel batch so the
|
|
176
|
-
// completed-skip cannot short-circuit; every spawn routes through the init
|
|
177
|
-
// path again, but the in-flight collapse must still produce exactly ONE more
|
|
178
|
-
// init for the batch (before+1).
|
|
179
|
-
forceProviderMiss = true;
|
|
180
|
-
const beforeMissBatch = initProvidersCalls;
|
|
181
|
-
const initBatch = await Promise.all(
|
|
182
|
-
Array.from({ length: 4 }, (_, i) => agent.execute({
|
|
183
|
-
type: 'spawn',
|
|
184
|
-
agent: 'worker',
|
|
185
|
-
tag: `init${i}`,
|
|
186
|
-
cwd: root,
|
|
187
|
-
prompt: `init task ${i}`,
|
|
188
|
-
}, { invocationSource: 'model-tool', cwd: root })),
|
|
189
|
-
);
|
|
190
|
-
await Promise.all(initBatch.map((o, i) => waitJob(o, /ack worker/, `init ${i}`)));
|
|
191
|
-
assert(initProvidersCalls === beforeMissBatch + 1,
|
|
192
|
-
`forced-miss fanout must share a single init; before=${beforeMissBatch} after=${initProvidersCalls}`);
|
|
193
|
-
forceProviderMiss = false;
|
|
194
|
-
|
|
195
|
-
// --- 3b: provider CONFIG CHANGE must re-run initProviders() ---
|
|
196
|
-
// The completed-skip cache is keyed on provider + effective-config signature,
|
|
197
|
-
// not on "is the provider registered". The provider stays registered here, so
|
|
198
|
-
// a registered-only fast path would WRONGLY skip init after a config edit.
|
|
199
|
-
// Changing the config must flip the signature and force exactly one new init.
|
|
200
|
-
const callsBeforeChange = initProvidersCalls;
|
|
201
|
-
// Same config first: must be skipped (no new init).
|
|
202
|
-
await waitJob(await agent.execute({
|
|
203
|
-
type: 'spawn', agent: 'worker', tag: 'cfgSame', cwd: root, prompt: 'cfg same',
|
|
204
|
-
}, { invocationSource: 'model-tool', cwd: root }), /ack worker/, 'cfg same');
|
|
205
|
-
assert(initProvidersCalls === callsBeforeChange,
|
|
206
|
-
`unchanged config must not re-init; before=${callsBeforeChange} after=${initProvidersCalls}`);
|
|
207
|
-
// Now mutate the provider config and spawn again → must re-init once.
|
|
208
|
-
providerConfig = { 'openai-oauth': { enabled: true, baseUrl: 'https://changed.example' } };
|
|
209
|
-
await waitJob(await agent.execute({
|
|
210
|
-
type: 'spawn', agent: 'worker', tag: 'cfgChanged', cwd: root, prompt: 'cfg changed',
|
|
211
|
-
}, { invocationSource: 'model-tool', cwd: root }), /ack worker/, 'cfg changed');
|
|
212
|
-
assert(initProvidersCalls === callsBeforeChange + 1,
|
|
213
|
-
`config change must trigger exactly one re-init; before=${callsBeforeChange} after=${initProvidersCalls}`);
|
|
214
|
-
|
|
215
|
-
// --- 3c: A(slow) -> B(superseded) -> C(latest) ---
|
|
216
|
-
// Three rapid-fire config generations on the same provider:
|
|
217
|
-
// A: baseUrl 'gen-a', init is SLOW (200ms)
|
|
218
|
-
// B: baseUrl 'gen-b', requested while A is still running → SUPERSEDED by C
|
|
219
|
-
// C: baseUrl 'gen-c', the LATEST config, init fast (20ms)
|
|
220
|
-
// Two invariants the guard must hold:
|
|
221
|
-
// (i) the registry ends on the LATEST config (C) — no stale init lands last
|
|
222
|
-
// (ii) NO spawn (incl. the superseded B) runs prepareSpawn/askSession before
|
|
223
|
-
// the LATEST init that was current at its request time has completed.
|
|
224
|
-
// A superseded request must not resolve early against an unprepared
|
|
225
|
-
// provider — it must transitively wait for C.
|
|
226
|
-
const raceRoot = mkdtempSync(join(tmpdir(), 'mixdog-agent-race-'));
|
|
227
|
-
const raceDataDir = join(raceRoot, '.mixdog-data');
|
|
228
|
-
mkdirSync(raceDataDir, { recursive: true });
|
|
229
|
-
let lastAppliedConfig = null; // last config initProviders() actually applied
|
|
230
|
-
let raceInitCalls = 0;
|
|
231
|
-
let providerReadyGen = null; // signature most recently made live
|
|
232
|
-
const askViolations = [];
|
|
233
|
-
const raceReg = {
|
|
234
|
-
getProvider() { return undefined; }, // always force the init path
|
|
235
|
-
async initProviders(config) {
|
|
236
|
-
raceInitCalls += 1;
|
|
237
|
-
const url = config?.['openai-oauth']?.baseUrl || 'base';
|
|
238
|
-
await sleep(url === 'gen-a' ? 200 : 20); // A slow, others fast
|
|
239
|
-
lastAppliedConfig = url;
|
|
240
|
-
providerReadyGen = url;
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
|
-
let raceConfig = { providers: { 'openai-oauth': { enabled: true, baseUrl: 'gen-a' } } };
|
|
244
|
-
// Each spawn records which config gen was the LATEST at its spawn time; the
|
|
245
|
-
// fake askSession asserts the provider is ready (init completed) before it
|
|
246
|
-
// runs. If a spawn proceeds before ANY init completed, providerReadyGen is
|
|
247
|
-
// null → violation.
|
|
248
|
-
const raceCfgMod = {
|
|
249
|
-
loadConfig() {
|
|
250
|
-
return {
|
|
251
|
-
providers: raceConfig.providers,
|
|
252
|
-
agents: { worker: { provider: 'openai-oauth', model: 'gpt-5.5', effort: 'low' } },
|
|
253
|
-
presets: [{ id: 'fake-worker', name: 'Fake Worker', provider: 'openai-oauth', model: 'gpt-5.5', tools: 'full', effort: 'low' }],
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
resolveRuntimeSpec(preset, ctx) {
|
|
257
|
-
return { lane: 'agent', scopeKey: `race:${ctx.agentId}`, provider: preset.provider, model: preset.model };
|
|
258
|
-
},
|
|
259
|
-
};
|
|
260
|
-
async function raceAsk(sessionId, prompt) {
|
|
261
|
-
// Provider MUST be ready (some init completed) before any spawn runs.
|
|
262
|
-
if (providerReadyGen === null) {
|
|
263
|
-
askViolations.push(`${prompt}: ran before any provider init completed`);
|
|
264
|
-
}
|
|
265
|
-
const session = getSession(sessionId);
|
|
266
|
-
if (session) { session.status = 'running'; session.lastStreamDeltaAt = Date.now(); }
|
|
267
|
-
try { await sleep(10); return { content: `ack worker (${providerReadyGen})` }; }
|
|
268
|
-
finally { if (session) { session.status = 'idle'; session.lastStreamDeltaAt = Date.now(); } }
|
|
269
|
-
}
|
|
270
|
-
const raceMgr = { ...mgr, askSession: raceAsk };
|
|
271
|
-
const raceAgent = createStandaloneAgent({ cfgMod: raceCfgMod, reg: raceReg, mgr: raceMgr, dataDir: raceDataDir, cwd: raceRoot });
|
|
272
|
-
// Fire A (slow), then B and C back-to-back while A is still running. B is
|
|
273
|
-
// superseded by C before A's chain link releases.
|
|
274
|
-
const aOut = await raceAgent.execute({
|
|
275
|
-
type: 'spawn', agent: 'worker', tag: 'raceA', cwd: raceRoot, prompt: 'race A',
|
|
276
|
-
spawnPrepTimeoutMs: 0, // testing init serialization, not the prep cap
|
|
277
|
-
}, { invocationSource: 'model-tool', cwd: raceRoot });
|
|
278
|
-
// Let A's deferred job reach ensureProvider and START its slow (200ms) init,
|
|
279
|
-
// so B/C arrive while A's init is genuinely in flight — this is what makes the
|
|
280
|
-
// "slow A completes and would clobber the newer config" path real. With the
|
|
281
|
-
// per-provider serialization, the latest (C) still lands last.
|
|
282
|
-
await sleep(60);
|
|
283
|
-
raceConfig = { providers: { 'openai-oauth': { enabled: true, baseUrl: 'gen-b' } } };
|
|
284
|
-
const bOut = await raceAgent.execute({
|
|
285
|
-
type: 'spawn', agent: 'worker', tag: 'raceB', cwd: raceRoot, prompt: 'race B',
|
|
286
|
-
spawnPrepTimeoutMs: 0,
|
|
287
|
-
}, { invocationSource: 'model-tool', cwd: raceRoot });
|
|
288
|
-
raceConfig = { providers: { 'openai-oauth': { enabled: true, baseUrl: 'gen-c' } } };
|
|
289
|
-
const cOut = await raceAgent.execute({
|
|
290
|
-
type: 'spawn', agent: 'worker', tag: 'raceC', cwd: raceRoot, prompt: 'race C',
|
|
291
|
-
spawnPrepTimeoutMs: 0,
|
|
292
|
-
}, { invocationSource: 'model-tool', cwd: raceRoot });
|
|
293
|
-
await Promise.all([
|
|
294
|
-
waitJob(aOut, /ack worker/, 'race A'),
|
|
295
|
-
waitJob(bOut, /ack worker/, 'race B'),
|
|
296
|
-
waitJob(cOut, /ack worker/, 'race C'),
|
|
297
|
-
]);
|
|
298
|
-
// Give any (incorrectly) un-serialized slow A init time to land last.
|
|
299
|
-
await sleep(250);
|
|
300
|
-
// (i) registry ends on the latest config C.
|
|
301
|
-
assert(lastAppliedConfig === 'gen-c',
|
|
302
|
-
`stale init overwrote newer config; lastApplied=${lastAppliedConfig}`);
|
|
303
|
-
// (ii) no spawn ran before the provider was ready (incl. superseded B).
|
|
304
|
-
assert(askViolations.length === 0,
|
|
305
|
-
`spawn ran before latest provider init completed: ${askViolations.join('; ')}`);
|
|
306
|
-
// The superseded B must have observed a READY provider that is the latest
|
|
307
|
-
// (gen-c), never gen-a/gen-b stale-then-proceed.
|
|
308
|
-
const bResult = await raceAgent.execute({ type: 'read', task_id: taskId(bOut) }, { invocationSource: 'model-tool', cwd: raceRoot });
|
|
309
|
-
assert(/ack worker \(gen-c\)/.test(bResult),
|
|
310
|
-
`superseded B must proceed only after latest (gen-c) init; got ${bResult}`);
|
|
311
|
-
// B and C must NOT have triggered their own separate inits landing last — the
|
|
312
|
-
// dedup must keep total inits small (A + the latest C = 2; B is dropped).
|
|
313
|
-
assert(raceInitCalls <= 2, `superseded gen must not add an extra init; raceInitCalls=${raceInitCalls}`);
|
|
314
|
-
raceAgent.closeAll('agent-parallel-smoke-race-end');
|
|
315
|
-
rmSync(raceRoot, { recursive: true, force: true });
|
|
316
|
-
|
|
317
|
-
// --- 4: spawn-prep cap fires even with firstResponseTimeoutMs:0 ---
|
|
318
|
-
// Dedicated agent whose provider init hangs forever, so prep can never
|
|
319
|
-
// resolve. The model watchdog is disabled (firstResponseTimeoutMs:0) but the
|
|
320
|
-
// independent prep cap must still abort the job so a single hung prep cannot
|
|
321
|
-
// wedge the whole fanout.
|
|
322
|
-
const hangRoot = mkdtempSync(join(tmpdir(), 'mixdog-agent-hang-'));
|
|
323
|
-
const hangDataDir = join(hangRoot, '.mixdog-data');
|
|
324
|
-
mkdirSync(hangDataDir, { recursive: true });
|
|
325
|
-
const hangReg = {
|
|
326
|
-
getProvider() { return undefined; }, // never registered → init runs
|
|
327
|
-
initProviders() { return new Promise(() => {}); }, // hangs forever
|
|
328
|
-
};
|
|
329
|
-
const hangAgent = createStandaloneAgent({ cfgMod, reg: hangReg, mgr, dataDir: hangDataDir, cwd: hangRoot });
|
|
330
|
-
const wedgeStart = Date.now();
|
|
331
|
-
const wedged = await hangAgent.execute({
|
|
332
|
-
type: 'spawn',
|
|
333
|
-
agent: 'worker',
|
|
334
|
-
tag: 'wedge1',
|
|
335
|
-
cwd: hangRoot,
|
|
336
|
-
prompt: 'wedge prep',
|
|
337
|
-
firstResponseTimeoutMs: 0, // model watchdog disabled
|
|
338
|
-
spawnPrepTimeoutMs: 150, // but prep cap is short
|
|
339
|
-
}, { invocationSource: 'model-tool', cwd: hangRoot });
|
|
340
|
-
assert(/agent task:/.test(wedged), 'wedge spawn should still return a task id immediately');
|
|
341
|
-
// Spawn return itself must be immediate even though prep will hang.
|
|
342
|
-
assert(Date.now() - wedgeStart < 100, 'wedge spawn return must not block on hung prep');
|
|
343
|
-
const wedgeResult = await waitJob(wedged, /status: error|timed out/, 'wedge prep cap', 40);
|
|
344
|
-
assert(/timed out/.test(wedgeResult) || /status: error/.test(wedgeResult),
|
|
345
|
-
`prep cap did not abort hung spawn: ${wedgeResult}`);
|
|
346
|
-
try { hangAgent.closeAll('agent-parallel-smoke-hang-end'); } catch {}
|
|
347
|
-
rmSync(hangRoot, { recursive: true, force: true });
|
|
348
|
-
|
|
349
|
-
// --- 4b: same-tag retry after prep timeout must not race late bind/cleanup ---
|
|
350
|
-
const retryRoot = mkdtempSync(join(tmpdir(), 'mixdog-agent-retry-prep-'));
|
|
351
|
-
const retryDataDir = join(retryRoot, '.mixdog-data');
|
|
352
|
-
mkdirSync(retryDataDir, { recursive: true });
|
|
353
|
-
let releaseRetryInit;
|
|
354
|
-
const retryInitGate = new Promise((resolve) => { releaseRetryInit = resolve; });
|
|
355
|
-
let retryInitCalls = 0;
|
|
356
|
-
const retryReg = {
|
|
357
|
-
getProvider() { return undefined; }, // force every spawn through shared init
|
|
358
|
-
async initProviders(config) {
|
|
359
|
-
retryInitCalls += 1;
|
|
360
|
-
await retryInitGate;
|
|
361
|
-
return realInitProviders({ 'openai-oauth': { enabled: true }, ...config });
|
|
362
|
-
},
|
|
363
|
-
};
|
|
364
|
-
const retryAgent = createStandaloneAgent({ cfgMod, reg: retryReg, mgr, dataDir: retryDataDir, cwd: retryRoot });
|
|
365
|
-
const retryFirst = await retryAgent.execute({
|
|
366
|
-
type: 'spawn',
|
|
367
|
-
agent: 'worker',
|
|
368
|
-
tag: 'retrySameTag',
|
|
369
|
-
cwd: retryRoot,
|
|
370
|
-
prompt: 'retry first should timeout before provider init releases',
|
|
371
|
-
spawnPrepTimeoutMs: 50,
|
|
372
|
-
}, { invocationSource: 'model-tool', cwd: retryRoot });
|
|
373
|
-
await waitJob(retryFirst, /timed out|status: failed/, 'same-tag first prep timeout', 20);
|
|
374
|
-
assert(retryInitCalls === 1, `first retry spawn should start one gated init; calls=${retryInitCalls}`);
|
|
375
|
-
const retrySecond = await retryAgent.execute({
|
|
376
|
-
type: 'spawn',
|
|
377
|
-
agent: 'worker',
|
|
378
|
-
tag: 'retrySameTag',
|
|
379
|
-
cwd: retryRoot,
|
|
380
|
-
prompt: 'retry second should succeed after init releases',
|
|
381
|
-
spawnPrepTimeoutMs: 0,
|
|
382
|
-
}, { invocationSource: 'model-tool', cwd: retryRoot });
|
|
383
|
-
assert(/agent task:/.test(retrySecond), `same-tag retry should return a task: ${retrySecond}`);
|
|
384
|
-
await sleep(30); // let the retry join the gated provider init before release
|
|
385
|
-
releaseRetryInit();
|
|
386
|
-
const retrySecondResult = await waitJob(retrySecond, /ack worker/, 'same-tag retry success', 60);
|
|
387
|
-
assert(!/already exists/i.test(retrySecondResult), `same-tag retry hit stale bind: ${retrySecondResult}`);
|
|
388
|
-
try { retryAgent.closeAll('agent-parallel-smoke-retry-end'); } catch {}
|
|
389
|
-
rmSync(retryRoot, { recursive: true, force: true });
|
|
390
|
-
|
|
391
|
-
// --- 5: spawnPrepTimeoutMs:0 disables the prep cap even when an env default
|
|
392
|
-
// is set. The module captured ENV_PREP_CAP_MS (150ms) at load. A prep step
|
|
393
|
-
// that runs longer than that (300ms) would normally be aborted by the env
|
|
394
|
-
// cap, but the explicit per-call spawnPrepTimeoutMs:0 must win and let prep
|
|
395
|
-
// finish.
|
|
396
|
-
const slowRoot = mkdtempSync(join(tmpdir(), 'mixdog-agent-slowprep-'));
|
|
397
|
-
const slowDataDir = join(slowRoot, '.mixdog-data');
|
|
398
|
-
mkdirSync(slowDataDir, { recursive: true });
|
|
399
|
-
let slowInitDone = false;
|
|
400
|
-
const slowReg = {
|
|
401
|
-
getProvider() { return undefined; }, // force init path
|
|
402
|
-
async initProviders(config) {
|
|
403
|
-
await sleep(300); // longer than the 150ms env cap
|
|
404
|
-
slowInitDone = true;
|
|
405
|
-
return realInitProviders({ 'openai-oauth': { enabled: true }, ...config });
|
|
406
|
-
},
|
|
407
|
-
};
|
|
408
|
-
const slowAgent = createStandaloneAgent({ cfgMod, reg: slowReg, mgr, dataDir: slowDataDir, cwd: slowRoot });
|
|
409
|
-
const slowStart = Date.now();
|
|
410
|
-
const slowOut = await slowAgent.execute({
|
|
411
|
-
type: 'spawn',
|
|
412
|
-
agent: 'worker',
|
|
413
|
-
tag: 'slowprep1',
|
|
414
|
-
cwd: slowRoot,
|
|
415
|
-
prompt: 'slow prep override',
|
|
416
|
-
spawnPrepTimeoutMs: 0, // explicit disable beats the env cap
|
|
417
|
-
}, { invocationSource: 'model-tool', cwd: slowRoot });
|
|
418
|
-
const slowResult = await waitJob(slowOut, /ack worker/, 'slow prep override', 40);
|
|
419
|
-
assert(/ack worker/.test(slowResult),
|
|
420
|
-
`spawnPrepTimeoutMs:0 must disable prep cap despite env default; got ${slowResult}`);
|
|
421
|
-
assert(slowInitDone, 'slow prep init should have completed, not been aborted by env cap');
|
|
422
|
-
assert(Date.now() - slowStart >= 280,
|
|
423
|
-
'slow prep should have run its full duration (cap was disabled), not been cut short');
|
|
424
|
-
try { slowAgent.closeAll('agent-parallel-smoke-slowprep-end'); } catch {}
|
|
425
|
-
rmSync(slowRoot, { recursive: true, force: true });
|
|
426
|
-
|
|
427
|
-
process.stdout.write(`agent parallel smoke passed (spawnReturn=${spawnReturnMs}ms, maxConcurrency=${maxAskConcurrency}, initCalls=${initProvidersCalls})\n`);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
try {
|
|
431
|
-
await main();
|
|
432
|
-
} finally {
|
|
433
|
-
try { agent.closeAll('agent-parallel-smoke-end'); } catch {}
|
|
434
|
-
rmSync(root, { recursive: true, force: true });
|
|
435
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { mkdtempSync, rmSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
|
|
7
|
-
test('parallel agent routes flush in one atomic batch', async () => {
|
|
8
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-agent-route-batch-'));
|
|
9
|
-
const previousDataDir = process.env.MIXDOG_DATA_DIR;
|
|
10
|
-
process.env.MIXDOG_DATA_DIR = root;
|
|
11
|
-
try {
|
|
12
|
-
const {
|
|
13
|
-
flushAgentStatuslineRoutes,
|
|
14
|
-
writeAgentStatuslineRoute,
|
|
15
|
-
} = await import(`../src/standalone/agent-tool/helpers.mjs?batch=${Date.now()}`);
|
|
16
|
-
const {
|
|
17
|
-
readGatewaySessionRoute,
|
|
18
|
-
} = await import('../src/vendor/statusline/src/gateway/session-routes.mjs');
|
|
19
|
-
|
|
20
|
-
const count = 48;
|
|
21
|
-
for (let i = 0; i < count; i += 1) {
|
|
22
|
-
assert.equal(writeAgentStatuslineRoute(`sess_route_batch_${i}`, {
|
|
23
|
-
id: 'worker',
|
|
24
|
-
name: 'Worker',
|
|
25
|
-
provider: 'openai-oauth',
|
|
26
|
-
model: 'gpt-5.5',
|
|
27
|
-
}), true);
|
|
28
|
-
}
|
|
29
|
-
assert.equal(flushAgentStatuslineRoutes(), true);
|
|
30
|
-
|
|
31
|
-
const routes = Array.from({ length: count }, (_, i) =>
|
|
32
|
-
readGatewaySessionRoute(`sess_route_batch_${i}`));
|
|
33
|
-
assert.equal(routes.every((route) => route?.defaultProvider === 'openai-oauth'), true);
|
|
34
|
-
assert.equal(new Set(routes.map((route) => route?.updatedAt)).size, 1);
|
|
35
|
-
} finally {
|
|
36
|
-
if (previousDataDir == null) delete process.env.MIXDOG_DATA_DIR;
|
|
37
|
-
else process.env.MIXDOG_DATA_DIR = previousDataDir;
|
|
38
|
-
rmSync(root, { recursive: true, force: true });
|
|
39
|
-
}
|
|
40
|
-
});
|