AMPR-216: T3 — Typed failure + RoutingEvent when no model meets the floor - #580
Merged
wow-miley merged 1 commit intoJun 15, 2026
Conversation
…loor Adds RoutingResolution.FloorUnmet sealed variant and RouteFloorUnmet event so a rung floor that no model satisfies is terminal and never silently downgrades to a sub-floor AIConfiguration. - RoutingResolution → sealed interface (Success | FloorUnmet) - RouteFloorUnmet event (HIGH urgency) emitted on EventSerialBus alongside existing RouteSelected/RouteFallback/RouteResolved events - CognitiveRelayImpl.resolveWithMetadata detects floor-unmet when minRung is set and no ByCapability rule's descriptor meets it; bestAvailableRung carried for diagnostics - CognitiveRelayImpl.resolve throws RoutingFloorUnmetException on FloorUnmet - AgentLLMService throws RoutingFloorUnmetException rather than silently downgrading when resolveWithMetadata returns FloorUnmet - SignificanceAwareEventLogger handles RouteFloorUnmet as SIGNIFICANT - CognitiveRelayFloorTest: 8 tests covering FloorUnmet result, terminal behaviour, exception throw, event emission, and no-floor-unmet for satisfiable or floor-absent requirements - Existing resolveWithMetadata call sites updated for sealed return type Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Concept staleness check — 4 warning(s). These changes touched files listed under a concept's Validator output |
wow-miley
deleted the
miley/ampr-216-t3-typed-failure-routingevent-when-no-model-meets-the-floor
branch
June 15, 2026 05:55
wow-miley
added a commit
that referenced
this pull request
Jun 15, 2026
#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
added a commit
that referenced
this pull request
Jun 15, 2026
#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
added a commit
that referenced
this pull request
Jun 15, 2026
…582) * AMPR-219: T6 — Activate the relay in the CODE production agent path 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> * AMPR-219: Handle RouteFloorUnmet in CLI event when-expressions #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> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
RoutingResolutiona sealed interface (Success|FloorUnmet) so a rung floor that no registered model satisfies is a typed, terminal result — not a silent downgradeRoutingEvent.RouteFloorUnmet(HIGH urgency) emitted onEventSerialBusalongside existing routing events, carryingrequestedFloorandbestAvailableRungfor diagnosticsCognitiveRelayImpl.resolvethrowsRoutingFloorUnmetException;resolveWithMetadatareturnsFloorUnmet— callers choose which API surface to useAgentLLMServicethrowsRoutingFloorUnmetExceptionrather than silently falling through to a sub-floor configChanges
RoutingResolution→ sealed interface (Success,FloorUnmet) inCognitiveRelay.ktRouteFloorUnmetdata class added toRoutingEvent.ktRoutingFloorUnmetException(new file) for theresolve()throw pathCognitiveRelayImpl: floor-unmet detection +emitRouteFloorUnmet+bestRungAmongCapabilityRuleshelperSignificanceAwareEventLogger:RouteFloorUnmet→SIGNIFICANTAgentLLMService: handlesFloorUnmetsealed variantCognitiveRelayPassthrough,CognitiveRelayCapabilityTest,CognitiveRelayCostTest,CognitiveRelayImplTest,RoutingEventTest: updated for sealedRoutingResolutionCognitiveRelayFloorTest(new): 8 tests covering all validation criteria from the ticketTest plan
FloorUnmetreturned whenminRung = THREEand best available is rung TWOSuccessreturned when a rung THREE model exists and matchesAIConfigurationproducedresolve()throwsRoutingFloorUnmetExceptionwith correctrequestedFloor/bestAvailableRungRouteFloorUnmetevent emitted onEventSerialBuswith correct fieldsRouteSelectedNOT emitted when floor is unmetnullbestAvailableRungwhen registry has no descriptors for the configured rulesno minRungrequirement resolves toSuccessnormallyCloses: AMPR-216 · Depends on: #577 (T2)
🤖 Generated with Claude Code