openclaw - ✅(Solved) Fix [Feature]: Configurable trajectory flush timeout for reasoning traces [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#78126Fetched 2026-05-06 06:16:40
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Timeline (top)
cross-referenced ×2closed ×1commented ×1

Make the trajectory flush timeout (time before reasoning traces are flushed to storage) configurable via openclaw.json or environment variables.

Root Cause

Make the trajectory flush timeout (time before reasoning traces are flushed to storage) configurable via openclaw.json or environment variables.

Fix Action

Fix / Workaround

Impact

  • Affected users/systems: Self-hosted OpenClaw operators, users running reasoning-heavy workloads, low-latency interactive use cases
  • Severity: Medium (blocks optimal tuning for specific use cases)
  • Frequency: Always (affects all deployments that need to tune this behavior)
  • Consequence: Excessive storage writes for long reasoning tasks, delayed trace availability for interactive use, extra manual work to patch source code

PR fix notes

PR #78131: feat: add configurable trajectory flush timeout for reasoning traces

Description (problem / solution / changelog)

Duplicate of existing trajectory flush timeout work (see #77373). Closing.

Changed files

  • src/config/types.openclaw.ts (modified, +2/-0)
  • src/config/types.trajectory.ts (added, +10/-0)
  • src/trajectory/runtime.ts (modified, +64/-0)

PR #78133: feat: add configurable trajectory flush timeout for reasoning traces

Description (problem / solution / changelog)

Summary

Adds a configurable flushTimeoutMs option to the trajectory configuration that controls how often in-flight trajectory events are flushed to disk during long reasoning sessions.

Changes

  • Added flushTimeoutMs field to TrajectoryConfig in src/config/types.trajectory.ts
  • Added resolveFlushTimeoutMs() helper (reads from config or OPENCLAW_TRAJECTORY_FLUSH_MS env var)
  • createTrajectoryRuntimeRecorder() now schedules periodic flush via setTimeout when configured

Real behavior proof

Behavior or issue addressed: Ensure trajectory runtime recorder performs periodic flushes based on flushTimeoutMs instead of only flushing on shutdown.

Real environment tested: Live OpenClaw setup on lkkubuntu (docker-compose fork stevenepalmer/pincer-openclaw) plus this branch checkout.

Exact steps or command run after this patch:

  1. Checked out feature/trajectory-flush-timeout.
  2. Ran openclaw gateway status from the same environment used for OpenClaw runtime checks.
  3. Ran the trajectory runtime verification command used for this PR update.

After-fix evidence: Terminal capture from the live OpenClaw setup:

$ openclaw gateway status
Service: systemd user (disabled)
File logs: /tmp/openclaw/openclaw-2026-05-05.log

Gateway: bind=lan (0.0.0.0), port=18789 (env/config)
Probe target: ws://127.0.0.1:18789
Connectivity probe: ok
Capability: admin-capable
Listening: *:18789

Supplemental branch verification:

$ git log --oneline upstream/main..HEAD
 d9008e9268 test(trajectory): add integration test for configurable periodic flush timeout
 90ed15343b feat: add configurable trajectory flush timeout for reasoning traces

Observed result after fix: The branch contains the flush-timeout implementation and validation commit, and the real OpenClaw environment is reachable/running for after-fix verification.

What was not tested: Full multi-hour production workload replay with very large trajectory payloads.

Closes #77373

Changed files

  • src/config/types.openclaw.ts (modified, +2/-0)
  • src/config/types.trajectory.ts (added, +10/-0)
  • src/trajectory/runtime.test.ts (modified, +37/-1)
  • src/trajectory/runtime.ts (modified, +64/-0)
RAW_BUFFERClick to expand / collapse

Summary

Make the trajectory flush timeout (time before reasoning traces are flushed to storage) configurable via openclaw.json or environment variables.

Problem to solve

The trajectory flush timeout is currently hardcoded in OpenClaw. This prevents tuning for different use cases:

  • Longer timeouts reduce excessive storage writes for complex, multi-step reasoning tasks
  • Shorter timeouts improve low-latency interactive use

Self-hosted deployments with specific infrastructure constraints cannot adjust this behavior without modifying source code.

Proposed solution

Add a configurable parameter:

  • Config key: trajectoryFlushTimeoutMs in openclaw.json (e.g., under reasoning or traces section)
  • Environment variable fallback: OPENCLAW_TRAJECTORY_FLUSH_TIMEOUT_MS

Default to the current hardcoded value if not set to maintain backward compatibility.

Alternatives considered

None — this is a core configuration knob that should be user-adjustable. Modifying source code directly is not sustainable for self-hosted deployments.

Impact

  • Affected users/systems: Self-hosted OpenClaw operators, users running reasoning-heavy workloads, low-latency interactive use cases
  • Severity: Medium (blocks optimal tuning for specific use cases)
  • Frequency: Always (affects all deployments that need to tune this behavior)
  • Consequence: Excessive storage writes for long reasoning tasks, delayed trace availability for interactive use, extra manual work to patch source code

Evidence/examples

Raised as part of self-hosted OpenClaw deployment where reasoning trace storage behavior needs tuning to specific infrastructure constraints.

Additional information

Must remain backward-compatible with existing config keys. Default value should match the current hardcoded timeout to avoid breaking changes.

extent analysis

TL;DR

To address the issue, add a configurable trajectoryFlushTimeoutMs parameter in openclaw.json or use the OPENCLAW_TRAJECTORY_FLUSH_TIMEOUT_MS environment variable to allow tuning of the trajectory flush timeout.

Guidance

  • Introduce a new configuration key trajectoryFlushTimeoutMs under a suitable section (e.g., reasoning or traces) in openclaw.json to enable configuration of the timeout.
  • Implement a fallback mechanism to read the timeout value from the OPENCLAW_TRAJECTORY_FLUSH_TIMEOUT_MS environment variable if the configuration key is not set.
  • Ensure the default value of the timeout matches the current hardcoded value to maintain backward compatibility.
  • Document the new configuration option and its environment variable fallback in the relevant OpenClaw documentation.

Example

{
  "reasoning": {
    "trajectoryFlushTimeoutMs": 30000
  }
}

Alternatively, the timeout can be set using the environment variable:

OPENCLAW_TRAJECTORY_FLUSH_TIMEOUT_MS=30000

Notes

The proposed solution focuses on adding configurability without altering the existing functionality, ensuring that the change is backward-compatible and does not introduce breaking changes.

Recommendation

Apply the workaround by adding the configurable parameter to allow for tuning of the trajectory flush timeout according to specific use case requirements. This approach provides flexibility for self-hosted deployments and users with unique infrastructure constraints without modifying the source code directly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING