refactor(gateway): extract message/config helpers from run.py (slice 2 of #54962) - #77438
Open
andrexibiza wants to merge 3 commits into
Open
refactor(gateway): extract message/config helpers from run.py (slice 2 of #54962)#77438andrexibiza wants to merge 3 commits into
andrexibiza wants to merge 3 commits into
Conversation
…2 of NousResearch#54962) Second slice of the gateway god-file unpacking: extract the Slack ignored-channel guard, CSV/list-to-set normalization, parent-channel resolution, and message-timestamp opt-in check into gateway/message_config_helpers.py with no behavior change. - gateway/run.py: -65 lines; the 5 helpers are now imported from the module (module-attribute imports keep existing tests green) - gateway/message_config_helpers.py: new module, pure functions, no module state — directly unit-testable Follow-up to NousResearch#77433 (display helpers, slice 1). Progress on NousResearch#54962. Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
… of NousResearch#54962) Third slice of the gateway god-file unpacking: extract build_resume_recovery_note, _build_replay_entry and the shared _ASSISTANT_REPLAY_FIELDS whitelist into gateway/resume_replay_helpers.py. - Byte-identical extraction (AST-verified against origin/main): no behavior change - gateway/run.py: -172 lines; helpers imported at the extraction point (module-attribute imports keep existing tests green) - 43 tests pass across replay-entry, resume-pending, and message timestamp suites Follow-up to NousResearch#77433 (slice 1) and NousResearch#77438 (slice 2). Progress on NousResearch#54962. Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
Contributor
Author
|
Update: this PR now also carries slice 3 (same branch, second commit). Slice 3 — resume/replay helpers (
|
8 tasks
andrexibiza
added a commit
to andrexibiza/hermes-agent
that referenced
this pull request
Aug 3, 2026
… 5 of NousResearch#54962) Fifth slice of the gateway god-file unpacking: extract _is_transient_network_error and _gateway_loop_exception_handler into gateway/error_helpers.py. - Byte-identical extraction (AST-verified against origin/main): the classifier walks the exception cause chain (NousResearch#31066/NousResearch#31110); the loop handler wires it into the event-loop safety net - gateway/run.py: -78 lines; helpers imported at the extraction point - 46 tests pass (loop exception handler + compression notices) Follow-up to NousResearch#77433 (slice 1), NousResearch#77438 (slices 2-3), NousResearch#77450 (slice 4). Progress on NousResearch#54962. Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
8 tasks
…(slice 3 of NousResearch#54962)" This reverts commit c672092.
Open
9 tasks
19 tasks
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.
Related #54962 #55138 #77433
What does this PR do?
Second slice of the Extract Gateway Platform Routing from
gateway/run.py refactor (#54962, #55138) — follow-up to #77433 (slice 1:
display helpers).
This slice pulls the message/config helper cluster out of the
26,700-line god-file into
gateway/message_config_helpers.py:_csv_or_list_to_set— config list / comma-scalar normalization_slack_ignored_channels_from_gateway_config— runner-level Slackchannel blacklist guard (fail-safe below the adapter's first-line drop)
_slack_parent_channel_id— thread-scoped chat ID → parent channel_is_slack_ignored_channel— the dispatch-time blacklist check_message_timestamps_enabled— gateway.message_timestamps opt-inNo behavior change: pure move + import.
gateway/run.pyshrinks by65 lines; the extracted functions are module-attribute-imported so
existing tests that reference them via
gateway.runstay green.The extracted module has no module state — everything derives from
arguments, so the helpers are directly unit-testable (the existing
test_message_timestamps.pyandtest_slack_runner_ignored_channels.pycover them; 5 pure-logic tests pass on this branch).
Scope honesty
The full platform-routing extraction from a 26.7K-line file is a
multi-PR effort. This is slice 2 of that series, using the same verified
pattern as slice 1 (module + import + shrink). Platform adapters and the
dispatch loop remain for follow-up slices.
How to test
What platforms were tested?
tests pass,
git diff --checkclean, attribution audit clean.Why this matters
Every slice shrinks the largest file in the codebase and gives extracted
helpers direct coverage.
gateway/run.pyis down from 26,819 to 26,600lines across slices 1-2, with more to come.
Part of #54962
Part of #55138 (Extract Gateway Platform Routing)
Checklist
git diff --checkcleanPart of #78647