Skip to content

chore: remove dead code (OpenAI voice backend + dead modules/functions)#100

Merged
Time4Mind merged 2 commits into
mainfrom
chore/remove-dead-code
May 23, 2026
Merged

chore: remove dead code (OpenAI voice backend + dead modules/functions)#100
Time4Mind merged 2 commits into
mainfrom
chore/remove-dead-code

Conversation

@Time4Mind
Copy link
Copy Markdown
Owner

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=openai was unreachableconfig.py coerces any value not in (auto/whisper/apple/off) to auto, and the per-user voice-setting allowlist excludes openai too. Removed _openai_transcribe, the httpx client (_client/_get_client/close_client), the dispatch branch, the dead openai_api_key/openai_base_url config fields, the unreachable warning in messages.py, the app.py shutdown call; deleted the openai-only test_transcribe.py; trimmed test_config.py; updated docs/READMEs. (SENSITIVE_ENV_VARS keeps scrubbing OPENAI_API_KEY from subprocess env — a standalone safety measure.)

2. Dead modules / functions / scaffolding (commit 2)

  • Modules: handlers/context_poll.py (only referenced by a commented-out create_task; the /context-into-pane approach was abandoned for JSONL math) + its app.py scaffolding; handlers/response_builder.py + its test (no src caller — moved to send layer).
  • Functions: 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 --fix dropped the now-orphaned imports.
  • Docs corrected where they named removed helpers (the switcher-tap bg-prompt path actually uses enter_kb_mode).

NOT removed — flagged for a decision (judgment calls, not auto-cut)

  • 4 config knobs read but never consumed: max_sessions, preview_live_lag, bg_notify_mode, bg_status_quota_thresholds. Each binds a documented env var; removing drops a spec'd knob.
  • ~20 orphan i18n keys (×3 langs) — the UI uses hardcoded English strings instead; either delete the keys or wire the UI.
  • 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

Time4Mind and others added 2 commits May 23, 2026 14:44
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>
@Time4Mind Time4Mind merged commit 9159150 into main May 23, 2026
4 checks passed
@Time4Mind Time4Mind deleted the chore/remove-dead-code branch May 23, 2026 11:57
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