2d58b487fbc36fbca4d526dec47b7ce8eff35428
1304
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2d58b487fb |
Merge pull request #956 from samcharles93/feat/vue-shadcn-migration
Feat/vue shadcn migration |
||
|
|
5712a05dec |
fix(webui): stop menus locking the page, and make tooltips optional
Two things reported from use. The topbar dropdowns shifted the whole page on click. reka's DropdownMenu is modal by default, which locks body scroll; losing the scrollbar widens the layout by its width (measured: 15px at 1440), so everything moved sideways. It also blocked clicking the page while a menu was open. Non-modal is now the default for every dropdown, not just the nav's: a menu is not a dialog. Hover descriptions became a preference on /system/appearance, applied in the Tooltip primitive so a tooltip added later honours it without each call site remembering. On by default; nothing depends on a tooltip to be usable. Appearance also lost its duplicated copy: the page, its first card, and that card's field each said "Appearance" or "Theme" in turn. |
||
|
|
db20d12f6d |
feat(webui): scroll the chat transcript with MessageScroller
The transcript scrolled itself with a watcher that set `scrollTop = scrollHeight` on every new message and streamed token, reaching into ScrollArea's internals through `[data-slot="scroll-area-viewport"]` to find the element that actually scrolls. That follows the tail and nothing else. It has no notion of the reader having scrolled away, so every streamed token yanked them back, and no way down for someone who had deliberately scrolled up. shadcn-vue's MessageScroller is the component for exactly this, so the surface is composed from it instead: the provider owns autoscroll, the viewport reports its edges, the content is a `role="log"` region, and the item carries the scroll anchor. It buys the part the watcher could not express: once the reader scrolls, autoscroll stops rather than fighting them, and a "Scroll to end" button appears. Verified in the browser: at the tail the root reports `data-scrollable="start"` and the button is inert; after a wheel scroll it reports `data-scrollable="end"`, autoscroll disengages, and the button is visible at opacity 1 and reachable. A programmatic scrollTop does not count as intent, which is right: autoscroll reclaims the tail unless a person asked for something else. |
||
|
|
b9daa01b4b |
feat(webui): port the dashboard (Phases 3-5)
Every page from the deleted Preact dashboard, rebuilt in Vue 3 + shadcn-vue.
The navigation restructure landed earlier on this branch; this is the surfaces
behind it, and the two are now one app.
Dashboard, Tasks (list and detail), Configuration split six ways, Logs,
Inspector, Mappings, Bindings, Workflows, Skills, Curators, Channels, chat.
Components, not files: docs/prds/dashboard-port-brief.md requires one
component, one job, one file, with shared state in a module beside it. So a
page file composes and holds nothing, and a shape repeated across panes becomes
its own component (LogRow, PageHeader, PanelLoading, WorkflowBar).
Behaviour that had to survive, because each was a fix:
- Live activity's detail is clamped to one line with the payload on the title.
Unclamped, one row made the dashboard 7,481px tall.
- Each health card takes its own height. Equalising left a mostly-empty box
taking a quarter of the first screen once setup was done.
- Tasks: `tab`/`attempt` live in the query string and are written with
router.replace, so a tab click adds no history entry and does not remount.
The list's deep-link reveal honours prefers-reduced-motion.
- LOG_LEVELS is a wire contract (the server matches that CSV server-side), used
unchanged by both log panes.
- The chat panel's Phase 5 list: a FAB that is the only toggle, a morph whose
scale, radius and position interpolate together, no scrim, no close button,
Escape returning focus to the launcher, Stop only while streaming.
- Unconfigured is not broken. A 501 on /api/version or the log stream renders
what is true ("Not configured on this deployment") rather than blank, and a
read-only Configuration says so instead of offering controls that cannot work.
Three things the port decided rather than carried:
- Button gains an `attention` variant and Badge the five status tones, in the
project's own cva. The pill's dot did not come across: the Badge's shape is
the affordance, and the same tone now covers a trend indicator.
- The icon module is not ported. Its name-to-glyph lookup is the pattern
shadcn-vue's rules call out as wrong, so icons come from @lucide/vue at the
call site. The five bespoke glyphs have no consumer yet and become components
if a page draws them.
- The theme control left the topbar for /system/appearance, per the approved
navigation design. ThemeToggle.vue and Placeholder.vue are deleted rather
than orphaned: every route now resolves to a real page.
Also fixes the bundle freshness check failing on the first build after every
change. ui/dist is committed, so nothing ignores it and Tailwind's content
detection scanned it, making each build an input to the next.
|
||
|
|
5fe25045d1 |
feat(webui): port the dashboard (Phase 3, first page)
The control room, on the primitives from the previous commit. Being the first page it also settles the shape of the rest: shadcn components for chrome, one feature folder per page, Lucide imported at the call site. Carried across deliberately, because each was a fix rather than a layout: - Live activity's detail is cut to one line and clamped again in the cell, so a long unbroken token (a path, a URL, a hash) cannot widen the column past the table. Unclamped, one agent_finish row made the dashboard 7,481px tall. - Each HEALTH card takes its own content height. Matching them was right while both held a checklist; once setup is done that card is a title and a line while Gate pulse carries a gauge and four rows, so equalising them left a mostly-empty box taking a quarter of the first screen. The task links are router paths now, not the `#/tasks` hashes the Preact build used. History routing means a hash is not a route any more, so one that survived here would navigate nowhere. Also in this change: - Button gains an `attention` variant, in the project's own cva. An action that exists because something needs a human has to look unlike one that is always present, and `destructive` would overstate it: nothing is broken, it is waiting. - The setup panel branches on the state machine rather than on "is setup present at all". Guarding on presence showed a 100% checklist with every step struck through where the complete state belongs. |
||
|
|
3d20dde9cb |
feat(webui): port the shared primitives (Phase 2)
The Preact tree's ui/src/base/ was deleted with the dashboard. This rebuilds what depended on it, on the shadcn layer rather than as new bespoke markup. Badge and Card come from the shadcn-vue CLI, so they match the already-vendored components, and the composed pieces sit on top of them: - Badge gains the five status variants the pills used, over the palette's status tokens. The pill's dot did not come across: the Badge's own shape is the affordance, and the same variant now covers a trend indicator, where a dot reads as noise. - base/StatTile.vue uses full Card composition instead of dumping everything into one content slot, with base/Sparkline.vue and the goodDirection logic that says whether "up" is good news. - base/Gauge.vue and base/SegmentBar.vue, both of them: the original exported two components from one file and budget composition uses the second. - base/LogRow.vue over lib/log.ts, which holds the LOG_LEVELS wire contract (the server matches that CSV server-side, so it is not a display choice). - lib/status.ts, so status colour has one home: a task state, a gate result, a log level and a trend all draw from the same five kinds. Two deliberate departures: The icon module is not ported. Its name-to-glyph string lookup is the pattern shadcn-vue's rules call out as wrong, and nothing consumes the five bespoke glyphs anyway: the navigation is text with tooltips. Icons come from @lucide/vue at the call site, and the five become components if a page draws them. The gauge's aria-label announces the rounded percentage. It announced the raw one, so a screen reader read 71.38461538461539% where the screen showed 71% (bead 86au). Also lands the four modules the checklist marks copy-verbatim, which encode bugs fixed just before the delete: dashboard/activity-detail, chat/ command-scroll, workflows/workflow-rows and logs/logs-empty. |
||
|
|
c578a4d6c3 |
feat(webui): land the Phase 1 foundation on the navigation restructure
Two Vue branches were in flight and looked like competing versions of the same change. They were not: this branch had the navigation restructure (Phase 4) and the route table, and the other worktree had the Phase 1 foundation, still uncommitted. Neither had ported a page. This reconciles them. What came across from the foundation: - lib/api.ts, the one client every request goes through, so the CSRF and Content-Type headers live in a single place, plus the four framework-free modules it needs: uuid, stream-state, format, task-meta. - loadTaskMeta() at boot, so /api/task-meta replaces the freeze-dried lifecycle defaults instead of the catalogue being frozen into the bundle. - capabilities.ts keeps the other branch's pure hiddenRoutes, but reads route.meta.section. The other version read route.section, which is always undefined for this route table, so its capability gating was silently dead. The route table stays this branch's: internal/gateway's registry test holds it in parity with the agent-facing page index in both directions, and the other branch's table fails it with seven errors. The frame is Tailwind on the shell, not a ported stylesheet. layout.css described a shell, a topbar and a nav as authored classes, but the topbar is a Vue component like every other surface and emits none of them, so two thirds of that file had no consumer. What the frame needs is now the shell element's own utilities plus the canvas, focus floor and motion preference in style.css's base layer, where a global element rule belongs. Verified equal to the stylesheet it replaces: 20px radius, hairline border, blur(28px) saturate(1.2), and the narrow-screen collapse. Also fixes the bundle freshness check failing on the first build after any change, which had cost both branches of this port a rebuild-and-retry. ui/dist is committed, so nothing ignores it and Tailwind's content detection scanned it, making every build an input to the next: class strings left in the bundle generated utilities for classes nothing references any more, so an unchanged tree built a different bundle. Excluding it also drops ~12KB of dead CSS. |
||
|
|
a1b8008774 |
feat(webui): adopt the violet palette, and give the outlet the viewport
Takes style.css, lib/theme.ts and index.html's pre-paint script from the palette work on worktree-groovy-imagining-widget (73e602a7..72034249), leaving its flat topbar and route table behind. The theme is a data-theme attribute set before the first paint, so a reload does not flash the wrong palette, and color-scheme moves with it. The outlet takes the viewport height below the topbar so an empty state has somewhere to sit. |
||
|
|
82512b84cd |
feat(webui): grouped topbar navigation, built from components
Five top-level items instead of eleven flat ones: Dashboard as a link, then
Work, Agent, Events and System as dropdowns, with each item's one-line
description on a hover tooltip. Configuration dissolves into /system/{status,
appearance,tasks,models,repos,advanced} and /settings redirects to the first of
them, so existing bookmarks still land somewhere. Logs gets a nav entry for the
first time.
The bar is composed from named components rather than one file: Brand (Logo,
BrandName), Nav (NavTrigger, NavGroup, NavItem), SearchBar, SupportLink,
ThemeToggle, ProfileDropdown. The nav model reads the route table, so a route
and its nav entry cannot disagree, and a group whose every child is gated off
is dropped while a group left with one child stays a dropdown.
The Go page registry moves with it, which its parse-the-route-table test
enforces.
|
||
|
|
6c8a2b31b1 | docs(webui): nav item descriptions are hover tooltips | ||
|
|
8c83449cf4 |
feat(webui): history routing
createWebHistory with base "/". The Go server already falls back to index.html for any unmatched path and [web] has no path-prefix option, so the dashboard is always at the root. legacy-hash-redirect.ts rewrites `#/path` links minted before this change. Verified against archie-ui rather than the Vite dev server: /tasks, /tasks/42 and /settings all serve index.html with assets resolving, and #/settings lands on /settings. |
||
|
|
83c939b3df |
fix(webui): self-host Geist, and fold the cross-check findings into the plan
Four review agents checked the bootstrap and the migration checklist against
the deleted tree and the Go handlers. Three found real problems.
The shadcn-vue CLI's default font resolved to a Google Fonts @import. archied
is deployed on LAN-only and air-gapped hosts, where that silently falls back to
a generic sans and makes an admin tool that otherwise has no third-party calls
start making one. Now @fontsource-variable/geist, self-hosted: five woff2 files
in dist and no external URL left in the bundle.
vite.config.ts used __dirname for the @ alias, which Vite 8 already warns is
unsupported under its native config loader. Now import.meta.url. Dropped the
leftover template vite.svg.
The checklist gained what the review found missing, most of it consequential:
- main.jsx was never named as a source, so the jump-to search, the `soon:`
nav treatment, the boot-time task-meta re-render and the route-keying rule
(keyed on path+params but NOT the query, so a tab switch does not remount)
had no home. vue-router needs an equivalent key strategy.
- css/layout.css is 498 lines and holds the shell, the chat dock and morph,
and every breakpoint Phase 5 described only in prose. Named as the source
to port from rather than left to reverse-engineering.
- Six further CSS files carried behaviour with no mapping: focus-visible,
.sr-only, the global prefers-reduced-motion override, and the pill colours
a Badge port has to match.
- Chat's content features -- session switching, persona and model selectors,
inline tool-call rendering -- were absent; Phase 5 described only chrome.
- Configuration's editable-vs-read-only dual mode (503 when the process only
holds a published snapshot) is architecture, not styling.
- Tasks writes tab/attempt state with history.replaceState specifically to
avoid a remount per tab click.
- statTile also exports Sparkline, gauge also exports SegmentBar, and five
icons have no 1:1 Lucide equivalent, so those swaps are design calls.
- LOG_LEVELS is a wire contract matched by splitCSV server-side.
Corrections: the API surface is 48 methods plus two SSE subscribers, not ~45.
Mutations require both X-Archie-CSRF: 1 and Content-Type: application/json,
answered 403 and 415 -- the likeliest silent breakage after the port, now
stated exactly. My claim that a test enforced "no second fetch()" was wrong:
that text-scan was deliberately removed upstream for testing the file's wording
rather than its behaviour. The real guard was per-method header classification,
flagged as the one test worth bringing back first.
The 106px clipping figure is a live measurement and not recoverable from git,
so it now carries the viewport and both edge positions.
|
||
|
|
154f36f255 |
docs(webui): migration checklist for the Vue + shadcn-vue port
Records what has to exist again, the contracts that break silently if missed (embed output shape, the Go route registry, capability gating, the single fetch path, SSE teardown), and the behaviour shipped today that lives only in the deleted tree -- the chat launcher, the topbar shrink rules, the clamped activity detail, the corrected contrast tokens, the readyState-derived stream state. Five deleted modules are framework-free and port by rename; each encodes a bug fixed today, so re-deriving them by hand is how those bugs come back. |
||
|
|
d933d36449 |
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.
|
||
|
|
da0116f0ba |
fix(webui): stop the UI contradicting itself, and clear the AA failures
Four P1 findings from the audit. Workflows claimed "No workflow runs yet" directly above stage tables listing those runs (archie-core-rcbf). The rows were built from the definition list alone, so a workflow with statistics but no definition produced no row at all. workflow-rows.js now merges both sides: a run is evidence the workflow exists. The producer is also at fault -- /api/workflows returns definitions: [] from the archie-ui composition while the daemon logs a registry of seven -- which also means "Start work" never renders there. Filed as archie-core-3tij. The logs page said "Durable history unavailable" twice and promised live logs from a stream that had stopped (archie-core-c5bz). EventSource fires onerror both for a retry and for a give-up; readyState tells them apart, so a dead stream now reports "unavailable" in red instead of "reconnecting" in amber forever. The toolbar says "Live only" and the empty state carries the explanation, each once. An unconfigured update check (501) now says so on Configuration rather than rendering nothing at all. Contrast (archie-core-umdn). --fg-subtle was 3.37:1 dark and 2.72:1 light, used for every KPI caption and column header; both move to values clearing 4.5:1 on every surface they actually land on, down to surface-hover at 4.51. White on the dark accent was 3.2:1 on the active nav item and every primary button: --accent-fg becomes near-black at 5.96:1 and the accent itself is untouched, since it is also the link colour and reads correctly on the canvas. Swept four routes in both themes: no remaining failures outside elements painted on a gradient, which a compositing check cannot judge and which are white on blue-purple anyway. The HEALTH cards take their own height again (archie-core-1786637500926-421-7c63bcd3). Equalising them was right when both held a checklist; once setup completes, that card is a title and one line while Gate pulse carries a gauge and four rows, so matching heights left a ~400px empty box in the first screen. |
||
|
|
3dfc5394bd |
feat(webui): rehome update and dangerous-action controls to Configuration
Installing a release and approving a gated action are things you do to the deployment, not things you say to Archie. They lived in the chat surface only because that is where they were first built, and in a launcher panel a few hundred pixels wide they crowded out the conversation (archie-core-tf20). Both are new cards in ui/src/settings/operator-cards.jsx, wired into Configuration beside the read-only UpdateStatusCard that was already there. Behaviour is unchanged from the chat panel, including accepting both the capitalised and lowercase checkpoint field shapes the API has returned. A 501 from either endpoint renders no card at all rather than an error: a deployment that does not wire update-checking should show nothing, which is what the dev stack does. Reload Telegram deliberately did not move. It was never an API call -- the old handler sent the "/restart" chat command as a message -- so a Configuration button would have to post a chat message to reach the adapter. It stays as /restart in the palette until the cross-process restart RPC exists (archie-core-ry4k); archie-core-oif3 tracks landing it here afterwards. |
||
|
|
af8ba18068 |
fix(webui): make the chat panel behave like a chat window
Remediation from testing the launcher (archie-core-ifay), plus the morph Sam
asked for.
The panel grows out of the launcher rather than fading in beside it: closed, it
is collapsed to a pill the size of the button and translated over it; open, it
is the full panel. Scale, border-radius and position interpolate together, and
the contents fade in once the shape has mostly arrived, so the button reads as
becoming the panel. The launcher stays visible throughout and is the only
control that opens and closes it, so the panel carries no close button.
- Header shows the open conversation's name; ChatApp owns the header now,
because the title and the actions that change it belong to the same
component.
- New chat became the Lucide message-circle-plus glyph and moved into the
header. Added to the icon set, which is the same 24-grid stroke system.
- The commands accordion is gone. The composer's slash palette was already
the command surface and floats above the input; having both was two
answers to one question.
- Arrow keys scroll the palette so the selection stays visible. The decision
is pure arithmetic in command-scroll.js, including the case of an option
taller than the list, which aligns to its top so the command name is not
the part scrolled out of sight.
- The settings popover closes on any pointerdown or focus outside it.
- Stop renders only while a reply is streaming.
- The composer keeps focus and stays writeable during a send, so the next
message can be typed while one streams. It was `disabled`, which also made
the focus() in the send's finally block a silent no-op. sendMessage already
refuses a second concurrent turn via isSendingRef.
- Composer actions sit at the right of the input row, the resize handle is
gone, and the Enter/Shift+Enter hint is removed.
- Message bubbles dropped their "Archie"/"You" labels; side and colour
already say who spoke.
- Fixed an empty band under the composer: the panel still declared two grid
rows from when the launcher owned the header.
|
||
|
|
1422dc5955 |
fix(webui): make chat a FAB-opened panel and stop the topbar clipping
Four P0 defects from the frontend audit, plus the one-line theme fix that was
making every one of them look worse.
Chat is a floating launcher and the panel it opens, not a route
(archie-core-yuvg, archie-core-hesx). /chat rendered an empty page with a
drawer over it, and that drawer hosted the full-page chat workspace: a page
title, a conversations column, a four-control action row and a command-help
column, all inside 440px. Measured at 1440x900, .chat-workspace was 174px wide
holding 270px of content and the composer ran off the viewport.
- The Chat nav entry, the /chat route and the topbar chat icon are gone;
the launcher is the single way in.
- The panel anchors to the launcher and opens leftward from it, sharing its
bottom edge, so the button never moves. No scrim and no scroll lock: the
page stays readable and clickable, which is the point of asking Archie
about the page you are on.
- Conversations became a switcher in a compact bar; personality, provider
and model moved into a disclosure beside it; the empty state and composer
dropped to panel type scale.
- The launcher renders outside .shell because .shell's backdrop-filter is a
containing block for fixed positioning, which otherwise pinned the button
to the scrolling shell instead of the viewport.
- Update-check, Dangerous actions and Reload Telegram left the panel; their
api.* calls are untouched for the rehome to Configuration
(archie-core-tf20).
The topbar no longer clips its utility cluster (archie-core-mkb3). brand, nav
and topbar-end were all flex:none with no wrap above 1220px, and .app sets
overflow:hidden, so between 1221px and ~1582px the avatar, theme toggle and
documentation button were cut off with no way to reach them. The nav is now
the one region allowed to shrink, the search collapses to its icon below
1500px, and the nav wraps to its own row below 1270px where it stops fitting.
Live activity clamps its detail column (archie-core-qo7f). An agent_finish
payload rendered raw turned one row into six viewports and the dashboard into
7,481px. The cell shows the first meaningful line; the full text stays on the
title.
color-scheme is bound to the active theme (archie-core-nm0y), so scrollbars
and native controls stop rendering light inside the dark UI.
|
||
|
|
5baeadd85e |
chore(dev): move the dev State Store off the contested 9090
cockpit binds 9090 by default on this host, so task dev could not start the State Store and every service came up without one. dev.toml's own comment says to move the listen/target pair when that happens. |
||
|
|
d4ce6799b6 |
fix(yaegiutil): refuse incomplete Yaegi interface wrappers at load
The generated symbol tables carried 25 hand-added nil guards across three
packages, re-applied by hand after every regeneration because `yaegi extract`
does not emit them. Regeneration silently dropped them, and three package docs
instructed the next agent to put them back.
The guards also answered the wrong way. A nil WResolve returned ("", nil), so a
malformed secret engine served an empty secret and reported success; a nil
WStop reported a clean shutdown for a module that never ran one.
Reject the wrapper where it enters the daemon instead. Yaegi type-checks
"var X Iface = impl{}" and refuses an incomplete impl on its own, but the
wrapper type is exported into the symbol table, so interpreted code can build
one directly and struct-literal semantics leave the omitted method nil.
Resolve now names the missing method and skips the plugin.
Generated tables are used verbatim again. Also names the wanted type on a
failed assertion, which formatted as "want <nil>" for every interface target.
|
||
|
|
b2fcf25c0b |
feat(skills): make the archaeology main-check squash-aware
`git merge-base --is-ancestor` answers a topology question, so it reports a landed repair as never-landed for every squash merge and for any rebase merge that had to replay commits. This repository squash-merged its last fifteen pull requests (everything merged up to 2026-09-18 used merge commits), so the check documented in the failure-archaeology skill is a false negative for all of them. Add scripts/on-main.sh: `--is-ancestor` stays the offline fast path, and a non-ancestor falls back to the GitHub API, where merge state is recorded independently of the commit graph. It separates landed (0) from not-landed (1) from undetermined (2) instead of folding an unanswered question into a negative -- `if on-main.sh <ref>; then` is the mistake it exists to prevent. Verified against live data: ancestor -> 0, squash-merged PR #899 -> 0, closed unmerged PR #896 -> 1, commit in no pull request -> 1, local-only commit GitHub has never seen -> 2, bad ref / bad base / no args / bad option -> 2. |
||
|
|
37b688f462 |
refactor(plugin): delete the unused Registry type
Registry carried no plugin identity, discovery, compatibility or lifecycle, so it was never the seed for the approved internal/domain/plugin package. Host, Manifest and Module are, and they stay. Regenerating pluginextract strips the interface-wrapper nil guards, so those are restored by hand; the only intended change to the generated table is dropping the Registry symbol. |
||
|
|
0f957ed1a2 | chore(release): archied v1.30.0 archie v1.30.0 | ||
|
|
bba659a33c |
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. |
||
|
|
f45ebd288d |
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. |
||
|
|
2935010504 | fix(build): make formatting and CI converge (#901) | ||
|
|
301ced4dc0 |
test(daemon): prove a stalled forge cannot block a sibling sweep (#900)
sweepAccess sweeps each forge in its own goroutine, but nothing pinned that: the table test asserts coverage, not ordering, so the sweep could be made sequential again without a failure. The test stalls the root forge in AcceptInvitations and asserts the sibling identity is swept while it is still blocked, then that Startup returns once the stall is released. Verified RED against a sequential sweepAccess (times out waiting for the sibling) and GREEN against the goroutine-per-forge implementation. |
||
|
|
2cc579367a |
Fix/dashboard vocabulary single source (#898)
* fix(ui): make the served lifecycle vocabulary actually load
base/task-meta.jsx documents the backend as the source of truth: /api/task-meta
returns the statuses (label, pill severity, "needs you") and the operator
actions, and loadTaskMeta() replaces the freeze-dried defaults with that
catalog. Nothing called it. Every pill, status filter and action control read
the snapshot, so a catalogue change on the server never reached the browser --
the module's first paragraph was simply not true.
main.jsx now asks for the catalog once at boot, alongside the capabilities read
it already does for the same reason: the shell paints immediately and upgrades a
moment later.
The two vocabularies the dashboard mirrors rather than serves -- FILE_STATUS
(ids owned by internal/domain/workflow/task/changes.go) and CONFIG_SCHEMA
(events.ConfigCapturedSchema) -- are now documented as the deliberate second
tier, with their two-sided pins named, so the tree stops telling two stories
about where a vocabulary comes from. Both degrade to a raw id or the verbatim
payload rather than rendering something wrong, which is why mirroring is
tolerable there and not for a presentation catalog.
RED before (loader never called):
x booting the dashboard replaces the freeze-dried vocabulary with the served catalog
actual: 'custom_status', expected: 'Custom status'
Also repairs a drifted LAW asset. A fresh build of pristine main dirties both
ui/dist/assets/index.css and index.js:
|
||
|
|
29bd321894 |
feat(messaging): Messaging Service operator surface, chat report rendering, and the diff-cap config fix (#899)
* feat(workflow): post line-anchored review comments with suggested fixes Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached the operator only as a flat list in the PR body, so the author had to map every finding back to its line by hand and apply mechanical fixes by hand. Now the line-anchored findings are also posted as inline review comments, carrying a one-click suggestion when the reviewer could state the fix. Domain (internal/domain/workflow): - ReviewFinding gains Suggestion; Validate rejects one on anything but a confirmed finding, so the agent's record_finding call is refused with something it can act on. Validate splits into validateAnchor / validateClassification / validateDisposition, which also brings it back under the cyclop limit the gate enforces. - StagePostReviewComments runs after StageOpenPR in the implement workflow. It posts only line-anchored findings (Line > 0); a whole-file finding has no line to attach to and stays in the body list, which remains the complete record. It is best-effort: the PR is open and the body already lists every finding, so a failed comment is logged, never a park -- the same reasoning as OpenPR's existing best-effort LinkBranch call. - The suggestion fence is gated on Verdict == confirmed where the fence is written, because it is a one-click apply: a wrong suggestion breaks the code and the author has to notice. Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations, type-asserted like PullRequestReader so a forge that cannot is skipped rather than faked (NoopForge is pinned as not satisfying it). GitHub loops one CreateComment per comment and joins the failures, so one refused anchor cannot drop the rest; Gitea carries them on a single COMMENT-state review. Two deliberate departures from the PRD's sketch, both recorded in it: - The interface is batch (CreateReviewComments), not one call per comment: Gitea's only inline shape is one submitted review, and the set then crosses NATS once instead of once per finding. - The head SHA is resolved inside each forge implementation rather than by the caller. The stage runs in archie-agent, which holds no forge credentials and has no PullRequestReader; the daemon-side forgerpc handler is the only place that does. Transport (internal/forgerpc): workflow.Forger gains the method, so the agent reaches the daemon over the new create_review_comments subject; the server type-asserts the writer and answers an incapable forge with an error the stage logs. This is the one proxied method whose absence on an image skew does not park a task. The reviewer prompt and record_finding schema ask for a suggestion on a confirmed, mechanically fixable defect only. Regenerating the wfextract symbol table -- the documented way a new exported workflow symbol reaches interpreted stage plugins -- also picked up symbols that were missing from the committed table (the Status* and Source* constants, ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to every wrapper afterwards, as that file's header requires. Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new stage logic each fail a test that names the behaviour -- dropping the confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure escape -- so the tests discriminate rather than passing vacuously. * fix(build): drop the Dockerfile pin assertion The guard fetched golangci-lint's go.mod at image build time to fail the build when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped on self-inflicted pin drift, but it added a network fetch and a new failure mode to the release build, which is not where that belongs. The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 equals GOFUMPT_VERSION) and the comment above them still states the invariant, so the reasoning survives without the build-time machinery. The pin change itself reaches the agent image through the normal release path: CI rebuilds and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only release deliberately does not. * feat(workflow): add the remediate workflow for PR review remediation Implements step 5 of docs/prds/pr-review-remediation.md: a remediate workflow that resumes the task's existing worktree onto its PR branch (worktree.Manager.Resume, not Prepare's refresh), runs a builder agent against the review's actionable comments, commits and pushes to the same branch, and replies via the forge's ReplyToReview. Task.RetryCount doubles as the remediation round counter, capped by the repo's max_retries; the round-cap stage parks the task and posts one comment when it's hit. Task gains a ReviewPayload field (JSON-encoded review unit) with full store/proto/staterpc plumbing. workflow.Forger gains Comment and ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume and its Dir lookup are added as an unexported optional Trees capability rather than widening the exported interface, which is already at golangci-lint's interfacebloat cap and is projected into wfextract's Yaegi symbol table for repository-authored stage plugins. The daemon-side reaction consumer that dispatches into this workflow (subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing per-task serialization) is tracked separately in archie-core-8li9.4. * feat(messaging): extract standalone messaging service binary and process composition * feat(messaging): adapt channel frontends to consume Gateway ChatContract * feat(messaging): remove in-process channels and Router from daemon bootstrap Telegram, email and webhook now run only in the Messaging Service, which reaches this process through the Gateway's ChatContract. The daemon builds no channel and no gateway.Router, so the wiring that existed only to serve them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway, setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the release-announcement path helper. The seams those paths owned move to where they can still be honoured: - Channel ValidateConfig runs in archiemessaging.compose, which now returns an error, so a configured-but-invalid front-end fails the service rather than being dropped silently. - The inbound rate limiter moves to the Gateway process, which owns the only Router and therefore the only place a per-sender budget applies to every channel's turns. - The daemon's gateway readiness probe becomes a ContractProbe against the Gateway. It cannot observe a channel lifecycle it no longer runs, and a channel-count probe would have reported every daemon degraded. - telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a chat turn runner actually reads. Telegram operator features that were wired only in the daemon (/update, release announcements, version reporting, SIGHUP reload) are not yet wired in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting: archie-core-8cda.6.8. The Gateway process builds no worktree manager, so review_pr is unadvertised on every channel: archie-core-8cda.6.7. * feat(messaging): re-wire the Telegram operator surface in the Messaging Service setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's own process. Each is resolved by where the fact it needs is owned, not by where it used to be built; the decision table is in docs/architecture/migration-decisions.md. Wired here: /update (built from this service's own [chat.telegram] check and install commands), the update-report relay (same sha256(bot_user)[:8] path the daemon wrote, so a pending report is found rather than written afresh), show_tool_calls, and /restart's config reload, which re-resolves the token and allowlist from this service's own file and refuses a reload that resolves to an empty token. /version is sourced from the Gateway: ChatSnapshot gains a Version field carrying the Gateway's rendered build block, read per call and bounded by the dependency timeout. cmd/archie-messaging deliberately takes no version ldflags, so it cannot report a partial upgrade as a matched one. RunningVersions and ReleaseAnnouncements stay nil. Both need a component's real running version, and the only versions this process can obtain are a different binary's stamps -- reporting them would manufacture exactly the false success the update check exists to catch, and the announcer without parseable versions is a no-op that reads as configured. archie-core-8cda.6.9 carries the contract that unblocks them. Dangerous stays nil: no composition has ever supplied a command authority. Enrich is dropped from the update service: componentInstallTypeEnricher read [nats], which this service must not decode, so the check command's own reported install type stands. * fix(workflow): guard inline review comments against head drift Two findings from the review of q9au. A comment's line numbers describe exactly one revision of the branch, but the forge resolved the pull request's head at posting time -- after the review had already read the worktree. A push in that window (a collaborator, a retry) meant the findings were anchored to whatever now occupied those lines, mislabelling instead of failing. The revision the review measured now travels with the comment set: OpenPR records it from the same worktree read it already performs (TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through Forger to forgerpc, and the forge refuses the whole set once the head it reads has moved off it -- which the best-effort stage logs, the PR body remaining the record. An unmeasured revision posts unverified rather than dropping every finding, so a worktree that cannot report one degrades instead of regressing. Suggestion was documented single-line only, because GitHub applies a suggestion fence up to its first line and a multi-line replacement would silently corrupt the file. Only the verdict was validated, so a multi-line suggestion reached the renderer and posted as that truncated fence. Validate now rejects an embedded newline, which makes record_finding refuse it with feedback the model can act on instead of the reviewer discovering the corruption later. * fix(gateway): render chat reports as lines, not one run-on paragraph /status and /tasks are line-oriented reports, but their newlines were plain "\n" -- CommonMark's soft wrap. The Telegram rich-block renderer space-joins soft-wrapped lines, by design: a Telegram paragraph renders an embedded newline as nothing at all, so a space is the only separator that survives. The reports therefore arrived as one line each: "Runtime Provider: DeepSeek Model: deepseek/deepseek-flash", and every task's title, state and park reason jammed together. The renderer now implements CommonMark's hard line break (two trailing spaces, or a trailing backslash): the line closes its own block and the next one hugs it, so a stanza keeps its lines without the spacer paragraph that separates unrelated blocks. Ordinary prose is untouched -- a model's wrapped paragraph still joins with a space. The producers mark their report lines with it. Two report fixes alongside: - A park reason is capped to its first line at 160 runes. It carries whatever the failing stage reported, which for a lint gate is the whole tool log; unbounded, one parked task pushed every other task out of the reply. The full reason is still on the task. - /status loses its "Runtime" sub-header. A section header over two fields made a four-fact report read like a document. * fix(config): let diff_cap_lines = 0 actually switch the cap off Config.DiffCapLines was a plain int, so the defaults pass could not tell an absent key from an explicit 0 and rewrote both to 400. The dashboard schema said "0 means unlimited" and StageDiffCap treated <= 0 as unlimited, but 0 never reached the step: the documented way to switch the cap off was unreachable through config. Same root cause, worse instance: configForIdentity assigned root.DiffCapLines = identity.DiffCapLines unconditionally, so an identity that simply omitted the key overwrote the shared cap with the zero value and silently disabled the safety rail for that identity. DiffCapLines is now *int on both Config and IdentityConfig -- nil is absent, 0 is no cap -- read through Config.DiffCap(). Defaults fill only nil, and an identity overrides only when it set the key. TaskConfig keeps a resolved int, so the daemon/agent wire format is unchanged and a version-skewed agent cannot misread a null. The park reason changes too. It told the operator to "approve manually", but a parked task's actions are retry, abandon and reject (internal/taskstate): there is no approve path out of diff-cap, so it sent them looking for a button that does not exist. It now names the two things that work. * feat(config): make the daemon's readiness dependency timeout configurable The daemon's gateway probe bounded its call with a hardcoded 5s constant, while every other NewContractProbe call site (archie-ui, archie-messaging) passes the service's configured DependencyTimeout. It was the only magic number among them. [health].dependency_timeout carries it, defaulting to the same 5s the extracted services' -dependency-timeout flag defaults to, so every process bounds a probe into a dependency the same way out of the box. It is not added to the dashboard config schema or the reloadable set: [health] appears in neither today, health.listen included, and a probe assembled at boot would not observe a reload anyway. |
||
|
|
1dc212e50e |
feat(gateway): give /status a real daemon-health surface (#892)
* feat(gateway): give /status a real daemon-health surface Phase 2 of archie-core-wp9s. Phase 1 split the commands apart (health vs work) but left /status with one aggregate queue line and a static runtime block; it could not answer the questions an operator actually asks when something feels wrong. /status now reports, between the queue line and the runtime block: - Broker: the live state of this process's own NATS connection (eventbus/nats.Client.Connected), not a fresh dial -- a probe would report the probe's reachability, not the daemon's. - Containers: the pool's own active counter against the configured cap (Pool.Active/Cap), not a Docker listing, which would include containers this pool does not own. A zero cap means unlimited, so it is not shown as a ratio. - Channels: the channel manager's real lifecycle state, including a failed adapter's reason (the documented decision: read the existing manager rather than re-deriving health per adapter). - Chat model: last-known outcome of every chat-model call this process made, recorded once in sendChatTurn (the single choke point) and read back by /status. The second documented decision: never a live probe, so /status stays instant and reports what happened -- or says plainly that nothing has been attempted yet. - Last poll: when the most recent poll pass began, stamped on both poll paths (Run's single-identity loop and runIdentities' per-identity goroutines). A pass that hangs leaves the stamp stale, which is the signal; stamping completion would leave a wedged poller looking healthy. Truthful or absent: a section this process has no source for is omitted rather than rendered as a zero. The standalone Gateway owns no poll loop, pool or channel manager, so its /status reports broker and chat-model health only; aggregating across processes would need a new daemon RPC and is deliberately not built. Version stays out (/version owns it). /status and /tasks descriptions now describe what each command actually does on both published surfaces (Telegram menu/help and the shared specs), pinned by a test that also fails if the two surfaces drift. Sources are read through functions, not captured values: occupancy and channel state move, and the daemon is built after the gateways, so a source captured at construction would freeze /status on boot state. Left in place deliberately: the Runtime (provider/model) block, which Phase 1 flagged and which duplicates /model and /whoami. Removing it is a product call on a command Sam uses daily, not a mechanical follow-up. * docs(prds): record the two open /status health decisions as settled Both were flagged in PR #892 as needing the maintainer's call; both are now answered, and the PRD is the place a follow-up would look: - The Runtime (provider/model) block stays. It is the one line in /status the ticket's own rule says should not be there, but /status is read daily to see the active model at a glance, so the duplication is deliberate. Recorded as a settled product decision so it is not removed later as an oversight. - Health stays per-process. Pooling the daemon's and the Gateway's chat-model outcomes would need a new daemon<->gateway health RPC for one status line, and a per-process line is true where an aggregate would be a claim about a process the answering one cannot see. /agents' published description is still left to archie-core-mxls, unchanged. |
||
|
|
9e307c21de |
fix(container): stop the reaper from deleting teardown bookkeeping early (#893)
The reaper's deferred forgetTeardown could delete a container's teardown entry between the reaper's own claim and Release's later claim check. teardownLocked then recreated a fresh, unclosed entry, letting Release believe it still owned teardown and re-run ContainerStop/ContainerRemove. Release is now the sole owner of deleting the entry, since it always runs for every acquired container. |
||
|
|
d4ac771e38 |
Feat/q9au inline review comments (#895)
* feat(workflow): post line-anchored review comments with suggested fixes Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached the operator only as a flat list in the PR body, so the author had to map every finding back to its line by hand and apply mechanical fixes by hand. Now the line-anchored findings are also posted as inline review comments, carrying a one-click suggestion when the reviewer could state the fix. Domain (internal/domain/workflow): - ReviewFinding gains Suggestion; Validate rejects one on anything but a confirmed finding, so the agent's record_finding call is refused with something it can act on. Validate splits into validateAnchor / validateClassification / validateDisposition, which also brings it back under the cyclop limit the gate enforces. - StagePostReviewComments runs after StageOpenPR in the implement workflow. It posts only line-anchored findings (Line > 0); a whole-file finding has no line to attach to and stays in the body list, which remains the complete record. It is best-effort: the PR is open and the body already lists every finding, so a failed comment is logged, never a park -- the same reasoning as OpenPR's existing best-effort LinkBranch call. - The suggestion fence is gated on Verdict == confirmed where the fence is written, because it is a one-click apply: a wrong suggestion breaks the code and the author has to notice. Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations, type-asserted like PullRequestReader so a forge that cannot is skipped rather than faked (NoopForge is pinned as not satisfying it). GitHub loops one CreateComment per comment and joins the failures, so one refused anchor cannot drop the rest; Gitea carries them on a single COMMENT-state review. Two deliberate departures from the PRD's sketch, both recorded in it: - The interface is batch (CreateReviewComments), not one call per comment: Gitea's only inline shape is one submitted review, and the set then crosses NATS once instead of once per finding. - The head SHA is resolved inside each forge implementation rather than by the caller. The stage runs in archie-agent, which holds no forge credentials and has no PullRequestReader; the daemon-side forgerpc handler is the only place that does. Transport (internal/forgerpc): workflow.Forger gains the method, so the agent reaches the daemon over the new create_review_comments subject; the server type-asserts the writer and answers an incapable forge with an error the stage logs. This is the one proxied method whose absence on an image skew does not park a task. The reviewer prompt and record_finding schema ask for a suggestion on a confirmed, mechanically fixable defect only. Regenerating the wfextract symbol table -- the documented way a new exported workflow symbol reaches interpreted stage plugins -- also picked up symbols that were missing from the committed table (the Status* and Source* constants, ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to every wrapper afterwards, as that file's header requires. Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new stage logic each fail a test that names the behaviour -- dropping the confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure escape -- so the tests discriminate rather than passing vacuously. * fix(build): drop the Dockerfile pin assertion The guard fetched golangci-lint's go.mod at image build time to fail the build when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped on self-inflicted pin drift, but it added a network fetch and a new failure mode to the release build, which is not where that belongs. The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 equals GOFUMPT_VERSION) and the comment above them still states the invariant, so the reasoning survives without the build-time machinery. The pin change itself reaches the agent image through the normal release path: CI rebuilds and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only release deliberately does not. * feat(workflow): add the remediate workflow for PR review remediation Implements step 5 of docs/prds/pr-review-remediation.md: a remediate workflow that resumes the task's existing worktree onto its PR branch (worktree.Manager.Resume, not Prepare's refresh), runs a builder agent against the review's actionable comments, commits and pushes to the same branch, and replies via the forge's ReplyToReview. Task.RetryCount doubles as the remediation round counter, capped by the repo's max_retries; the round-cap stage parks the task and posts one comment when it's hit. Task gains a ReviewPayload field (JSON-encoded review unit) with full store/proto/staterpc plumbing. workflow.Forger gains Comment and ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume and its Dir lookup are added as an unexported optional Trees capability rather than widening the exported interface, which is already at golangci-lint's interfacebloat cap and is projected into wfextract's Yaegi symbol table for repository-authored stage plugins. The daemon-side reaction consumer that dispatches into this workflow (subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing per-task serialization) is tracked separately in archie-core-8li9.4. * feat(messaging): extract standalone messaging service binary and process composition * feat(messaging): adapt channel frontends to consume Gateway ChatContract * feat(messaging): remove in-process channels and Router from daemon bootstrap Telegram, email and webhook now run only in the Messaging Service, which reaches this process through the Gateway's ChatContract. The daemon builds no channel and no gateway.Router, so the wiring that existed only to serve them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway, setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the release-announcement path helper. The seams those paths owned move to where they can still be honoured: - Channel ValidateConfig runs in archiemessaging.compose, which now returns an error, so a configured-but-invalid front-end fails the service rather than being dropped silently. - The inbound rate limiter moves to the Gateway process, which owns the only Router and therefore the only place a per-sender budget applies to every channel's turns. - The daemon's gateway readiness probe becomes a ContractProbe against the Gateway. It cannot observe a channel lifecycle it no longer runs, and a channel-count probe would have reported every daemon degraded. - telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a chat turn runner actually reads. Telegram operator features that were wired only in the daemon (/update, release announcements, version reporting, SIGHUP reload) are not yet wired in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting: archie-core-8cda.6.8. The Gateway process builds no worktree manager, so review_pr is unadvertised on every channel: archie-core-8cda.6.7. * feat(messaging): re-wire the Telegram operator surface in the Messaging Service setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's own process. Each is resolved by where the fact it needs is owned, not by where it used to be built; the decision table is in docs/architecture/migration-decisions.md. Wired here: /update (built from this service's own [chat.telegram] check and install commands), the update-report relay (same sha256(bot_user)[:8] path the daemon wrote, so a pending report is found rather than written afresh), show_tool_calls, and /restart's config reload, which re-resolves the token and allowlist from this service's own file and refuses a reload that resolves to an empty token. /version is sourced from the Gateway: ChatSnapshot gains a Version field carrying the Gateway's rendered build block, read per call and bounded by the dependency timeout. cmd/archie-messaging deliberately takes no version ldflags, so it cannot report a partial upgrade as a matched one. RunningVersions and ReleaseAnnouncements stay nil. Both need a component's real running version, and the only versions this process can obtain are a different binary's stamps -- reporting them would manufacture exactly the false success the update check exists to catch, and the announcer without parseable versions is a no-op that reads as configured. archie-core-8cda.6.9 carries the contract that unblocks them. Dangerous stays nil: no composition has ever supplied a command authority. Enrich is dropped from the update service: componentInstallTypeEnricher read [nats], which this service must not decode, so the check command's own reported install type stands. * fix(workflow): guard inline review comments against head drift Two findings from the review of q9au. A comment's line numbers describe exactly one revision of the branch, but the forge resolved the pull request's head at posting time -- after the review had already read the worktree. A push in that window (a collaborator, a retry) meant the findings were anchored to whatever now occupied those lines, mislabelling instead of failing. The revision the review measured now travels with the comment set: OpenPR records it from the same worktree read it already performs (TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through Forger to forgerpc, and the forge refuses the whole set once the head it reads has moved off it -- which the best-effort stage logs, the PR body remaining the record. An unmeasured revision posts unverified rather than dropping every finding, so a worktree that cannot report one degrades instead of regressing. Suggestion was documented single-line only, because GitHub applies a suggestion fence up to its first line and a multi-line replacement would silently corrupt the file. Only the verdict was validated, so a multi-line suggestion reached the renderer and posted as that truncated fence. Validate now rejects an embedded newline, which makes record_finding refuse it with feedback the model can act on instead of the reviewer discovering the corruption later. * fix(gateway): render chat reports as lines, not one run-on paragraph /status and /tasks are line-oriented reports, but their newlines were plain "\n" -- CommonMark's soft wrap. The Telegram rich-block renderer space-joins soft-wrapped lines, by design: a Telegram paragraph renders an embedded newline as nothing at all, so a space is the only separator that survives. The reports therefore arrived as one line each: "Runtime Provider: DeepSeek Model: deepseek/deepseek-flash", and every task's title, state and park reason jammed together. The renderer now implements CommonMark's hard line break (two trailing spaces, or a trailing backslash): the line closes its own block and the next one hugs it, so a stanza keeps its lines without the spacer paragraph that separates unrelated blocks. Ordinary prose is untouched -- a model's wrapped paragraph still joins with a space. The producers mark their report lines with it. Two report fixes alongside: - A park reason is capped to its first line at 160 runes. It carries whatever the failing stage reported, which for a lint gate is the whole tool log; unbounded, one parked task pushed every other task out of the reply. The full reason is still on the task. - /status loses its "Runtime" sub-header. A section header over two fields made a four-fact report read like a document. |
||
|
|
2d3e4e59ad |
fix(ui,gateway): load the served lifecycle vocabulary, and make the page registry match the routes (#890)
* fix(ui): make the served lifecycle vocabulary actually load
base/task-meta.jsx documents the backend as the source of truth: /api/task-meta
returns the statuses (label, pill severity, "needs you") and the operator
actions, and loadTaskMeta() replaces the freeze-dried defaults with that
catalog. Nothing called it. Every pill, status filter and action control read
the snapshot, so a catalogue change on the server never reached the browser --
the module's first paragraph was simply not true.
main.jsx now asks for the catalog once at boot, alongside the capabilities read
it already does for the same reason: the shell paints immediately and upgrades a
moment later.
The two vocabularies the dashboard mirrors rather than serves -- FILE_STATUS
(ids owned by internal/domain/workflow/task/changes.go) and CONFIG_SCHEMA
(events.ConfigCapturedSchema) -- are now documented as the deliberate second
tier, with their two-sided pins named, so the tree stops telling two stories
about where a vocabulary comes from. Both degrade to a raw id or the verbatim
payload rather than rendering something wrong, which is why mirroring is
tolerable there and not for a presentation catalog.
RED before (loader never called):
x booting the dashboard replaces the freeze-dried vocabulary with the served catalog
actual: 'custom_status', expected: 'Custom status'
Also repairs a drifted LAW asset. A fresh build of pristine main dirties both
ui/dist/assets/index.css and index.js:
|
||
|
|
c29cdf6f79 |
feat(workflow): post line-anchored review comments with suggested fixes (#891)
* feat(workflow): post line-anchored review comments with suggested fixes Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached the operator only as a flat list in the PR body, so the author had to map every finding back to its line by hand and apply mechanical fixes by hand. Now the line-anchored findings are also posted as inline review comments, carrying a one-click suggestion when the reviewer could state the fix. Domain (internal/domain/workflow): - ReviewFinding gains Suggestion; Validate rejects one on anything but a confirmed finding, so the agent's record_finding call is refused with something it can act on. Validate splits into validateAnchor / validateClassification / validateDisposition, which also brings it back under the cyclop limit the gate enforces. - StagePostReviewComments runs after StageOpenPR in the implement workflow. It posts only line-anchored findings (Line > 0); a whole-file finding has no line to attach to and stays in the body list, which remains the complete record. It is best-effort: the PR is open and the body already lists every finding, so a failed comment is logged, never a park -- the same reasoning as OpenPR's existing best-effort LinkBranch call. - The suggestion fence is gated on Verdict == confirmed where the fence is written, because it is a one-click apply: a wrong suggestion breaks the code and the author has to notice. Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations, type-asserted like PullRequestReader so a forge that cannot is skipped rather than faked (NoopForge is pinned as not satisfying it). GitHub loops one CreateComment per comment and joins the failures, so one refused anchor cannot drop the rest; Gitea carries them on a single COMMENT-state review. Two deliberate departures from the PRD's sketch, both recorded in it: - The interface is batch (CreateReviewComments), not one call per comment: Gitea's only inline shape is one submitted review, and the set then crosses NATS once instead of once per finding. - The head SHA is resolved inside each forge implementation rather than by the caller. The stage runs in archie-agent, which holds no forge credentials and has no PullRequestReader; the daemon-side forgerpc handler is the only place that does. Transport (internal/forgerpc): workflow.Forger gains the method, so the agent reaches the daemon over the new create_review_comments subject; the server type-asserts the writer and answers an incapable forge with an error the stage logs. This is the one proxied method whose absence on an image skew does not park a task. The reviewer prompt and record_finding schema ask for a suggestion on a confirmed, mechanically fixable defect only. Regenerating the wfextract symbol table -- the documented way a new exported workflow symbol reaches interpreted stage plugins -- also picked up symbols that were missing from the committed table (the Status* and Source* constants, ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to every wrapper afterwards, as that file's header requires. Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new stage logic each fail a test that names the behaviour -- dropping the confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure escape -- so the tests discriminate rather than passing vacuously. * fix(build): drop the Dockerfile pin assertion The guard fetched golangci-lint's go.mod at image build time to fail the build when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped on self-inflicted pin drift, but it added a network fetch and a new failure mode to the release build, which is not where that belongs. The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 equals GOFUMPT_VERSION) and the comment above them still states the invariant, so the reasoning survives without the build-time machinery. The pin change itself reaches the agent image through the normal release path: CI rebuilds and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only release deliberately does not. * feat(workflow): add the remediate workflow for PR review remediation Implements step 5 of docs/prds/pr-review-remediation.md: a remediate workflow that resumes the task's existing worktree onto its PR branch (worktree.Manager.Resume, not Prepare's refresh), runs a builder agent against the review's actionable comments, commits and pushes to the same branch, and replies via the forge's ReplyToReview. Task.RetryCount doubles as the remediation round counter, capped by the repo's max_retries; the round-cap stage parks the task and posts one comment when it's hit. Task gains a ReviewPayload field (JSON-encoded review unit) with full store/proto/staterpc plumbing. workflow.Forger gains Comment and ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume and its Dir lookup are added as an unexported optional Trees capability rather than widening the exported interface, which is already at golangci-lint's interfacebloat cap and is projected into wfextract's Yaegi symbol table for repository-authored stage plugins. The daemon-side reaction consumer that dispatches into this workflow (subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing per-task serialization) is tracked separately in archie-core-8li9.4. * feat(messaging): extract standalone messaging service binary and process composition * feat(messaging): adapt channel frontends to consume Gateway ChatContract * feat(messaging): remove in-process channels and Router from daemon bootstrap Telegram, email and webhook now run only in the Messaging Service, which reaches this process through the Gateway's ChatContract. The daemon builds no channel and no gateway.Router, so the wiring that existed only to serve them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway, setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the release-announcement path helper. The seams those paths owned move to where they can still be honoured: - Channel ValidateConfig runs in archiemessaging.compose, which now returns an error, so a configured-but-invalid front-end fails the service rather than being dropped silently. - The inbound rate limiter moves to the Gateway process, which owns the only Router and therefore the only place a per-sender budget applies to every channel's turns. - The daemon's gateway readiness probe becomes a ContractProbe against the Gateway. It cannot observe a channel lifecycle it no longer runs, and a channel-count probe would have reported every daemon degraded. - telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a chat turn runner actually reads. Telegram operator features that were wired only in the daemon (/update, release announcements, version reporting, SIGHUP reload) are not yet wired in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting: archie-core-8cda.6.8. The Gateway process builds no worktree manager, so review_pr is unadvertised on every channel: archie-core-8cda.6.7. * feat(messaging): re-wire the Telegram operator surface in the Messaging Service setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's own process. Each is resolved by where the fact it needs is owned, not by where it used to be built; the decision table is in docs/architecture/migration-decisions.md. Wired here: /update (built from this service's own [chat.telegram] check and install commands), the update-report relay (same sha256(bot_user)[:8] path the daemon wrote, so a pending report is found rather than written afresh), show_tool_calls, and /restart's config reload, which re-resolves the token and allowlist from this service's own file and refuses a reload that resolves to an empty token. /version is sourced from the Gateway: ChatSnapshot gains a Version field carrying the Gateway's rendered build block, read per call and bounded by the dependency timeout. cmd/archie-messaging deliberately takes no version ldflags, so it cannot report a partial upgrade as a matched one. RunningVersions and ReleaseAnnouncements stay nil. Both need a component's real running version, and the only versions this process can obtain are a different binary's stamps -- reporting them would manufacture exactly the false success the update check exists to catch, and the announcer without parseable versions is a no-op that reads as configured. archie-core-8cda.6.9 carries the contract that unblocks them. Dangerous stays nil: no composition has ever supplied a command authority. Enrich is dropped from the update service: componentInstallTypeEnricher read [nats], which this service must not decode, so the check command's own reported install type stands. * fix(workflow): guard inline review comments against head drift Two findings from the review of q9au. A comment's line numbers describe exactly one revision of the branch, but the forge resolved the pull request's head at posting time -- after the review had already read the worktree. A push in that window (a collaborator, a retry) meant the findings were anchored to whatever now occupied those lines, mislabelling instead of failing. The revision the review measured now travels with the comment set: OpenPR records it from the same worktree read it already performs (TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through Forger to forgerpc, and the forge refuses the whole set once the head it reads has moved off it -- which the best-effort stage logs, the PR body remaining the record. An unmeasured revision posts unverified rather than dropping every finding, so a worktree that cannot report one degrades instead of regressing. Suggestion was documented single-line only, because GitHub applies a suggestion fence up to its first line and a multi-line replacement would silently corrupt the file. Only the verdict was validated, so a multi-line suggestion reached the renderer and posted as that truncated fence. Validate now rejects an embedded newline, which makes record_finding refuse it with feedback the model can act on instead of the reviewer discovering the corruption later. |
||
|
|
c1f5977a39 |
fix(build): make task fmt apply the gofumpt rules task lint checks
`task lint` enables gofumpt's `extra-rules`, so it demands `func f(a, b int)` where `task fmt`'s bare `gofumpt -w .` left `func f(a int, b int)` alone -- and `task fmt` is the documented repair for a failing gate, so a contributor had no command that could satisfy `task check`. That is the same failure shape as the version drift fixed alongside it, one layer up: fmt and lint are not the same formatter, so only the rules they happen to share are safe. `-extra` matches `extra-rules`, and nothing reformats as a result: the tree is already clean under it (`gofumpt -extra -l .` is empty). Still open, filed as archie-core-q288: gci's custom-order places archie-core imports last where gofumpt sorts them alphabetically, so `task fmt` can still produce formatting it will never fix. That needs a decision about which formatter owns formatting rather than another flag, and it is a decision CI cannot currently surface at all -- the deploy gate never runs golangci-lint. |
||
|
|
19f42aabfd |
docs(prds): write PRDs for tool/MCP completion, self-update transaction, extensions center
Covers the three ready epics with no settled design: archie-core-1786637493439-140-2cee2e9b (tools/MCP/guardrails, mostly already shipped — scoped down to the five real gaps), archie-core-hj1t (self-update artifact install/topology migration/journaled transaction), and archie-core-1786637490708-35-38424ead (Extensions center). Child issues filed and linked back to each doc's matching section. |
||
|
|
74c2f12cf5 |
fix(build): pin gofumpt and golangci-lint as one matched pair
`task fmt` formats with the standalone gofumpt and `task lint` re-checks that formatting with the gofumpt golangci-lint vendors. `task check` runs `fmt` then `lint` without diffing the tree, so `lint` is the only hard failure for formatting -- and when the two versions differ, any construct they disagree on makes the gate unsatisfiable: the standalone formatter rewrites a file one way and lint rejects it, with nothing a contributor can run to satisfy both. The surfaces had drifted onto three different pairs. This machine ran gofumpt v0.7.0 against golangci-lint 2.13.2 (vendors v0.11.0), the image pinned golangci-lint 2.12.2 (vendors v0.9.2) next to gofumpt v0.11.0, and CI installed gofumpt@latest. `any((Trees)(nil))` in changes_test.go is the construct that surfaced it: gofumpt <= v0.9.2 keeps the redundant parens, >= v0.10.0 removes them. - Dockerfile: golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 now equals the pinned GOFUMPT_VERSION, so the image's two formatters agree. - Dockerfile: fail the build if the pins ever diverge, rather than ship an image whose gate cannot pass. - deploy.yml: gofumpt@v0.11.0 instead of @latest, which drifts ahead of whatever golangci-lint vendors. - Record the invariant where an agent will meet it: AGENTS.md (CLAUDE.md) and the build-and-env skill, whose snapshots now name the pinned pair instead of calling both unpinned. |
||
|
|
7a7baf2b37 |
docs: add reusable PRD template with multi-agent execution breakdown
Extract the shape that worked for image-capability-contract.md (decisive per-sub-feature decisions instead of deferrals, a call-site inventory, and a council-lens assignment per slice) into a template so future PRDs get written the same way -- and so the resulting sub-issues are clear enough for a cheaper/faster model to implement without re-deriving the design. - references/templates.md: new "PRD: open capability design with multi-agent execution" template. - SKILL.md: docs/prds/ was missing from the "choose one destination" table entirely; added. - image-capability-contract.md: retrofitted with the Execution breakdown (lens assignment per #498-501) the template now asks for. |
||
|
|
559e27dded |
docs(prds): complete the image gen/edit PRD across all five open beads
The contract-only doc (#497) explicitly deferred hosted provider (#498), local GPU provider (#499), /image routing (#500), and channel/web delivery (#501) to sibling beads with no design recorded. Fill in all four plus a call-site inventory: - Hosted: decide ai-sdk for generate, direct HTTP for edit (ai-sdk has no edit support) -- the decision the original doc explicitly punted on. - Local: ComfyUI as the baseline recipe (no prior art in this repo to reconcile), submit/poll shaped like minimax.Client.GenerateAndWait. - /image: Router.handleImage beside handleModel, per-request mechanism selection (session-scoped preference has no generic home in Router today, confirmed by reading its fields -- not invented here). - Delivery: mostly already built. generate_video's MultimodalResult -> MediaEvent -> channel pipeline already handles "image" generically; Telegram already calls SendPhoto. Documented per-channel evidence instead of assuming a gap that isn't there. |
||
|
|
d591d02f0b |
fix(tools): stop silently truncating tracker titles in reachaudit output
The whole-package section hard-truncated tracker hit text to 56 chars with no ellipsis, so long issue titles cut off mid-word (e.g. "...neither re"). Switch to the same indented-list format already used for the in-package section instead of a fixed-width single line. |
||
|
|
0c9d61eed3 |
feat(tools): surface half-wired symbols inside shipped packages in reachaudit
reachaudit classified whole unreachable packages but explicitly skipped
findings inside packages already in the cmd closure ("reported separately
as live-package findings" -- never implemented). That's the more common
half-built-feature shape: the package ships, one symbol at its call site
doesn't (crondelivery.ChatCourier, eda/playbook.Store.Dispatch,
gatewayrpc.StoreClient). Add a second in-package-* report section using
the same tracked/untracked/dynamic classification. Also wires the --md
flag, which was accepted but never written.
|
||
|
|
bea9e6a9dd |
fix(deps): bump grpc to patch GO-2026-6443
Server panic via missing :authority/Host header, reachable through archied's gRPC gateway server. No stable google.golang.org/grpc release carries the fix yet, so this pins the pre-release commit that does. |
||
|
|
9979dea4fe | chore(release): archied v1.29.0 archie v1.29.0 | ||
|
|
19b400bf07 |
chore(plugin): delete the unwired capability-host health surface (#882)
* chore(plugin): delete the unwired capability-host health surface
plugin.Host.Health, plugin.Host.Manifests, ModuleStatus and their private
safeHealth helper were implemented, exhaustively tested, and called from nowhere
but their own tests. AGENTS.md forbids speculative surfaces, and no settled
design places plugin module status anywhere that exists:
- docs/prds/status-health-surface.md Phase 2 is self-described as "a proposed
resolution, awaiting Sam's sign-off -- not yet implemented", and does not
mention plugin status even in that unapproved list.
- The readiness subsystem enumerates exactly five probes -- state_db, config,
disk, model, gateway (internal/app/archied/readiness.go) -- with no plugin
probe.
- docs/architecture/plugins-and-extensions.md names no operator-visible plugin
status surface.
- The only bead naming it is closed.
plugin.Host itself stays: it is the daemon's live capability host, constructed
and Start/Stop-ed from internal/app/archied. Only the unconsumed observability
methods go.
host_contract_test.go encoded the defect -- it asserted plugin.Host *defines*
"Health" and "Manifests" -- so those two names are removed from its list, which
is now exactly the shipped lifecycle: Register, Start, Stop. The three tests
covering the deleted surface are removed with it.
The Yaegi symbol table (internal/plugin/pluginextract) was regenerated rather
than hand-edited, so ModuleStatus leaves the reflected type set with it.
Reachability evidence: Host.Health and Host.Manifests appear only in their own
tests; plugin.Host is otherwise reached from bootstrap.go and gateway.go for
Register/Start/Stop. Note that "task reachability" does NOT flag these -- the
address-taken constructor is a known blind spot of the whole-program RTA.
* chore(plugin): delete the dead Module.Health chain wired to nothing
Extends the capability-host observability deletion: plugin.Module.Health
was a required interface method with real implementations in
tools/provider/mcp and tools/provider/builtin, aggregated by
tools/provider.Registry.Health via a provider-package-local safeHealth,
and backed by per-module LifecycleState bookkeeping in plugin.Host
(registeredModule.state, setModuleState). None of it had a caller before
this change -- Host.Health was the only thing that would ever have read
a registered module's Health(), and Host.Health was already deleted as
unreachable. registeredModule.state was write-only: nothing ever read it.
Deleted:
- plugin.Module.Health, plugin.Health/HealthStatus (+ consts),
plugin.LifecycleState (+ consts), legacyModule.Health,
registeredModule.state, Host.setModuleState and its call sites.
- tools/provider.Registry.Health, tools/provider.safeHealth.
- tools/provider/mcp.Provider.Health, tools/provider/builtin.Provider.Health.
- Tests exclusively covering the above, and fakes' now-unnecessary Health
methods (plugin/host_test.go, pluginextract/reachability_test.go,
tools/provider/{provider,optional}_test.go, tools/provider/mcp/provider_test.go,
app/agentworker/mcp_providers_test.go).
internal/plugin/pluginextract's generated file was regenerated via
`go generate ./internal/plugin/...` and the yaegi wrapper nil-guards
(dropped by fresh generation, as documented in reachability_test.go)
were reapplied by hand to WManifest/WStart/WStop/WName/WVersion,
following this repo's established post-regen pattern.
|
||
|
|
10e7d0301c |
chore(memory): delete internal/memory (unification slice 5) (#889)
Deletes internal/memory (Manager, builtin.Provider, memory_edit tool) now
that slices 2-4 built the CRUD engine family and its per-turn read/write
seams. Also deletes internal/infrastructure/memory/builtin/provider.go (the
memory_edit adapter over the old package -- its markdown store already
relocated in slice 2), internal/tools/provider/memory (the old tool
registration, redundant with slice 4's memory_create/update/delete/list),
config.Memory.{Provider,ProviderConfig} and the validateMemory rejection
that existed only to complain about Provider, and webui.MemoryStatus/
MemoryProviderHandle plus its dashboard page -- never wired in production
(s.Memory was always nil), confirmed by /api/capabilities always reporting
"memory": false.
Rewrites ARCHITECTURE.md's "Memory engine family" section to describe the
current engine (internal/domain/memory contract, internal/infrastructure/
memory builtin engine + its builtin/ markdown store, the per-turn read seam
in gateway/turn_memory.go, the per-turn write tools in
gateway/turn_memory_tool.go) instead of the deleted Manager. Fixes two
docs/architecture/configuration.md rows that described the deleted
manager's literals and SaveConfig mechanism.
|
||
|
|
c4c059bdde |
feat(gateway): chat memory write path (unification slice 4) (#888)
Build a per-turn memory tool set (memory_create/update/delete/list) onto the turn's resolved Subject, matching slice 3's read-side scope model. The model picks a scope KIND from an enum built off Subject.WritableScopes() (never global); the agent and user ids a scope resolves to come from the turn's Subject, with no schema field either could ever land in. A subject with no writable scope, or a nil write store, gets no memory tools at all. TurnRunnerConfig gains MemoryWriter (MemoryWriteStore: Create/Update/ Forget/List), wired alongside the existing MemoryEngine read surface through the same active engine (boot.activeMemoryEngine, narrowed by memoryStore/memoryWriter). |
||
|
|
1208458aba |
fix(gateway): enforce per-scope memory quota and escape-aware byte cap
Greptile review on #887 (slice 3, merged): - BuiltinEngine.Query bounds Limit across the whole result, not per scope it is given. renderMemory passed one Limit for all of subject.Scopes() combined, so an early scope (agent-user, queried first) could exhaust the whole budget and starve later, wider scopes. Now queries each scope separately, each capped at memoryRecordsPerScope. - memoryBlockByteCap was checked against each line's raw size, but BuildSystemPrompt's {{xml .Memory}} escapes &/</> afterward, expanding a byte up to fivefold. The cap is now measured against the escaped size (escapeXML, extracted from prompt.go's template func) while the block itself still accumulates raw lines, since the template escapes once on render -- escaping here too would double-escape it. |
||
|
|
c8f88c84b2 |
feat(gateway): chat memory read path (unification slice 3) (#887)
Wires the durable-memory engine into the chat turn: prepareTurn resolves a
per-channel Subject (BotUser as AgentID, TurnRunnerConfig.UserIdentity for
the user), runs a scope-only Query over Subject.Scopes(), and renders the
result into a new <memory purpose="durable_context" trust="data"> block
between <tools> and <env>, following the same untrusted-data framing as
those two blocks. The read is synchronous, total, and never surfaces an
error: a nil engine, a failing Query, or a panicking provider all degrade to
no memory block (recovered in gateway.renderMemory).
UserIdentity is supplied per channel by the composition
(userIdentityResolver in internal/app/archied): telegram and email resolve
their native SenderID, the dashboard ("web") and webhook resolve nothing, so
a webhook's route-path SenderID can never become a user identity and the
dashboard's shared bearer token can never impersonate a person.
Fixes the composition-ordering bug that left every turn runner holding a nil
memory engine: setupMemoryAll now runs before setupGateways in main.go, and
before setupGatewayChat in gateway.go's startGatewayRuntime, so
boot.memoryStore() has a live engine at every turn-runner construction site.
Named constants bound the read: memoryRecordsPerScope per scope, and
memoryBlockByteCap on the rendered block, which drops (and logs) trailing
records rather than truncating one mid-line.
|
||
|
|
d5026f1a49 |
feat(memory): four-scope contract and builtin engine CRUD (unification slice 2) (#886)
* feat(memory): four-scope contract with CRUD and revisions
Seam for memory unification slice 2 (docs/prds/memory-engine-unification.md
§1, §2, §7): internal/domain/memory is now a scope-addressed CRUD contract.
- Scope{Kind,Agent,User} with the four ratified kinds, Validate rejecting a
component present where it is not required, and a length-prefixed Key so
opaque channel-native ids cannot collide.
- Subject{AgentID,UserID} with Scopes()/WritableScopes(): global is never
writable, and an absent user id removes every scope requiring one.
- Store becomes Create/Get/Query/List/Update/Forget/Revisions over
NewRecord/RecordUpdate/Record/Revision, with ErrNotFound/ErrStaleRevision.
Observation, Identity and Metadata are deleted.
- The content scanner moves into the family (internal/domain/memory) so every
engine applies it in Create and Update; internal/memory re-exports the types
until slice 5 deletes it.
- The markdown store moves to internal/infrastructure/memory/builtin, its
correct home per organisation.md.
WIP: internal/infrastructure/memory and internal/infrastructure/sessioncurator
are converted in the lanes that follow this commit.
* feat(memory): builtin engine CRUD, retained revisions and the curator's agent-user write
Slice 2 implementation (docs/prds/memory-engine-unification.md §1, §2, §6,
§7), on top of the contract seam in the previous commit.
- internal/infrastructure/memory: per-scope markdown heads with a JSON
provenance marker, per-scope HISTORY.md retaining superseded and deleted
states, Update superseding before replacing the live block, ErrStaleRevision
via RecordUpdate.Expected, idempotent Forget, and the family scanner applied
in Create and Update. Scope directories are hex(sha256(Scope.Key())).
- internal/infrastructure/sessioncurator: the participant is derived from the
session's user-role senders; exactly one writes agent-user scope, zero or
several write nothing and return ActionSkipped naming the count.
- docs/architecture: the settled decision recorded in migration-decisions §5
(superseding the 2026-09-02 marker entry) and agent-system.md pointing at it.
Draft: to be squashed and reviewed before publication.
* test(curator): conform the registry's fake memory engine to the CRUD contract
The fake still implemented the pre-CRUD Store surface (Write taking an
Observation, List/Forget keyed by a bare string), so the package's test
binary no longer compiles: fakeMemoryEngine is missing Create, Get, Update
and Revisions, and domainmemory.Observation no longer exists. That took
`go fix ./...`, `go vet ./...` and `go test ./...` down with it, which is
what `task check` runs first.
Missed by the same commit that updated internal/infrastructure/sessioncurator's
own fake to the new interface. Repaired on the fake, not by loosening the
interface: the fake is the only thing out of date.
* fix(sessioncurator): refuse to attribute a session with unidentified user messages
sessionParticipant skipped user-role messages with an empty SenderID and
counted only the identified ones, so a session holding one identified sender
plus any number of unidentified user messages yielded that sender as the
single participant. Those messages are still part of the excerpt the
extraction model reads, so facts derived from content of unknown provenance
were written into the identified sender's agent-user scope: user A's memory
can end up crediting content that may belong to someone else. It is exactly
the case the function's own doc comment claims to handle, which it only
caught when no message at all was identified.
An unidentified user message now makes the session unattributable outright,
beside any number of identified senders, and the skip action's reason names
the count instead of reporting a sender count that no longer explains the
skip. Assistant-role messages are unaffected: they carry the bot, so they
still cannot manufacture a participant.
Fixed in sessionParticipant rather than at the write, because it is the
single producer of the attribution decision: it now returns the participant
or the reason there is none, so the caller cannot print a reason that
disagrees with what it decided. The fail-closed path (nothing written, one
ActionSkipped) and the extraction flow are unchanged.
* fix(memory): carry record content through the block format intact
builtin.Store's format ends a block at a blank line and starts a section at a
"## " line, but storeContent only trimmed the content and rejected an empty
one. Content holding either delimiter was accepted, written, and answered back
to the caller in full -- then read back truncated at the delimiter by Get,
List, or a process restart, with the remainder unaddressable and no error
anywhere along the path.
Fixed at the producer, in the render/parse pair that owns the block format:
renderBlock escapes the two delimiter shapes (an empty line becomes a single
backslash, a line already starting with a backslash or "## " gains one) and
parseBlocks undoes it on the way back, so a record's content survives the
write whole. Rejecting the content instead would have made an ordinary
multi-paragraph note or a quoted heading unrepresentable; escaping every line
would have changed the on-disk shape of every record. Only the lines that need
it are escaped, so a one-paragraph record is byte-identical to what the
unfixed engine wrote and the document stays hand-editable.
Reachable from both producers: the chat tool's note and the curator's
model-extracted fact are free text, and neither is constrained to one
paragraph.
Tests: TestBuiltinEngineRenderedBlockRoundTripsContent asserts
parseBlocks(renderBlock(c)) == c for eleven content shapes, and
TestBuiltinEngineContentSurvivesTheWriteAndAReopen carries the same shapes
through Create, Get, and a second engine reading the file a restart would.
* fix(memory): compare Update's expected revision against the file, not the cache
Update read the record to compare against out of findBlock(stores.live, ...)
-- the engine's cached copy of the scope document -- and checked Expected
against that copy. This engine caches one document per scope and rewrites it
whole, so a second engine over the same scope file (archied and the gateway,
or a restart) holds a copy taken when it last read the file: its view of the
record's revision is superseded, Expected matches the revision it remembers,
ErrStaleRevision never fires, and the rewrite that follows writes that stale
copy back over the file -- discarding the other writer's update and every
record written since the copy was loaded. The field existed and could not
fire.
Reload the scope document before anything is decided from it, so the check
answers about the revision actually on disk and the rewrite starts from the
current document. That is the smaller of the two fixes the PRD leaves open
("Not determined": a reload-before-mutate or an advisory lock); no locking
scheme, no retry loop, and no change to the read paths.
Still unsolved, and deliberately: the whole-document rewrite is
last-writer-wins between the reload and the write, so two engines writing one
scope concurrently can still lose one of the two writes, and HISTORY.md is
rewritten from the cached copy the same way.
Tests: TestBuiltinEngineSecondEngineCannotReuseAStaleRevision asserts the
second engine gets ErrStaleRevision and the first writer's state survives;
TestBuiltinEngineUpdateDoesNotEraseRecordsItHasNotLoaded asserts the record
written after the second engine loaded is still there after its update.
* fix(memory): emit the scanner's warning instead of dropping it
scanContent returned nil for every result that was not ThreatBlock, so a
ThreatWarn result -- documented in the scanner as "allow the write but emit a
warning", and what every sensitive-data match produces (API keys, passwords,
tokens, private keys) -- was stored with no audit signal anywhere. The
comment justified the silence by pointing at Bind, but Bind's argument is
about Registrar.Events: internal/events declares no memory kind and the
composition binds no memory event sink, so an invented kind would look wired
and not be. A scanner warning is a diagnostic rather than an event, and there
was nothing else to carry it: the registrar had no logger.
Bind now takes Registrar.Log, optional and mirroring the curator family's
Registrar for the same reason, scanContent emits the warn-level result
through it before the write is allowed, and bootstrap passes the daemon's
logger so the line reaches archied's configured sinks instead of only the
process default. The write is still allowed: only the silence changed.
Tests: TestBuiltinEngineScanWarnsWithoutRefusingTheWrite runs Create and
Update over warn, clean and block content, asserting the write lands either
way, that a warn-level scan result logs exactly one warning carrying the
scanner's own message, that clean content logs none, and that a refused
block-level match logs none.
* test(memory): carry every content shape through Update and Revisions
Update replaces the block it read out of the document by that text, and
retains the superseded state in HISTORY.md, so an escaped block has to be
found, superseded and retained exactly like an unescaped one. Covered here
rather than left to the Create path: without the escaping, every shape in
this table came back truncated after an update, including the plain
one-paragraph record whose replacement holds a blank line.
The test asserts values only: the updated record as a second engine reads it
off disk, and the superseded content as Revisions returns it.
* style(memory): apply the linter's gofumpt form to the Update revision error
golangci-lint's bundled gofumpt wants the closing paren of that wrapped
fmt.Errorf on its own line; the standalone gofumpt binary the fmt task uses
(0.7.0, a different version) leaves it as it was. The text is unchanged from
before the engine fixes in this branch, so this is pre-existing drift inside a
function these commits already touch -- taken so the file is clean under both
formatters rather than only one.
|
||
|
|
2ebb3763ce |
chore(deps): refresh go modules and tidy the tools module
Direct bumps:
- github.com/nats-io/nats-server/v2 v2.14.6 -> v2.15.0
- github.com/nats-io/nats.go v1.53.1 -> v1.54.0
- github.com/samcharles93/ai-sdk v0.1.32 -> v0.1.39
- google.golang.org/grpc v1.83.2 -> v1.84.0
- modernc.org/sqlite v1.58.0 -> v1.59.0
- golang.org/x/net v0.58.0 -> v0.59.0
- golang.org/x/term v0.45.0 -> v0.46.0
Indirect: go-humanize, x/crypto, x/exp, x/sync, x/sys, x/text, x/time,
genproto/googleapis{,/api,/rpc}, modernc.org/libc.
tools/ is a separate module and needs its own tidy to match the root's
ai-sdk and sqlite bumps. docs:check runs it with -mod=readonly, so a
stale tools/go.mod fails loudly there rather than being rewritten.
|