Skip to content

feat(dream): configurable dream-temporal Phase-2 LLM timeout - #23

Open
W4-NERF wants to merge 1 commit into
GottZ:rootfrom
W4-NERF:feat/dream-temporal-timeout-config
Open

feat(dream): configurable dream-temporal Phase-2 LLM timeout#23
W4-NERF wants to merge 1 commit into
GottZ:rootfrom
W4-NERF:feat/dream-temporal-timeout-config

Conversation

@W4-NERF

@W4-NERF W4-NERF commented Aug 13, 2026

Copy link
Copy Markdown

feat(dream): configurable dream-temporal Phase-2 LLM timeout

Summary

The dream-temporal Phase-2 LLM review (temporal-marker extraction: weekly/monthly/sessional patterns) used a hardcoded ValidateTimeout = 90s. Slow reasoning models (e.g. nemotron-super-trt) exceed this on full prompts; the call then dies with context deadline exceeded and temporal-marker extraction is silently skipped — the error is logged as non-fatal, but the block loses its temporal dimensions for that cycle.

This PR makes the timeout configurable via a new hot-reloadable setting while keeping the legacy default byte-identical for existing deployments.

What changed

File Change
go/internal/config/config.go New DreamConfig.TemporalTimeout — key dream.temporal_timeout, env CTX_DREAM_TEMPORAL_TIMEOUT, default 90 (s), mut:"hot"
go/internal/dream/router.go New Router.TemporalTimeout field (0 = legacy package default)
go/internal/events/scheduler.go newRouter wires cfg.Dream.TemporalTimeout into the router
go/internal/dream/validate_temporal.go New temporalTimeout(r) helper — router setting wins, otherwise ValidateTimeout; call site uses it
go/internal/dream/validate_temporal_test.go New TestTemporalTimeout — nil router / empty router / configured router
docs/operations.md Env-table entry for CTX_DREAM_TEMPORAL_TIMEOUT

Why it matters

Without this, operators of slower dream backends get a silent degradation: the dream cycle appears healthy (links are still written by the eval phase), but temporal markers (weekly/monthly recurrence) are never extracted because the Phase-2 call always times out at 90s. The failure is WARN-only and non-fatal, so it is easy to miss. On our deployment (nemotron-super-trt), the Phase-2 call reliably needs ~92s on full prompts — just past the old ceiling; raising the setting to 180s made the same call complete and temporal dimensions appear again.

Backward compatibility

  • Default is unchanged (90 = the previous hardcoded constant)
  • Router.TemporalTimeout == 0 falls back to the package ValidateTimeout — all existing call sites (tests, handlers) behave exactly as before
  • Setting is hot — takes effect without restart

Tests & verification

  • go build ./...
  • go vet ./internal/dream/ ./internal/config/ ./internal/events/
  • go test ./internal/dream/ ./internal/config/ ./internal/events/ -short ✅ (including new TestTemporalTimeout)
  • golangci-lint run (repo config, v2) — 0 issues
  • Live E2E (self-hosted instance): the exact call that timed out at 90s completed in 92s with the setting at 180s; temporal directions were extracted, dream cycle wrote links afterwards ✅

The dream-temporal Phase-2 LLM review (weekly/monthly pattern
extraction) used a hardcoded 90s ValidateTimeout. Slow reasoning
models (e.g. nemotron-super-trt) exceed this on full prompts; the
call then fails with 'context deadline exceeded' and temporal-marker
extraction is silently skipped (non-fatal, but the block loses its
temporal dimensions).

Add dream.temporal_timeout (env CTX_DREAM_TEMPORAL_TIMEOUT, default
90, hot) carried through the Router to validate_temporal.go. The
router setting wins, otherwise the legacy ValidateTimeout default
applies — behavior for existing deployments is unchanged.

Docs: operations.md env table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant