Skip to content

fix(debug): sync memory in before rendering the agent system prompt#767

Merged
edenreich merged 3 commits into
mainfrom
fix/debug-system-prompt-memory-sync
Jul 6, 2026
Merged

fix(debug): sync memory in before rendering the agent system prompt#767
edenreich merged 3 commits into
mainfrom
fix/debug-system-prompt-memory-sync

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

infer debug agent system_prompt renders the prompt straight from disk without syncing memory in, so on a fresh machine with the git memory backend configured (e.g. a CI runner probing the prompt before the agent starts) the PERSISTENT MEMORY INDEX section is silently omitted — while the real agent, which runs SyncIn in its pre-session hook before building the prompt, does receive it. The debug render under-reports the agent's reality.

Observed via infer-action, which probes the merged prompt before spawning infer agent: docs run 28809013238 shows the full context block but no memory index despite the git backend being fully configured.

Change

The debug command now calls SyncIn on the container's memory backend before BuildSystemPrompt(), mirroring the headless agent's pre-session hook. Fail-soft like the agent (the backend warns and continues); the local backend is a no-op, and the git backend self-gates on sync.on_start and is sync.Once-idempotent — so behavior is unchanged except when a configured git memory repo hasn't been pulled yet.

Test

cmd/debug_test.go reproduces the fresh-runner case: a seeded local bare repo as the memory remote, a non-existent memory dir, and asserts the rendered prompt contains PERSISTENT MEMORY INDEX and the seeded fact.

@edenreich edenreich requested a review from a team as a code owner July 6, 2026 18:05
Comment thread cmd/debug_test.go Outdated
Comment thread cmd/debug_test.go Outdated
Comment thread cmd/debug_test.go Outdated
Co-authored-by: Eden Reich <eden.reich@gmail.com>
Comment thread cmd/debug_test.go
Co-authored-by: Eden Reich <eden.reich@gmail.com>
@edenreich edenreich merged commit 31af295 into main Jul 6, 2026
9 checks passed
@edenreich edenreich deleted the fix/debug-system-prompt-memory-sync branch July 6, 2026 18:17
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 6, 2026
## [0.133.1](v0.133.0...v0.133.1) (2026-07-06)

### 🐛 Bug Fixes

* **debug:** sync memory in before rendering the agent system prompt ([#767](#767)) ([31af295](31af295))

### 🧹 Maintenance

* **deps:** bump claude-code 2.1.197 -> 2.1.201 ([#763](#763)) ([bdf5cdf](bdf5cdf))
* **deps:** bump infer CLI v0.132.1 -> v0.133.0, infer-action v0.23.7 -> v0.26.0 ([#764](#764)) ([43c3851](43c3851))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.133.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant