Repository navigation
fix(memory): require a base_url for the hindsight backend - #301
Merged
Merged
Conversation
`{"memory": {"backend": "hindsight"}}` — no endpoint, just the backend name —
built a client whose base_url fell back to a hard-coded service, so the config
silently sent every prompt to a deployment the user never named. The decision
record says a network backend is "reachable only by explicit configuration: an
endpoint written in the user's own config file"; the code enforced the file and
not the endpoint.
`NewHTTPMemoryClient` now takes the bank and refuses an empty base URL, so
`memoryStore` returns an error the composition root already logs and runs
without memory. There is no default endpoint anywhere in the tree.
The bank had the same problem in a smaller way: `hermes` was hard-coded while
`memory.bank` existed in the config and was read by nobody. It now comes from
the config and falls back to `default`, which is Hindsight's own default tenant
name rather than one deployment's.
Docs move with it: CODEBASE says the endpoint is required, the example config
says a hindsight backend must name one, the decision record says the endpoint
rule is enforced rather than stated, and the roadmap's B2 evidence keeps its
baseline wording with a note that that default no longer exists.
Verified: go test ./... -count=1, 16 packages ok; go vet and gofmt clean; the
gate mutation-checked (the empty-base refusal disabled fails
TestHTTPMemoryClientRequiresAnEndpoint, restored it passes).
Refs #293
This was referenced Oct 27, 2026
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.
What changed
agent/memory.go: the hard-codedhttps://memory.yusiwen.cn/dp-apidefault and the hard-codedhermesbank are gone.NewHTTPMemoryClient(baseURL, bank)now returns an error for an empty baseURL, so a client cannot exist without an endpoint; the bank comes from the caller and falls back to
default.main.go:memoryStorepassesmemory.bankand lets the constructor fail; the composition rootalready logs a store it cannot build and runs without memory.
agent/memory_test.go: the two "default base" assertions are replaced byTestHTTPMemoryClientRequiresAnEndpoint(empty and blank rejected, the error namesbase_url, thebank defaults, a named bank survives), and the stub server's paths use a test bank.
memory_wiring_test.go: the hindsight case asserts the configured base and the bank, and a new testpins that a hindsight spec with no
base_urlis an error.CODEBASE.md(endpoint required, bank from config),config.example.json("'hindsight'requires base_url"),
docs/memory-decision.md(the endpoint rule is enforced, not just stated), anddocs/roadmap.md's B2 evidence keeps its baseline wording with a note that the default is gone.Why
{"memory": {"backend": "hindsight"}}— the backend named, no endpoint — built a client whose base URLfell back to a hard-coded service. Every run would have sent its prompt to a deployment the user never
named, while the decision record promised that the endpoint is theirs to write. The code enforced the
"own config file" half of that sentence and not the "endpoint" half.
The bank had the same defect in miniature:
memory.bankexisted in the config, was parsed, was read bynobody, and the client used one deployment's bank name. It now comes from the config.
Verification
go test ./... -count=1→ 16 packagesok;go vetandgofmt -lclean.TestHTTPMemoryClientRequiresAnEndpointfails withan empty base URL was accepted; restored, it passes.grep -rn 'memory.yusiwen.cn' --include=*.go .→ no hits; the only remaining mention is the roadmap'spinned B2 evidence line, which now says the default no longer exists.
git log --format='%h %G? %s'→G.Honest scope
OPENAI_API_KEYfallback inauth()is untouched: it is a separate item (S4 of [memory] Local store, wired recall, and one explicit writer #293) about whichcredential is sent, not where.
default endpoint and makes the config authoritative.
backend: hindsightwithout abase_urlwere pointing at the author'sservice; they now fail at startup with a message that names the missing key. That is the intended
change, and it is stated in the report.
Follow-ups
the backend
ctxon the calls that lack it.Refs #293