-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: protocols audit follow-up (REVIEW + fold pass) #1869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
82133e0
refactor: document KEEP rationale for 5 _PrivatePrefixed protocol seams
Aureliolo 964a407
refactor: remove 5 dead/single-consumer typing-seam protocols
Aureliolo c47abca
refactor: fold duplicate-named ConflictDetector and SignalAggregator …
Aureliolo 690d1d0
refactor: annotate _MAX_EVIDENCE_LENGTH and _MAX_INHERITANCE_DEPTH as…
Aureliolo ec29efa
refactor: drop stale line numbers from _AsyncStartStop rationale comment
Aureliolo 89d975b
docs: reconcile REVIEW-row math in protocols-audit.md
Aureliolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |||||
| :class:`RoutingScorerConfig` (resolved at construction time). | ||||||
| """ | ||||||
|
|
||||||
| from typing import TYPE_CHECKING, Final, Protocol | ||||||
| from typing import TYPE_CHECKING, Final | ||||||
|
|
||||||
| from pydantic import BaseModel, ConfigDict, Field, model_validator | ||||||
|
|
||||||
|
|
@@ -23,6 +23,7 @@ | |||||
| if TYPE_CHECKING: | ||||||
| from synthorg.core.agent import AgentIdentity | ||||||
| from synthorg.engine.decomposition.models import SubtaskDefinition | ||||||
| from synthorg.settings.bridge_configs import EngineBridgeConfig | ||||||
|
|
||||||
| logger = get_logger(__name__) | ||||||
|
|
||||||
|
|
@@ -37,33 +38,6 @@ | |||||
| _WEIGHT_SUM_WARN_CEILING: Final[float] = 1.3 # lint-allow: magic-numbers -- ceiling | ||||||
|
|
||||||
|
|
||||||
| class _RoutingScorerBridge(Protocol): | ||||||
| """Structural type for the EngineBridgeConfig fields the scorer reads. | ||||||
|
|
||||||
| Declared locally to break the import cycle that would otherwise | ||||||
| pull ``settings.bridge_configs`` into the engine routing module. | ||||||
| The fields are exposed as ``@property`` so this Protocol matches | ||||||
| frozen Pydantic models (whose attributes are read-only). Mypy | ||||||
| validates the attribute mapping in ``from_bridge_config`` against | ||||||
| this Protocol; any caller passing an object missing one of the | ||||||
| fields gets a static type error rather than a runtime | ||||||
| ``AttributeError``. | ||||||
| """ | ||||||
|
|
||||||
| @property | ||||||
| def routing_weight_primary_skill(self) -> float: ... | ||||||
| @property | ||||||
| def routing_weight_secondary_skill(self) -> float: ... | ||||||
| @property | ||||||
| def routing_weight_tag_match_bonus(self) -> float: ... | ||||||
| @property | ||||||
| def routing_weight_role_match_bonus(self) -> float: ... | ||||||
| @property | ||||||
| def routing_weight_seniority_alignment_bonus(self) -> float: ... | ||||||
| @property | ||||||
| def routing_min_score(self) -> float: ... | ||||||
|
|
||||||
|
|
||||||
| class RoutingScorerConfig(BaseModel): | ||||||
| """Operator-tunable configuration for :class:`AgentTaskScorer`. | ||||||
|
|
||||||
|
|
@@ -116,13 +90,13 @@ def _check_weight_sum(self) -> RoutingScorerConfig: | |||||
| return self | ||||||
|
|
||||||
| @classmethod | ||||||
| def from_bridge_config(cls, bridge: _RoutingScorerBridge) -> RoutingScorerConfig: | ||||||
| def from_bridge_config(cls, bridge: EngineBridgeConfig) -> RoutingScorerConfig: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
| """Project the routing-scorer subset out of an ``EngineBridgeConfig``. | ||||||
|
|
||||||
| Typed via the local ``_RoutingScorerBridge`` Protocol so mypy | ||||||
| validates the attribute mapping without forcing a runtime | ||||||
| import of ``settings.bridge_configs`` (which would create a | ||||||
| cycle through the engine namespace). | ||||||
| ``EngineBridgeConfig`` is imported under ``TYPE_CHECKING`` so the | ||||||
| routing module stays free of a runtime dependency on | ||||||
| ``settings.bridge_configs`` (which would cycle through the engine | ||||||
| namespace). | ||||||
| """ | ||||||
| return cls( | ||||||
| primary_skill_weight=bridge.routing_weight_primary_skill, | ||||||
|
|
||||||
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
EngineBridgeConfigtype is only imported within aTYPE_CHECKINGblock. Since this file does not usefrom __future__ import annotations, Python will attempt to evaluate the type hint at runtime when the class is defined, leading to aNameError. You should wrap the type hint in quotes to treat it as a forward reference.