Repository navigation
fix(active-memory): name the reason when recall is skipped - #138658
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cbf682cb35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!toolAuthority) { | ||
| api.logger.debug?.( | ||
| "active-memory: recall skipped because this prompt has no turn tool authority", | ||
| ); | ||
| logRecallSkipped("no-tool-authority"); |
There was a problem hiding this comment.
Log absent authority at the dispatcher boundary
When a turn actually lacks tool authority, this branch is unreachable through the production hook runner. The plugin is registered with requiresToolAuthority: true, so runBeforePromptBuild filters it out (src/plugins/hooks.ts:1080), while authorized dispatch is skipped when the fingerprint is absent (src/agents/embedded-agent-runner/run/attempt-prompt-build.ts:181-188) and otherwise synthesizes ctx.toolAuthority (src/plugins/hooks.ts:1114-1136). The new test calls the captured handler directly and bypasses this boundary. Consequently the no-tool-authority case still emits nothing; record the reason where authorized dispatch is skipped instead.
AGENTS.md reference: AGENTS.md:L303-L303
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 11:44 PM ET / September 5, 2026, 03:44 UTC. ClawSweeper reviewWhat this changesAdds info-level reasons for five Active Memory recall skips while keeping routine escalation messages at debug level. Merge readiness✅ Ready for maintainer review The narrowed diagnostic change remains useful and is absent from current main. No blocking findings remain; the supplied Gateway output satisfies the prior proof request for the changed logging path. Priority: P2 Review scores
Verification
How this fits togetherActive Memory runs during prompt preparation and can add recalled context before the model receives a turn. Its existing policy, session, and destination checks decide whether recall proceeds; this change makes selected skips visible in Gateway logs. flowchart TD
A[Incoming agent turn] --> B[Host prompt preparation]
B --> C[Authorized Active Memory hook]
C --> D{Recall eligibility checks}
D -->|Selected skip| E[Named info log]
D -->|Eligible| F[Escalation decision]
F --> G[Recall or routine debug skip]
G --> H[Prepared model prompt]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +19, Tests +21. Total +40 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep diagnostics at the existing plugin exit decisions; the small shared helper is justified because status persistence clears some outcomes and omits harness skips. Do we have a high-confidence way to reproduce the issue? Yes for the diagnostic gap: current-main policy and session skip branches return without an info message. Source inspection establishes that path; the reporter’s broader loss of recall remains unexplained. Is this the best way to solve the issue? Yes for the narrowed scope: logging at the existing decisions is appropriate, while gating these messages behind optional timing logs would preserve the silence. Missing-authority diagnostics belong to separate host-dispatch work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 12cdb3e3a4e4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
The before_prompt_build hook returns early at several points. Five of them logged nothing at all, so an operator whose recall had stopped could not tell whether recall ran and found nothing or never ran at all. The absence of transcripts was the only available signal. Add a logRecallSkipped helper and call it at the five previously silent exits with a stable reason: policy-disabled, harness-session, session-disabled, session-ineligible and destination-not-allowed. Each names a state the operator configured or can act on, and each is reachable through the authorized prompt-build pass. Two existing debug lines keep their level on purpose. The escalation decision stays at debug because escalate is the default mode and ordinary prompts resolve to no-recall-intent, so raising it would add a line to healthy turns. The no-tool-authority guard stays at debug because the host filters authority-required registrations out of the unauthorized pass and always constructs an authority object before the authorized pass, so that branch is defensive only and never runs in production. The helper is not gated on config.logging, which defaults to false and would reproduce the invisibility being reported. Co-Authored-By: Claude Opus 5 <[email protected]>
cbf682c to
802f3ca
Compare
|
Thanks @DasX! Proof: Real authenticated Gateway turns now name all five existing skip reasons at the default log level. All 426 focused tests, the exact-head CI run, and the final independent review passed. Nine fresh acceptance cases also verified changed inputs and successful recall after public session off/on commands.
The logging bound is per prompt build. Original whole-turn silence expectations and an exploratory phrasing that did not trigger the existing intent heuristic are preserved in private evidence; neither was counted as passing automatic-recall proof. The successful independent off/on control inspected actual memory-tool output and its inclusion in the main request. This is diagnostic logging only. It does not resolve the broader recall regression in #138561, which remains open. No external channel or independent model-reasoning claim is made. Exact-head CI completed successfully with no failed jobs. Contributor credit is preserved; the follow-up only consolidates duplicated test setup. AI-assisted verification. |
* commit '04869ae4899ad0524c3287759798362b0d62fef8': (677 commits) fix(release): pin Kova census refresh (#142104) fix: doctor read-only database inspections time out on large agent databases (#142179) docs: align v2026.9.3 framing with release announcement (#142307) fix(ui): discover models when default-model pickers open (#142105) fix(ci): keep Docker upgrade seed baseline older than target (#142273) refactor(tests): reuse named OAuth credential fixtures (#142272) fix(ci): keep mobile release helpers out of source checks (#142115) chore(ui): refresh control ui locales (#142147) fix(active-memory): explain why recall was skipped (#138658) fix(media): preserve converted images with HEIC filenames (#142263) docs: add v2026.9.3 release notes (#142277) fix(ui): retire picker focus listeners together (#142258) fix(ui): keep menu hover colors consistent across themes (#142243) fix(release): keep changelog credits within verified history (#142261) fix: keep tool-finalizer placeholders private in message-only groups (#138645) perf(tui): carry prepared URL membership through rendering (#142262) test(ui): await activity cache imports before teardown (#142282) fix(qa): align auth and Workshop proofs with runtime contracts (#142280) feat(xai): use one curated catalog and concrete setup default (#142136) refactor(outbound): reuse prepared sendability facts (#142252) ...
Expose fixed default-log reasons at five existing Active Memory skip decisions while preserving branch conditions, prompt and recall behavior, and healthy debug-only escalation logging. Keep the broader recall regression in openclaw#138561 separate. Verified all five skips through real Gateway-authorized prompt builds, an actual memory_get recall control, default/debug controls, and nine fresh independent cases including off/on recovery. Passed 426 focused tests, scoped formatting/lint, source ratchets and independent source review. The log bound is per prompt build; a successful outer recall may also report its deliberately ineligible manual helper. The test correction consolidates the policy-reason assertion into existing no-side-effect coverage. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #138561
What Problem This Solves
Active Memory can skip recall because of tool policy, a locked harness session, a disabled session, session eligibility, or destination policy. Default Gateway logs do not name those decisions, so operators cannot distinguish them from recall that ran without a useful result.
Why This Change Was Made
Each of the five existing exits emits a fixed info-level reason. The branch conditions, return values, recall policy, and optional detailed logging remain unchanged. The existing strict authority boundary remains intact.
Reasons apply per prompt build. Successful recall can also emit
session-ineligiblefor its separate manual helper build, which deliberately avoids recursive automatic recall. That line does not mean the outer user turn performed no memory work. Existing structured trace relationships identify the nested build; the message adds no private identifiers.The healthy
no-recall-intentoutcome and defensive missing-authority guard stay at debug level. No new setting, schema, or hook API is added.User Impact
Default logs expose
policy-disabled,harness-session,session-disabled,session-ineligible, anddestination-not-allowedwithout including prompt, memory, session, destination, or credential data in the reason message. This is diagnostic logging only. It does not fix or diagnose the broader recall regression in #138561; that issue remains open.Evidence
Pinned-main and candidate proof use the same compiled-source Gateway, task-owned Memory Core state, deterministic loopback provider, and real authenticated Gateway requests. The catalog fixture creates a locked session through the supported creation owner; session disabling uses the public
/active-memory offcommand. No direct callback or database-write fixture substitutes for those routes.AI-assisted verification and test consolidation. Original implementation by @DasX.
Captured default-log messages from separate real Gateway prompt builds:
Each shown skip build completed its turn. The eligible outer build performed real memory retrieval and supplied context; its separate manual helper produced its own session-ineligible record. The ordinary default no-intent control produced no info skip line. Complete source, fixture, logs, provider requests and acceptance evidence are retained privately with hashes. Public extracts omit prompts, memory contents, session/destination identities and infrastructure metadata.
One exploratory phrasing did not trigger the existing recall-intent heuristic; it is preserved as a separate observation and not counted as automatic-recall proof. This repair does not change that heuristic. Source-history changes also make the two complete requests differ; the introduced patch changes only the logging owner and regression assertions, so this is not a claim of whole-repository byte-equivalence.