Repository navigation
fix(warning,batch): stderr fallback on handler throw + align batch cap to concurrency limit - #170
Merged
Merged
Conversation
…p to concurrency limit
audit 2.2.6: warningHandler empty catch after removeAllListeners('warning')
made warnings a black hole when the handler itself threw (e.g. analytics
logEvent). Add stderr last-resort write in catch, dev/verbose-gated so the
non-dev silent path is unchanged.
audit 1.4.7: batch skill prompt told the model to spawn 5-30 agents while
the AgentTool hard concurrency cap (FUSION_MAX_CONCURRENT_SUBAGENTS) defaults
to 20 — the 21st+ spawn was rejected, causing model retry/error-spin. Bind
MAX_AGENTS to DEFAULT_MAX_CONCURRENT_SUBAGENTS so prompt and hard cap share
one source.
Gates: typecheck 0 / 704 tests / lint net-zero 4601 / build:dev 3755 modules.
Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Aug 28, 2026
dahai80
added a commit
that referenced
this pull request
Aug 28, 2026
…sx (audit 1.1.1) (#172) Third surgical extraction in the REPL.tsx god-module split (audit §1.1.1). The three viewed-task derives (viewedTask / viewedTeammateTask / viewedAgentTask) move from inline in REPL.tsx to a pure-function selector module: src/tasks/viewedTaskSelector.ts. No React, no side effects — deps as args. - getViewedTask: raw record lookup by id - getViewedTeammateTask: teammate-only narrowed (in_progress_teammate) - getViewedAgentTask: teammate OR local_agent — drives downstream boolean checks REPL keeps the three const bindings as thin call wrappers (identical names, identical downstream usage) — pure relocation + import wiring, byte-identical behavior. Removed now-unused isInProcessTeammateTask guard import from REPL (sole call site moved out); kept InProcessTeammateTaskState type (still used at the panel helper) and isLocalAgentTask (two other call sites). REPL.tsx 6741 → 6732 LOC (-9). viewedTaskSelector.ts +36 LOC (new). Cohesion win: selector logic now reusable + unit-testable in isolation. Gates: typecheck 0 / 714 tests pass (+10 new) / lint net-zero vs 4601 baseline / build:dev 3757 modules. Follows PR #168 (leaf components, -285) + PR #171 (spinner derives, -70) in the multi-session split. Task #170 stays in_progress — full 4-6wk split continues in follow-up PRs. Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Aug 28, 2026
Merged
dahai80
added a commit
that referenced
this pull request
Aug 29, 2026
….1 slice #34) (#207) Slice #34 of #170 REPL god-module split. Extract the idle-return-hint useEffect body (5 early-return guards + setTimeout with 5 stale-closure-bypass positional args generating Ink <Text> JSX for the hint_v2 variant + logEvent + cleanup) into maybeScheduleIdleReturnHint() in src/screens/idleReturnHint.tsx. PURE-ROUTING SUB-BLOCK class (6th, like slice #29 maybeSendIdleNotification). The function returns the setTimeout handle so the kept-thin useEffect cleanup (clearTimeout + removeNotification + ref reset) still works byte-identically. JSX-generating extract -> .tsx + Text import from ../ink.js. 5 setTimeout-arg + 2 guard dep + removeNotification pass via ctx object; getFeatureValue_CACHED_MAY_BE_STALE/logEvent/AnalyticsMetadata/getGlobalConfig/ getTotalInputTokens/formatTokens imported directly. removeNotifications path checked: formatTokens became import-only (sole user moved) -> removed from REPL; getFeatureValue/getGlobalConfig/getTotalInputTokens/Text/logEvent/ AnalyticsMetadata still multi-use -> kept. Gates: typecheck 0 errors / 921 pass / biome new-file-clean / build:dev pass. REPL 5754 -> 5703 (-51 net: -59 body, +8 thin shell). Byte-identical behavior. Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Aug 29, 2026
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.
What
Two surgical fixes from the 0827 audit (P0-P3 sweep, Batch F):
2.2.6 — warningHandler empty catch = warning black hole
src/utils/warningHandler.tsstrips the Node default warning listener (process.removeAllListeners('warning')) for non-dev builds, then installs its own handler. That handler wrapped its body intry { ... } catch {}with an empty catch — if the handler itself threw (e.g. analyticslogEventthrew), the warning was permanently lost with no fallback.Fix: write to
process.stderras a last resort inside the catch, gated onCLAUDE_DEBUGor dev-build so the non-dev silent path is byte-identical to today. If stderr itself fails (closed fd), a final no-op catch is the true last resort — nothing more to degrade to.1.4.7 — batch prompt cap exceeds hard spawn cap
src/skills/bundled/batch.tstold the model to decompose into 5–30 worktree agents, but the AgentTool hard concurrency cap (FUSION_MAX_CONCURRENT_SUBAGENTS, default 20 insubagentGuardrails.ts) rejects the 21st+ spawn. The model would spawn 30, hit the limit at 20, then retry / error-spin on the rejected ones.Fix: bind
MAX_AGENTStoDEFAULT_MAX_CONCURRENT_SUBAGENTSso the prompt upper bound and the hard cap share one source — no drift. The skill description string interpolates the same constant.Why surgical
catchthat was previously empty; dev-gate preserves the silent non-dev path.Verification
bun run typecheck→ 0 errorsbun test src/__tests__/→ 704 pass / 0 failbun run lint→ 4601 errors (net-zero vs baseline; no new diagnostics in changed files)bun run build:dev→ 3755 modules, built./fusion-code-devAudit context
0827 audit residual triage. These two were the only genuine surgical default-on findings among the 12 OPEN candidates. The rest were: closed by prior PRs (2.2.2 stream-resume via #163, 2.2.1 via Batch B), experimental-feature-gated-off (2.2.4 unattended retry, 1.2.x daemon cluster — DCE'd from shipped binary), deliberate design pushback (1.4.6 budget stub = v1 DEFERRED), or false positives verified against current code (2.1.6 abortController = fresh per turn via
new QueryEngine/newAbortController; 1.3.4 normalize cache = reference-identity invalidation handles compact). Documented in memory per Rule 12.Closes audit 2.2.6 + 1.4.7.
Co-Authored-By: Claude Fable 5 [email protected]