AMPR-219: T6 — Activate the relay in the CODE production agent path - #582
Merged
wow-miley merged 2 commits intoJun 15, 2026
Conversation
|
Concept staleness check — 1 warning(s). These changes touched files listed under a concept's Validator output |
Wire the capability/cost-aware CognitiveRelay into one real bundled agent path (SparkBasedAgent.Code, built by AgentFactory for AgentType.CODE) so the full selection seam runs live: AgentDefinition.minimumRung floor -> RoutingContext -> resolveWithMetadata -> model-keyed cost-aware selection -> outbound client. Manual constructor injection, no Koin. - SparkBasedAgent: new _cognitiveRelay/_minimumRung params threaded into the agentConfiguration getter and the Code factory. - CapabilityRoutingDefaults (new): one ByCapability rule per bundled cloud model, in lockstep with the registry seed, so a declared floor is satisfiable. - AgentFactory: builds a real CognitiveRelayImpl + InMemoryModelDescriptorRegistry over the shared eventSerialBus, wired into the CODE path only (THREE floor). PRODUCT/PROJECT/QUALITY stay dormant (null relay). - AgentDefinition.Custom: carries minimumRung (defaults null, non-breaking). SparkBasedAgentRelayActivationTest drives a real Code agent end-to-end: resolves to Gemini 2.5 Pro respecting the floor, emits RouteSelected + RouteResolved, and an unsatisfiable floor throws RoutingFloorUnmetException + emits RouteFloorUnmet with no downgrade. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
#580 added RoutingEvent.RouteFloorUnmet to the sealed hierarchy but left the ampere-cli when-expressions non-exhaustive, breaking :ampere-cli:compileKotlinJvm on main. Now that the activated CODE path actually emits RouteFloorUnmet, the CLI must render it: - EventCategorizer: classify RouteFloorUnmet as CRITICAL (terminal routing failure needing human awareness). - EventRenderer: 🔀 in red, matching the routing-event icon family. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
wow-miley
force-pushed
the
miley/ampr-219-t6-activate-the-relay-in-one-production-agent-path-record
branch
from
June 15, 2026 06:27
142ad3b to
4aaf865
Compare
wow-miley
deleted the
miley/ampr-219-t6-activate-the-relay-in-one-production-agent-path-record
branch
June 15, 2026 06:33
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
Activates the capability/cost-aware
CognitiveRelayin one real bundled agent path —SparkBasedAgent.Code(the agentAgentFactorybuilds forAgentType.CODE) — so the full selection seam runs live at least once:AgentDefinition.minimumRungfloor →RoutingContext→CognitiveRelayImpl.resolveWithMetadata→ model-keyed cost-aware selection → outbound client. Manual constructor injection, no Koin.Closes the antipattern AMPR-219 targets: the tier system is no longer assertion-only — it has a live consumer, validated end-to-end, with a recorded go/no-go verdict.
Resolves AMPR-219 / #575.
Changes
SparkBasedAgent.kt— new_cognitiveRelay/_minimumRungconstructor params, threaded into theagentConfigurationgetter (cognitiveRelay,AgentDefinition.Custom(minimumRung = …)) and exposed on theCodefactory.CapabilityRoutingDefaults.kt(new) — oneByCapabilityrule per bundled cloud model, in lockstep with theInMemoryModelDescriptorRegistryseed. Without it any declared floor would always beFloorUnmet.AgentFactory.kt— builds a realCognitiveRelayImpl+InMemoryModelDescriptorRegistryover the sharedeventSerialBus, wired into the CODE path only (DEFAULT_CODE_AGENT_RUNG = THREE). PRODUCT / PROJECT / QUALITY stay dormant (null relay).AgentDefinition.kt—Customfactory now carriesminimumRung(defaultsnull→ non-breaking for existing callers).Validation (end-to-end, not unit-only)
SparkBasedAgentRelayActivationTestdrives a realSparkBasedAgent.Codethrough its owncallLLMseam:Code(...)setscognitiveRelayand declaresminimumRung = THREE.RouteSelected+RouteResolved(cost-aware, candidateCount > 1).RoutingFloorUnmetException+ emitsRouteFloorUnmet; the outbound client is never invoked../gradlew :ampere-core:jvmTest(new test + existingAgentDefinitionRungThreadingTest/SparkBasedAgentCodeFactoryTest),:ampere-core:compileCommonMainKotlinMetadata, andktlintFormatpass.Out of scope
🤖 Generated with Claude Code