refactor(acp): decompose long functions in zeph-acp agent module#3472
Merged
refactor(acp): decompose long functions in zeph-acp agent module#3472
Conversation
Extract private helpers from three functions that suppressed clippy::too_many_lines with deferred TODOs: - do_new_session: evict_oldest_idle_session_if_full, spawn_notify_drainer, build_new_session_response - do_prompt: is_acp_native_slash_command, acquire_prompt_channels, persist_user_message_async, compute_stop_reason, build_prompt_response - run_agent: promote req_handler!/notif_handler! macros to module scope, reducing function body below the lint threshold Also wire spawn_notify_drainer in do_load_session, do_fork_session, and do_resume_session (DRY fix), and add /compact to is_acp_native_slash_command. Removes all three #[allow(clippy::too_many_lines)] suppressions. No public API changes. Closes #3459
This was referenced Apr 26, 2026
bug-ops
added a commit
that referenced
this pull request
Apr 26, 2026
/compact was incorrectly added to is_acp_native_slash_command in PR #3472, causing the ACP layer to intercept it and return "unknown command: /compact" instead of forwarding it to the core agent loop where CompactCommand is handled. Remove the /compact predicate from is_acp_native_slash_command and drop it from the /help text in handle_slash_command. Closes #3474
bug-ops
added a commit
that referenced
this pull request
Apr 26, 2026
/compact was incorrectly added to is_acp_native_slash_command in PR #3472, causing the ACP layer to intercept it and return "unknown command: /compact" instead of forwarding it to the core agent loop where CompactCommand is handled. Remove the /compact predicate from is_acp_native_slash_command and drop it from the /help text in handle_slash_command. Closes #3474
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
clippy::too_many_lineswith deferred TODOs incrates/zeph-acp/src/agent/mod.rsreq_handler!/notif_handler!macros to module scope forrun_agentdo_load_session,do_fork_session,do_resume_sessionnow callspawn_notify_drainerinstead of inlining the drainer block/compacttois_acp_native_slash_command(was listed in/helpbut not intercepted)Helpers added
evict_oldest_idle_session_if_fulldo_new_sessionspawn_notify_drainerdo_new_session(now alsodo_load_session,do_fork_session,do_resume_session)build_new_session_responsedo_new_sessionis_acp_native_slash_commanddo_promptacquire_prompt_channelsdo_promptpersist_user_message_asyncdo_promptcompute_stop_reasondo_promptbuild_prompt_responsedo_promptTest plan
cargo clippy -p zeph-acp --all-features -- -D warnings— cleancargo nextest run -p zeph-acp --all-features --lib --bins— 72/72 passed#[allow(clippy::too_many_lines)]suppressions removed;do_fork_sessionsuppression untouchedCloses #3459