Repository navigation
feat(core): explicit activePoints() declarations win; undeclared middlewares are auto-detected - #3579
Merged
juruoO-o merged 10 commits intoNov 11, 2026
Conversation
activePoints() is now abstract: participation is only what a middleware explicitly declares — no default "active everywhere", and a null declaration fails fast at agent construction. middlewaresAt() lists only explicit declarants. All in-repo implementations now declare exactly the points they hook; EN/ZH middleware docs updated. Also give ChatSessionsTest a single calibrated 30s wait bound; the old 15s block timed out on loaded parallel builds. Migration: implement activePoints() with the hooked points (or EnumSet.allOf to keep prior behavior); rebuild third-party middleware jars against this version.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Conflict and semantic resolutions: - ChatSessionsTest#injectionDoesNotStartExecutionAndSurvivesRestart: keep main's 60s await ceiling (upstream deflake for the 16.5s CI run under -T1C) instead of the branch's 30s constant at this site; the ceiling only bounds the failure deadline, so the happy path is unchanged. - SubagentFactoryDeclarationTest (new on main): the anonymous MiddlewareBase now declares activePoints() = ON_AGENT as required by this branch's explicit active-points contract.
…oints Semantic conflict resolutions (activePoints() is now abstract): - OpenAIDecisionsMiddlewareExample.ModelAudit declares ON_MODEL_CALL - A2aAgentTest anonymous middlewares declare ON_REASONING / ON_AGENT
✅ Preview approved@juruoO-o approved a Mintlify preview for commit |
…oints Conflict resolution and contract adaptation: - ContextConventionsMiddleware: keep our explicit activePoints() declaration alongside main's new order() override and reset-warning logging (mutually orthogonal changes) - Adapt main's new anonymous MiddlewareBase tests to the abstract activePoints() contract: ReActAgentPostActingFeedbackTest and StructuredOutputRequestPreparationTest declare ON_MODEL_CALL, ContextConventionsResetOrderTest declares ON_SYSTEM_PROMPT
…under -T1C contention notificationReachesModelRequestUnderRealScheduling asserted on MockModel.getLastMessages(), but the HarnessAgent post-call memory maintenance (flush -> consolidation) reuses the same model and appends its consolidation request shortly after the call returns. Under -T1C full-verify load the consolidation request can land before the test reads the last recorded request, so the assertion saw the consolidation prompt instead of this call's reasoning request (PR CI, ubuntu job). Select the reasoning request by its user message from getRecordedMessages() instead of racing the background pipeline on the last entry.
…lewares are auto-detected Replace the abstract activePoints() contract with a compatible three-tier design: explicit non-null declarations are authoritative (read once at agent construction), the null default delegates participation to per-class auto-detection of implemented hooks (inherited implementations count, cached via ClassValue), and the empty set keeps registration with zero participation. - MiddlewareBase: activePoints() keeps its default (returns null); ExtensionPoint constants carry their hook method name for detection; javadoc documents the compatibility-only null default and the new-point review rule (side-effect activation never by detection alone) - new ActivePointsResolver: resolve/infer (middleware dimension) and middlewaresAt(point, Supplier)/groupByPoint (point dimension); ReActAgent delegates construction-time grouping, frozen snapshot unchanged - tests: inference semantics (null/default, inherited, zero-hook), resolver unit tests, declaration-consistency checks folded into the core/harness ActivePoints tests - docs: EN/ZH middleware guide updated to the three-tier contract
…udgets under -T2C contention doesNotLoseMessageWhenCursorPersistenceInterruptsThePoll used a 10s method timeout with a 4s latch await while exercising the same loopback polling machinery as its sibling test (which already uses 30s/10s). Under -T2C reactor contention the failed-save redelivery cycle exceeds those budgets and JUnit cuts the method mid-await. Align both budgets with the sibling test; assertions unchanged.
…gets under -T2C contention The routing tests await the async submit -> factory -> agent-run -> status=success pipeline with 5s budgets; under -T2C reactor contention the full cycle can exceed them (observed at 21s elapsed). Raise the await ceiling to 30s — the 25ms poll returns as soon as the condition holds, so the budget only matters under contention; assertions unchanged.
juruoO-o
approved these changes
Nov 11, 2026
juruoO-o
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the explicit-declaration-first resolution and null/default hook inference, including inherited implementations and per-class caching. The implementation matches the agreed design; no blocking issues found. The previous revision passed 40 focused Core/Harness tests locally; the latest update merges main without changing the resolver contract. Merge remains subject to the latest required CI and CLA checks passing.
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.
Fixes #3576
Summary
MiddlewareBase#activePoints()keeps itsdefault— fully source- and binary-compatible: no compile errors, precompiled third-party jars keep running — but the contract is now three-tier:EnumSet.noneOf(...)keeps registration with zero participation (runtime switch);EnumSet.allOf(...)explicitly opts into every point.null, the default) = auto-detection. Participation is inferred per class — computed once and cached — from the hook methods the class actually implements; implementations inherited from superclasses count.ExtensionPointconstants now carry their hook method name to drive detection.nulldefault exists solely for API compatibility with middlewares written before this contract and may change in a future release — do not rely on it. All in-repo middlewares declare.New
ActivePointsResolverowns participation in both dimensions:resolve/infer(middleware → points) andmiddlewaresAt(point, Supplier)/groupByPoint(points → middleware).ReActAgentdelegates its construction-time grouping to it; its frozen snapshot and publicmiddlewaresAt(point)behavior are unchanged.Why
activePoints()participated at every point — including points added in future releases — somiddlewaresAt(point)mixed real participants with middlewares swept in by default, and the documented "no participants → no wrapper" optimization was unreachable on any real chain.!middlewaresAt(point).isEmpty().Behavioral note (compatible, but visible)
nullpreviously meant "all points"; it now means "auto-detect from implemented hooks". For code that relied on the old default this only removes vacuous participation (pass-through slots); hooks that are actually implemented keep firing.middlewaresAt()results shrink accordingly — that is the fix.Changes
ActivePointsResolver(explicit-wins resolution, per-classClassValue-cached hook detection, point-dimension queries);activePoints()default returnsnullwith rewritten javadoc;ExtensionPointconstants carry their hook method name;ReActAgentgroups via the resolver at construction (frozen map and public behavior unchanged).*ActivePointsTests.