Skip to content

gut: eliminate callers and delete ~20 EXCLUDE-STUB files in src/agents/#2377

Merged
alexey-pelykh merged 2 commits intomainfrom
gut/delete-exclude-stub-agents-2367
Apr 16, 2026
Merged

gut: eliminate callers and delete ~20 EXCLUDE-STUB files in src/agents/#2377
alexey-pelykh merged 2 commits intomainfrom
gut/delete-exclude-stub-agents-2367

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

  • Delete 20 EXCLUDE-STUB files in src/agents/ and 1 test file (failover-error.test.ts)
  • Eliminate all import callers across 33 source and test files
  • Remove the now-empty pi-embedded-runner/ directory
  • Update 20 disposition entries from EXCLUDE-STUB to EXCLUDE-GUT

Closes #2367

Stubs deleted

pi-embedded-runner/{model,run/params,runs}.ts, pi-embedded.ts, pi-embedded-runner.ts, auth-profiles/session-override.ts, bash-tools.ts, bootstrap-budget.ts, bootstrap-cache.ts, cli-runner.ts, context-window-guard.ts, failover-error.ts, identity-file.ts, model-fallback.ts, sandbox.ts, skills-status.ts, skills.ts, stream-message-shared.ts, system-prompt.ts, test-helpers/usage-fixtures.ts

Caller elimination strategy

  • Constant-returning stubs: replaced calls with the constant value
  • Type-only stubs (any): inlined replacement types at call sites
  • No-op void stubs: removed calls entirely
  • Dead code chains (followup-runner's runWithModelFallback + runEmbeddedPiAgent): replaced with no-op + log
  • Test mocks for deleted stubs: removed vi.mock blocks, added local stubs where needed

Test plan

  • pnpm check passes (format + typecheck + lint)
  • pnpm test passes (730 test files, 6420+ tests)
  • CI build + test jobs pass

🤖 Generated with Claude Code

@alexey-pelykh alexey-pelykh enabled auto-merge (squash) April 16, 2026 13:20
@alexey-pelykh alexey-pelykh force-pushed the gut/delete-exclude-stub-agents-2367 branch from d98090e to 6664b8d Compare April 16, 2026 13:26
…s/ (#2367)

Delete 20 EXCLUDE-STUB files and their test file (failover-error.test.ts),
eliminate all import callers across 33 source and test files, and remove
the now-empty pi-embedded-runner/ directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh force-pushed the gut/delete-exclude-stub-agents-2367 branch from 6664b8d to 8e0cc0c Compare April 16, 2026 15:10
Three security audit test cases and the entire tts summarizeText describe
block depended on deleted EXCLUDE-STUB agent code (sandbox.ts config
resolver, embedded Pi model runner). With those stubs gone, the production
code either returns a hardcoded gutted config or throws unconditionally —
so the affected assertions can no longer exercise meaningful behavior.

- src/security/audit.test.ts:
  - "scores small-model risk" — drop the "sandbox=all → info" case
    (resolveSandboxConfigForAgent now always returns mode="off")
  - "checks sandbox docker mode-off findings with/without agent override"
    → rename to "flags sandbox docker config when mode is off" and drop
    the agent-override case (same gutted resolver)
  - "checks sandbox browser bridge-network restrictions" — delete
    (gutted resolver returns browser.enabled=false unconditionally)
- src/tts/tts.test.ts:
  - Delete the summarizeText describe block and its associated mocks
    (summarizeText now always throws; embedded model runner was removed)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit 84e53de into main Apr 16, 2026
12 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/delete-exclude-stub-agents-2367 branch April 16, 2026 17:49
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 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>
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.

gut: eliminate callers and delete ~18 EXCLUDE-STUB files in src/agents/

1 participant