bc215e8daa04500a161aff996ca2228ecbbdd9ce
169
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
845b192a89 |
feat(taskstate): count completed runs in the per-workflow stats
The transition table moved the no-change outcomes to StatusCompleted, so a run that opens no pull request now ends in a status the per-workflow stats did not count at all: it was not merged, not in review, not parked, and the workflows page would have shown it as a run that went nowhere. The count travels the whole State Store path, since every dashboard consumer reads it through the gRPC client rather than the local store. - WorkflowStats filters `completed` beside merged and pr_open; the SQL is the count, so a wrong filter reads as zero rather than failing, and TestWorkflowStatsCountsCompletedRuns holds it against a real store. - storecontract.WorkflowStat gains Completed (json "completed"), the proto message gains field 9, and workflowStatProto/workflowStatValue carry it; TestWorkflowStatProtoCarriesEveryField round-trips every field by name. - The gateway's chat task report names the status. - The dashboard counts a completed run as delivered in GatePulseCard's totals and badge numerator, and the WorkflowStat/WorkflowStats/WorkflowRow interfaces carry the field. - TestOutcomeSitesAreTransitionsFromRunning is the guard that keeps the producer and the table agreeing: it re-reads this package's tc.Outcome assignment sites from source and requires each status to be one internal/taskstate allows from running, so a new or moved site has to be adjudicated against the table instead of discovered on a live run. |
||
|
|
049bbf2a7d |
feat(webui): Plugins and Container runtime settings pages; Advanced keeps only dangerous actions
Plugins: the four extension directories. Container runtime: image, pull policy (missing or always, the two the daemon accepts), concurrency, uptime and volume retention as durations, network, and named profiles with their image and tool allowlist. Advanced now holds only stop and rollback, and the Managed elsewhere card goes. With every settings kind on its own page, the generic schema-driven resource editor had no consumer and is deleted. |
||
|
|
b1a5954594 |
feat(webui): Personas and Schedules settings pages
Personas: a filterable list with the default marked, and an editor with name, a default toggle, the system prompt with a character and token count, Duplicate and Delete. Renaming or deleting the default keeps the collection naming one that exists; the last persona cannot be deleted. Schedules: an empty state, then one card per job with ID, task title, instructions, when (interval, cron line or a single time) and overlap. Settings opens on Personas. |
||
|
|
9639e7041e |
feat(webui): Settings > History, and a resizable Settings sidebar
History replaces the Audit card on every settings page: one change log for all settings, filterable by section, actor and time window, with the filters in the query so each page's History link opens it filtered to that page. Rows show the old and new value as a diff and expand to the full value; Restore still puts a resource back to the version before a change. The sidebar's edge drags (or takes arrow keys) between 180 and 420px, resets on double-click and remembers its width per browser. |
||
|
|
7095a583b8 |
feat(webui): Tools & MCP settings page
MCP servers as editable rows per transport (stdio command and arguments, HTTP URL, SSE endpoints) with parallel tool calls; MiniMax with its key as a secret reference; web fetch with byte, duration and a danger-toned private-networks toggle, its fields disabled while it is off; tool output limits with a token estimate. Fixes sticky positioning across the app: the frame and main used overflow hidden, which made each a scroll container that never scrolls, so the Settings save bar and sidebar never stuck. Both now clip instead. |
||
|
|
cb6b902f97 |
feat(webui): Scheduling policy settings page
Its own page under Settings > Agents instead of a generic card on Advanced: trigger as a segmented control with the label field shown and required only when the trigger needs one, the six forge state labels as a fixed table, a max-retries stepper and a duration input for the poll interval. Settings pages leave room below the last setting so it can be scrolled up to eye level. |
||
|
|
1bb52fe8c7 |
feat(webui): five-place top bar with Settings, New task and one connection pill
Dashboard, Tasks, Workflows, Events and Settings replace the Work, Agent and System menus. Configuration pages move under /settings/* with redirects from their old paths; Logs and Appearance leave the bar and stay reachable from Jump to, the Dashboard and the account menu. New task opens the Start work form in a dialog and lands on the new task. One pill reports the live stream's state. Drops docs/prds/dashboard-navigation-groups.md: web UI design is not tracked in PRDs. |
||
|
|
35dd7489dd |
test: remove layout-pinned route-registry and task-meta fixture tests
TestDashboardPagesRegistryCoversEveryRoute parsed ui/src/router/index.ts as text, and TestTaskMetaPayloadMatchesFixture plus ui/test/task-meta-snapshot pinned a formatted JSON fixture. They failed on formatting, not behaviour. |
||
|
|
065606b2a5 |
fix(ci): make the gate tolerate formatting and give deploy a PG 18 client
The page-registry test parsed the route table one line per route and the task-meta fixture was byte-compared, so the prettier reformat broke both. The registry test now splits route objects and ignores comments; the fixture compares compacted JSON. Also drops a stale router comment that described the removed redirects, rebuilds ui/dist, regenerates the contracts artifact, keeps prettier off generated output, and installs postgresql-client-18 in deploy.yml's gate as quality.yml already does. |
||
|
|
440d2e8e46 | fix: reject values that exceed Int32 for all SQL LIMIT params | ||
|
|
e57221f34b | docs(store): drop residual SQLite references; fix lane lint findings | ||
|
|
a383f6820f | refactor(gateway): replace the SQLite session store with an in-memory store | ||
|
|
4ce4b46977 | style(postgres,gateway): adopt task fmt rewrites from the lane merge | ||
|
|
710fbab094 |
feat(gateway): port session store to Postgres
Move sessions, messages, turns and full-text search off the per-process SQLite file onto Postgres behind the existing messaging.SessionStore contract. New adapter internal/gateway/session_store_postgres.go, sqlc queries/gateway.sql, migration 0003_gateway.sql, regenerated postgresdb. FTS5 becomes a STORED generated tsvector column over (sender, text) plus GIN. plainto_tsquery is the tsvector analog of ftsMatchQuery's quote-escaping: query text is parsed as plain text, never query syntax, and the surviving terms are ANDed. MessagePage.Truncated stays always-false on Postgres too: the result set is counted exactly. On internal/domain/messaging/session_store.go: this is a comment-only edit to the MessagePage.Truncated doc comment (the brief's own "change the comment" instruction). It changes no type, method or value, so L2 and the import lane still build against an unchanged contract and the wire is unaffected. No interface widened or altered. Semantics preserved verbatim: - The timestamp clamp is SQL-atomic (INSERT ... SELECT MAX(ts)+1). Appends to one session are serialised by a transaction-scoped advisory lock keyed on the session so two concurrent appends cannot read the same MAX(ts); a Go clamp would race (proven by the new cross-handle monotonicity test). - Session ordering is GREATEST(last_active_at, created_at) with a matching expression index. - ClaimTurn is insert-first (ON CONFLICT DO NOTHING), with a race test across two handles. State outside the store is NOT made shared by this change, and none of it is silently improved or worsened: - sessionTracker.active, Router.titling and per-session persona selection are in-memory, per-process caches; a second Gateway still diverges from the first. - messaging.Turns lanes and the per-process recovery latch stay per-process. - RecoverTurns still fails every turn owned by another process, so a second Gateway starting would still fail the first's in-flight turns. This lane does NOT make that safe and does not try to: the safeguard is D4.1's single-Gateway advisory serve-ownership lock (not implemented here), which prevents a second Gateway from serving at all. The turn-recovery semantics are left exactly as they were. Production openers still return SQLite; this lane adds the adapter and tests only. The cutover and the state-sharing questions remain follow-up work. |
||
|
|
0e6c6fc6d1 |
feat(artifacts): publish the completed PR review to the collaborative editor
Implements docs/prds/artifact-sender.md (Approved). archie-core now sends generated artifacts to the offloaded.dev collaborative editor, whose POST /api/artifacts route, bearer service token, PocketBase-backed versions and idempotency semantics are the receiving contract. - [artifacts] config section: base_url + token SecretRef with a token_env fallback naming WORKSPACE_INGEST_TOKEN. An empty base_url disables the sender entirely; a base_url with an unresolvable token disables it with a warning, because a missing credential disables a capability rather than stopping the daemon. - internal/infrastructure/artifactsync: one-method Publish seam in the Courier posture, full source per publish (versions of record are snapshots), 503 retried three times with backoff, 401/400 surfaced immediately with the field reason, deterministic request ids (artifact:pr-review:<owner>/<repo>#<n>). - ReviewReport gains a pure markdown renderer in internal/domain/workflow: summary, one subsection per finding with the failure scenario and disposition when present, verified properties as a checked-clean list. - The daemon's PR reviewer publishes after a completed review when the sender is configured, records the editor deep link on the result, and degrades a failed publish to a log line -- publishing never fails the producing work. |
||
|
|
8485f24332 |
fix(messaging): render a tool call as one line with its own icon
A tool call rendered as a label line plus a ```text fence. Telegram draws a fenced block as a full code widget (language header bar, copy button, panel), and the block parser inserts a spacer paragraph before every block, so one call cost four rendered elements. Three calls filled the screen to show three word counts. Every toolPreview path already summarises to a single line, so the fence was never wrapping more than one. Drop it and put the preview on the header line. Tool lines now join with a hard break rather than a bare newline: a soft break would space-join them into one run-on paragraph, and a blank line would put the spacer back. Three calls are now three consecutive blocks. Two hardcoded values go with it. The status word is printed only when the outcome is not success, since every line otherwise read "done" and distinguished nothing. The icon is no longer a literal in the renderer: each builtin declares its own on tools.Tool (not on Schema, which is the model's contract), the provider carries it into ToolEntry, and the turn snapshots the registry's icons alongside its tool set. A tool that declares none renders without one rather than borrowing a generic wrench. Carries a dependency upgrade (go.mod, go.sum, tools/go.mod, tools/go.sum). |
||
|
|
3902b7ecbc |
feat(identity): attribute a task action to the identity that acted
The transport could carry an actor and nothing filled it. It does now, so a dashboard approval is recorded as the person whose credential verified, and an agent's token is recorded as the agent's action -- for an agent, agent_approved; for a person, human_approved; and for a caller whose identity archie could not verify, task_approved, which claims nothing about who did it. The actor travels the path the action takes: webui reads it from the request context the middleware resolved, carries it in the gateway request, the daemon passes it through the in-process adapter, and the NATS request body carries it to the service that records it. Scope stays separate from actor at every hop, because scope is which task a caller may touch and the actor is who touched it. A chat channel's bound identity is an actor too: a bot acting on its own channel's task is recorded as an agent's action rather than a person's, via ActorFromScope, whose empty kind is what keeps it out of human_approved. The agent-facing task_action tool passes that identity and never input["identity"]. The UI process's credential check is now filled by endpoint references rather than by configuration: -oidc-issuer and -oidc-audience on archie-ui, two URLs the process already understands the shape of, with the verifier built in Run because cmd/ parses flags and nothing else. The UI package still never reads config, and a configured provider that cannot be reached fails boot rather than falling back to the gate that names nobody. Evidence for this change, stated as measured: go build ./... and go vet ./... are clean, and every package this touches passes -- webui, domain/taskactions, infrastructure/taskactions, infrastructure/gatewayrpc, gateway, app/archieui, app/archied, domain/messaging, channels/telegram, cmd/archie-ui. task check could not be run to completion: it fails in cmd/archie-messaging on an untracked internal/buildinfo package another lane has in flight, which is not this change and was left untouched. The end-to-end flip is covered in internal/webui/api_tasks_actor_test.go: a person's credential produces a record naming that person with human_approved, an agent's produces agent_approved, an unverified request produces task_approved with no actor, and a request carrying forged actor fields cannot name one. |
||
|
|
c70fb61bfc |
fix(gateway): stamp the session platform from the channel that carried the message
One Router serves every channel and named itself "web", so Source.Platform -- the FIRST component of the session natural key, and the platform GetByChannel filters on -- was a constant, true of no channel but the dashboard. Two consequences followed: the per-user identity policy was real code that no production call site reached with a real channel name, and a curator pass's write to agent-user memory could not be read back by the turn that wrote it, because that turn resolved no UserID. The channel now travels with the message. Frontends name the channel they carry (pb.Message.platform: telegram, email, webhook, web), and the Gateway stamps the session from it, falling back to its own name when a sender names none -- which is what every existing row holds and what a frontend that does not participate keeps doing. Identity resolution reads the platform off the inbound rather than closing over a channel name, so carriesPersonIdentity finally decides something in production: telegram and email resolve a person, the dashboard and a webhook resolve nothing, and an unknown platform fails closed. Deliberately NOT changed, because it is where this could quietly widen scope: TurnRunnerConfig.Channel still keys tool availability, so no channel gains or loses a tool here. Only session lookup and identity follow the message's platform. Consequence the maintainer accepted: a chat whose active session came from /new or /branch re-resolves once, since GetByChannel now filters on the channel's name. A chat with no /new re-resolves onto the same deterministic session id and heals silently. Verified: gateway, archied, gatewayrpc, messaging, webui, channels and cmd suites, go vet ./..., go build ./..., golangci-lint run ./... (0 issues), docs:check. New contracts: TestResolveSessionKeyStampsTheMessagesPlatform, the per-platform identity table, and the transport-context wire round trip. |
||
|
|
bb81e5695b |
feat(webui): make Events one page with three tabs
Inspector, Bindings and Mappings were three sibling destinations in a dropdown, for what is one chain read in order: an event, the mapping that names its fields, the binding that decides what runs. They are now three tabs on /events, and the bar carries Events as a link rather than a menu with one child sharing its name. The navigation entry is always live and the tabs prune themselves: each is a separate capability, so a composition that can back only some of them still reaches the ones it can, and an unreported section stays visible. Which tabs exist, and which one is showing, lives in tab-selection.ts and is unit-tested without a browser; the page owns the components and the address bar. The old paths survive as bookmarks that redirect to their tab, so a link or a learned URL still lands somewhere that works. Three pages become tab panels: they lose their page-level headers -- the page names the page -- and keep their own actions in a right-aligned row. CapturesHeader.vue is absorbed into the Inspector panel, which is where its stream status belongs. |
||
|
|
be66412b30 | style(gateway): apply task fmt (go fix) to the compress trigger test | ||
|
|
ae848fd307 | feat(gateway): compress a chat session when a turn crosses its context budget | ||
|
|
18cca53bab |
fix(webhook): keep a route path out of the sender identity
A webhook set SenderID to its configured route path. The turn path reads that field through a per-channel resolver which refuses webhook, but the session curator derives its participant from the raw field with no channel filter, so a webhook session with exactly one distinct sender and one extracted fact wrote agent-user memory addressed to User: "/hooks/...". Nothing reads it, and every pass added more, because the facts are identical strings with no dedup. docs/prds/memory-engine-unification.md criterion 7 requires that a route path never become a user identity. Clear it at the producer rather than teaching every consumer which channels are lying: a route path is a source, not a person, so it no longer enters SenderID. It still keys the inbound rate limit, where it is the documented per-source budget for webhooks (config.RateLimitConfig), so it travels in the new transport-only Inbound.BudgetKey -- carried on the wire beside Page, never persisted, and never read as an identity. pb.Message gains budget_key (field 9) for the same reason page (field 7) exists: transport context that rides with an inbound message and is deliberately absent from storedProto's rendering of a canonical record. The curator needs no change. An empty SenderID already fails closed as an unidentified user message, which is the path a dashboard session takes, and sessionParticipant's existing skip covers it; the test name now says so. |
||
|
|
02720c8e81 |
feat(controlplane): runtime administration over the State Store's gRPC server
The Web UI and messaging channels now read and write Archie's runtime settings through one versioned, audited control-plane API hosted on the State Store's existing gRPC server: catalog, query, command, watch. Each feature owns its resource, validation and commands; storage only writes versions and audit records. Workflows move with it. Definitions become portable YAML compiled through a closed, typed step registry and stored as a control-plane resource, so the yaegi interpretation paths (internal/gate, wfeval, wfextract, gateeval, gateextract, skillbuild) are deleted rather than carried. The UI process reads definitions as data: the JSON projection lives in internal/domain/workflow/task so a dashboard decodes the stored collection without linking the workflow engine, which cmd/archie-ui's deletion gate forbids. Shipped definitions ride the catalog descriptor rather than a bespoke REST route, keeping the API to its four operations. archie-messaging gains -state-store-target/-state-store-token and reads channel settings from the database, failing closed when the State Store is unreachable: the database is authoritative for those settings. |
||
|
|
47cbe2b8d3 |
fix(webui): cut redundant tails and restating descriptions from copy
Empty states and card descriptions no longer explain the consequence the main clause already implies, page descriptions match between the router and the chat page-index tool, and the Appearance cards lose descriptions that restated their controls. |
||
|
|
e553b2ca9c |
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.
|
||
|
|
b90f733825 |
feat(webui): bootstrap Vue 3 + shadcn-vue, replacing the Preact dashboard
Sam owns this codebase and reads Vue fluently, not Preact; a UI its maintainer
cannot read is the liability that outweighs the port. shadcn-vue is Vue-only,
so adopting it means the framework moves with it.
Scaffolded per the official Vite guide: `npm create vite --template vue-ts`,
Tailwind v4 via @tailwindcss/vite, `shadcn-vue init` (Reka UI, Lucide, neutral
base, CSS variables). Button and DropdownMenu are added, the latter being what
the pending navigation restructure needs.
Two deviations from the guide, both forced:
- The guide sets `baseUrl` alongside `paths`. TypeScript 6 deprecates
`baseUrl` and errors on it, and this project is heading for TS 7 native, so
`paths` stands alone and resolves relative to the config file. Not a
downgrade: the scaffold's typescript ~6.0.2 is untouched.
- vite.config.ts keeps `base: "./"` and unhashed asset names. ui/embed.go
embeds a committed dist/, served from a path the build does not know;
hashed names would also orphan a file in git on every rebuild.
The Preact app and its 43 test files are deleted rather than ported, on Sam's
instruction: tests return when there is behaviour worth pinning rather than a
port to re-assert. `task test:ui` is now a vue-tsc typecheck, which is what
would actually catch a broken component; an empty `npm test` would pass
vacuously.
ui/src/router/index.ts carries the route table and is the new source of truth
for TestDashboardPagesRegistryCoversEveryRoute, which parsed main.jsx before.
Keeping that contract alive matters: it is what caught the stale /chat entry
earlier today. Every route resolves to a named placeholder view, so an unported
page is visibly unported rather than blank.
golangci-lint now excludes ui/node_modules. The dashboard toolchain pulls in
`flatted`, which ships a Go implementation beside its JavaScript, and the gate
was failing on complexity in a vendored third-party file.
The shadcn MCP server is registered in the root .mcp.json. `shadcn-vue mcp init`
writes it to the directory it runs in, which for a nested ui/ is a path Claude
Code never reads.
|
||
|
|
18a098b6b1 |
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.
|
||
|
|
16e3b84048 |
fix: address the Greptile findings on the merged PRs (#902)
* fix: address the Greptile findings on the merged PRs Four valid review findings from PRs #892, #893, #898 and #899, which were merged without the comments being read. - Config.Clone left the new diff-cap pointers aliased (#899, mine). Clone deep-copies every reference field, including the *bool beside it, so a clone could write the cap through to the published snapshot. Both the top-level field and the identity overrides are copied, with the clone test extended to cover them. - providerOutcomeRecorder.record could report an older call as the latest (#892). The completion time is taken before the lock, so two concurrent calls can reach the lock in the opposite order to their completion and the unconditional store overwrote the newer outcome. It now keeps the newer, via a recordAt seam that makes the reordering testable. - Curator model calls bypassed the recorder (#892). curatorLLMRunner calls the runtime directly, so a daemon whose only recent model traffic was curator work reported "no calls attempted yet" while the provider was demonstrably reachable. It records at its own adapter, and sendChatTurn's "single choke point" comment is corrected to say there are two. - A provider error reached /status raw (#892), unlike channel details, so a multiline or oversized error broke the one-line-per-fact layout. Both now share one bounded formatter. Found while fixing the curator path: agentexec.NewRuntime returns nil when no provider is configured, and a nil *runtime.Runtime panics on its first method call, so a curator asking for a completion took the daemon down. It now returns an error, and records nothing -- a local misconfiguration is not a provider call. Not fixed, filed instead: the shared lastPollAt masking a stuck identity, the container max-uptime callback resurrecting teardown bookkeeping, the dashboard dropping a served-only status filter on cold load, and the route registry test's line-by-line parser. * fix(build): drop goimports from the gate's formatter set `task check` spent 136 of its 167 seconds in `task fmt`, and 134 of those 136 in one formatter: goimports alone over the tree. golangci-lint's goimports formatter calls imports.Process once per file, which builds a fresh x/tools ProcessEnv each time, so internal/imports.getFixesWithSource re-reads modindex.Read($GOMODCACHE) per file. On this machine that index is 62.7 MiB / 2,081,070 lines (an 11 GiB module cache), and modindex's in-process memo does not take effect: 3 files read 187.9 MiB back, 15 files open the payload 15 times. That is ~53 GiB of I/O and CSV parsing per run, and it is linear at ~155 ms per file (122 files -> 18.8s, 864 -> 133.8s). Pointing the index cache elsewhere drops the same command to 3.9s. The same analyzer runs under `golangci-lint run`, so a cold cache pays it again: 169s cold with goimports, 31s without -- which is what CI and archied's own PR gate see, since only `fmt` never caches locally. Removing it costs no enforcement. gofumpt and gci remain, `task lint` still reports formatter drift as an issue, and the whole-tree fmt is now 2.2s with the tree byte-identical. What is given up is goimports' convenience of adding and removing import lines, which compile errors already cover. The examples/secret-engines exclusion stays: gofumpt and gci leave those Yaegi programs alone today, but the exclusion is the stated invariant that a formatter must not rewrite the imports of files it cannot type-check, and TestFormattersExcludeInterpretedSecretEngines holds it. Its comment no longer pins the reason to the formatter that was dropped. * fix(gateway): stop /status promising and mis-reporting health it cannot see Two findings from the cloud review of #892. Title generation no longer records chat-model health. It runs detached after a first turn under its own 30s bound and its error is swallowed by the caller, but it shared the process-wide outcome recorder, so a title that merely timed out overwrote the health line with "failed" -- reporting a broken provider on the strength of a call no user was waiting for. The /status command description no longer claims "workers" and "channels". Neither can render: newStatusHealth reads the container pool and the poll loop from boot, but the only production router.Health assignment is in setupGatewayChat, which runs solely in the archie-gateway process, where neither exists; channels is nil since the Messaging Service took the front-ends. Only the broker and chat-model lines actually appear, so that is what the help text now says. The underlying split -- daemon owns the facts, Gateway owns the Router -- is filed rather than patched here: it needs either a cross-process health contract or a ratified two-section /status, not a quick wire-up. |
||
|
|
af74e93a20 |
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. |
||
|
|
0644d8291e |
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. |
||
|
|
91769fa022 |
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:
|
||
|
|
4750ac097b |
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. |
||
|
|
5d04bea3d4 |
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). |
||
|
|
c6b4fe237f |
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. |
||
|
|
f8d6ea33e5 |
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.
|
||
|
|
3b0ec1b79b |
feat(gateway): persist the channel-native sender id on messages
Slice 1 of docs/prds/memory-engine-unification.md: persist the participant, so a later curator can address agent-user memory scope. - messages gains sender_id: schema, ALTER migration (idempotent via duplicate-column detection), both inserts, and both history selects. Pre-existing rows default to empty. - curator.SessionSummary gains AgentID and ConversationMessage gains SenderID; the sessioncurator adapter fills them from the session's bot identity and the stored record. The memory contract is untouched and nothing consumes the new fields yet. Deriving a session's participant from its user-role messages, and failing closed on ambiguity, stays with the curator rewrite. |
||
|
|
a3dba83d0a | Update internal/gateway/stream.go | ||
|
|
804121424f |
fix: Repeated successful tool calls are never collapsed into a counted entry (archie)
Fixes #840 |
||
|
|
45f6283ad8 |
test: failing repro
Refs #840 |
||
|
|
9123f6ef62 |
fix(telegram): require the truncation wrapper before treating a count as metadata
Review found that a bare "showing 3/197 lines" inside ordinary output was accepted as truncation metadata and replaced by a summary, hiding the real result. Both built-in producers wrap the notice as "[truncated: …]" (internal/tools/builtin/truncate.go), so the wrapper is now required rather than tolerated: it is the only marker separating a notice the tool printed from content that merely mentions a count. |
||
|
|
85c6a59fdc |
fix(telegram): address greptile review on tool-result rendering
Four findings from review, all valid:
1. Search detection is now gated on the tool name rather than applied to every
result. A compiler diagnostic ("file.go:42: message") has the same shape as
a search hit, so counting it reported a build error as "N matches" and hid
the diagnostic.
2. Only ripgrep match lines are counted. The hyphen context form
("path-N-text") and "--" group separators were being counted as matches, so
a search with context requested reported the match count plus every
surrounding context line.
3. The notice parser accepts shell's "showing last N/M lines" form as well as
the plain "showing N/M lines" one. Shell emits the "last" form, which failed
integer parsing and was not recognised as metadata -- so a truncated shell
result quoted the raw truncation notice as its preview, the exact defect this
change set out to remove. The summary now also states which end was kept
("97 lines total; showing last 66" for a tail truncation).
4. The renderer cases are consolidated into one table-driven test per the
development protocol in AGENTS.md, covering all four defects above plus
singular/plural, colons in paths, and module-cache noise.
|
||
|
|
4cef7dd365 |
fix(telegram): summarise tool results instead of quoting an arbitrary line
Operator report: tool output in the Telegram channel was unreadable during
search-heavy turns -- a wall of fenced blocks each showing one arbitrary
match line ("/path/config.json-322- }") under a heading that said
only "grep -- done".
The renderer quoted the first non-module-cache line of a result and appended
a line count recomputed from its own truncated sample, which could not agree
with the total the tool had already reported: one search rendered the tool's
"194 more lines" beside our "… 3 more lines". Two different numbers for one
result set read as noise, and the quoted line carried no context at all.
- Describe, don't quote: a search is reported as "N matches", a truncated
result as "<total> lines total; showing <n>", and every other tool falls
back to its first informative line. Truncation notices are skipped, since
they are metadata rather than content.
- Never invent a count: the tool's own reported total is the only
trustworthy source, parsed from its truncation notice rather than
recomputed from the visible sample.
- Remove the now-dead compactToolPreview and countNonEmptyOrContentLines.
Also bump go-telegram/bot v1.25.0 -> v1.27.0, which fixes a streaming bug
that lands squarely on this path: rawRequest sent the multipart body through
an io.Pipe, which net/http cannot replay, so sendMessage/editMessageText
failed until the connection was dropped.
Remaining work from the report (collapsing repeated calls into one counted
entry, and a ring of recent activity lines with a capped frame) is tracked
in #837.
|
||
|
|
0e0611a6b3 |
refactor(gateway): share sensitive-key markers with webhookguard
Resolves infra-misc-3. WIRE: webhookguard.SensitiveKeyMarkers is now the single exported marker list, and gateway.sensitiveParameterKey consumes it instead of inlining an identical copy. webhookguard/redact.go documented that the two lists must match "exactly so the two redaction paths agree"; that agreement is now structural (one slice, two consumers) rather than a comment nothing enforces. A new test asserts both consumers observe the same set, so a future edit cannot silently desynchronise chat-transcript redaction from webhook-capture redaction. |
||
|
|
da5b9e7273 |
refactor(gateway): delete orphaned SessionState goal/steer/queue machinery
No /goal, /steer, or /queue command exists in messaging.localCommands, no Router handler dispatches them, and BuildGoalPrompt was never merged into the turn's system prompt. NewSessionState had no caller outside its own test. Delete the entire mechanism rather than let a fully-built but unreachable feature be mistaken for a live one. |
||
|
|
65d51250ff |
fix(gateway): delete unwired Router.Dangerous approval path
All four production Router constructions left Dangerous nil; the only Decide implementation was webui.DangerousService, used directly by the webui HTTP handler, not through the Router. handleDeny and the typed /approve branches always returned "not configured" in production. Delete DangerousApprover, the Dangerous field, /deny, and the dead branches so the router surface matches what is actually wired; the dashboard's dangerous-action path is unaffected since it never routed through here. |
||
|
|
db18d2675a |
feat(ratelimit): wire per-identity inbound rate limiting into the gateway
internal/ratelimit was fully built (sliding-window limiter, ticker-driven eviction) but had no consumer, leaving multi-identity deployments with no inbound request budget on any channel (archie-core-6wxb / GH #797). Adds Message.SenderID (Telegram numeric user ID, SMTP from address, or webhook route path -- the closest thing webhook has to a caller identity), threads it into Router.Route/RouteStream via a shared checkRateLimit, and wires an opt-in [chat.rate_limit] config section through bootstrap with the documented EvictStale ticker. |
||
|
|
a00c578cb7 |
refactor(ui): sever the archie-ui binary from every daemon runtime package
Completes the objective deletion gate for the UI Service (archie-core-8cda.5.6): go list -deps ./cmd/archie-ui now links zero banned packages -- no modernc.org/sqlite, no internal/store, gateway, channels, memory, secret, agentexec, tools, skill, yaegiutil, curator, or the workflow engine. The closure shrinks from 68 to 26 archie-core packages. Each cut is a producer-side move; no consumer-side defensive shims. - Store contracts (TaskStore family, value types, sentinels) moved from internal/store to internal/domain/storecontract -- the approved contract location per state-store-contract rev. 2d, and NOT internal/contracts: that tree is buf generate output and tools/proto.sh check deletes hand-written files there. internal/store keeps aliases; sentinel message strings are byte-identical and remain the wire contract. - Chat contracts (ChatContract, sessions, turns, streaming, commands) moved from internal/gateway to internal/domain/messaging; gateway keeps aliases. ToolCallEvent rendering helpers become gateway functions (methods cannot live on alias types). - Task vocabulary (Task, statuses, mid-run Store, Definition) split into internal/domain/workflow/task; the pipeline engine stays in package workflow with aliases, so daemon-side callers are unchanged. - overlay.DeniedKeys moved to internal/infrastructure/configuration: webui referenced the constant and that dragged the overlay SQLite store in. - webui.Server's concrete runtime handles become webui-owned view interfaces with daemon-side bootstrap adapters: channel lifecycle (internal/channels/status), MemoryStatus, CuratorStatus, and a SkillCatalog seam replacing the direct skill.DefaultRoots/CatalogRoots calls. Each degrades to an empty page when unwired. - config.SecretRef moved into internal/config (config vocabulary); internal/secret keeps an alias and Registry.Resolve absorbs the zero-value short-circuit. Docs: state-store-contract rev. 2d relocation record; ui-service-boundary deletion gate marked satisfied; ARCHITECTURE.md package map rows. |
||
|
|
ad1e6ea0d3 |
feat(gateway): operator-triggered PR review with selectable reviewer model
Add a channel-neutral review_pr command that runs the adversarial reviewer against an existing pull request and returns structured findings. The Web UI chat and Telegram invoke the same command; the reviewer model is models.reviewer (falling back to models.builder), configurable independently of planner/builder. - forge: PullRequest + PullRequestReader.GetPullRequest (github, gitea) - worktree: Manager.CheckoutPR materialises a PR head for Diff/Snapshot - agentworker: NewOperatorReviewer + ReviewerModel (single model-resolution rule) - gateway: review_pr tool, ChatPRReviewer, wired into TurnRunner for every channel - archied: prReviewer adapter with identity-scoped repo allow-list and per-PR single-flight, so duplicate/concurrent reviews are deterministic Closes archie-core-h019.8. |
||
|
|
19c9002c19 | feat(gateway): add session_transcript tool for full JSON export | ||
|
|
4e641478c2 |
feat(gateway): give the dashboard operator its own task-action contract
archie-core-8cda.5.4 requires /api/tasks/{id}/action to go through
ChatContract rather than a task-action service the UI process composes
itself. The contract could not carry the request: ApplyTaskAction's identity
is a scope, and the daemon's action service distinguishes a named identity
from a nil one, which is the authenticated operator acting across
identities. Sending "" would not have expressed it either -- that is a real
identity in a single-identity deployment (chatTaskProfiles).
ApplyOperatorTaskAction is that case, additively: a separate RPC, so buf
sees no cardinality change on a shipped field, and no request that can carry
both an identity and operator authority. ChatTaskActor's identity becomes a
pointer end to end, from the Gateway's local adapter through the NATS hop to
taskactions.Service.Apply, which has always taken one.
The conformance test now covers both scopes through the local adapter and
the gRPC hop; the chat tool test pins that a chat action is never unscoped.
No caller passes nil yet -- the dashboard handler switches over with the
rest of the cutover.
|