Skip to content

fix(memory): default null target to memory store - #46356

Merged
teknium1 merged 1 commit into
mainfrom
ironclaw-port/memory-null-target-4547
Jul 7, 2026
Merged

teknium1 merged 1 commit into
mainfrom
ironclaw-port/memory-null-target-4547

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

memory(action="add", target=null, ...) now behaves like an omitted target and writes to the default memory store.

Source: nearai/ironclaw#4547 fixed the same strict-provider shape for IronClaw's memory_write capability. Hermes adapts the invariant at the Python tool dispatcher boundary instead of adding provider-specific schema plumbing.

Changes

  • tools/memory_tool.py: normalize target is None to "memory" before target validation.
  • tests/tools/test_memory_tool.py: add regression coverage for target=None and keep non-string targets rejected.

Validation

Check Result
scripts/run_tests.sh tests/tools/test_memory_tool.py 71/71 passed
E2E real MemoryStore, temp memory dir, target=None writes MEMORY.md; target=42 still rejected

Source adaptation

Infographic

Memory null target fallback

Port from nearai/ironclaw#4547: treat a JSON null memory target as omitted so strict providers that fill optional fields with null use the documented default target instead of failing validation.
@github-actions

Copy link
Copy Markdown

🔎 Lint report: ironclaw-port/memory-null-target-4547 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10904 on HEAD, 10904 on base (➖ 0)

🆕 New issues (3):

Rule Count
invalid-argument-type 2
invalid-assignment 1
First entries
tests/tools/test_memory_tool.py:429: [invalid-argument-type] invalid-argument-type: Argument to function `memory_tool` is incorrect: Expected `str`, found `None`
tests/tools/test_memory_tool.py:440: [invalid-argument-type] invalid-argument-type: Argument to function `memory_tool` is incorrect: Expected `str`, found `Literal[42]`
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`

✅ Fixed issues (2):

Rule Count
unresolved-attribute 2
First entries
run_agent.py:2920: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`

Unchanged: 5733 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@liuhao1024

Copy link
Copy Markdown

Verification: Reviewed the diff — treating target=None (JSON null from strict providers) as the default "memory" store is a clean defensive fix. The coercion happens before the target not in {"memory", "user"} guard, so null values won't leak through. Test coverage includes null-target default and non-string rejection. CI green.

@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets tool/memory Memory tool and memory providers P3 Low — cosmetic, nice to have labels Jun 15, 2026
@teknium1
teknium1 merged commit 07d9341 into main Jul 7, 2026
22 checks passed
@teknium1
teknium1 deleted the ironclaw-port/memory-null-target-4547 branch July 7, 2026 09:10
@teknium1

teknium1 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Merged in PR #46356 — memory(target=null) now falls back to the default memory store instead of failing validation.

santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
Port from nearai/ironclaw#4547: treat a JSON null memory target as omitted so strict providers that fill optional fields with null use the documented default target instead of failing validation.
justemu pushed a commit to justemu/hermes-agent that referenced this pull request Jul 18, 2026
Port from nearai/ironclaw#4547: treat a JSON null memory target as omitted so strict providers that fill optional fields with null use the documented default target instead of failing validation.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
Port from nearai/ironclaw#4547: treat a JSON null memory target as omitted so strict providers that fill optional fields with null use the documented default target instead of failing validation.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
Port from nearai/ironclaw#4547: treat a JSON null memory target as omitted so strict providers that fill optional fields with null use the documented default target instead of failing validation.
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
Port from nearai/ironclaw#4547: treat a JSON null memory target as omitted so strict providers that fill optional fields with null use the documented default target instead of failing validation.
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
Port from nearai/ironclaw#4547: treat a JSON null memory target as omitted so strict providers that fill optional fields with null use the documented default target instead of failing validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants