mixdog 0.9.18 → 0.9.20
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/LICENSE +21 -0
- package/README.md +93 -29
- package/package.json +5 -3
- package/scripts/build-runtime-windows.ps1 +242 -242
- package/scripts/build-tui.mjs +6 -0
- package/scripts/hook-bus-test.mjs +8 -0
- package/scripts/log-writer-guard-smoke.mjs +131 -0
- package/scripts/output-style-smoke.mjs +2 -2
- package/scripts/reactive-compact-persist-smoke.mjs +22 -6
- package/scripts/recall-bench-cases.json +10 -0
- package/scripts/recall-bench.mjs +91 -2
- package/scripts/recall-quality-cases.json +1 -2
- package/scripts/recall-usecase-cases.json +1 -1
- package/scripts/session-ingest-compaction-smoke.mjs +241 -0
- package/scripts/smoke-runtime-negative.ps1 +106 -106
- package/scripts/tool-efficiency-diag.mjs +5 -2
- package/scripts/tool-smoke.mjs +251 -72
- package/src/agents/debugger/AGENT.md +3 -3
- package/src/agents/heavy-worker/AGENT.md +7 -10
- package/src/agents/maintainer/AGENT.md +1 -2
- package/src/agents/reviewer/AGENT.md +1 -2
- package/src/agents/worker/AGENT.md +5 -8
- package/src/defaults/agents.json +3 -0
- package/src/help.mjs +2 -5
- package/src/lib/mixdog-debug.cjs +13 -0
- package/src/mixdog-session-runtime.mjs +7 -3311
- package/src/rules/agent/00-core.md +4 -3
- package/src/rules/agent/30-explorer.md +53 -22
- package/src/rules/lead/02-channels.md +3 -3
- package/src/rules/lead/lead-tool.md +3 -2
- package/src/rules/shared/01-tool.md +24 -29
- package/src/runtime/agent/orchestrator/context/collect.mjs +33 -9
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +24 -3
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/agent-loop.mjs +663 -0
- package/src/runtime/agent/orchestrator/session/compact/engine.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +153 -0
- package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/loop/steering-ladder.mjs +250 -35
- package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +9 -1
- package/src/runtime/agent/orchestrator/session/loop.mjs +8 -1860
- package/src/runtime/agent/orchestrator/session/manager/agent-runtime-singleton.mjs +29 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +686 -0
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +60 -12
- package/src/runtime/agent/orchestrator/session/manager/env-utils.mjs +8 -0
- package/src/runtime/agent/orchestrator/session/manager/idle-cleanup.mjs +159 -0
- package/src/runtime/agent/orchestrator/session/manager/message-sanitize.mjs +143 -0
- package/src/runtime/agent/orchestrator/session/manager/prefetch-bridge.mjs +268 -0
- package/src/runtime/agent/orchestrator/session/manager/provider-cache-key.mjs +22 -0
- package/src/runtime/agent/orchestrator/session/manager/runtime-loaders.mjs +26 -0
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +124 -0
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +258 -0
- package/src/runtime/agent/orchestrator/session/manager/session-errors.mjs +20 -0
- package/src/runtime/agent/orchestrator/session/manager/session-id.mjs +9 -0
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +475 -0
- package/src/runtime/agent/orchestrator/session/manager/session-lock.mjs +23 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +6 -4
- package/src/runtime/agent/orchestrator/session/manager.mjs +88 -2285
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +440 -0
- package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +153 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/tool-batch.mjs +642 -0
- package/src/runtime/agent/orchestrator/tools/bash-session.mjs +23 -3
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +198 -6
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +10 -2
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +13 -15
- package/src/runtime/agent/orchestrator/tools/builtin/read-batch.mjs +6 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-tool.mjs +45 -3
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +5 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +195 -3
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-paths.mjs +108 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-process.mjs +15 -3
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +7 -0
- package/src/runtime/agent/orchestrator/tools/builtin/shell-runtime.mjs +24 -2
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +17 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +38 -0
- package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +72 -8
- package/src/runtime/agent/orchestrator/tools/shell-policy-danger-target.mjs +5 -1
- package/src/runtime/agent/orchestrator/tools/shell-state.mjs +1 -1
- package/src/runtime/channels/backends/discord-gateway.mjs +14 -1
- package/src/runtime/channels/backends/discord.mjs +43 -1
- package/src/runtime/channels/index.mjs +6 -2096
- package/src/runtime/channels/lib/inbound-handler.mjs +328 -0
- package/src/runtime/channels/lib/inbound-routing.mjs +19 -12
- package/src/runtime/channels/lib/interaction-handlers.mjs +260 -0
- package/src/runtime/channels/lib/memory-client.mjs +32 -14
- package/src/runtime/channels/lib/network-retry.mjs +23 -0
- package/src/runtime/channels/lib/output-forwarder.mjs +38 -7
- package/src/runtime/channels/lib/owned-runtime.mjs +547 -0
- package/src/runtime/channels/lib/owner-heartbeat.mjs +13 -4
- package/src/runtime/channels/lib/runtime-paths.mjs +35 -1
- package/src/runtime/channels/lib/tool-dispatch.mjs +17 -7
- package/src/runtime/channels/lib/transcript-binding.mjs +336 -0
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +39 -2
- package/src/runtime/channels/lib/worker-bootstrap.mjs +97 -0
- package/src/runtime/channels/lib/worker-ipc.mjs +201 -0
- package/src/runtime/channels/lib/worker-main.mjs +771 -0
- package/src/runtime/memory/index.mjs +73 -1725
- package/src/runtime/memory/lib/embedding-provider.mjs +4 -2
- package/src/runtime/memory/lib/embedding-worker.mjs +47 -6
- package/src/runtime/memory/lib/http-router.mjs +772 -0
- package/src/runtime/memory/lib/memory-action-handlers.mjs +901 -0
- package/src/runtime/memory/lib/memory-embed.mjs +28 -7
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +8 -2
- package/src/runtime/memory/lib/memory-recall-store.mjs +182 -9
- package/src/runtime/memory/lib/query-handlers.mjs +38 -6
- package/src/runtime/memory/lib/recall-format.mjs +106 -6
- package/src/runtime/memory/lib/session-ingest-runtime.mjs +401 -0
- package/src/runtime/memory/lib/session-ingest.mjs +1 -1
- package/src/runtime/shared/atomic-file.mjs +10 -4
- package/src/runtime/shared/background-tasks.mjs +4 -2
- package/src/runtime/shared/tool-execution-contract.mjs +1 -1
- package/src/runtime/shared/tool-result-summary.mjs +1 -1
- package/src/runtime/shared/tool-surface.mjs +30 -1
- package/src/session-runtime/boot-profile.mjs +36 -0
- package/src/session-runtime/channel-config-api.mjs +70 -0
- package/src/session-runtime/config-lifecycle.mjs +1 -1
- package/src/session-runtime/context-status.mjs +181 -0
- package/src/session-runtime/cwd-plugins.mjs +46 -3
- package/src/session-runtime/env.mjs +17 -0
- package/src/session-runtime/lifecycle-api.mjs +242 -0
- package/src/session-runtime/mcp-glue.mjs +24 -3
- package/src/session-runtime/model-route-api.mjs +198 -0
- package/src/session-runtime/output-styles.mjs +44 -10
- package/src/session-runtime/provider-auth-api.mjs +135 -0
- package/src/session-runtime/resource-api.mjs +282 -0
- package/src/session-runtime/runtime-core.mjs +2046 -0
- package/src/session-runtime/session-turn-api.mjs +274 -0
- package/src/session-runtime/tool-catalog.mjs +18 -264
- package/src/session-runtime/tool-defs.mjs +2 -2
- package/src/session-runtime/workflow-agents-api.mjs +238 -0
- package/src/session-runtime/workflow.mjs +16 -1
- package/src/standalone/agent-tool.mjs +2 -2
- package/src/standalone/channel-worker.mjs +78 -5
- package/src/standalone/explore-tool.mjs +1 -1
- package/src/standalone/memory-runtime-proxy.mjs +56 -6
- package/src/tui/App.jsx +88 -97
- package/src/tui/app/channel-pickers.mjs +45 -0
- package/src/tui/app/core-memory-picker.mjs +1 -1
- package/src/tui/app/slash-commands.mjs +0 -1
- package/src/tui/app/slash-dispatch.mjs +0 -16
- package/src/tui/app/transcript-window.mjs +44 -1
- package/src/tui/app/use-mouse-input.mjs +15 -2
- package/src/tui/app/use-prompt-handlers.mjs +7 -94
- package/src/tui/app/use-transcript-scroll.mjs +82 -4
- package/src/tui/app/use-transcript-window.mjs +65 -5
- package/src/tui/components/PromptInput.jsx +33 -64
- package/src/tui/components/ToolExecution.jsx +2 -2
- package/src/tui/dist/index.mjs +7908 -7558
- package/src/tui/engine/context-state.mjs +145 -0
- package/src/tui/engine/prompt-history.mjs +27 -0
- package/src/tui/engine/session-api-ext.mjs +478 -0
- package/src/tui/engine/session-api.mjs +545 -0
- package/src/tui/engine/session-flow.mjs +485 -0
- package/src/tui/engine/turn.mjs +1078 -0
- package/src/tui/engine.mjs +69 -2582
- package/src/tui/index.jsx +7 -0
- package/src/tui/lib/voice-setup.mjs +166 -0
- package/src/tui/paste-attachments.mjs +12 -5
- package/src/tui/prompt-history-store.mjs +125 -12
- package/vendor/ink/build/ink.js +16 -1
- package/vendor/ink/build/output.js +30 -4
- package/vendor/ink/build/render.js +5 -0
- package/scripts/bench/cache-probe-tasks.json +0 -8
- package/scripts/bench/lead-review-tasks-r3.json +0 -20
- package/scripts/bench/lead-review-tasks.json +0 -20
- package/scripts/bench/r4-mixed-tasks.json +0 -20
- package/scripts/bench/r5-orchestrated-task.json +0 -7
- package/scripts/bench/review-tasks.json +0 -20
- package/scripts/bench/round-codex.json +0 -114
- package/scripts/bench/round-mixdog-lead-r3.json +0 -269
- package/scripts/bench/round-mixdog-lead.json +0 -269
- package/scripts/bench/round-mixdog.json +0 -126
- package/scripts/bench/round-r10-bigsample.json +0 -679
- package/scripts/bench/round-r11-codexalign.json +0 -257
- package/scripts/bench/round-r13-clientmeta.json +0 -464
- package/scripts/bench/round-r14-betafeatures.json +0 -466
- package/scripts/bench/round-r15-fulldefault.json +0 -462
- package/scripts/bench/round-r16-sessionid.json +0 -466
- package/scripts/bench/round-r17-wirebytes.json +0 -456
- package/scripts/bench/round-r18-prewarm.json +0 -468
- package/scripts/bench/round-r19-clean.json +0 -472
- package/scripts/bench/round-r20-prewarm-clean.json +0 -475
- package/scripts/bench/round-r21-delta-retry.json +0 -473
- package/scripts/bench/round-r22-full-probe.json +0 -693
- package/scripts/bench/round-r23-itemprobe.json +0 -701
- package/scripts/bench/round-r24-shapefix.json +0 -677
- package/scripts/bench/round-r25-serial.json +0 -464
- package/scripts/bench/round-r26-parallel3.json +0 -671
- package/scripts/bench/round-r27-parallel10.json +0 -894
- package/scripts/bench/round-r28-parallel10-stagger.json +0 -882
- package/scripts/bench/round-r29-parallel10-stagger166.json +0 -886
- package/scripts/bench/round-r30-instid.json +0 -253
- package/scripts/bench/round-r31-upgradeprobe.json +0 -256
- package/scripts/bench/round-r32-vs-codex-lead.json +0 -254
- package/scripts/bench/round-r33-vs-codex-codex.json +0 -115
- package/scripts/bench/round-r34-orchestrated.json +0 -120
- package/scripts/bench/round-r35-orchestrated-codex.json +0 -61
- package/scripts/bench/round-r36-orchestrated-capped.json +0 -128
- package/scripts/bench/round-r4-codex.json +0 -114
- package/scripts/bench/round-r4-mixed.json +0 -225
- package/scripts/bench/round-r5-gpt-lead.json +0 -259
- package/scripts/bench/round-r6-codex.json +0 -114
- package/scripts/bench/round-r6-solo.json +0 -257
- package/scripts/bench/round-r7-full.json +0 -254
- package/scripts/bench/round-r8-fulldefault.json +0 -255
- package/src/tui/components/prompt-input/voice-indicator.mjs +0 -39
- package/src/tui/lib/voice-recorder.mjs +0 -469
- package/src/workflows/sequential/WORKFLOW.md +0 -51
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"round": "5",
|
|
3
|
-
"runner": "lead",
|
|
4
|
-
"opts": {
|
|
5
|
-
"provider": null,
|
|
6
|
-
"model": null,
|
|
7
|
-
"effort": null,
|
|
8
|
-
"fast": false,
|
|
9
|
-
"env": {
|
|
10
|
-
"MIXDOG_DATA_DIR": "C:\\Users\\tempe\\.mixdog\\bench-data"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"tasks": 3,
|
|
14
|
-
"completed": 3,
|
|
15
|
-
"completion_rate": 100,
|
|
16
|
-
"sessions": [
|
|
17
|
-
"sess_59600_1783037462018_1783037462266_c37bce6b74c830c56d6c7aff52efeca7",
|
|
18
|
-
"sess_54696_1783037462027_1783037462276_0dfadaccfebd2d42d0c14e5053f61d4a",
|
|
19
|
-
"sess_59440_1783037462045_1783037462291_6eb45d2479f73ed04b11f9f18b0b8109"
|
|
20
|
-
],
|
|
21
|
-
"results": [
|
|
22
|
-
{
|
|
23
|
-
"id": "r4-debug-forwarding-gap",
|
|
24
|
-
"agent": "reviewer",
|
|
25
|
-
"ok": true,
|
|
26
|
-
"ms": 99020,
|
|
27
|
-
"sessionId": "sess_59600_1783037462018_1783037462266_c37bce6b74c830c56d6c7aff52efeca7",
|
|
28
|
-
"output": "sessionId: sess_59600_1783037462018_1783037462266_c37bce6b74c830c56d6c7aff52efeca7\nInvestigated: the bridge has recovery for the known pending-file/owner-start race, but there are still EOF-binding cases that can permanently skip early output.\n\n**Path traced**: `start()` writes `bridge-state.json` before runtime readiness, then ownership/startup binds a transcript and `OutputForwarder.startWatch()` triggers `forwardNewText()` → `backend.sendMessage()` (`src/runtime/channels/index.mjs:1734`, `src/runtime/channels/index.mjs:710`, `src/runtime/channels/index.mjs:317`, `src/runtime/channels/lib/output-forwarder.mjs:647`, `src/runtime/channels/lib/output-forwarder.mjs:351`).\n\n**Highest impact — existing transcript + no matching persisted cursor drops backlog**: `catchUpFromPersisted` falls back to `currentSize` when the persisted path does not match, so bytes already written before binding become the baseline and are never reread (`src/runtime/channels/lib/output-forwarder.mjs:117`); backlog catch-up does **not** recover this.\n\n**No channel binding also drops pre-bind existing backlog**: if no persisted/main channel exists, activation returns without binding (`src/runtime/channels/index.mjs:624`), and the first inbound bind uses default EOF cursoring (`src/runtime/channels/index.mjs:1597`, `src/runtime/channels/lib/output-forwarder.mjs:125`); backlog catch-up does **not** recover already-written output in an existing transcript.\n\n**Pending transcript file is mostly recovered**: binding a not-yet-created path makes `fs.watch` fail/close (`src/runtime/channels/lib/output-forwarder.mjs:656`), but `schedulePendingTranscriptRearm()` polls, installs the watcher, and calls `forwardNewText()` once the file appears (`src/runtime/channels/index.mjs:357`, `src/runtime/channels/index.mjs:376`); backlog catch-up **does** recover it if the path is known and appears within 60s, otherwise recovery is not automatic (`src/runtime/channels/index.mjs:384`).\n\n**Ownership/startup probe window delays, not drops**: pre-connect forwarding is owner-gated off because `_isOwner()` requires `bridgeRuntimeConnected && currentOwnerState().owned` (`src/runtime/channels/index.mjs:316`, `src/runtime/channels/lib/output-forwarder.mjs:351`), but startup explicitly forwards or re-arms after connect (`src/runtime/channels/index.mjs:801`); backlog catch-up **does** recover unless the earlier binding already set the cursor to EOF.\n\nVerdict: the pending-file bridge race is covered, but activation can still silently lose early assistant output when an existing transcript is bound without a matching persisted cursor.",
|
|
29
|
-
"card": {
|
|
30
|
-
"session": "sess_59600_1783037462018_1783037462266_c37bce6b74c830c56d6c7aff52efeca7",
|
|
31
|
-
"provider": "openai-oauth",
|
|
32
|
-
"model": "gpt-5.5",
|
|
33
|
-
"wall_ms": 88475,
|
|
34
|
-
"turns": 5,
|
|
35
|
-
"tool_calls": 5,
|
|
36
|
-
"tools_per_turn": 1,
|
|
37
|
-
"total_tool_ms": 428,
|
|
38
|
-
"llm_stream_ms": 87399,
|
|
39
|
-
"cache_ratio": 0.4883110541414881,
|
|
40
|
-
"cached_tokens": 64000,
|
|
41
|
-
"prompt_tokens": 131064,
|
|
42
|
-
"uncached_tokens": 67064,
|
|
43
|
-
"output_tokens": 9669,
|
|
44
|
-
"cache_weighted_input_10": 73464,
|
|
45
|
-
"cache_weighted_input_25": 83064,
|
|
46
|
-
"prompt_growth": 32405,
|
|
47
|
-
"antipatterns": 0,
|
|
48
|
-
"issues": 4,
|
|
49
|
-
"issue_types": [
|
|
50
|
-
"cache",
|
|
51
|
-
"cache_break",
|
|
52
|
-
"broad_tool_result",
|
|
53
|
-
"service_tier"
|
|
54
|
-
],
|
|
55
|
-
"read_fragmentation_paths": [],
|
|
56
|
-
"grep_sweep_count": 0
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"id": "r4-impl-usage-summary",
|
|
61
|
-
"agent": "worker",
|
|
62
|
-
"ok": true,
|
|
63
|
-
"ms": 125876,
|
|
64
|
-
"sessionId": "sess_54696_1783037462027_1783037462276_0dfadaccfebd2d42d0c14e5053f61d4a",
|
|
65
|
-
"output": "sessionId: sess_54696_1783037462027_1783037462276_0dfadaccfebd2d42d0c14e5053f61d4a\n구현 위치와 기존 스크립트 스타일을 확인한 뒤 바로 반영하겠습니다.재영님, 구현 완료했고 `usage:today` 실행까지 확인했습니다.\n\n- **바뀐 점**: `package.json`에 `usage:today`가 추가됐고, 새 `scripts/usage-today.mjs`가 `MIXDOG_DATA_DIR` 또는 기본 `~/.mixdog/data/history/agent-trace.jsonl`을 읽습니다.\n\n- **동작**: 로컬 자정 이후 `usage`/`usage_raw` 행을 모델별로 집계해 `calls`, `input`, `cached`, `output`, `costUsd`와 `GRAND TOTAL`을 출력합니다.\n\n- **검증**: `node --check scripts/usage-today.mjs` 통과, `npm run usage:today` 실행 성공. 현재 실행 결과 총합은 `858 calls`, `60.3242 costUsd`였습니다.\n\n- **diff 요약**: `package.json` 1줄 추가, `scripts/usage-today.mjs` 신규 파일. 기존 작업물로 보이는 `src/runtime/channels/lib/*` 수정 2건은 건드리지 않았습니다.",
|
|
66
|
-
"card": {
|
|
67
|
-
"session": "sess_54696_1783037462027_1783037462276_0dfadaccfebd2d42d0c14e5053f61d4a",
|
|
68
|
-
"provider": "openai-oauth",
|
|
69
|
-
"model": "gpt-5.5",
|
|
70
|
-
"wall_ms": 115327,
|
|
71
|
-
"turns": 13,
|
|
72
|
-
"tool_calls": 13,
|
|
73
|
-
"tools_per_turn": 1,
|
|
74
|
-
"total_tool_ms": 2688,
|
|
75
|
-
"llm_stream_ms": 112157,
|
|
76
|
-
"cache_ratio": 0.7477417701432699,
|
|
77
|
-
"cached_tokens": 212992,
|
|
78
|
-
"prompt_tokens": 284847,
|
|
79
|
-
"uncached_tokens": 71855,
|
|
80
|
-
"output_tokens": 8740,
|
|
81
|
-
"cache_weighted_input_10": 93154.2,
|
|
82
|
-
"cache_weighted_input_25": 125103,
|
|
83
|
-
"prompt_growth": 27149,
|
|
84
|
-
"antipatterns": 1,
|
|
85
|
-
"issues": 7,
|
|
86
|
-
"issue_types": [
|
|
87
|
-
"readonly_stall",
|
|
88
|
-
"cache",
|
|
89
|
-
"cache_break",
|
|
90
|
-
"tool_error",
|
|
91
|
-
"service_tier",
|
|
92
|
-
"missed_parallelism",
|
|
93
|
-
"tool_churn_cluster"
|
|
94
|
-
],
|
|
95
|
-
"read_fragmentation_paths": [],
|
|
96
|
-
"grep_sweep_count": 0
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"id": "r4-explain-compact-engine",
|
|
101
|
-
"agent": "explore",
|
|
102
|
-
"ok": true,
|
|
103
|
-
"ms": 98391,
|
|
104
|
-
"sessionId": "sess_59440_1783037462045_1783037462291_6eb45d2479f73ed04b11f9f18b0b8109",
|
|
105
|
-
"output": "ession/loop/compact-policy.mjs:89`, `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:100`\n\n- **Threshold math:** boundary comes from `compactBoundaryTokens/contextWindow/autoCompactTokenLimit`, trigger is explicit sub-boundary limit or boundary minus buffer, and reserve includes request tools plus configured reserve. `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:94`, `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:117`, `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:118`\n\n- **Fire condition:** compaction fires when forced reactive overflow is pending, token estimate is unknown, or transcript pressure plus reserve reaches trigger. `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:170`\n\n- **No-fire path:** if below threshold, telemetry records `pre_send_check` without mutating messages. `src/runtime/agent/orchestrator/session/loop.mjs:365`, `src/runtime/agent/orchestrator/session/loop.mjs:366`\n\n- **Reactive path:** provider context overflow marks a one-shot reactive retry and loops back through the normal pre-send compact path. `src/runtime/agent/orchestrator/session/loop.mjs:982`, `src/runtime/agent/orchestrator/session/loop.mjs:995`, `src/runtime/agent/orchestrator/session/loop.mjs:1010`\n\n- **Mode selection:** agent-owned sessions are forced semantic; otherwise type comes from env/config and resolves to semantic or recall-fasttrack. `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:39`, `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:45`, `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:139`\n\n- **Semantic flow:** optional prune runs first, then `semanticCompactMessages` is called with reserve, cache keys, timeout, tail policy, and `force:true`. `src/runtime/agent/orchestrator/session/loop.mjs:405`, `src/runtime/agent/orchestrator/session/loop.mjs:407`, `src/runtime/agent/orchestrator/session/loop.mjs:439`\n\n- **Recall flow:** recall-fasttrack ingests/dumps/drains memory roots, caps recall injection to context share, then calls `recallFastTrackCompactMessages`. `src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs:61`, `src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs:84`, `src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs:109`, `src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs:161`\n\n- **Semantic window split:** engine sanitizes, separates protected system prefix from conversation, finds previous summary, and removes summary messages from live history. `src/runtime/agent/orchestrator/session/compact/engine.mjs:100`\n\n- **Semantic tail choice:** with user turns, it keeps up to `tailTurns` recent turns within `preserveRecentBudget`, splitting the newest turn suffix if needed. `src/runtime/agent/orchestrator/session/compact/engine.mjs:134`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:151`\n\n- **No-user semantic tail:** without user turns, it chooses the newest valid non-tool cut that fits, never starts the tail on a tool result, and preserves tool-call pairing. `src/runtime/agent/orchestrator/session/compact/engine.mjs:121`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:193`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:246`\n\n- **Semantic output shape:** selected `head` becomes the summary source, selected `tail` is kept verbatim, and preserved facts are extracted from the head. `src/runtime/agent/orchestrator/session/compact/engine.mjs:244`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:258`\n\n- **Recall tail choice:** recall-fasttrack keeps the newest structured turns, defaults to two user-anchored turns, caps tail tokens, drops oldest turns first, then truncates old surviving content. `src/runtime/agent/orchestrator/session/compact/engine.mjs:449`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:467`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:593`\n\n- **Recall no-user tail:** a no-user recent tail is valid; it preserves recent assistant/tool structure and computes head before that tail. `src/runtime/agent/orchestrator/session/compact/engine.mjs:613`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:617`\n\n- **Redaction hook:** semantic compaction no-ops unchanged if already within budget, but once compaction proceeds it redacts tool-call secret values before window selection. `src/runtime/agent/orchestrator/session/compact/engine.mjs:286`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:306`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:312`\n\n- **Redacted preservation:** semantic preserved system/tail are emitted from the redacted selection, so verbatim tail is redacted in the final transcript. `src/runtime/agent/orchestrator/session/compact/engine.mjs:389`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:392`\n\n- **Recall redaction:** recall-fasttrack applies the same redaction before splitting safe system/live and selecting the preserved tail. `src/runtime/agent/orchestrator/session/compact/engine.mjs:644`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:646`\n\n- **Redaction rules:** secret-like raw `key:value` / `key=value` strings are replaced with `[redacted]`, and recursive arg normalization redacts sensitive keys before truncation. `src/runtime/agent/orchestrator/session/compact/text-utils.mjs:46`, `src/runtime/agent/orchestrator/session/compact/text-utils.mjs:121`\n\n- **Budget fallback:** if mandatory system+tail plus minimum summary room exceeds target budget, engine raises the working budget instead of refusing. `src/runtime/agent/orchestrator/session/compact/engine.mjs:319`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:328`\n\n- **Semantic hard failures:** engine throws on no compactable prior history, prompt not fitting, empty provider summary, summary not fitting, or final result exceeding budget. `src/runtime/agent/orchestrator/session/compact/engine.mjs:315`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:335`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:371`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:384`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:394`\n\n- **Loop fallback:** semantic failures attempt one anchor-independent `pruneToolOutputsUnanchored` recovery; recall-fasttrack failures skip this silent prune contract. `src/runtime/agent/orchestrator/session/loop.mjs:500`, `src/runtime/agent/orchestrator/session/loop.mjs:511`, `src/runtime/agent/orchestrator/session/loop.mjs:527`\n\n- **Overflow failure:** if no compacted result exists after fallback, loop records `overflow_failed`, emits failed compact event/trace, then throws `agentContextOverflowError`. `src/runtime/agent/orchestrator/session/loop.mjs:546`, `src/runtime/agent/orchestrator/session/loop.mjs:552`, `src/runtime/agent/orchestrator/session/loop.mjs:597`, `src/runtime/agent/orchestrator/session/loop.mjs:618`\n\n- **Session-runner fallback:** recall-fasttrack failure can degrade to semantic fallback; semantic/non-recall failure then tries unanchored prune before recording `post_turn_failed` or `manual_failed`. `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:231`, `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:242`, `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:322`, `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:348`\n\n- **Successful mutation:** successful compaction replaces `session.messages`, clears `providerState`, records stage `post_turn` or `manual`, and marks context tokens stale after auto compaction. `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:410`, `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:411`, `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:423`, `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:446`",
|
|
106
|
-
"card": {
|
|
107
|
-
"session": "sess_59440_1783037462045_1783037462291_6eb45d2479f73ed04b11f9f18b0b8109",
|
|
108
|
-
"provider": "openai-oauth",
|
|
109
|
-
"model": "gpt-5.5",
|
|
110
|
-
"wall_ms": 87846,
|
|
111
|
-
"turns": 12,
|
|
112
|
-
"tool_calls": 12,
|
|
113
|
-
"tools_per_turn": 1,
|
|
114
|
-
"total_tool_ms": 976,
|
|
115
|
-
"llm_stream_ms": 86211,
|
|
116
|
-
"cache_ratio": 0.4211291996676356,
|
|
117
|
-
"cached_tokens": 150528,
|
|
118
|
-
"prompt_tokens": 357439,
|
|
119
|
-
"uncached_tokens": 206911,
|
|
120
|
-
"output_tokens": 7040,
|
|
121
|
-
"cache_weighted_input_10": 221963.8,
|
|
122
|
-
"cache_weighted_input_25": 244543,
|
|
123
|
-
"prompt_growth": 70730,
|
|
124
|
-
"antipatterns": 1,
|
|
125
|
-
"issues": 7,
|
|
126
|
-
"issue_types": [
|
|
127
|
-
"readonly_stall",
|
|
128
|
-
"cache",
|
|
129
|
-
"cache_break",
|
|
130
|
-
"broad_tool_result",
|
|
131
|
-
"service_tier",
|
|
132
|
-
"missed_parallelism",
|
|
133
|
-
"tool_churn_cluster"
|
|
134
|
-
],
|
|
135
|
-
"read_fragmentation_paths": [],
|
|
136
|
-
"grep_sweep_count": 0
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
],
|
|
140
|
-
"task_complete": true,
|
|
141
|
-
"task_errors": [],
|
|
142
|
-
"score_complete": true,
|
|
143
|
-
"score_errors": [],
|
|
144
|
-
"group": {
|
|
145
|
-
"n": 3,
|
|
146
|
-
"wall_ms": 97216,
|
|
147
|
-
"turns": 10,
|
|
148
|
-
"tool_calls": 10,
|
|
149
|
-
"tools_per_turn": 1,
|
|
150
|
-
"total_tool_ms": 1364,
|
|
151
|
-
"llm_stream_ms": 95255.7,
|
|
152
|
-
"cache_ratio": 0.6,
|
|
153
|
-
"cached_tokens": 142506.7,
|
|
154
|
-
"prompt_tokens": 257783.3,
|
|
155
|
-
"uncached_tokens": 115276.7,
|
|
156
|
-
"output_tokens": 8483,
|
|
157
|
-
"cache_weighted_input_10": 129527.3,
|
|
158
|
-
"cache_weighted_input_25": 150903.3,
|
|
159
|
-
"prompt_growth": 43428,
|
|
160
|
-
"antipatterns": 0.7,
|
|
161
|
-
"issues": 6,
|
|
162
|
-
"grep_sweep_count": 0
|
|
163
|
-
},
|
|
164
|
-
"cards": [
|
|
165
|
-
{
|
|
166
|
-
"session": "sess_59600_1783037462018_1783037462266_c37bce6b74c830c56d6c7aff52efeca7",
|
|
167
|
-
"provider": "openai-oauth",
|
|
168
|
-
"model": "gpt-5.5",
|
|
169
|
-
"wall_ms": 88475,
|
|
170
|
-
"turns": 5,
|
|
171
|
-
"tool_calls": 5,
|
|
172
|
-
"tools_per_turn": 1,
|
|
173
|
-
"total_tool_ms": 428,
|
|
174
|
-
"llm_stream_ms": 87399,
|
|
175
|
-
"cache_ratio": 0.4883110541414881,
|
|
176
|
-
"cached_tokens": 64000,
|
|
177
|
-
"prompt_tokens": 131064,
|
|
178
|
-
"uncached_tokens": 67064,
|
|
179
|
-
"output_tokens": 9669,
|
|
180
|
-
"cache_weighted_input_10": 73464,
|
|
181
|
-
"cache_weighted_input_25": 83064,
|
|
182
|
-
"prompt_growth": 32405,
|
|
183
|
-
"antipatterns": 0,
|
|
184
|
-
"issues": 4,
|
|
185
|
-
"issue_types": [
|
|
186
|
-
"cache",
|
|
187
|
-
"cache_break",
|
|
188
|
-
"broad_tool_result",
|
|
189
|
-
"service_tier"
|
|
190
|
-
],
|
|
191
|
-
"read_fragmentation_paths": [],
|
|
192
|
-
"grep_sweep_count": 0
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"session": "sess_54696_1783037462027_1783037462276_0dfadaccfebd2d42d0c14e5053f61d4a",
|
|
196
|
-
"provider": "openai-oauth",
|
|
197
|
-
"model": "gpt-5.5",
|
|
198
|
-
"wall_ms": 115327,
|
|
199
|
-
"turns": 13,
|
|
200
|
-
"tool_calls": 13,
|
|
201
|
-
"tools_per_turn": 1,
|
|
202
|
-
"total_tool_ms": 2688,
|
|
203
|
-
"llm_stream_ms": 112157,
|
|
204
|
-
"cache_ratio": 0.7477417701432699,
|
|
205
|
-
"cached_tokens": 212992,
|
|
206
|
-
"prompt_tokens": 284847,
|
|
207
|
-
"uncached_tokens": 71855,
|
|
208
|
-
"output_tokens": 8740,
|
|
209
|
-
"cache_weighted_input_10": 93154.2,
|
|
210
|
-
"cache_weighted_input_25": 125103,
|
|
211
|
-
"prompt_growth": 27149,
|
|
212
|
-
"antipatterns": 1,
|
|
213
|
-
"issues": 7,
|
|
214
|
-
"issue_types": [
|
|
215
|
-
"readonly_stall",
|
|
216
|
-
"cache",
|
|
217
|
-
"cache_break",
|
|
218
|
-
"tool_error",
|
|
219
|
-
"service_tier",
|
|
220
|
-
"missed_parallelism",
|
|
221
|
-
"tool_churn_cluster"
|
|
222
|
-
],
|
|
223
|
-
"read_fragmentation_paths": [],
|
|
224
|
-
"grep_sweep_count": 0
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"session": "sess_59440_1783037462045_1783037462291_6eb45d2479f73ed04b11f9f18b0b8109",
|
|
228
|
-
"provider": "openai-oauth",
|
|
229
|
-
"model": "gpt-5.5",
|
|
230
|
-
"wall_ms": 87846,
|
|
231
|
-
"turns": 12,
|
|
232
|
-
"tool_calls": 12,
|
|
233
|
-
"tools_per_turn": 1,
|
|
234
|
-
"total_tool_ms": 976,
|
|
235
|
-
"llm_stream_ms": 86211,
|
|
236
|
-
"cache_ratio": 0.4211291996676356,
|
|
237
|
-
"cached_tokens": 150528,
|
|
238
|
-
"prompt_tokens": 357439,
|
|
239
|
-
"uncached_tokens": 206911,
|
|
240
|
-
"output_tokens": 7040,
|
|
241
|
-
"cache_weighted_input_10": 221963.8,
|
|
242
|
-
"cache_weighted_input_25": 244543,
|
|
243
|
-
"prompt_growth": 70730,
|
|
244
|
-
"antipatterns": 1,
|
|
245
|
-
"issues": 7,
|
|
246
|
-
"issue_types": [
|
|
247
|
-
"readonly_stall",
|
|
248
|
-
"cache",
|
|
249
|
-
"cache_break",
|
|
250
|
-
"broad_tool_result",
|
|
251
|
-
"service_tier",
|
|
252
|
-
"missed_parallelism",
|
|
253
|
-
"tool_churn_cluster"
|
|
254
|
-
],
|
|
255
|
-
"read_fragmentation_paths": [],
|
|
256
|
-
"grep_sweep_count": 0
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"round": "6",
|
|
3
|
-
"runner": "codex",
|
|
4
|
-
"opts": {
|
|
5
|
-
"provider": "openai-oauth",
|
|
6
|
-
"model": "gpt-5.5",
|
|
7
|
-
"effort": "high",
|
|
8
|
-
"fast": false,
|
|
9
|
-
"env": {}
|
|
10
|
-
},
|
|
11
|
-
"tasks": 3,
|
|
12
|
-
"completed": 3,
|
|
13
|
-
"completion_rate": 100,
|
|
14
|
-
"sessions": [
|
|
15
|
-
"019f2558-6ca0-7a43-95e9-1e23cdfdf054",
|
|
16
|
-
"019f2558-6c90-79c0-bce4-b7da60be88e0",
|
|
17
|
-
"019f2558-6c99-75a1-b6c9-dedcf6dd5a7f"
|
|
18
|
-
],
|
|
19
|
-
"results": [
|
|
20
|
-
{
|
|
21
|
-
"id": "r4-debug-forwarding-gap",
|
|
22
|
-
"agent": "reviewer",
|
|
23
|
-
"ok": true,
|
|
24
|
-
"ms": 162183,
|
|
25
|
-
"sessionId": "019f2558-6ca0-7a43-95e9-1e23cdfdf054",
|
|
26
|
-
"card": {
|
|
27
|
-
"session": "019f2558-6ca0-7a43-95e9-1e23cdfdf054",
|
|
28
|
-
"wall_ms": 162183,
|
|
29
|
-
"uncached_in": 106326,
|
|
30
|
-
"cached_in": 576768,
|
|
31
|
-
"out_tokens": 9228,
|
|
32
|
-
"cache_ratio": 0.844,
|
|
33
|
-
"completed": 1
|
|
34
|
-
},
|
|
35
|
-
"output": "조사 결과입니다. 코드 변경은 하지 않았습니다.\n\n**Activation Path**\n`start()`가 먼저 `channelBridgeActive=true`와 `bridge-state.json`을 씁니다 (`src/runtime/channels/index.mjs:1734-1736`). 그 다음 ownership을 claim하고 `refreshBridgeOwnership({ restoreBinding: true })`를 기다립니다 (`index.mjs:1741-1744`). owner이면 `startOwnedRuntime()`이 `active-instance`를 `backendReady:false`로 광고하고 (`index.mjs:731`), persisted transcript bind를 backend connect와 병렬로 시작합니다 (`index.mjs:758-763`). 실제 forwarding은 `OutputForwarder.startWatch()` 또는 explicit `forwardNewText()`가 `extractNewText()`로 JSONL을 읽고, queue drain이 `cb.send()`를 호출한 뒤 cursor를 commit하는 흐름입니다 (`src/runtime/channels/lib/output-forwarder.mjs:351-410`, `output-forwarder.mjs:435-461`).\n\n**Findings**\n1. **High: existing transcript + no matching persisted cursor can permanently skip early output.** \n Initial bind calls `rebindTranscriptContext(..., catchUpFromPersisted: true)` without `catchUp` (`index.mjs:625-629`). If discovery finds an already-existing transcript, replay-from-start is only enabled when `options.catchUp` is true and a pending session was seen (`index.mjs:435-448`). Then `setContext()` sets the cursor to persisted `lastFileSize` only when persisted path matches; otherwise it sets `readFileSize/lastFileSize` to current EOF (`output-forwarder.mjs:117-129`). So assistant bytes written after bridge-state activation but before this first bind are silently treated as old history if there is no matching persisted transcript cursor. Backlog catch-up: **No**, unless `statusState.transcriptPath` already matches and has an older `lastFileSize`.\n\n2. **Medium: pre-connect owner probe delays transcript forwarding.** \n The forwarder owner probe is `bridgeRuntimeConnected && currentOwnerState().owned` (`index.mjs:316`; ownership itself is exact `instanceId` match in `src/runtime/channels/lib/owner-heartbeat.mjs:21-30`). During startup, binding/watch can be installed before `backend.connect()` resolves (`index.mjs:759-769`), but `forwardNewText()` returns immediately when `_isOwner()` is false (`output-forwarder.mjs:31-41`, `output-forwarder.mjs:351-354`). Backlog catch-up: **Yes for transcript bytes**, because the read cursor is not advanced on that false return and `startOwnedRuntime()` calls `forwardNewText()` after connect or rearms missing transcripts (`index.mjs:776-811`). It does not recover the High case above if the cursor was already set to EOF.\n\n3. **Medium: `fs.watch` cannot watch a not-yet-created transcript, but most of this is recovered by re-arm.** \n `startWatch()` catches watch-install failure and closes the watcher (`output-forwarder.mjs:647-670`). `index.mjs` compensates with a 250ms poll for up to 60s, then installs the watch and calls `forwardNewText()` when the file appears (`index.mjs:340-345`, `index.mjs:357-393`, `index.mjs:493-498`). It also rearms after backend connect if a pre-connect poll exited while not owner (`index.mjs:803-807`). Backlog catch-up: **Yes if the file appears within the re-arm window** and the cursor was initialized to `0` or a valid persisted offset. **No automatic recovery after timeout** unless a later inbound/rebind/explicit flush touches the same transcript.\n\n4. **Low/Medium: non-transcript side-channel output can be dropped by owner gating.** \n Tool summaries call `forwardToolLog()` after tool execution (`src/runtime/channels/lib/tool-dispatch.mjs:145-150`), but `forwardToolLog()` returns with no queue when `_isOwner()` is false or no channel is bound (`output-forwarder.mjs:413-415`). Backlog catch-up: **Partial**. The underlying `tool_use` may later be reconstructed from transcript by `extractNewText()` (`output-forwarder.mjs:227-267`), but the direct post-tool summary call itself is not persisted.\n\n5. **Low: scheduler/lifecycle sends are delayed, not transcript-backed.** \n Scheduler sends explicitly await `bindingReady` (`index.mjs:1058-1062`), and lifecycle sends attach a `bindingReady.then(...)` continuation (`index.mjs:1038-1044`). Backlog catch-up: **Delayed by promise, not transcript catch-up**. If no target channel is supplied, lifecycle send returns before queuing (`index.mjs:1037-1039`).\n\nVerdict: the main real reliability hole is the initial existing-transcript bind setting the cursor to EOF when no matching persisted cursor exists; missing-file and pre-connect owner windows are mostly delayed and recovered by explicit post-connect/re-arm catch-up."
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"id": "r4-impl-usage-summary",
|
|
39
|
-
"agent": "worker",
|
|
40
|
-
"ok": true,
|
|
41
|
-
"ms": 79789,
|
|
42
|
-
"sessionId": "019f2558-6c90-79c0-bce4-b7da60be88e0",
|
|
43
|
-
"card": {
|
|
44
|
-
"session": "019f2558-6c90-79c0-bce4-b7da60be88e0",
|
|
45
|
-
"wall_ms": 79789,
|
|
46
|
-
"uncached_in": 37795,
|
|
47
|
-
"cached_in": 219648,
|
|
48
|
-
"out_tokens": 3542,
|
|
49
|
-
"cache_ratio": 0.853,
|
|
50
|
-
"completed": 1
|
|
51
|
-
},
|
|
52
|
-
"output": "현재 세션이 `read-only`라서 파일 쓰기가 차단되어, 제가 직접 패치를 적용하지는 못했습니다. 다만 작업트리에는 이미 요청 기능에 해당하는 변경분이 들어와 있습니다.\n\n영향 파일:\n- [package.json](C:/Project/mixdog-bench/package.json:55): `usage:today` npm script 1줄 추가\n- [scripts/usage-today.mjs](C:/Project/mixdog-bench/scripts/usage-today.mjs:1): 새 119라인 스크립트 추가\n\n검증:\n- `node --check scripts/usage-today.mjs` 통과\n- `npm run usage:today` 실행 완료\n- 출력 총계: `calls=2862`, `input=21.39M`, `cached=374.92M`, `output=3.21M`, `costUsd=257.5234`\n\n주의할 점 하나가 있습니다. 현재 스크립트는 `input_tokens/inputTokens`를 우선 합산하는데, 기존 `session-bench.mjs` 흐름과 실제 trace row를 보면 총 입력 컨텍스트는 `prompt_tokens/promptTokens`가 더 정확합니다. 제가 적용하려던 수정은 `prompt_tokens`, `promptTokens`를 먼저 보고 없을 때 `input_tokens`, `inputTokens`로 fallback하는 변경이었지만, sandbox 때문에 거부되었습니다.\n\ndiff summary:\n- `package.json`: `1 insertion`\n- `scripts/usage-today.mjs`: untracked new file, `119 lines`\n- 참고: 기존에 unrelated modified 파일로 `src/runtime/channels/lib/event-queue.mjs`, `src/runtime/channels/lib/output-forwarder.mjs`도 있습니다."
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"id": "r4-explain-compact-engine",
|
|
56
|
-
"agent": "explore",
|
|
57
|
-
"ok": true,
|
|
58
|
-
"ms": 111028,
|
|
59
|
-
"sessionId": "019f2558-6c99-75a1-b6c9-dedcf6dd5a7f",
|
|
60
|
-
"card": {
|
|
61
|
-
"session": "019f2558-6c99-75a1-b6c9-dedcf6dd5a7f",
|
|
62
|
-
"wall_ms": 111028,
|
|
63
|
-
"uncached_in": 110141,
|
|
64
|
-
"cached_in": 209152,
|
|
65
|
-
"out_tokens": 5651,
|
|
66
|
-
"cache_ratio": 0.655,
|
|
67
|
-
"completed": 1
|
|
68
|
-
},
|
|
69
|
-
"output": "**Compaction Brief**\n\n- Public surface is the `compact.mjs` facade, which re-exports `semanticCompactMessages` and `recallFastTrackCompactMessages` from `compact/engine.mjs`: `src/runtime/agent/orchestrator/session/compact.mjs:52-55`.\n- Engine entry points are semantic LLM summarization and recall fast-track compaction: `src/runtime/agent/orchestrator/session/compact/engine.mjs:278`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:445`.\n- Main loop caller resolves policy before each provider send, then gates on `shouldCompactForSession`: `src/runtime/agent/orchestrator/session/loop.mjs:329-365`.\n- Loop chooses recall-fasttrack when policy says so, otherwise semantic; both pass `force:true` and tail/budget options: `src/runtime/agent/orchestrator/session/loop.mjs:414-459`.\n- Recall loop pipeline hydrates/dumps memory, computes a recall cap, then calls `recallFastTrackCompactMessages`: `src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs:61-84`, `src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs:151-172`.\n- Manual and auto-clear paths enter through `runSessionCompaction`: `src/runtime/agent/orchestrator/session/manager.mjs:1841-1849`, `src/runtime/agent/orchestrator/session/manager.mjs:1943-1957`.\n- Auto policy is disabled by config/env, requires a boundary, computes trigger as explicit sub-boundary limit or boundary minus buffer, and resolves compact type: `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:89-148`.\n- Compaction fires when reactive retry is forced, token estimate is unknown, or transcript+reserve pressure meets trigger: `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:170-174`.\n- Default trigger leaves buffer headroom below boundary; persisted full-window limits are ignored to avoid zero-buffer compaction: `src/runtime/agent/orchestrator/session/compact.mjs:7-14`, `src/runtime/agent/orchestrator/session/loop/compact-policy.mjs:102-117`.\n- Reactive overflow path catches provider context overflow, marks one retry, and loops back through normal pre-send compaction: `src/runtime/agent/orchestrator/session/loop.mjs:982-1010`.\n- Semantic engine first sanitizes/splits protected system prefix, live non-summary messages, and previous summary: `src/runtime/agent/orchestrator/session/compact/engine.mjs:100-111`.\n- Semantic no-ops if sanitized transcript already fits and compaction is not forced: `src/runtime/agent/orchestrator/session/compact/engine.mjs:284-304`.\n- Semantic preserved-tail budget comes from explicit keep/preserve tokens, else min/max bounded budget math: `src/runtime/agent/orchestrator/session/compact/budget.mjs:274-288`.\n- Semantic tail selection uses user-turn anchoring when users exist, otherwise valid non-tool cut points: `src/runtime/agent/orchestrator/session/compact/engine.mjs:235-242`.\n- User-turn tail keeps up to `tailTurns` recent turns within budget and may split the newest turn suffix: `src/runtime/agent/orchestrator/session/compact/engine.mjs:130-159`.\n- No-user tail never starts on a tool result and keeps the newest fitting cut-point suffix: `src/runtime/agent/orchestrator/session/compact/engine.mjs:121-127`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:188-215`.\n- Selected semantic tail is re-sanitized/reconciled so tool-call/tool-result pairing survives the cut: `src/runtime/agent/orchestrator/session/compact/engine.mjs:244-250`.\n- Recall tail keeps the newest structured turns, drops oldest turns over cap, then truncates only if one turn still exceeds cap: `src/runtime/agent/orchestrator/session/compact/engine.mjs:449-466`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:593-619`.\n- Recall truncation walks backward, middle-truncates oversized newest content, and extends backward to avoid orphan tool results: `src/runtime/agent/orchestrator/session/compact/engine.mjs:525-575`.\n- Redaction hooks only once compaction proceeds: semantic redacts before window selection, recall does the same after its no-op check: `src/runtime/agent/orchestrator/session/compact/engine.mjs:306-314`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:644-646`.\n- Redaction touches assistant tool-call argument values while preserving role/content/tool IDs/order/pairing: `src/runtime/agent/orchestrator/session/compact/text-utils.mjs:291-325`.\n- Sensitive keys/raw secret strings are matched by key regexes and replaced with `[redacted]` or raw-string redactions: `src/runtime/agent/orchestrator/session/compact/text-utils.mjs:12-23`, `src/runtime/agent/orchestrator/session/compact/text-utils.mjs:230-237`.\n- Semantic raises budget to fit mandatory system+tail plus summary room instead of failing on mandatory cost: `src/runtime/agent/orchestrator/session/compact/engine.mjs:319-331`.\n- Semantic failures include missing provider, empty live/no compactable head, prompt cannot fit, empty summary, unfittable summary, or final budget overflow: `src/runtime/agent/orchestrator/session/compact/engine.mjs:279-280`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:254-256`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:315-317`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:335-397`.\n- Recall failures include no compactable prior history, empty recall text, unfittable summary, or final budget overflow: `src/runtime/agent/orchestrator/session/compact/engine.mjs:653-668`, `src/runtime/agent/orchestrator/session/compact/engine.mjs:691-699`.\n- Loop fallback tries non-LLM unanchored prune only for non-recall failures; otherwise it records overflow failure and throws context overflow: `src/runtime/agent/orchestrator/session/loop.mjs:500-536`, `src/runtime/agent/orchestrator/session/loop.mjs:552-619`.\n- Manager runner can degrade recall-fasttrack failure to semantic if semantic is enabled and provider is available: `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:231-267`.\n- Manager runner then uses the same non-recall prune safety net, or records `manual_failed/post_turn_failed` and returns an error: `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:322-397`.\n- Successful manager compaction replaces `session.messages`, clears `providerState`, and records stage/type/token telemetry: `src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs:410-445`."
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"task_complete": true,
|
|
73
|
-
"task_errors": [],
|
|
74
|
-
"score_complete": true,
|
|
75
|
-
"score_errors": [],
|
|
76
|
-
"group": {
|
|
77
|
-
"n": 3,
|
|
78
|
-
"wall_ms": 117666.7,
|
|
79
|
-
"uncached_in": 84754,
|
|
80
|
-
"cached_in": 335189.3,
|
|
81
|
-
"out_tokens": 6140.3,
|
|
82
|
-
"cache_ratio": 0.8,
|
|
83
|
-
"completed": 1
|
|
84
|
-
},
|
|
85
|
-
"cards": [
|
|
86
|
-
{
|
|
87
|
-
"session": "019f2558-6ca0-7a43-95e9-1e23cdfdf054",
|
|
88
|
-
"wall_ms": 162183,
|
|
89
|
-
"uncached_in": 106326,
|
|
90
|
-
"cached_in": 576768,
|
|
91
|
-
"out_tokens": 9228,
|
|
92
|
-
"cache_ratio": 0.844,
|
|
93
|
-
"completed": 1
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"session": "019f2558-6c90-79c0-bce4-b7da60be88e0",
|
|
97
|
-
"wall_ms": 79789,
|
|
98
|
-
"uncached_in": 37795,
|
|
99
|
-
"cached_in": 219648,
|
|
100
|
-
"out_tokens": 3542,
|
|
101
|
-
"cache_ratio": 0.853,
|
|
102
|
-
"completed": 1
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"session": "019f2558-6c99-75a1-b6c9-dedcf6dd5a7f",
|
|
106
|
-
"wall_ms": 111028,
|
|
107
|
-
"uncached_in": 110141,
|
|
108
|
-
"cached_in": 209152,
|
|
109
|
-
"out_tokens": 5651,
|
|
110
|
-
"cache_ratio": 0.655,
|
|
111
|
-
"completed": 1
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
}
|