Skip to content

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.

  • Refused agent completions hold payload changes (@memberjunction/ai-agents, @memberjunction/integration-test-suite): a completion refused by Success validation (such as FinalPayloadValidation, minimum executions, or self-checks) now holds its payloadChangeRequest instead 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 by BaseAgent.GetAgentTools now 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 setting UsesCircuitBreaker: false in AgentToolDefinition, or across an entire agent type by setting UsesActionCircuitBreaker: false.
  • Payload change requests support path keys and nested array permissions (@memberjunction/ai-agents): ApplyAgentChangeRequest now 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. In allowedPaths (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, and prototype are stripped when parsing agent JSON replies and when PayloadManager applies 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 after preparePromptParams completes rather than during super.preparePromptParams(). Previously, template parameters added by agent subclasses after invoking super were 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_CALLING and _NATIVE_CONTROL_FLOW flags. AIPromptParams adds an OnTemplateDataFinalized callback 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-scoped WeakMaps. 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 an ErrorMessage stating “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): BaseEngine now triggers a full cache slot reload rather than applying peer cache events (set or row_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 on GetCredential. Unparseable credential values now throw CredentialValuesUnreadableError with sanitized error messages.
  • Credential timestamp updates are throttled to reduce database writes and update conflicts (@memberjunction/credentials): CredentialEngine now throttles writes for LastUsedAt and LastValidatedAt to 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 in V202611012253__v6.2.x__Metadata_Sync caused by missing FK_QueryField_SourceEntityField foreign key references (#6557). The migration script now restores the 27 virtual EntityField rows removed by R__RefreshMetadata at 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.ValidateReadOnlyStatement now accepts set operations (UNION, UNION ALL, INTERSECT, EXCEPT) where all combined statements are valid read-only SELECT queries. The validator also uses a strict-only rewriting pass to parse SQL Server and PostgreSQL syntax omitted by standard grammars, including STRING_AGG(...) WITHIN GROUP, TRY_CAST, COUNT_BIG(*), RANGE window frames, LIKE ... ESCAPE, TOP ... WITH TIES, and OFFSET ... FETCH clauses.
  • IS-A entity hierarchy tab navigation no longer freezes browser tabs (@memberjunction/ng-explorer-core, @memberjunction/ng-base-forms): ComponentCacheManager now incorporates the entity discriminator into cache keys for RecordResource and Records tabs. 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 to MjFormToolbarComponent.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 as about:blank, srcdoc, sandboxed iframes, and data: URLs). Relative subresource URLs are resolved against https://localhost when window.location.origin is "null", preventing URL resolution errors while preserving scheme security checks.
  • React linter handles missing SQL types and deduplicates validator error logs (@memberjunction/react-linter): MapSQLTypeToJSType now treats missing SQL type metadata as 'unknown' instead of throwing a TypeError. Library lint validators now log errors once per lint pass rather than per AST node, eliminating verbose log output, and LintComponent falls back to spec component names to prevent crash loops when component names are omitted.
  • Metadata lint rules and component specifications updated (@memberjunction/core): the check-chart-ref-management ApexCharts 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 proper onRowClick usage without causing duplicate record open calls.
  • Distribution applications omit workspace prebundle excludes (@memberjunction/installer): installer distribution templates no longer ship @memberjunction/* packages in angular.json prebundle excludes. This allows npm-installed distribution applications running ng serve to resolve third-party library dependencies (such as katex) directly under pnpm without requiring explicit top-level package declarations.