Skip to content

fix(active-memory): isolate recall auth health - #71539

Merged
obviyus merged 4 commits into
openclaw:mainfrom
obviyus:fix/active-memory-auth-health-71284
Apr 25, 2026
Merged

obviyus merged 4 commits into
openclaw:mainfrom
obviyus:fix/active-memory-auth-health-71284

Conversation

@obviyus

@obviyus obviyus commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes #71284.

Active Memory recall runs now use local auth-health failure policy, so silent helper billing/auth failures do not disable the shared provider profile used by normal turns.

Validation:

  • pnpm check:changed

@obviyus
obviyus requested a review from a team as a code owner April 25, 2026 10:46
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Apr 25, 2026
@greptile-apps

greptile-apps Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR isolates Active Memory recall sub-agent auth-health failures from the shared provider profile by introducing an AuthProfileFailurePolicy type ("shared" | "local") and wiring "local" into the recall invocation. The inline resolveAuthProfileFailureReason closure in run.ts is cleanly extracted into its own tested module, with all four call-sites updated consistently and backward compatibility preserved (undefined policy behaves as "shared").

Confidence Score: 4/5

Safe to merge — fix is minimal, well-tested, and fully backward compatible; only a documentation nit was found.

Logic is correct and the refactor preserves existing behavior exactly. Tests cover all three policy branches and the integration scenario. The sole finding is a P2 style suggestion about restoring the explanatory comment that was dropped when the inline function was extracted into its own module.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-runner/run/auth-profile-failure-policy.ts
Line: 10-11

Comment:
**Missing explanatory comment for timeout exclusion**

The original inline function included a comment explaining why timeouts are excluded from auth-profile health (`// Timeouts are transport/model-path failures, not auth health signals, so they should not persist auth-profile failure state.`). Now that this logic lives in a standalone, importable module, the rationale is even more valuable for future readers who may not have the original PR context.

```suggestion
  // Policy "local": sub-agent failures (e.g. recall billing/auth) must not
  // pollute the shared provider profile used by normal turns.
  // Timeouts are transport/model-path failures, not auth health signals,
  // so they should not persist auth-profile failure state regardless of policy.
  if (params.policy === "local" || !params.failoverReason || params.failoverReason === "timeout") {
    return null;
  }
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(active-memory): isolate recall auth ..." | Re-trigger Greptile

@obviyus obviyus self-assigned this Apr 25, 2026
@obviyus
obviyus force-pushed the fix/active-memory-auth-health-71284 branch from 04a5653 to 5644eb6 Compare April 25, 2026 11:01
@aisle-research-bot

aisle-research-bot Bot commented Apr 25, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 1 potential security issue(s) in this PR:

# Severity Title
1 🟡 Medium Local auth-profile failure policy disables cooldown marking, enabling repeated failing provider calls
1. 🟡 Local auth-profile failure policy disables cooldown marking, enabling repeated failing provider calls
Property Value
Severity Medium
CWE CWE-400
Location src/agents/pi-embedded-runner/run/auth-profile-failure-policy.ts:9-12

Description

The new authProfileFailurePolicy: "local" used for the active-memory recall sub-agent suppresses recording all non-timeout provider/auth failures into shared auth-profile health.

  • extensions/active-memory/index.ts now runs recall with authProfileFailurePolicy: "local".
  • resolveAuthProfileFailureReason returns null for any failoverReason when policy is local.
  • runEmbeddedPiAgent uses this resolver before calling markAuthProfileFailure, so failures like auth, billing, rate_limit, etc. will not place the auth profile into cooldown.

Impact:

  • If a profile is invalid/blocked/billing-disabled, recall runs can repeatedly retry the same broken credential without tripping the shared circuit breaker.
  • A user (or automation) can vary query to bypass the recall cache and trigger repeated upstream calls, causing provider hammering, unexpected cost, or account lockouts.

Vulnerable behavior is introduced by the combination of the new policy and the resolver logic.

Recommendation

Do not blanket-suppress auth-profile failure recording for local runs.

Options:

  1. Still record hard auth health failures (auth, billing) even in local mode, while suppressing only transient/transport signals.
export function resolveAuthProfileFailureReason({ failoverReason, policy }: {
  failoverReason: FailoverReason | null;
  policy?: AuthProfileFailurePolicy;
}): AuthProfileFailureReason | null {
  if (!failoverReason || failoverReason === "timeout") return null;
  if (policy === "local") {
    ​// still poison shared state for non-transient credential/account failures
    if (failoverReason === "auth" || failoverReason === "billing") return failoverReason;
    return null;
  }
  return failoverReason;
}
  1. Alternatively, keep local suppression but add a separate local circuit breaker (per-session / per-run / per-profile) so repeated recall failures back off and stop retrying the same profile.

Also consider adding rate limiting for recall sub-agent runs or enforcing caching keyed by normalized queries to reduce easy cache busting.


Analyzed PR: #71539 at commit 7756084

Last updated on: 2026-04-25T11:16:35Z

@obviyus
obviyus merged commit bdba4fa into openclaw:main Apr 25, 2026
70 checks passed
@obviyus

obviyus commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator Author

Landed on main.

Angfr95 pushed a commit to Angfr95/openclaw that referenced this pull request Apr 25, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
ayesha-aziz123 pushed a commit to ayesha-aziz123/openclaw that referenced this pull request Apr 26, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
* fix(agents): scope helper auth failures

* fix(active-memory): isolate recall auth health

* fix: isolate active memory auth health (openclaw#71539)

* fix: avoid auth policy import cycle (openclaw#71539)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression after 2026.4.23: active-memory Claude CLI usage error disables shared claude-cli profile

1 participant