Skip to content

fix(memory-core): raise NARRATIVE_TIMEOUT_MS from 15s to 60s#72852

Merged
steipete merged 1 commit into
openclaw:mainfrom
RayWoo:fix/memory-core-narrative-timeout-config
Apr 27, 2026
Merged

fix(memory-core): raise NARRATIVE_TIMEOUT_MS from 15s to 60s#72852
steipete merged 1 commit into
openclaw:mainfrom
RayWoo:fix/memory-core-narrative-timeout-config

Conversation

@RayWoo

@RayWoo RayWoo commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

What

Bumps NARRATIVE_TIMEOUT_MS in extensions/memory-core/src/dreaming-narrative.ts from 15 s → 60 s, and updates the matching unit-test assertion.

Why

Closes #72837.

On v2026.4.25 stable, narrative generation reliably times out for all three dreaming phases (light, REM, deep) regardless of gateway warm-up state. The memory.dream.completed event for each phase fires correctly (the underlying dream report is written to disk) but the prose-summary subagent run hits the 15 s limit before completion, so the diary entry is dropped and the gateway logs:

memory-core: narrative generation ended with status=timeout for <phase> phase.

The 15 s limit predates current model latencies — even unblocked LLM calls (OpenAI gpt-5.4-mini over a healthy network, p50 ≈ 3 s, p99 ≈ 12 s) brush against it on the first sweep after a restart, and reliably exceed it during load. Two consecutive openclaw cron run <jobId> triggers on the same machine 22 minutes apart both timed out for all 3 phases — full evidence in the linked issue.

Why 60 s (not raised further, not made configurable)

The existing comment above the constant captured the maintainer's concern explicitly:

// Narrative generation is best-effort. Keep the timeout short so a stalled
// diary subagent does not leave the parent dreaming cron job "running" for
// minutes after the reports have already been written.

60 s preserves that constraint — it's still well under "minutes" (plural) — while giving realistic LLM-call headroom. I considered exposing this as a dreaming.execution.narrativeTimeoutMs config field but CONTRIBUTING.md notes that new features generally aren't accepted, and a single constant bump is a tighter scope. Happy to convert to a config knob in a follow-up if you'd prefer that shape.

The new comment block reflects the empirical reasoning so a future reader doesn't need to dig through the issue history.

Testing

  • dreaming-narrative.test.ts "skips extra settle waits after timeout and still attempts cleanup" hard-codes the constant (expect(...).toMatchObject({ timeoutMs: 15_000 })); updated to 60_000 to match.
  • Local pnpm install not run (this fork is on a Linux host without a provisioned monorepo dev env; pulling all transitive deps was out of scope). Change is a literal-value swap with no logic or call-graph effect, so CI is the right verification surface.
  • No new tests added — the existing assertion already exercises the call path; adding a separate test for "timeout is 60_000" would just duplicate what's there.

Diff size

extensions/memory-core/src/dreaming-narrative.test.ts |  2 +-
extensions/memory-core/src/dreaming-narrative.ts      | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)

Related

@greptile-apps

greptile-apps Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Raises NARRATIVE_TIMEOUT_MS from 15 s to 60 s in dreaming-narrative.ts and updates the single corresponding test assertion, fixing reliable narrative-generation timeouts observed on v2026.4.25 stable across all three dreaming phases. The change is a literal-value swap with no logic or call-graph effect; the updated comment block accurately reflects the empirical rationale.

Confidence Score: 5/5

Safe to merge — minimal, well-scoped constant bump with no logic changes and a correctly updated test.

No logic, interface, or call-graph changes. The constant is defined in one place and consumed in one place; the matching test assertion was updated consistently; no other references to the old value remain.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(memory-core): raise NARRATIVE_TIMEOU..." | Re-trigger Greptile

@steipete steipete force-pushed the fix/memory-core-narrative-timeout-config branch 4 times, most recently from 2889b32 to 8292515 Compare April 27, 2026 20:09
Closes openclaw#72837. The 15s narrative-subagent timeout was empirically too
tight for warm-gateway runs across light, REM, and deep phases —
gpt-5.4-mini latency through OpenAI alone routinely brushes 12s+, so the
first sweep after a restart deterministically times out across all three
phases. 60s gives realistic LLM-call headroom while still capping the
worst case at one minute, preserving the original comment's "don't leave
parent cron running for minutes" constraint.

Test: updates the matching toMatchObject assertion in
dreaming-narrative.test.ts from 15_000 to 60_000.
@steipete steipete force-pushed the fix/memory-core-narrative-timeout-config branch from 8292515 to 962fe46 Compare April 27, 2026 20:12
@steipete steipete merged commit ad6e1cd into openclaw:main Apr 27, 2026
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dreaming narrative generation times out for all 3 phases on v2026.4.25 warm gateway — #69487 fix appears regressed/incomplete

2 participants