MemoryTurnStart: the 300 ms budget skipped memory retrieval on 1 in 4 prompts on a Windows install
Maintainer thường phản hồi trong vòng 5 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- bun, typescript
Hướng nghiên cứu
Bắt đầu với hooks/MemoryTurnStart.hook.ts, đặc biệt là SOFT_BUDGET_MS ở dòng 62 và ngân sách của worker truy xuất ở các dòng 280–288. So sánh ngân sách 300 ms với kết quả 2000 ms được báo cáo, sau đó kiểm tra cách hook hoạt động trên các hệ điều hành. Công việc hoàn tất khi hoạt động truy xuất không bị bỏ qua trong các điều kiện được báo cáo và thời gian chờ prompt nằm trong ngân sách đã chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
LifeOS 8.761.0 · attestation: not run
What is broken
MemoryTurnStart gives per-prompt memory retrieval SOFT_BUDGET_MS = 300 (cut from 4000 on 2026-10-16). When the worker has not answered inside the budget, the prompt gets the notice "retrieval skipped this turn: ... the machine is loaded" and no recalled notes.
On one Windows 11 install the notice replaced retrieval on 19 of 76 prompts (25%) while the release value was in force (2026-11-24 10:45 to 2026-11-26 07:30 UTC), with the hook's wall time at a median of 769 ms. With the budget raised to 2000 ms, 0 of 21 prompts skipped (2026-11-26 07:30 to 2026-11-27 00:00 UTC). Not measured on macOS, so whether this is Windows-only is open.
Where (file:line)
hooks/MemoryTurnStart.hook.ts:62 (SOFT_BUDGET_MS), :280-288 (budget applied to the retrieval worker)
Repro on a clean tree
# Windows 11, 8.761.0 release, Git Bash. Use Claude Code normally for a day or two, then run this from
# ~/.claude. It reads only the UserPromptSubmit hook attachments Claude Code stores in projects/*.jsonl
# and prints counts, no text. Set the first window to when SOFT_BUDGET_MS was 300 on your install;
# here 300 ms ran 2026-11-24 10:45Z to 2026-11-26 07:30Z, and 2000 ms from then to 2026-11-27 00:00Z.
cat > probe.js <<'EOF'
const { readdirSync, readFileSync, statSync } = await import("node:fs");
const { join } = await import("node:path");
const W300 = [Date.parse("2026-11-24T10:45:00Z"), Date.parse("2026-11-26T07:30:00Z")], W2000 = [W300[1], Date.parse("2026-11-27T00:00:00Z")];
const files = [];
const walk = (d) => { for (const n of readdirSync(d)) { const p = join(d, n), s = statSync(p); if (s.isDirectory()) walk(p); else if (n.endsWith(".jsonl") && s.mtimeMs >= W300[0]) files.push(p); } };
walk(join(process.cwd(), "projects"));
const seen = new Set(), b = { 300: { n: 0, skip: 0, ms: [] }, 2000: { n: 0, skip: 0, ms: [] } };
for (const f of files) for (const line of readFileSync(f, "utf8").split(String.fromCharCode(10))) {
if (!line.includes("UserPromptSubmit")) continue;
let o; try { o = JSON.parse(line); } catch { continue; }
const a = o.attachment; if (o.type !== "attachment" || !a || a.hookEvent !== "UserPromptSubmit" || a.type !== "hook_success") continue;
const out = String(a.stdout || ""); if (!/<lifeos-(memory-delta|ground|memory)>/.test(out) || seen.has(o.uuid)) continue; seen.add(o.uuid);
const t = Date.parse(o.timestamp), k = t >= W300[0] && t < W300[1] ? 300 : t >= W2000[0] && t < W2000[1] ? 2000 : 0; if (!k) continue;
b[k].n++; if (typeof a.durationMs === "number") b[k].ms.push(a.durationMs); if (out.includes("retrieval skipped this turn")) b[k].skip++;
}
const med = (x) => x.length ? x.slice().sort((p, q) => p - q)[Math.floor((x.length - 1) / 2)] : null;
for (const k of [300, 2000]) console.log("SOFT_BUDGET_MS " + k + ": " + b[k].skip + " of " + b[k].n + " prompts skipped retrieval; hook wall time median " + med(b[k].ms) + " ms");
process.exit(b[300].skip > 0 ? 1 : 0);
EOF
bun -e "$(cat probe.js)" # exit 1 when any prompt skipped retrieval at 300 ms
# The notice the model receives on a skipped prompt:
# <lifeos-ground> (retrieval skipped this turn: the prompt hooks were already past their time budget ...)
Negative control
Probe: bun -e 'const { readdirSync, readFileSync, statSync } = await import("node:fs"); const { join } = await import("node:path"); const W300 = [Date.parse("2026-11-24T10:45:00Z"), Date.parse("2026-11-26T07:30:00Z")], W2000 = [W300[1], Date.parse("2026-11-27T00:00:00Z")]; const files = []; const walk = (d) => { for (const n of readdirSync(d)) { const p = join(d, n), s = statSync(p); if (s.isDirectory()) walk(p); else if (n.endsWith(".jsonl") && s.mtimeMs >= W300[0]) files.push(p); } }; walk(join(process.cwd(), "projects")); const seen = new Set(), b = { 300: { n: 0, skip: 0, ms: [] }, 2000: { n: 0, skip: 0, ms: [] } }; for (const f of files) for (const line of readFileSync(f, "utf8").split(String.fromCharCode(10))) { if (!line.includes("UserPromptSubmit")) continue; let o; try { o = JSON.parse(line); } catch { continue; } const a = o.attachment; if (o.type !== "attachment" || !a || a.hookEvent !== "UserPromptSubmit" || a.type !== "hook_success") continue; const out = String(a.stdout || ""); if (!/<lifeos-(memory-delta|ground|memory)>/.test(out) || seen.has(o.uuid)) continue; seen.add(o.uuid); const t = Date.parse(o.timestamp), k = t >= W300[0] && t < W300[1] ? 300 : t >= W2000[0] && t < W2000[1] ? 2000 : 0; if (!k) continue; b[k].n++; if (typeof a.durationMs === "number") b[k].ms.push(a.durationMs); if (out.includes("retrieval skipped this turn")) b[k].skip++; } const med = (x) => x.length ? x.slice().sort((p, q) => p - q)[Math.floor((x.length - 1) / 2)] : null; for (const k of [300, 2000]) console.log("SOFT_BUDGET_MS " + k + ": " + b[k].skip + " of " + b[k].n + " prompts skipped retrieval; hook wall time median " + med(b[k].ms) + " ms"); process.exit(b[300].skip > 0 ? 1 : 0);' · exit 1 · captured 2026-11-27T01:33:50.840Z
Red looks like: SOFT_BUDGET_MS 300: 19 of 76 prompts skipped retrieval
SOFT_BUDGET_MS 300: 19 of 76 prompts skipped retrieval; hook wall time median 769 ms
SOFT_BUDGET_MS 2000: 0 of 21 prompts skipped retrieval; hook wall time median 583 ms
Suggested fix
Applied on one install: SOFT_BUDGET_MS 300 -> 2000 (MemoryTurnStart.hook.ts:62). Skips went from 19 of 76 prompts to 0 of 21 over the windows in the probe. Cost: a prompt sent while retrieval is slow can wait up to 2 s for its notes; the hook still returns as soon as the worker answers.
A narrower option, not tried: keep 300 ms on macOS and use a larger budget on win32, or make the budget a setting.
Environment
- OS: Windows (x64)
- Harness: claude-code
- bun: 1.4.2 · git: 2.56.1.
- Doctor broken: none
- Ngôn ngữ chính
- TypeScript
- Star
- 20k
- Fork
- 2.5k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của danielmiessler/LifeOS
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
danielmiessler/LifeOS#2985 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
danielmiessler/LifeOS#2980 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
danielmiessler/LifeOS#2977 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
danielmiessler/LifeOS#2967 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
danielmiessler/LifeOS#2966 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của danielmiessler/LifeOS
Issue tương tự
-
P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug L3 level 1 needs-review wocs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SatyamPandey-07/WorkSphere#10739 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
maintenance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
assistant-ui/assistant-ui#10946 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:auth-provider issue-rating: 🦞 diamond lobster no-stale P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openclaw/openclaw#206303 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày