Session curator and chat turn derive the memory AgentID differently: curator memory is unreachable, and single-identity deployments fail every pass #1333
Notifications
Due Date
No due date set.
Blocks
Reference: sam/archie#1333
Reference in new issue
Block a user
Found by auditing main after memory unification slices 2-5 merged (#886-#889). The epic is closed but this defect is live on main.
ROOT CAUSE: one AgentID concept, two derivations.
Turn path (slice 3) reads agent scope from the router turn-runner bot identity:
internal/gateway/turn_memory.go:121 Subject{AgentID: domainmemory.AgentID(r.BotUser)}
internal/app/archied/chat_setup.go:192 TurnRunnerConfig{... BotUser: cfg.BotUser ...}
cfg.BotUser is the top-level bot_user (defaulted "archie-bot" in setup.go:34) -> always non-empty.
Curator (slice 2) reads it from the session record, which stores the ROUTER IDENTITY NAME, not the bot user:
internal/infrastructure/sessioncurator/sessioncurator.go:195 Scope{Kind: ScopeAgentUser, Agent: domainmemory.AgentID(sess.AgentID), User: participant}
internal/infrastructure/sessioncurator/adapter.go:44 SessionSummary{AgentID: s.Source.BotUser}
internal/gateway/session_commands.go:300 and :549 SessionSource{... BotUser: r.Identity ...}
internal/app/archied/main.go:773 router.Identity = identity
internal/app/archied/main.go chatTaskProfiles: identity is "" when len(cfg.Identities)==0, else identities[0].Name
TWO LIVE CONSEQUENCES:
Single-identity deployments (no identities -- deployments/single-forge-github.toml, the shipped default): AgentID is "" -> Scope.Validate rejects agent-user (contract.go:133 "agent and user both required") -> BuiltinEngine.Create returns an error -> reviewOne returns (nil, err) -> Pass aborts with "session %q: %w". So the curator writes NO memory and fails EVERY pass, permanently: the same session is re-derived on each pass, so it never gets past the first one. Acceptance criterion 4 (a curator pass writes a record a later turn reads) cannot hold there.
Multi-identity deployments (identities present): the curator writes agent-user{Agent:"primary"} while the turn reads {agent:archie-bot, user:u, agent-user:archie-bot:u, global}. The write is never read. Criterion 4 fails SILENTLY there.
SAME CLASS, SAME FILE: any per-session engine refusal aborts the whole Pass and drops the Actions already collected (sessioncurator.go Pass loop returns PassResult{}, err on the first reviewOne error), so one unscannable fact starves every other session. PRD §6 says an unattributable session must "write nothing and record why", not kill the pass.
FIX DIRECTION (agreed with maintainer for the agent-id question: fail closed now, single source of truth):
Close reason
Commit 1 landed: the curator addresses memory by the deployment's bot user (cfg.BotUser) and returns ActionSkipped, not a Pass error, for a session with no agent id. Commit 2 (oyna) is blocked by c1qx and was deliberately not attempted.
Imported from beads
archie-core-ga6i· GitHub #904 · type bug · priority P1 · created 2026-09-19 · closed 2026-09-21