v6.2.2: AI agent resilience, credential caching, and SQL parser fixes
A patch release for the certified 6.2 LTS line focused on AI agent execution reliability, prompt caching optimizations, and credential cache consistency. Key updates include holding refused agent completion changes, run-scoped circuit breakers for agent-local tools, nested payload path key resolution, and prompt caching improvements for Gemini. Additional fixes cover PostgreSQL migration stability, multi-server credential caching, SQL parser set operations, IS-A tab navigation hangs, and React component runtime loading.
MemberJunction 6.x is released under the Business Source License 1.1; 5.x and earlier stay ISC. What the licence grants, and what needs certification, is in the licence section of the v6 upgrade guide.
Bug Fixes
Section titled “Bug Fixes”- Refused agent completions hold payload changes (
@memberjunction/ai-agents,@memberjunction/integration-test-suite): a completion refused by Success validation (such asFinalPayloadValidation, minimum executions, or self-checks) now holds itspayloadChangeRequestinstead of discarding it. Previously, models answered a refusal with only corrections rather than full replacements, causing subsequent completion attempts to run against payloads that had lost earlier updates and fail again on already-sent fields. The held changes are made visible to subsequent prompts, merged with follow-up changes, and committed only when a completion is accepted. Unaccepted held changes are dropped if the run ends without success. When a change is refused, the model is notified that the change is held and instructed to send only corrections. In addition, the notification calculation now uses the raw model step before validation so in-place step transformations by subclasses do not incorrectly mark applied changes as discarded, and envelope responses include the discarded change as JSON. - Agent-local tools enforce a run-scoped circuit breaker (
@memberjunction/ai-agents): driver tools returned byBaseAgent.GetAgentToolsnow track call failures across a run and stop executing after repeated errors, matching the behavior of action circuit breakers. Calls with identical arguments are refused after 2 failures, and after 5 total failures across any arguments, the tool is disabled for the remainder of the agent run. Tools can opt out by settingUsesCircuitBreaker: falseinAgentToolDefinition, or across an entire agent type by settingUsesActionCircuitBreaker: false. - Payload change requests support path keys and nested array permissions (
@memberjunction/ai-agents):ApplyAgentChangeRequestnow resolves path keys (such as"meta.title"or"dependencies[2].code") to target nested payload values instead of creating literal top-level keys containing dots or brackets. InallowedPaths(PayloadSelfWritePaths), permissions are now evaluated against full paths (e.g.dependencies.2.code), allowing write access to be granted on specific fields within array elements (e.g.allowedPaths: ["dependencies.*.code"]). Pattern matching for[*]and[n]element indices and multi-segment**wildcards has also been fixed. - Agent JSON parsing and payload merges reject prototype keys (
@memberjunction/ai-agents): keys named__proto__,constructor, andprototypeare stripped when parsing agent JSON replies and whenPayloadManagerapplies change requests, merges, or clones payloads, preventing prototype pollution through agent responses. - Prompt parameter data added after super calls is retained in runtime state (
@memberjunction/ai-agents): trailing<mj-runtime-state>messages are now constructed afterpreparePromptParamscompletes rather than duringsuper.preparePromptParams(). Previously, template parameters added by agent subclasses after invokingsuperwere omitted from the cached pre-rendered child prompt when a specialization was relocated. - Relocated agent specializations re-render with native tool-calling flags (
@memberjunction/ai-core-plus,@memberjunction/ai-prompts,@memberjunction/ai-agents): when a Loop agent pre-renders a relocated child prompt into the trailing runtime-state message, it now re-renders the message after model selection determines the_NATIVE_TOOL_CALLINGand_NATIVE_CONTROL_FLOWflags.AIPromptParamsadds anOnTemplateDataFinalizedcallback executed by the runner before rendering, ensuring child prompts adopt the correct native or envelope wording matching the system prompt. - Prompt runner WeakMaps are shared across package copies (
@memberjunction/ai-prompts): native tool-calling decisions and sent-prefix fingerprints recorded by prompt runners are now stored in the process-wide Global Object Store rather than module-scopedWeakMaps. In environments with multiple physical installs of@memberjunction/ai-prompts, this prevents class lookup failures where tool results were lost and prompt caching was disabled. - Gemini prompt caching optimized with fixed user anchors and turn separators (
@memberjunction/ai-gemini): Gemini API calls now open with a fixed initial user/model turn anchor pair, allowing Gemini’s implicit prompt cache to reuse system prompt prefix tokens across consecutive agent loop calls. Additionally, consecutive user text messages are separated by short model turns ("OK"), preventing growing user turns from breaking cache reuse during envelope-path agent runs. Empty user turns are dropped to avoid trailing empty message errors. - Tool-call-only turns no longer log false parse errors (
@memberjunction/ai-prompts): prompt runs where the model responds strictly with native tool calls no longer record anErrorMessagestating “Failed to parse result into expected format; raw output saved instead”, eliminating log noise during standard tool execution turns. - Peer server cache updates reload encrypted credential fields instead of storing ciphertext (
@memberjunction/core,@memberjunction/credentials):BaseEnginenow triggers a full cache slot reload rather than applying peer cache events (setorrow_delta) that contain raw ciphertext ($ENC$...) on encrypted fields. This prevents multi-server environments sharing Redis from storing un-decrypted ciphertext in memory or returning empty values onGetCredential. Unparseable credential values now throwCredentialValuesUnreadableErrorwith sanitized error messages. - Credential timestamp updates are throttled to reduce database writes and update conflicts (
@memberjunction/credentials):CredentialEnginenow throttles writes forLastUsedAtandLastValidatedAtto at most once per minute per credential per process (TimestampTouchIntervalMs, defaulting to 60000ms). This prevents high-throughput API reads from generating excessive full-row database updates and eliminates race conditions where timestamp saves reverted concurrent key rotations. Failed touches retry on the next read. - PostgreSQL 6.1.x to 6.2 upgrade migration restores pruned virtual EntityFields (
@memberjunction/core): fixed PostgreSQL upgrade failures inV202611012253__v6.2.x__Metadata_Synccaused by missingFK_QueryField_SourceEntityFieldforeign key references (#6557). The migration script now restores the 27 virtualEntityFieldrows removed byR__RefreshMetadataat the end of 6.1.x runs before metadata synchronization executes. - Strict SQL parser accepts set operations and extended TransactSQL syntax (
@memberjunction/sql-parser,@memberjunction/generic-database-provider,@memberjunction/server):StrictFragmentValidator.ValidateReadOnlyStatementnow accepts set operations (UNION,UNION ALL,INTERSECT,EXCEPT) where all combined statements are valid read-onlySELECTqueries. The validator also uses a strict-only rewriting pass to parse SQL Server and PostgreSQL syntax omitted by standard grammars, includingSTRING_AGG(...) WITHIN GROUP,TRY_CAST,COUNT_BIG(*),RANGEwindow frames,LIKE ... ESCAPE,TOP ... WITH TIES, andOFFSET ... FETCHclauses. - IS-A entity hierarchy tab navigation no longer freezes browser tabs (
@memberjunction/ng-explorer-core,@memberjunction/ng-base-forms):ComponentCacheManagernow incorporates the entity discriminator into cache keys forRecordResourceandRecordstabs. Previously, because parent and child entities in an IS-A hierarchy share the same primary key (recordId), the cache manager returned detached parent components for child tab requests, causing an infinite synchronous reload loop. A cycle guard was also added toMjFormToolbarComponent.ChildChain. - React component runtime supports subresource loading on opaque origins (
@memberjunction/react-runtime): component library scripts and stylesheets can now load on pages with opaque origins (such asabout:blank,srcdoc, sandboxediframes, anddata:URLs). Relative subresource URLs are resolved againsthttps://localhostwhenwindow.location.originis"null", preventing URL resolution errors while preserving scheme security checks. - React linter handles missing SQL types and deduplicates validator error logs (
@memberjunction/react-linter):MapSQLTypeToJSTypenow treats missing SQL type metadata as'unknown'instead of throwing aTypeError. Library lint validators now log errors once per lint pass rather than per AST node, eliminating verbose log output, andLintComponentfalls back to spec component names to prevent crash loops when component names are omitted. - Metadata lint rules and component specifications updated (
@memberjunction/core): thecheck-chart-ref-managementApexCharts lint rule now runs once per lint pass and supports arrow-function components, fixing recursive AST re-traversals. The DataGrid component specification and guidance examples were updated to demonstrate properonRowClickusage without causing duplicate record open calls. - Distribution applications omit workspace prebundle excludes (
@memberjunction/installer): installer distribution templates no longer ship@memberjunction/*packages inangular.jsonprebundle excludes. This allows npm-installed distribution applications runningng serveto resolve third-party library dependencies (such askatex) directly under pnpm without requiring explicit top-level package declarations.