Skip to content

fix(listener): expose agent MemFS to mod callbacks - #3673

Merged
cpacker merged 3 commits into
mainfrom
overlord/fix-listener-mod-memfs-context
Aug 4, 2026
Merged

fix(listener): expose agent MemFS to mod callbacks#3673
cpacker merged 3 commits into
mainfrom
overlord/fix-listener-mod-memfs-context

Conversation

@overlord-letta

@overlord-letta overlord-letta commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • give listener mod callbacks the active agent’s MemFS status and scoped memory root
  • preserve that context across turn events, tools, permissions, commands, model/toolset updates, and approval recovery
  • keep disabled agents and concurrent agents isolated without using process-global MEMORY_DIR

Problem

The listener syncs an agent’s MemFS before loading mods, but callback context construction discarded that state. buildModInvocationContext() then supplied { enabled: false, memoryDir: null }, so MemFS-aware mods used machine-local fallback storage.

Reported in #3669.

Before / after

Before: a MemFS-enabled agent invoked through a listener gave global and package mods a disabled MemFS context.

After: each callback resolves the active agent’s current MemFS setting and exact scoped root. Disabled and no-agent contexts remain disabled.

Scope and risk

This does not change MemFS sync, storage, or commit behavior. It adds synchronous context metadata after the existing agent sync step. Context stays agent-scoped when one listener serves several agents.

Test plan

  • Direct listener-context regression for two enabled agents, one disabled agent, and no active agent
  • The same context test on the parent returns disabled/null for an enabled agent; it passes here with distinct scoped roots
  • bun test src/websocket/listener/mod-adapter.test.ts src/websocket/listener/agent-mod-isolation.test.ts
  • bun run check
  • git diff --check

Overlord (agent-c2adbf5c-8419-4211-8cd8-3740db164974)

👾 Generated with Letta Code

lettamate and others added 2 commits August 4, 2026 11:02
Letta Code (agent-c2adbf5c-8419-4211-8cd8-3740db164974)

Listener callbacks synced agent memory but dropped its scoped storage metadata before invoking global and package mods. Carry the active agent root through events, tools, permissions, commands, and approval recovery.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
Co-authored-by: Cameron Pfiffer <cameron@pfiffer.org>
Letta Code (agent-c2adbf5c-8419-4211-8cd8-3740db164974)

Stub the existing settings method instead of adding a patch-only test seam. The same callback regression can now run against the buggy parent and fail on the returned MemFS state.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
Co-authored-by: Cameron Pfiffer <cameron@pfiffer.org>
@overlord-letta
overlord-letta marked this pull request as ready for review August 4, 2026 19:06
@overlord-letta
overlord-letta marked this pull request as draft August 4, 2026 19:48
Letta Code (agent-c2adbf5c-8419-4211-8cd8-3740db164974)

Reuse one agent-context helper at the five listener tool-preparation seams and test the context boundary directly. This keeps the same sibling-path coverage while cutting the PR from 173 added lines to 71.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
Co-authored-by: Cameron Pfiffer <cameron@pfiffer.org>
@just-cameron
just-cameron marked this pull request as ready for review August 4, 2026 20:14
@cpacker
cpacker merged commit e7f52fb into main Aug 4, 2026
26 checks passed
@cpacker
cpacker deleted the overlord/fix-listener-mod-memfs-context branch August 4, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants