Skip to content

refactor(rlm): delete dead run_rlm_turn entry points (#6511) - #6611

Open
Hmbown wants to merge 1 commit into
mainfrom
ms-6511-rlm-dead-entry
Open

Hmbown wants to merge 1 commit into
mainfrom
ms-6511-rlm-dead-entry

Conversation

@Hmbown

@Hmbown Hmbown commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Refs #6511

Removes the last dead RLM entry points from #6511. The wall-clock bound is a separate question waiting on a founder decision, so this PR leaves it alone. turn_timeout() and the module doc about it are unchanged.

What changed

  • Deleted pub async fn run_rlm_turn and run_rlm_turn_with_root (crates/tui/src/rlm/turn.rs) and their re-export in rlm/mod.rs. rg over the workspace and tests found no callers. The only live path is bridge.rs → run_rlm_turn_inner_with_usage.
  • Their pub signatures put CodewhaleClient and Event into the crate's public API. That made rustc treat a set of test-only items as live. Removing the entry points unmasked 15 dead-code errors. This PR resolves them without changing production behavior:
    • Now #[cfg(test)] (only tests use them): run_rlm_turn_inner, CodewhaleClient::refresh_catalog_cache and publish_provider_lake_scope, ErrorEnvelope::{fatal, network}, redact_api_key_from_message, LlmError::from_http_response_with_request_context, provider_lake::replace_provider_live_snapshot, ProviderAvailability::label, ToolInspectionSnapshot::from_prepared_request, UserInputRequest::{from_value, validate}. Production already calls the *_with_limits forms, so validation at the trust boundary is unchanged.
    • Deleted (nothing used them, tests included): ToolVisibility::{RegistryOnly, Hidden}, AuthenticationErrorContext::new, AuthenticationErrorDetail::message, ErrorEnvelope::tool.
    • Event::ElevationRequired now has cfg_attr(not(test), expect(dead_code)). The TUI, runtime threads, exec agent and protocol parity all handle it, but the engine never emits it (git log -S shows no emitter in core/). Choosing between wiring an emitter and removing the sandbox-elevation flow is out of scope here. This adds one expect to the dead-code count, which goes from 259 to 260 and stays under the budget of 272.

Verification (local)

  • CARGO_BUILD_JOBS=4 scripts/dev-cargo.sh clippy -p codewhale-tui --all-targets --locked -- -D warnings -A clippy::uninlined_format_args -A clippy::too_many_arguments -A clippy::unnecessary_map_or: clean. The same command without --all-targets on origin/main was also clean, and the errors listed above appeared only after the deletion.
  • scripts/dev-cargo.sh test -p codewhale-tui --lib --locked -- rlm:: tool_inspection:: tools::user_input:: error_taxonomy:: llm_client:: refresh_catalog_cache provider_lake::: 201 passed, 0 failed.
  • cargo fmt --all -- --check, check-blocking-calls-budget.py, check-dead-code-budget.py, check-command-crate-boundaries.py, split/module_graph.py --check: all pass.
  • I did not run the full workspace suite locally. CI runs it.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings September 26, 2026 05:45
@Hmbown Hmbown added this to the v0.10.1 milestone Sep 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…y points

Neither public entry point had a caller; the live path is the bridge's
recursive run_rlm_turn_inner_with_usage. Their pub signatures put
CodewhaleClient and Event into the crate's public API, which kept a set of
test-only items looking "live" to rustc. Removing them unmasks that set, so
this also:

- gates test-only helpers with #[cfg(test)]: run_rlm_turn_inner,
  CodewhaleClient::refresh_catalog_cache + publish_provider_lake_scope,
  ErrorEnvelope::{fatal,network}, redact_api_key_from_message,
  LlmError::from_http_response_with_request_context,
  replace_provider_live_snapshot, ProviderAvailability::label,
  ToolInspectionSnapshot::from_prepared_request,
  UserInputRequest::{from_value,validate} (production uses the *_with_limits
  forms). No production behavior changes.
- deletes items nothing used, not even tests: ToolVisibility::{RegistryOnly,
  Hidden}, AuthenticationErrorContext::new,
  AuthenticationErrorDetail::message, ErrorEnvelope::tool.
- marks Event::ElevationRequired with cfg_attr(not(test), expect(dead_code)):
  every consumer handles it, but the engine never emits it. Wiring an emitter
  or removing the elevation flow is a separate decision.

The RLM wall-clock bound (rest of #6511) is untouched and still open.

Verification:
- scripts/dev-cargo.sh clippy -p codewhale-tui --all-targets --locked with
  CI's flags (-D warnings, 3 allows): clean
- scripts/dev-cargo.sh test -p codewhale-tui --lib -- rlm:: tool_inspection::
  tools::user_input:: error_taxonomy:: llm_client:: refresh_catalog_cache
  provider_lake:: : 201 passed, 0 failed
- cargo fmt --check, blocking-calls budget, dead-code budget (260 <= 272),
  command-crate boundaries, module_graph --check: pass

Refs #6511

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

2 participants