Task and event persistence now uses a dedicated SQLite sidecar derived from the configured state prefix, matching the independently persisted conversation store. The configured path now means a state-path prefix rather than a database file so fresh SQLite state never attempts to interpret the previous storage format.
Remove the retired implementation and dependency completely, strengthen SQLite migrations and concurrency behavior, restore backend-neutral coverage, and align configuration, operational guidance, UI labels, and deployment documentation with the new storage and host-daemon topology.
SaveConfig's hermesHome parameter and HERMES_HOME references in comments
were copied from another project. The interface and its callers are
entirely internal to archie-core (no external call sites exist outside
tests), so renaming them is safe.
hermesHome -> dataHome
HERMES_HOME -> data directory
/tmp/hermes -> /tmp/archie-test
- bodyclose: add deferred resp.Body.Close() in storage_test.go Docker test handler
- contextcheck: thread context through email handleSMTP/processMessage; replace
context.Background() with context.WithoutCancel(ctx) in telegram, webhook, webui
shutdown paths and container pool cleanup; add ctx parameter to Pool.Release
- containedctx: replace ctx context.Context struct field with stopCh chan struct{}
in StdioTransport and SSETransport; thread lifecycle context through goroutine
chains instead of storing it in structs
- fatcontext: lift context deadline derivation out of PrefetchContext loop
130 -> 96. forcetypeassert, predeclared and usetesting are now at zero.
Fanned out across four isolated worktrees partitioned by package so no
two workers could touch the same file: internal/tools (20 assertions),
internal/webui, internal/memory + internal/ratelimit, internal/secret.
Four stragglers outside those scopes fixed inline (internal/pairing,
internal/forge, internal/channels/telegram, internal/tools/mcp).
Unchecked type assertions became comma-ok with a t.Fatalf naming the
actual type. One site in a goroutine uses t.Errorf + return instead,
since t.Fatalf from a non-test goroutine is undefined behaviour.
predeclared renames chose names from meaning rather than adding a
suffix: max -> maxQueryLen, maxMatchLen, maxRequests, alphabetLen, and
nextBackoff's max -> ceiling. `real` -> `base` in the webui tests.
os.Setenv became t.Setenv, which restores on cleanup, so the paired
deferred Unsetenv calls went with it.
Note for future fan-outs: the agent worktrees branched from origin/main
(a7388a0), not from this branch, so every diff arrived based on a tree
without the phase 1 autofix. They were applied with `git apply --3way`
and the phase 1 changes to internal/memory/manager.go were verified to
survive — in particular the repaired `ctx, cancel =` assignment. A plain
`git apply` would have silently reverted it.
golangci-lint run --fix plus the formatters: errorlint, gocritic,
sloglint, usestdlibvars, usetesting, gci, gofumpt, goimports.
160 issues -> 130.
One autofix was wrong and had to be reverted by hand. gocritic rewrote
ctx, cancel = context.WithTimeout(ctx, m.prefetchTimeout)
to `:=` inside an if-block in internal/memory/manager.go. That does not
compile, which is the good outcome — had it compiled, the shadowed ctx
would have scoped the timeout to the if-block and the prefetch deadline
would silently never have applied. Restored the assignment and commented
why it must not be a declaration.
Worth recording: --fix is not a safe no-op. It broke the build on a
24-file change, and the failure mode it was one compiler error away from
was a silent behaviour change.
- daemon.go: real bug — maybeRetryParked resolved fg := d.forgeFor(task)
(matching markDead's pattern) but called d.Forge.SetStateLabel instead
of fg.SetStateLabel, silently using the wrong forge client for
multi-identity/multi-forge task routing. Fixed to use fg throughout.
- telegram.go: updateThreadID existed but was never called anywhere;
wired it into updateLoggingMiddleware so debug logs include thread_id.
- Two SA9003 empty-branch tests (nell adapter_test.go, tools
toolentry_test.go) were dead assertions with no body; implemented the
actual check instead of deleting them.
- memory manager_test.go: mockProvider.lastConfigSchema/lastBackupPaths
were declared but never recorded; wired GetConfigSchema/BackupPaths to
populate them and strengthened the aggregation tests to assert on
per-provider content, not just counts.
- Removed genuinely dead gateway messageevent_test.go helpers (intPtr/
i64Ptr, marked //go:fix inline, already fully superseded by the new()
builtin used throughout the file).
- Remaining errcheck findings (defer Close/Flush/Write, os.Setenv, etc.
in test files) fixed with the existing `_ = ` convention already used
elsewhere in the codebase.
go build ./..., go test ./... (all packages ok), and
golangci-lint run ./... all clean.