Skip to content

Lift closure-free createRunner helpers, add the runner split design (#1447 pass G) - #1454

Merged
currentbits merged 2 commits into
mainfrom
coder/refactor-g-lift-createrunner-helpers-spl-ad7272
Oct 5, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/refactor-g-lift-createrunner-helpers-spl-ad7272

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Round 2, pass G of #1447. Two parts.

1. Lift closure-free helpers out of createRunner

A babel scope analysis checked each of createRunner's 123 inner functions. 11 of them reference no binding in its scope. They move verbatim, with PLAN_TRUNCATE, to electron/runnerHelpers.js: shouldRecordSession, noticePrompt, formatQueuedPrompt, firstChanged, planText, questionInfo, replyCodexJsonRpc, replyCodexJsonRpcError, cancelCodexServerRequests, sanitizeAttachments, attachmentPromptSection. The other 112 all touch store, active or another stateful function, so they're left alone.

2. Design note: docs/superpowers/specs/2026-10-04-runner-split-design.md

The note is the plan for splitting the rest of createRunner in a later round:

  • It maps the closure state: each opts binding, Map, Set and timer, and which functions read or write it.
  • It identifies the hub functions that every seam depends on.
  • It proposes an extraction mechanism, create<Seam>(ctx) factories, generalising the deps object that workflow.js already takes.
  • It sets out 11 seams in leaf-to-hub order, each with a risk rating. Watchdogs, ask/btw, worktree setup, subagents, session recording and Claude keep-alive come first; permissions and the per-provider runs (~4,200 lines) come last. The target is a ~1,800-line runner.js.
  • It lists test coverage per seam and the gaps to close first: Claude's idle reap / LRU eviction, and the CI-workflow sign-off failing closed.

Checked

  • Ignoring indentation, the moved helpers are verbatim. The only new lines are requires and the export list.
  • No name shadowing: createRunner declares no local named path, truncate, approvalResponse, DECISION_CANCEL, normalizeQuestions or PLAN_TRUNCATE, so every lifted helper resolves the same bindings as before.
  • Full electron suite (CI-like env) 4109/4109; npm run typecheck clean.

🤖 Generated with Claude Code

Willem and others added 2 commits October 4, 2026 20:02
…pers.js (#1447)

Scope analysis (babel) of createRunner's 123 inner functions found 11 that
reference no createRunner binding. Move them verbatim (dedented) to
electron/runnerHelpers.js along with PLAN_TRUNCATE, and require them back.
Drops the now-unused DECISION_CANCEL import from runner.js.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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.

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