17 Commits
Author SHA1 Message Date
sam 58858f0d92 feat(connectors): the connector contract and its confined extension host (#1979) 2026-11-15 17:24:31 +11:00
sam a69a0ea942 feat(archie): the single binary's skeleton: bootstrap config, migrations under an advisory lock, health (#1977) 2026-11-15 16:59:21 +11:00
sam 6c287b48e6 fix: return write-side close errors; the gate checks unhandled errors 2026-11-14 03:31:46 +11:00
sam db346b159d fix(webui): mark cookies Secure behind a TLS proxy; run gosec in the gate (#1919)
Cookies took Secure from r.TLS, which is nil behind a proxy that terminates
TLS, so sign-in cookies went out without it. Every dashboard cookie now goes
through one builder that reads the scheme the way the origin check does.

The worktree reset and the agent worker's chown walk use os.Root, so a
symlink swapped in mid-walk can't point them outside the worktree.

gosec runs in golangci-lint, tests included. G104, G115, G204 and G304 are
excluded in config; each remaining finding is fixed or suppressed at the site
with its reason.
2026-11-13 03:16:15 +11:00
sam f5a04ce8c5 refactor(archiegateway): own the chat task profiles; archied built a task creator it never read
deploy / plan (push) Successful in 7s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 22s
2026-11-09 08:32:28 +11:00
sam 6871abd7ee chore(lint): guard the messaging service's contract boundary with depguard instead of a test
deploy / plan (push) Successful in 6s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 1m47s
2026-11-09 07:51:10 +11:00
sam 32fcbf1a2b chore(lint): guard the dashboard's daemon boundary with depguard instead of a test
deploy / plan (push) Successful in 7s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 38s
2026-11-09 07:50:15 +11:00
sam 656feab2a4 refactor(logging): log with the caller's context so records carry trace ids 2026-10-25 23:30:01 +11:00
sam d8d6d7318b chore(lint): depguard keeps each service's packages to its own composition 2026-10-04 00:59:54 +10:00
sam 1936d9c353 feat(secretengine): serve secret engines as go-plugin extensions
A secret engine is now a subprocess serving secretengine.v1, installed through
the package store's new extensions family and enabled by extension-settings.
bws leaves the binary, as do the Yaegi engine loader and its examples.
2026-10-04 00:40:23 +10:00
sam b90f733825 feat(webui): bootstrap Vue 3 + shadcn-vue, replacing the Preact dashboard
Sam owns this codebase and reads Vue fluently, not Preact; a UI its maintainer
cannot read is the liability that outweighs the port. shadcn-vue is Vue-only,
so adopting it means the framework moves with it.

Scaffolded per the official Vite guide: `npm create vite --template vue-ts`,
Tailwind v4 via @tailwindcss/vite, `shadcn-vue init` (Reka UI, Lucide, neutral
base, CSS variables). Button and DropdownMenu are added, the latter being what
the pending navigation restructure needs.

Two deviations from the guide, both forced:

  - The guide sets `baseUrl` alongside `paths`. TypeScript 6 deprecates
    `baseUrl` and errors on it, and this project is heading for TS 7 native, so
    `paths` stands alone and resolves relative to the config file. Not a
    downgrade: the scaffold's typescript ~6.0.2 is untouched.
  - vite.config.ts keeps `base: "./"` and unhashed asset names. ui/embed.go
    embeds a committed dist/, served from a path the build does not know;
    hashed names would also orphan a file in git on every rebuild.

The Preact app and its 43 test files are deleted rather than ported, on Sam's
instruction: tests return when there is behaviour worth pinning rather than a
port to re-assert. `task test:ui` is now a vue-tsc typecheck, which is what
would actually catch a broken component; an empty `npm test` would pass
vacuously.

ui/src/router/index.ts carries the route table and is the new source of truth
for TestDashboardPagesRegistryCoversEveryRoute, which parsed main.jsx before.
Keeping that contract alive matters: it is what caught the stale /chat entry
earlier today. Every route resolves to a named placeholder view, so an unported
page is visibly unported rather than blank.

golangci-lint now excludes ui/node_modules. The dashboard toolchain pulls in
`flatted`, which ships a Go implementation beside its JavaScript, and the gate
was failing on complexity in a vendored third-party file.

The shadcn MCP server is registered in the root .mcp.json. `shadcn-vue mcp init`
writes it to the directory it runs in, which for a nested ui/ is a path Claude
Code never reads.
2026-09-20 17:14:47 +10:00
sam 18a3b9ff9e docs(build): record why goimports is absent from the formatter set
Completes 856c6a8f. The measurement belongs next to the omission: without it
the next person to notice goimports missing re-adds it and pays ~135s per
gate run.
2026-09-20 02:54:01 +10:00
sam 16e3b84048 fix: address the Greptile findings on the merged PRs (#902)
* fix: address the Greptile findings on the merged PRs

Four valid review findings from PRs #892, #893, #898 and #899, which were
merged without the comments being read.

- Config.Clone left the new diff-cap pointers aliased (#899, mine). Clone
  deep-copies every reference field, including the *bool beside it, so a
  clone could write the cap through to the published snapshot. Both the
  top-level field and the identity overrides are copied, with the clone test
  extended to cover them.
- providerOutcomeRecorder.record could report an older call as the latest
  (#892). The completion time is taken before the lock, so two concurrent
  calls can reach the lock in the opposite order to their completion and the
  unconditional store overwrote the newer outcome. It now keeps the newer,
  via a recordAt seam that makes the reordering testable.
- Curator model calls bypassed the recorder (#892). curatorLLMRunner calls
  the runtime directly, so a daemon whose only recent model traffic was
  curator work reported "no calls attempted yet" while the provider was
  demonstrably reachable. It records at its own adapter, and sendChatTurn's
  "single choke point" comment is corrected to say there are two.
- A provider error reached /status raw (#892), unlike channel details, so a
  multiline or oversized error broke the one-line-per-fact layout. Both now
  share one bounded formatter.

Found while fixing the curator path: agentexec.NewRuntime returns nil when no
provider is configured, and a nil *runtime.Runtime panics on its first method
call, so a curator asking for a completion took the daemon down. It now
returns an error, and records nothing -- a local misconfiguration is not a
provider call.

Not fixed, filed instead: the shared lastPollAt masking a stuck identity, the
container max-uptime callback resurrecting teardown bookkeeping, the
dashboard dropping a served-only status filter on cold load, and the route
registry test's line-by-line parser.

* fix(build): drop goimports from the gate's formatter set

`task check` spent 136 of its 167 seconds in `task fmt`, and 134 of those
136 in one formatter: goimports alone over the tree.

golangci-lint's goimports formatter calls imports.Process once per file,
which builds a fresh x/tools ProcessEnv each time, so
internal/imports.getFixesWithSource re-reads modindex.Read($GOMODCACHE) per
file. On this machine that index is 62.7 MiB / 2,081,070 lines (an 11 GiB
module cache), and modindex's in-process memo does not take effect: 3 files
read 187.9 MiB back, 15 files open the payload 15 times. That is ~53 GiB of
I/O and CSV parsing per run, and it is linear at ~155 ms per file (122 files
-> 18.8s, 864 -> 133.8s). Pointing the index cache elsewhere drops the same
command to 3.9s.

The same analyzer runs under `golangci-lint run`, so a cold cache pays it
again: 169s cold with goimports, 31s without -- which is what CI and archied's
own PR gate see, since only `fmt` never caches locally.

Removing it costs no enforcement. gofumpt and gci remain, `task lint` still
reports formatter drift as an issue, and the whole-tree fmt is now 2.2s with
the tree byte-identical. What is given up is goimports' convenience of
adding and removing import lines, which compile errors already cover.

The examples/secret-engines exclusion stays: gofumpt and gci leave those
Yaegi programs alone today, but the exclusion is the stated invariant that a
formatter must not rewrite the imports of files it cannot type-check, and
TestFormattersExcludeInterpretedSecretEngines holds it. Its comment no longer
pins the reason to the formatter that was dropped.

* fix(gateway): stop /status promising and mis-reporting health it cannot see

Two findings from the cloud review of #892.

Title generation no longer records chat-model health. It runs detached after
a first turn under its own 30s bound and its error is swallowed by the
caller, but it shared the process-wide outcome recorder, so a title that
merely timed out overwrote the health line with "failed" -- reporting a
broken provider on the strength of a call no user was waiting for.

The /status command description no longer claims "workers" and "channels".
Neither can render: newStatusHealth reads the container pool and the poll
loop from boot, but the only production router.Health assignment is in
setupGatewayChat, which runs solely in the archie-gateway process, where
neither exists; channels is nil since the Messaging Service took the
front-ends. Only the broker and chat-model lines actually appear, so that is
what the help text now says.

The underlying split -- daemon owns the facts, Gateway owns the Router -- is
filed rather than patched here: it needs either a cross-process health
contract or a ratified two-section /status, not a quick wire-up.
2026-09-20 02:42:36 +10:00
sam 0efd812387 fix(build): make formatting and CI converge (#901) 2026-09-20 00:38:51 +10:00
sam 9187f023c3 chore: drop residual beads tooling from build and lint config
Beads was removed as the issue tracker in 8bf0f6b, but five files still
referenced it. The Dockerfile one had real cost: every agent container
downloaded and installed bd v1.1.2 into the image for a tool the project
no longer uses.

- Dockerfile: remove the beads install stanza
- .golangci.yml: the godox comment told agents `bd create`; tracked work
  now lives in GitHub Issues
- .air.toml, .dockerignore, .gitignore: drop .beads exclusions

Old archie-core-xxx identifiers in git history do not resolve to anything;
all 416 issues were migrated by title, which is how they must be matched.
2026-08-09 18:10:11 +10:00
sam 65aa5b462d chore: cleanup 2026-07-28 18:46:50 +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