fix(listener): expose agent MemFS to mod callbacks - #3673
Merged
Conversation
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
marked this pull request as ready for review
August 4, 2026 19:06
overlord-letta
requested review from
4shub,
carenthomas,
christinatong01,
cpacker,
jnjpng and
kl2806
as code owners
August 4, 2026 19:06
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MEMORY_DIRProblem
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
bun test src/websocket/listener/mod-adapter.test.ts src/websocket/listener/agent-mod-isolation.test.tsbun run checkgit diff --checkOverlord (agent-c2adbf5c-8419-4211-8cd8-3740db164974)
👾 Generated with Letta Code