Commit Graph
2710 Commits
Author SHA1 Message Date
sam 529b25eada docs: phase 3a — nilerr review, all 11 sites were false positives (qa4)
97 -> 85. Not one of the eleven nilerr findings was a bug.

I called these "real bug candidates" when I planned the phases. I was
wrong, and the reason is worth recording: every site is the same
deliberate idiom, and a linter cannot see intent.

  - inprocess.go (5) and gateway.go (2) are handlers that report a
    problem as TEXT to their consumer. A tool handler returning a Go
    error aborts the tool call; returning "rejected: ..." lets the model
    read the feedback and retry with valid arguments. A chat handler
    returning a Go error surfaces as a gateway fault instead of a usage
    hint to the human.
  - worker.go carries runErr in the response envelope's Error field.
    Returning it as a Go error too would double-report and abort the
    NATS reply.
  - email.go returns nil when Accept fails because context cancellation
    closed the listener. That is a clean shutdown.
  - codesearch.go skips an unreadable entry and continues the walk. A
    best-effort index must not abort on one bad file.
  - skill.go is documented in the function comment already: a
    non-directory skills path means "no skills", not a fatal error.

Annotated each with //nolint:nilerr and the specific reason rather than
excluding the linter by path, so nilerr stays live everywhere else and
the next reader wondering "why nil here?" gets an answer at the site.

This is the phase I insisted on keeping single-session and out of the
subagent fan-out. A worker told to "fix nilerr" would have converted all
eleven to error returns: malformed tool arguments would hard-fail the
agent loop instead of being correctable, chat typos would read as
gateway faults, and shutdown would log spurious errors. Every test would
still have passed.
2026-07-28 01:39:22 +10:00
sam 4ee8579ddc refactor: phase 2 of lint remediation — mechanical fixes (qa4)
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.
2026-07-28 01:37:20 +10:00
sam 15d746c2f6 style: phase 1 of lint remediation — autofix pass (qa4)
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.
2026-07-28 01:37:20 +10:00
sam 2b7b3bd794 build: add golangci-lint v2 config with structural and correctness linters
The repo had no .golangci.yml at all, so golangci-lint ran on defaults
only — errcheck, govet, ineffassign, staticcheck, unused. That is why it
reported "0 issues" on a 745-line file containing 21 struct types and a
180-line finalize() with a cognitive complexity of 106.

Adds a curated set on top of the standard linters: structure (cyclop,
dupl, funlen, gocognit, gocyclo, maintidx, nestif), architecture
(depguard, importas, interfacebloat), correctness (nilerr, bodyclose,
forcetypeassert, noctx, contextcheck, errorlint, sqlclosecheck, and
friends), and hygiene (gocritic, godox, sloglint, usestdlibvars).

Deliberately not `default: all`: the formatting-opinion linters (wsl_v5,
nlreturn, varnamelen) and the absolutist ones (exhaustruct, err113,
wrapcheck) would add hundreds of pure-opinion findings. A gate that cries
wolf gets disabled, and a disabled gate enforces nothing.

depguard now encodes the internal/indexing layering rule structurally:
that package is ported from tau and must stay refreshable by diff, so it
may not import internal/config. Until now that constraint was a comment,
which is to say it was advisory.

This surfaces 160 issues (81 outside tests), so the gate is RED until they
are cleared. That is intentional: the config is the work list. Notable is
nilerr — 11 sites returning nil on a path where err != nil, six of them in
internal/agentexec, which is the class of bug that reads as "the task
silently did nothing".

Verified with `golangci-lint config verify` against the v2 JSON schema.
2026-07-28 01:37:20 +10:00
sam 05cfc30da3 fix(indexing): surface index config properly and stop silent degradation
Follow-up to c924281, which introduced two defects of its own.

1. indexing.Config was a private config island: index paths existed nowhere
   in internal/config or config.example.toml, so they were undiscoverable
   and unsettable by anyone reading the real configuration.

   Now [indexing] in config.toml, defined in its own internal/config/
   indexer.go rather than appended to the 21-struct config.go, and its
   defaulting lives with it as IndexingConfig.withDefaults so finalize
   delegates instead of growing. Paths default off work_dir, keeping the
   two archied instances on one host from sharing an index. Documented in
   config.example.toml.

   internal/indexing keeps its own plain Config and does NOT import
   internal/config, so it stays a straight diff against its tau original.

2. A failed index build was invisible. refreshAsync wrote the reason to a
   database column with no reader and degraded to unindexed search in
   silence — the failure mode that costs hours precisely because nothing
   appears to be wrong. Every give-up path now logs, and a successful
   build logs once.

The logger is resolved at the point of use, not in the constructor: a
Manager can be built as a struct literal (the ported tests do), and
constructor-only defaulting panicked on the build goroutine, where a panic
takes the daemon with it. Regression test covers the zero and nil Manager.
2026-07-28 01:37:19 +10:00
sam 446dc6b3de feat(indexing): port tau's codesearch workspace index (4we)
First slice of the tau cherry-pick strategy: copy-and-mutate rather than
extracting tau to pkg/. Exporting would force designing metrics, session
and logger seams upfront, before archie-core knows which of them it wants
differently — a cost paid for reuse not yet proven. ai-sdk earned library
status by stabilising across two consumers; nothing in tau/internal has.

indexing is the cheapest high-value lift: 512 LoC, one file, and its only
coupling to tau was three calls to process-global config path helpers.
Nothing else in tau imports it.

Mutations from upstream:
  - path helpers become an explicit indexing.Config. Two archied instances
    share a host (archie and winter), so they must not share one index.
  - the child-process helper is archied's own workspace-codesearch
    subcommand, dispatched before flag parsing so it touches no config,
    store or NATS.
  - deferred db.Close calls explicitly discarded; archie-core runs errcheck.

The child process is not incidental: google/codesearch calls fatal exits on
a corrupt index and leaks mmapped regions. Verified end to end against this
repo — 2.2MB indexed, correct hits for BuildSystemPrompt, [] for no match,
and a deliberately corrupted index returns "corrupt index" with exit 1
instead of taking the process down.

Every lifted file carries a provenance header naming its tau path and
commit (4893818d0c76), so refreshing from upstream is a diff rather than
archaeology.
2026-07-28 01:37:19 +10:00
sam c79c623e9c feat(chat): real system prompt for Archie — identity, tools, env (sc5)
The chat agent's entire system prompt was the four-sentence static string
in gateway.DefaultPersonas(). It carried no tool inventory, no environment
block and no instruction precedence, so the model invented its own
capabilities: asked to set something up it announced it "only has the
memory editing tool", then offered to walk through installing software it
has no tool to install.

Renders a template modelled on tau's agent.md.tpl + tau.agent.md:
instruction precedence, core rules, communication rules, a <tools> block
and an <env> block. The persona stays the style layer on top; the rules
and the tool inventory live in the template so switching persona cannot
remove them.

The tool list is derived from the same core.ToolSet handed to the model,
so the prompt cannot drift from what the agent can actually call, and an
empty toolset renders an explicit "no tools are available" rather than
silence the model fills in for itself.

Tool metadata is third-party data from MCP servers, so it is markup-escaped
(<, >, & only — not xml.EscapeText, which mangles prose into &#xA;/&#39;)
and whitespace-flattened, so a description cannot forge a closing tag or a
second "- tool: ..." list entry.
2026-07-28 01:37:19 +10:00
sam 9e5fd7c38b Merge branch 'main' into fix/43-loaddir-no-timeout-around-yaegi-eval-can-hang-daemon-startup 2026-07-27 08:18:09 +00:00
sam a7388a0a59 Merge pull request 'Fetch() masks JetStream errors as empty-queue when zero msgs arrive (archie)' (#84) from fix/35-fetch-masks-jetstream-errors-as-empty-queue-when-zero-msgs-a into main
Reviewed-on: sam/archie-core#84
2026-07-27 08:17:51 +00:00
archie 5045592d41 fix: Fetch() masks JetStream errors as empty-queue when zero msgs arrive (archie)
Fixes #35
2026-07-27 04:37:17 +00:00
archie 03899171e6 test: failing repro for #35 2026-07-27 04:36:14 +00:00
archie 7c294f88f7 fix: LoadDir: no timeout around Yaegi Eval can hang daemon startup (archie)
Fixes #43
2026-07-27 03:04:28 +00:00
sam bcca6f9c25 feat(telegram): add approved component updates 2026-07-27 13:02:11 +10:00
archie 255f580cf6 test: failing repro for #43 2026-07-27 03:01:56 +00:00
sam c1c3a973c6 feat(telegram): report installed component versions 2026-07-27 12:53:59 +10:00
archie ce0fc1fac0 fix: skillscript.Run ignores context, cannot be canceled/timed out (archie)
Fixes #45
2026-07-27 02:41:44 +00:00
archie c3aa0a0a02 test: failing repro for #45 2026-07-27 02:35:35 +00:00
archie febf70a754 fix: Transition() ignores from status guard, allowing lost updates (archie)
Fixes #48
2026-07-27 02:26:52 +00:00
archie e94a418c99 test: failing repro for #48 2026-07-27 02:24:04 +00:00
archie 9ac5817b84 No test coverage for StageStats query (archie)
Implements #51
2026-07-27 02:20:39 +00:00
archie 79f82101ee fix: handleSSE silently swallows EventsSince backlog fetch errors (archie)
Fixes #52
2026-07-27 02:17:32 +00:00
archie 7927eab07b test: failing repro for #52 2026-07-27 02:12:59 +00:00
sam 647537c00a refactor(telegram): keep one model selector command 2026-07-27 11:44:27 +10:00
sam 2facb2be1b Merge pull request 'handleSummary ignores errors from WorkflowStats/StageStats/TokensByDay (archie)' (#78) from fix/53-handlesummary-ignores-errors-from-workflowstatsstagestatstok into main
Reviewed-on: sam/archie-core#78
2026-07-27 01:24:57 +00:00
sam 0ff8729080 Merge branch 'main' into fix/53-handlesummary-ignores-errors-from-workflowstatsstagestatstok 2026-07-27 01:24:45 +00:00
sam 329776de9c feat: establish Archie identity and use stable callback tokens 2026-07-27 11:03:40 +10:00
sam ec8534dfe2 feat(gateway): ship model controls, shell tools, and release tracking 2026-07-27 06:16:39 +10:00
archie 0b8560c2c2 fix: handleSummary ignores errors from WorkflowStats/StageStats/TokensByDay (archie)
Fixes #53
2026-07-26 20:08:20 +00:00
archie 902fd28bf5 test: failing repro for #53 2026-07-26 20:07:32 +00:00
archie ef12eb6141 fix: baseline gate repair (go test ./... -count=1) 2026-07-26 20:05:07 +00:00
archie 5f964030c5 feat: add MCP client capabilities to archied and archie-agent (archie)
Implements #75
2026-07-26 19:51:36 +00:00
archie a7054250ff fix: baseline gate repair (go test ./... -count=1) 2026-07-26 19:41:12 +00:00
sam 3cab289b41 refactor: centralize command specs and dynamic help text for Telegram 2026-07-27 05:34:46 +10:00
sam 19a6311f6c feat(telegram): /restart to reload config without dropping tasks (16.35)
Operator escape hatch: reload gateway config (notably the sender
allowlist) or recover a wedged adapter from chat, with no shell access to
the host.

Start becomes a supervisor loop that relaunches the bot on request, so a
restart is scoped to the gateway: the daemon keeps running and in-flight
agent tasks are untouched. Exiting the process would also have restarted
under the unless-stopped policy, but would have killed running work.

Two failure modes are handled deliberately:

- The handler runs on the very bot the supervisor is about to stop, so it
  hands off over a buffered channel and returns instead of tearing down
  inline, which would deadlock the restart it just requested. A duplicate
  request while one is in flight is dropped, not queued.
- A failed config reload logs and relaunches on the previous settings, so
  a bad config edit cannot take chat down permanently -- which would also
  remove the means to fix it.

Authorisation is inherited from authorizedMessage: only allowlisted
senders reach any handler, so /restart is admin-only by construction.
main.go supplies Reload, which re-reads config from disk and refreshes
token and allowlist; other fields still need a full daemon restart, since
they are wired at construction.
2026-07-27 05:21:58 +10:00
sam 9fd4696492 fix(telegram): publish command menu to all scopes, not just default
The menu still showed ~60 stale hermes commands (/steer, /reload_mcp,
/background) even though SetMyCommands succeeded and logged 8 commands.

Telegram resolves a chat's menu by scope specificity rather than by
recency: a list registered against all_private_chats wins over the
default scope in every DM. We wrote only the default scope, so hermes's
older per-scope registrations kept shadowing ours. getMyCommands confirms
it -- default held our 8, all_private_chats and all_group_chats each held
hermes's ~60.

That state lives on Telegram's side, keyed to the bot token, so it
survived the migration off hermes and would survive any redeploy. Publish
to default, all_private_chats and all_group_chats so the leftovers are
overwritten rather than shadowing us. One failing scope no longer aborts
the rest.
2026-07-27 05:18:26 +10:00
sam cb147b7a37 feat(telegram): deny-by-default sender allowlist + command menu (16.33, 16.34)
Allowlist (16.33). telegram.New was called with a nil allowlist and
isChatAllowed returned true whenever the list was empty, so any Telegram
user who found the bot could talk to it; AllowedChatIDs was not plumbed
into config, so there was no way to close it. Chat tools run with the
daemon's own authority, so this had to be fixed before wiring any real
tools to the chat agent.

Now chat.telegram.allowed_user_ids configures it and an empty list denies
everyone: a bot handle is public, so failing open is not a safe default.
The check matches the sender (from.id) rather than the chat, so adding
the bot to a group cannot be used to inherit access. Rejections log the
sender id and answer once, so a legitimate user missing from the list can
tell the bot is misconfigured rather than dead. Startup warns when the
gateway is enabled with an empty list.

The previous TestIsChatAllowed asserted 'empty allowlist allows all' --
it encoded the vulnerability -- and is replaced by fail-closed tests.

Command menu (16.34). SetMyCommands was never called, so Telegram showed
no menu and the commands Router implements were undiscoverable; asked
about /commands the LLM confidently answered it had none. The published
list mirrors what Router actually handles. Failure is logged, not fatal:
it costs discoverability, not function.
2026-07-27 05:14:34 +10:00
sam 285c618f74 fix(chat): drain FullStream, not TextStream — streaming deadlocked every reply
Streamed chat replies hung on the first token: the draft rendered an
empty cursor, the typing indicator never cleared, and the turn never
completed.

RouteStream consumed stream.TextStream, but ai-sdk's channel contract
makes FullStream authoritative and requires draining it until close --
its writes are synchronous, so an unread FullStream applies backpressure
and stalls the producer. Once its buffer filled, the producer blocked,
TextStream stopped yielding, and the range loop blocked forever.

TextStream was the wrong source regardless: it is explicitly best-effort
and drops deltas when not drained, so a reply reconstructed from it can
silently lose text. Range over FullStream and collect StreamPartTextDelta
parts, exactly as the SDK documents.

Also bumps ai-sdk v0.1.17 -> v0.1.18 (build, full suite and lint clean).
2026-07-27 05:04:04 +10:00
sam 3e3911a423 feat(telegram): native rich messages + streamed replies (16.32)
Upgrades go-telegram/bot v1.18.0 -> v1.22.0 and uses the Bot API's rich
message support instead of hand-rolled formatting.

The previous commit converted LLM Markdown into Telegram's HTML subset,
on the premise that the API could not take Markdown directly and had no
table element. Both are true of v1.18.0 but not of v1.22.0, which adds
sendRichMessage/sendRichMessageDraft taking InputRichMessage{Markdown},
plus RichBlockTableCell for native tables. markdownToHTML and its tests
are deleted: LLM Markdown, tables included, now goes to Telegram as-is.

Replies also stream. runtime.ChatStream already returned a TextStream
and sendRichMessageDraft renders partial output, so the only missing
piece was a gateway seam: gateway.LLMStreamResponder plus Router.
RouteStream, which degrades to the blocking Route when unset so any
adapter can call it unconditionally. Local commands answer from local
state and are not streamed; an unrecognised /command is, since Route
hands it to the LLM. main.go derives both responders from one shared
turn implementation.

Draft updates are throttled to one per 700ms to respect per-chat rate
limits, and every streaming/rich path falls back rather than dropping a
reply: a rejected rich send retries unformatted, and a failed draft
update is skipped since the final message is authoritative.
2026-07-27 04:57:36 +10:00
sam b52accf24a config: set containers.network explicitly for the docker deployment
Pins the agent-container network instead of relying on selfNetwork()
auto-detection, which silently fell back to the default bridge and broke
NATS resolution for spawned agents.
2026-07-27 04:51:10 +10:00
sam bf0e348cbb fix: pass HEYARCHIE_TELEGRAM_BOT_TOKEN through to archied
The telegram chat gateway is enabled via chat.telegram.token_env in
config.toml, but compose never forwarded the named variable, so
cfg.Chat.Telegram.TokenEnv resolved to empty and archied exited 1.
Same class of bug as ARCHIE_GITEA_TOKEN_ARCHIE.
2026-07-27 04:51:10 +10:00
sam cb1b0eb11a feat(telegram): typing indicator + Markdown rendering (part of 16.6)
Two gaps visible in the live heyarchie bot:

1. No typing indicator. A non-command message runs a full LLM turn
   (seconds), during which the chat looked dead. defaultHandler now
   shows the typing action for the duration, refreshed every 4s since
   Telegram clears it after ~5s.

2. ParseMode was never set, so LLM Markdown reached users verbatim:
   literal **bold**, backticks, and pipe tables. helpHandler was worse
   -- it emitted <b>Archie Gateway</b> with no ParseMode, so the raw
   tags were shown.

The SDK has no Markdown->Telegram converter (EscapeMarkdown does the
inverse: it escapes text so it renders literally), and neither native
parse mode helps, since Telegram's Markdown dialects use single-asterisk
*bold* whereas LLMs emit **bold**. So markdownToHTML converts to the
HTML subset Telegram accepts, mapping headings to <b>, bullets to '•',
and tables to <pre> (Telegram has no table element). Send falls back to
unformatted text if Telegram rejects the markup, so a conversion bug can
never swallow a reply.
2026-07-27 04:47:21 +10:00
sam 18948ac0e3 chore: remove accidentally-committed build/test scratch artifacts
.gotmp/ (Go build cache and test temp-dir output, created as a
workaround for a tmpfs disk-quota issue in this environment) got swept
into a prior commit by a broad `git add -A`. Remove it and gitignore
the directory so this doesn't recur.
2026-07-27 04:43:37 +10:00
sam 325aa7ae35 test message 2026-07-27 04:39:39 +10:00
sam 4c0fc12450 test message 2026-07-27 04:39:27 +10:00
sam 52015c81b0 fix: pass ARCHIE_GITEA_TOKEN_ARCHIE through to archied container
The archied service only forwarded ARCHIE_GITEA_TOKEN, but config.toml
names ARCHIE_GITEA_TOKEN_ARCHIE for the archie identity. Recreating the
container via docker compose (rather than a manual docker run with an
explicit -e) silently dropped the token.
2026-07-27 04:31:43 +10:00
sam 38a746a891 fix: make agent-container Docker network explicitly configurable
archied's container-mode agent tasks were all failing with "nats: no
responders available for request" in production. Root cause: pool.go's
selfNetwork() auto-detects the daemon's own Docker network by looking up
a container named after os.Hostname(), then joins spawned agent
containers to that same network so they can resolve "nats" by name.
On carina this detection was silently failing (wrong/stale hostname vs.
actual container ID) and returning "", so every per-task agent container
landed on the default bridge network instead — unable to resolve "nats",
never subscribing, hence "no responders" on every request.

selfNetwork() swallowed every failure silently (only logged on success),
so this had no diagnostic trail.

Fix: added Containers.Network config field (containers.network in
config.toml) so deployments can name the network explicitly instead of
relying on fragile self-detection; selfNetwork() remains as a fallback
but now logs a warning on every failure path so this doesn't silently
recur. Wired through container.Config and cmd/archied/main.go.
2026-07-27 04:25:28 +10:00
sam 63719cc3ec fix: restore [forge] token_env backward compat, fixing prod crash-loop
Both archied production containers (archie-core-archied-1 and -winter-1)
were crash-looping on carina with "forge token (engine \"env\", key
\"ARCHIE_GITHUB_TOKEN\") is required" despite being configured for gitea.

Root cause: the secrets-engine migration replaced [forge]'s flat
token_env string field with a {engine, key} struct (Forge.Token), but
dropped the old field entirely instead of keeping it as a deprecated
fallback like NATSConfig and TelegramConfig already do. TOML silently
ignores unknown keys, so deployed configs still using token_env had
their token config dropped without any warning, and finalize()
defaulted to demanding ARCHIE_GITHUB_TOKEN.

Fix: re-added Forge.TokenEnv and honor it in finalize() when the new
Token struct is unset, matching the existing NATS/Telegram pattern.
New-style [forge.token] still wins if both are present. Added
regression tests for both cases.

Operationally also fixed the two live configs on carina
(~/.config/archie/config.toml, winter.toml) to the new schema, and
added missing work_dir/db_path to winter.toml (its container had no
config-overlay, so it was defaulting to /root/.local/share/archie
instead of the mounted volume). Both containers verified healthy and
processing real issues after restart.
2026-07-27 04:13:04 +10:00
sam b9ecf37a48 refactor: replace fmt.Sprintf with fmt.Appendf in test 2026-07-27 04:03:23 +10:00
sam 80cd473559 fix: remove local filesystem replace directive for NellDB
go.mod pointed NellDB at a local dev-machine path
(/work/apps/nell-engine) instead of the published v0.2.5 module,
which the Gitea CI runner can't resolve — every push since the
replace was added has failed the deploy workflow's docker build
(go mod download: no such file or directory), silently leaving
carina on a two-day-old image. Confirmed nell-engine's local HEAD
is functionally identical to the already-tagged-and-pushed v0.2.5
(only a trivial .gitignore commit ahead), so dropping the replace
and re-resolving from the registry is a no-op for behavior.
2026-07-27 04:00:51 +10:00
sam 6fe1a7d037 fix: lint cleanup across repo (errcheck, staticcheck, ineffassign, unused)
- 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.
2026-07-27 03:49:33 +10:00