gut: remove vestigial embedded Pi orchestrator stubs and call sites#2273
Merged
alexey-pelykh merged 1 commit intomainfrom Apr 11, 2026
Merged
gut: remove vestigial embedded Pi orchestrator stubs and call sites#2273alexey-pelykh merged 1 commit intomainfrom
alexey-pelykh merged 1 commit intomainfrom
Conversation
…2146) Remove all embeddedPi-related stubs, call sites, config schema entries, and rename test mocks. The embedded Pi runner was gutted but its undefined-returning stubs remained, silently no-op-ing code paths. Production changes: - Remove queueEmbeddedPiMessage stub and dead steer block (agent-runner) - Remove abortEmbeddedPiRun, isEmbeddedPiRunActive, isEmbeddedPiRunStreaming, resolveEmbeddedSessionLane stubs (get-reply-run, subagents-tool, cleanup) - Remove getActiveEmbeddedRunCount stubs (server-reload-handlers, server.impl) - Remove handleAbortTrigger/handleStopCommand no-op stubs (commands-session) - Remove shouldSteer/isStreaming params from runReplyAgent (now dead) - Remove embeddedPi config type, Zod schema, help text, and labels Test changes: - Rename runEmbeddedPiAgentMock → runAgentMock across all test files - Rename embeddedPi mock properties in subagent-announce tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43c0cef to
16b1c2c
Compare
alexey-pelykh
added a commit
that referenced
this pull request
Apr 17, 2026
Production code no longer imports `pi-embedded.js` or `pi-embedded-runner/runs.js` — they were removed by prior gut commits (#2146/#2273, #2367, #2377). These 6 vi.mock calls registered mock factories against paths nothing resolves; vitest never invoked them. Deleted mocks: - src/agents/subagent-announce.timeout.test.ts - src/agents/subagent-announce.format.e2e.test.ts - src/auto-reply/reply/abort.test.ts - src/auto-reply/reply/get-reply-run.media-only.test.ts - src/cli/gateway-cli/run-loop.test.ts - src/cron/isolated-agent/run.test-harness.ts Also removed dead state tied to each mock: - run-loop.test.ts: local abortEmbeddedPiRun / getActiveEmbeddedRunCount / waitForActiveEmbeddedRuns vi.fn()s plus their setup calls and the comment at the SIGUSR1 restart assertion - run.test-harness.ts: runEmbeddedPiAgentMock export and its makeDefaultEmbeddedResult/reset helpers Pre-existing failures in four of the touched files (subagent-announce.timeout.test.ts, abort.test.ts, get-reply-run.media-only.test.ts, subagent-announce.format.e2e.test.ts) are unrelated semantic drift (session routing, ACP cancel flow, think-level extraction, message format) — pass/fail counts are identical before and after this change. Follow-up: ratchet the fork-openclaw skill's "≤6" invariant back to "0 matches" in HQ once this lands. Refs: remoteclaw/hq#35 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
alexey-pelykh
added a commit
that referenced
this pull request
Apr 17, 2026
Production code no longer imports `pi-embedded.js` or `pi-embedded-runner/runs.js` — they were removed by prior gut commits (#2146/#2273, #2367, #2377). These 6 vi.mock calls registered mock factories against paths nothing resolves; vitest never invoked them. Deleted mocks: - src/agents/subagent-announce.timeout.test.ts - src/agents/subagent-announce.format.e2e.test.ts - src/auto-reply/reply/abort.test.ts - src/auto-reply/reply/get-reply-run.media-only.test.ts - src/cli/gateway-cli/run-loop.test.ts - src/cron/isolated-agent/run.test-harness.ts Also removed dead state tied to each mock: - run-loop.test.ts: local abortEmbeddedPiRun / getActiveEmbeddedRunCount / waitForActiveEmbeddedRuns vi.fn()s plus their setup calls and the comment at the SIGUSR1 restart assertion - run.test-harness.ts: runEmbeddedPiAgentMock export and its makeDefaultEmbeddedResult/reset helpers Pre-existing failures in four of the touched files (subagent-announce.timeout.test.ts, abort.test.ts, get-reply-run.media-only.test.ts, subagent-announce.format.e2e.test.ts) are unrelated semantic drift (session routing, ACP cancel flow, think-level extraction, message format) — pass/fail counts are identical before and after this change. Follow-up: ratchet the fork-openclaw skill's "≤6" invariant back to "0 matches" in HQ once this lands. Refs: remoteclaw/hq#35 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
…d-turn termination (#2345) `server-reload-handlers.ts::getActiveCounts()` and `server.impl.ts::setPreRestartDeferralCheck()` both computed gateway capacity / restart-deferral as `queueSize + pendingReplies`, silently omitting active CLI agent subprocess runs. Result: a config reload or SIGUSR1-triggered restart would fire while CLI agents were mid-turn, killing live subprocess runs. Fix: include `getActiveSessionRunCount()` from `src/agents/session-run-registry.ts` in both sums. The registry is already populated by `ChannelBridge` (register at `:160`, unregister at `:349`) and was designed as the replacement for the `getActiveEmbeddedRunCount()` stub that was gutted with the Pi-embedded execution engine. Changes: - `src/gateway/server-reload-handlers.ts`: import `getActiveSessionRunCount`; add `activeCliRuns` field to `getActiveCounts()` return; fold into `totalActive` sum; extend `formatActiveDetails()` with an `activeCliRuns > 0` branch so the deferral log reports "N active CLI run(s)" alongside operations and replies. Field name `activeCliRuns` (not `activeRuns`) to disambiguate from the per-channel `activeRuns` concept used in `channels/run-state-machine.ts`, `gateway/channel-health-policy.ts`, and related modules. - `src/gateway/server.impl.ts`: import `getActiveSessionRunCount`; add `+ getActiveSessionRunCount()` to the `setPreRestartDeferralCheck` callback arrow. Note on stale issue body: #2345 prescribes editing a hardcoded `embeddedRuns = 0` in `server-reload-handlers.ts:150-158` and replacing a `getActiveEmbeddedRunCount()` import + call at `server.impl.ts:302`. Neither exists in the current tree — both were removed during the pi-embedded-runner gut (`f749ed3fb6`, #2146/#2273) and the subsequent cherry-pick cleanup (`028566c42b`, #2442). The semantic bug the issue names (capacity sums miscount active CLI runs as zero) is still present as an *omission* rather than a hardcoded literal, and this PR fixes it. Verification: - `pnpm check` (format + tsgo + lint + project-specific lints) → exit 0 - `pnpm vitest run --config vitest.unit.config.ts src/infra/restart src/infra/infra-runtime src/agents/session-run-registry src/gateway/server.impl` → 5 files, 71 tests, all passed - Rescan: `git grep "getTotalQueueSize() + getTotalPendingReplies"` returns only the one site I updated; no other sum call sites in the codebase need the same fix - Adversarial validation (fresh-context subclaude): CLEAN verdict on 8 AC + 11 adversarial checks — confirms `getActiveSessionRunCount` is LIVE (not a stub), registry is actively populated by ChannelBridge, no import cycle possible (session-run-registry has zero imports), `formatActiveDetails` correctly handles multi-counter output Closes #2345 Refs: #2089 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
4 tasks
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
…d-turn termination (#2345) (#2460) `server-reload-handlers.ts::getActiveCounts()` and `server.impl.ts::setPreRestartDeferralCheck()` both computed gateway capacity / restart-deferral as `queueSize + pendingReplies`, silently omitting active CLI agent subprocess runs. Result: a config reload or SIGUSR1-triggered restart would fire while CLI agents were mid-turn, killing live subprocess runs. Fix: include `getActiveSessionRunCount()` from `src/agents/session-run-registry.ts` in both sums. The registry is already populated by `ChannelBridge` (register at `:160`, unregister at `:349`) and was designed as the replacement for the `getActiveEmbeddedRunCount()` stub that was gutted with the Pi-embedded execution engine. Changes: - `src/gateway/server-reload-handlers.ts`: import `getActiveSessionRunCount`; add `activeCliRuns` field to `getActiveCounts()` return; fold into `totalActive` sum; extend `formatActiveDetails()` with an `activeCliRuns > 0` branch so the deferral log reports "N active CLI run(s)" alongside operations and replies. Field name `activeCliRuns` (not `activeRuns`) to disambiguate from the per-channel `activeRuns` concept used in `channels/run-state-machine.ts`, `gateway/channel-health-policy.ts`, and related modules. - `src/gateway/server.impl.ts`: import `getActiveSessionRunCount`; add `+ getActiveSessionRunCount()` to the `setPreRestartDeferralCheck` callback arrow. Note on stale issue body: #2345 prescribes editing a hardcoded `embeddedRuns = 0` in `server-reload-handlers.ts:150-158` and replacing a `getActiveEmbeddedRunCount()` import + call at `server.impl.ts:302`. Neither exists in the current tree — both were removed during the pi-embedded-runner gut (`f749ed3fb6`, #2146/#2273) and the subsequent cherry-pick cleanup (`028566c42b`, #2442). The semantic bug the issue names (capacity sums miscount active CLI runs as zero) is still present as an *omission* rather than a hardcoded literal, and this PR fixes it. Verification: - `pnpm check` (format + tsgo + lint + project-specific lints) → exit 0 - `pnpm vitest run --config vitest.unit.config.ts src/infra/restart src/infra/infra-runtime src/agents/session-run-registry src/gateway/server.impl` → 5 files, 71 tests, all passed - Rescan: `git grep "getTotalQueueSize() + getTotalPendingReplies"` returns only the one site I updated; no other sum call sites in the codebase need the same fix - Adversarial validation (fresh-context subclaude): CLEAN verdict on 8 AC + 11 adversarial checks — confirms `getActiveSessionRunCount` is LIVE (not a stub), registry is actively populated by ChannelBridge, no import cycle possible (session-run-registry has zero imports), `formatActiveDetails` correctly handles multi-counter output Closes #2345 Refs: #2089 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
embeddedPi-related stubs, call sites, config schema entries, and test mock names (gut: remove vestigial embedded Pi orchestrator stubs and call sites #2146)undefined/false/0-returning stubs remained, silently no-op-ing code paths that should either be removed or replacedProduction (11 files)
queueEmbeddedPiMessagestub and dead steer block; remove unusedshouldSteer/isStreamingparamsabortEmbeddedPiRun,isEmbeddedPiRunActive,isEmbeddedPiRunStreaming,resolveEmbeddedSessionLane); inline session lane key; hardcodeisActive=falseabortEmbeddedPiRunstub and both call siteshandleAbortTrigger/handleStopCommandno-op stubs and their import/registrationgetActiveEmbeddedRunCountstubs and call sitesresolveEmbeddedSessionLaneas template literalConfig (4 files)
embeddedPitype, Zod schema, help text, and labelsTests (8 files)
runEmbeddedPiAgentMock→runAgentMockisEmbeddedPiRunActive/isEmbeddedPiRunStreaming/queueEmbeddedPiMessage/waitForEmbeddedPiRunEndmock propertiesshouldSteer/isStreamingfrom test call sitesTest plan
grep -ri "embeddedPi" src/ extensions/returns zero matchespnpm checkpasses (format + typecheck + lint)pnpm testpasses (693 test files, 5926 tests)Closes #2146
🤖 Generated with Claude Code