You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcpx(plugin): readRememberedDaemon never validates the remembered target — a malformed storage record passes the gate and targetKey() fabricates 'unix://undefined' #2558
readRememberedDaemon (pkgs/mcpx/plugin/opencode/v2/remember.ts:43-52) is the gate between host namespaced storage (ctx.storage) and every consumer of the remembered daemon choice — but it validates almost nothing about the record's target:
Any non-null object with a numeric seenAt and a target that is merely not undefined passes, whatever shape the target has. The module's own test ("malformed records read as absent", v2.test.ts) only covers a non-object record ("not-a-record").
Laptop Bun probe (~/git/fleet/probe-2026-10-29-laneB-forgetcool/, real remember.ts/daemon.ts, md5-matched to main), Map-backed stub storage:
{ target: { kind: "socket" }, seenAt: 5 } (no path) → record returned, and targetKey(record.target) yields the literal string "unix://undefined".
{ target: "unix:///tmp/x.sock", seenAt: 5 } (string, not a Target object) → record returned, and targetKey(...) yields undefined.
Why it matters
The returned record is trusted downstream without further checks:
tools.ts:184 (refreshRemembered) keys change-detection on targetKey(record.target) — "unix://undefined" or undefined become the remembered key, so a malformed record can mask or fabricate a "the choice moved" transition.
tools.ts:208,348,401 pass record.target into the discovery ladder as the remembered target — a garbage target is health-checked / connected to as if a user had chosen it.
remember.ts:65 (recallDaemon) health-checks the unvalidated target for the until-gone lifetime rule.
Storage is host-provided and shared across plugin versions: a record written by an earlier/newer build, a partially migrated record, or plain corruption currently poisons discovery for the directory instead of reading as absent — which is exactly the contract the function documents and tests for non-object records.
Acceptance criteria
readRememberedDaemon returns undefined unless the target is a well-formed Target: kind: "socket" with a non-empty string path, or kind: "url" with a non-empty string base.
Tests in v2.test.ts extend "malformed records read as absent" to object records: socket target missing path, url target missing base, string target, numeric target, and an unknown kind.
Well-formed records written by rememberDaemon still round-trip unchanged (existing tests green).
Dedup: no existing issue covers readRememberedDaemon validation; #2557 is the same probe run's distinct finding (forget/cooldown in tools.ts).
Expectation: effort xs; done when only well-formed socket/url targets pass the gate and the malformed-records test covers object records, with rememberDaemon round-trips unchanged.
Activity
dezren39 commentedon Oct 30, 2026
🤖 Agent note · filed
16 remaining items
dezren39 commentedon Nov 2, 2026
🤖 Agent note · parked
dezren39 commentedon Nov 2, 2026
🤖 Agent note · picked up
Merge pull request #4215 from developing-today/queue/5383-2558-rememb…
dezren39 commentedon Nov 2, 2026
🤖 Agent note · done