feat(dream): configurable dream-temporal Phase-2 LLM timeout - #23
Open
W4-NERF wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(dream): configurable dream-temporal Phase-2 LLM timeout
Summary
The
dream-temporalPhase-2 LLM review (temporal-marker extraction: weekly/monthly/sessional patterns) used a hardcodedValidateTimeout = 90s. Slow reasoning models (e.g. nemotron-super-trt) exceed this on full prompts; the call then dies withcontext deadline exceededand 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
go/internal/config/config.goDreamConfig.TemporalTimeout— keydream.temporal_timeout, envCTX_DREAM_TEMPORAL_TIMEOUT, default90(s),mut:"hot"go/internal/dream/router.goRouter.TemporalTimeoutfield (0 = legacy package default)go/internal/events/scheduler.gonewRouterwirescfg.Dream.TemporalTimeoutinto the routergo/internal/dream/validate_temporal.gotemporalTimeout(r)helper — router setting wins, otherwiseValidateTimeout; call site uses itgo/internal/dream/validate_temporal_test.goTestTemporalTimeout— nil router / empty router / configured routerdocs/operations.mdCTX_DREAM_TEMPORAL_TIMEOUTWhy 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
90= the previous hardcoded constant)Router.TemporalTimeout == 0falls back to the packageValidateTimeout— all existing call sites (tests, handlers) behave exactly as beforehot— takes effect without restartTests & verification
go build ./...✅go vet ./internal/dream/ ./internal/config/ ./internal/events/✅go test ./internal/dream/ ./internal/config/ ./internal/events/ -short✅ (including newTestTemporalTimeout)golangci-lint run(repo config, v2) — 0 issues ✅