Skip to content

[PF-24] Configurable stream timeout and config merge from template JSON - #42

Merged
chucoding merged 3 commits into
developfrom
feature/PF-24_timeout
Mar 15, 2026
Merged

[PF-24] Configurable stream timeout and config merge from template JSON#42
chucoding merged 3 commits into
developfrom
feature/PF-24_timeout

Conversation

@chucoding

Copy link
Copy Markdown
Owner

Purpose

Make plan/implement streaming timeout configurable via planforge.json (with effort-based defaults) and unify config merge so that runtime defaults come only from template JSON (default-*.json) based on installed providers, instead of hardcoded constants.

Description

1. Stream timeout (plan/implement)

  • Config: Optional planner.streamTimeoutSec and implementer.streamTimeoutSec in planforge.json. 0 = no timeout.
  • Defaults when not set: Planner uses effort (high 300s, medium 180s, low 120s). Implementer uses 300s (or effort-based).
  • Flow: Commands resolve timeout (via timeout.ts / config.py), pass streamTimeoutMs in PlanOpts/ImplementOpts to Claude and Codex providers. Providers apply timeout only when > 0; otherwise no timeout (no setTimeout / proc.wait() without timeout).
  • Files:
    • packages/cli-js/src/config/types.ts — added streamTimeoutSec? to planner/implementer.
    • packages/cli-js/src/config/timeout.ts — new; resolvePlannerStreamTimeoutSec, resolveImplementerStreamTimeoutSec (replaces former resolve-timeout.ts).
    • packages/cli-js/src/providers/registry.tsPlanOpts.streamTimeoutMs?, ImplementOpts.streamTimeoutMs?.
    • packages/cli-js/src/commands/plan.ts, implement.ts — resolve timeout, pass streamTimeoutMs to runner.
    • packages/cli-js/src/providers/claude.ts, codex.ts — accept streamTimeoutMs; 0/undefined = no timeout.
    • packages/cli-py: planforge/utils/config.py (resolve helpers), commands/plan.py, commands/implement.py, providers/claude.py, providers/codex.py — same behavior; Codex implement path switched to _run_codex_exec_streaming with timeout.

2. Config merge from template JSON

  • Before: load_config / loadConfig merged planforge.json with hardcoded _MERGE_DEFAULTS / MERGE_DEFAULTS (provider, model).
  • After: Merge base is the template from getDefaultConfig(checkClaude(), checkCodex()) (default-both.json, default-claude-only.json, or default-codex-only.json). Planforge.json overrides on top.
  • Files:
    • packages/cli-js/src/config/load.ts — removed MERGE_DEFAULTS; loadConfig() uses template as merge base.
    • packages/cli-py/planforge/utils/config.py — removed _MERGE_DEFAULTS; load_config() uses template (lazy import of check_claude/check_codex).

3. Rename

  • resolve-timeout.tstimeout.ts; plan/implement imports updated to ../config/timeout.js.

How to test

  1. Timeout: Set planner.streamTimeoutSec: 0 in planforge.json and run planforge plan "short goal" — should not time out at 120s. Set planner.streamTimeoutSec: 30 and run a long plan — should fail with "timed out after 30s".
  2. Config merge: With both providers installed, remove provider from planner in planforge.json and run planforge plan "goal" — should still use planner from default-both.json.
  3. Build: cd packages/cli-js && npm run build — succeeds.

Review Requirement

  • Provider symmetry: Claude and Codex (JS and Python) both use streamTimeoutMs/streamTimeoutSec the same way; 0/None = no timeout.
  • Config load: Merge base must always come from the template selected by checkClaude()/checkCodex().
  • Python: load_config() lazy-imports provider checks; confirm plan/implement/doctor still load config correctly.

Additional Info

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chucoding chucoding self-assigned this Mar 15, 2026
@chucoding
chucoding merged commit c12c594 into develop Mar 15, 2026
3 checks passed
@chucoding
chucoding deleted the feature/PF-24_timeout branch March 15, 2026 07:32
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.

1 participant