chore: remove dead code (OpenAI voice backend + dead modules/functions)#100
Merged
Conversation
VOICE_BACKEND=openai was unreachable: config.py coerces any value not in (auto/whisper/apple/off) to auto, and the per-user voice setting allowlist excludes openai too — so config.voice_backend could never equal 'openai' and the _openai_transcribe path was never taken. Remove it entirely: - transcribe.py: drop _openai_transcribe, the httpx _client/_get_client, close_client, the dispatch branch, and the openai docstring lines. - config.py: drop the dead openai_api_key / openai_base_url fields (SENSITIVE_ENV_VARS keeps scrubbing OPENAI_API_KEY from subprocess env — that is a standalone safety measure, not tied to the removed reader). - bot/messages.py: drop the unreachable VOICE_BACKEND=openai warning. - bot/app.py: drop the close_transcribe_client import + shutdown call. - tests: delete the openai-only test_transcribe.py; trim test_config.py's openai field tests (keep the env-scrub test). - docs: deploy.md / architecture.md / secrets.md / README*.md. 548 tests pass · ruff clean · pyright 0 errors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two read-only audit agents (vulture-based + semantic reachability) swept the repo. Removes confirmed-dead code (zero real callers; verified each by grep, not just tool output): Whole modules: - handlers/context_poll.py — its loop was only referenced by a commented-out create_task in app.py (the /context-into-pane approach was abandoned for JSONL math). Drops the module + the _context_poll_task global / shutdown guard / commented launch in app.py (rationale kept as a comment). - handlers/response_builder.py + its test — build_response_parts had no src caller (markdown/splitting moved to the send layer); test-kept only. Dead functions/members: - interactive_ui: set_interactive_mode, clear_interactive_mode, adopt_interactive_msg, render_interactive_keyboard (the switcher-tap bg-prompt path actually uses enter_kb_mode; docs corrected). - bg_status.has_panel_content; directory_browser.build_window_picker; history.get_cached_total_pages; switcher.strip_active_switcher; card_model.Event.is_tool; terminal_parser.STATUS_SPINNERS (union of two still-used frozensets); session.py: _encode_cwd, clear_active_session, find_session_by_claude_id, set_session_goal, find_users_for_claude_session. - ruff --fix dropped the now-unused imports (Bot, BadRequest, CB_WIN_*). Docs: architecture.md / dm-architecture.md references to the removed interactive_ui helpers corrected to the real mechanism (enter_kb_mode / paint_card_on_carrier). 540 tests pass · ruff clean · pyright 0 errors. Co-Authored-By: Claude Opus 4.7 <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.
Acts on "cut the dead code" + a repo-wide dead-code sweep by two audit agents (a vulture-based static scan + a semantic reachability hunt). Every removal was re-verified by grep (zero real callers), not taken on tool output alone.
1. Dead OpenAI voice backend (commit 1)
VOICE_BACKEND=openaiwas unreachable —config.pycoerces any value not in(auto/whisper/apple/off)toauto, and the per-user voice-setting allowlist excludesopenaitoo. Removed_openai_transcribe, the httpx client (_client/_get_client/close_client), the dispatch branch, the deadopenai_api_key/openai_base_urlconfig fields, the unreachable warning inmessages.py, theapp.pyshutdown call; deleted the openai-onlytest_transcribe.py; trimmedtest_config.py; updated docs/READMEs. (SENSITIVE_ENV_VARSkeeps scrubbingOPENAI_API_KEYfrom subprocess env — a standalone safety measure.)2. Dead modules / functions / scaffolding (commit 2)
handlers/context_poll.py(only referenced by a commented-outcreate_task; the /context-into-pane approach was abandoned for JSONL math) + itsapp.pyscaffolding;handlers/response_builder.py+ its test (no src caller — moved to send layer).interactive_ui{set_interactive_mode,clear_interactive_mode,adopt_interactive_msg,render_interactive_keyboard};bg_status.has_panel_content;directory_browser.build_window_picker;history.get_cached_total_pages;switcher.strip_active_switcher;card_model.Event.is_tool;terminal_parser.STATUS_SPINNERS;session.py{_encode_cwd,clear_active_session,find_session_by_claude_id,set_session_goal,find_users_for_claude_session}.ruff --fixdropped the now-orphaned imports.enter_kb_mode).NOT removed — flagged for a decision (judgment calls, not auto-cut)
max_sessions,preview_live_lag,bg_notify_mode,bg_status_quota_thresholds. Each binds a documented env var; removing drops a spec'd knob.scripts/deploy.sh— unreferenced by docs/code, but a plausible manual operator tool.540 tests pass · ruff clean · pyright 0 errors. No behavior change (all removed code was unreachable/uncalled).
🤖 Generated with Claude Code