From 75158b7fc7714a2dda603bb9cbde8a147798bbaf Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Wed, 2 Sep 2026 20:20:54 +1000 Subject: [PATCH] feat(image): define provider-neutral image capability contract and config Adds internal/domain/image (Provider/Registry per the plugin engine family shape, but no Lifecycle -- a provider is call-scoped, not long-running) and config.ImageConfig with the same explicit enabled=true cost gate MinimaxConfig already uses, since a hosted provider spends real API credits and a local one can saturate the host GPU. Design doc at docs/prds/image-capability-contract.md per CLAUDE.md's rule for undesigned capabilities. No provider implementation lands here -- that's the epic's next child bead. Also re-links all 7 epic children that were unlinked from archie-core-1786748942120-1-6636e629 (same orphaning pattern found in the curator/memory epics earlier this session). --- .beads/issues.jsonl | 76 +++--- config.example.toml | 17 ++ docs/prds/image-capability-contract.md | 243 ++++++++++++++++++ internal/config/config.go | 38 +++ internal/domain/image/contract.go | 156 +++++++++++ internal/domain/image/contract_test.go | 68 +++++ internal/domain/image/registry.go | 90 +++++++ internal/domain/image/registry_test.go | 124 +++++++++ .../infrastructure/configuration/validate.go | 40 +++ .../configuration/validate_test.go | 101 ++++++++ 10 files changed, 915 insertions(+), 38 deletions(-) create mode 100644 docs/prds/image-capability-contract.md create mode 100644 internal/domain/image/contract.go create mode 100644 internal/domain/image/contract_test.go create mode 100644 internal/domain/image/registry.go create mode 100644 internal/domain/image/registry_test.go diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 9bf80cdd1..ae92b9aa9 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -1,7 +1,7 @@ -{"_type":"issue","id":"archie-core-2tqh","title":"P0: Reconcile domain packages - docs and tree have diverged","description":"internal/domain/ contains curator/, mapping/, scheduling/ which do NOT appear in migration-decisions.md's confirmed domain list (identity, agent, workflow, messaging, workintake, plugin).\n\nMeanwhile, confirmed domains (identity, agent, messaging, plugin) don't exist yet as packages.\n\nNeed to:\n- Audit actual domain packages in internal/domain/\n- Update migration-decisions.md to reflect reality\n- Decide: are curator/, mapping/, scheduling/ legitimate domains or should they be folded into confirmed domains?\n- Create stub packages for missing confirmed domains if needed\n\nBlocked by: nothing (but blocks clean migration progress)","status":"closed","priority":0,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:10Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:04:53Z","closed_at":"2026-08-31T10:04:53Z","close_reason":"Reconciled migration-decisions.md with actual tree: confirmed curator/mapping/scheduling as legitimate domains (were undocumented, not misplaced), documented that identity/agent/messaging/plugin are approved-but-unmaterialised targets rather than creating dead stub packages","dependency_count":0,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"archie-core-kg1w","title":"P0: Refactor cmd/archied/main.go - violates organisation.md wiring rule","description":"cmd/archied/main.go is 1085 lines of substantive wiring, directly violating organisation.md's rule: 'cmd/* MUST NOT contain substantive wiring'.\n\nThis is the migration docs' own stated next chunk: internal/app/{archied,agentworker} (not yet started).\n\nNeed to:\n- Extract wiring logic from cmd/archied/main.go\n- Create internal/app/archied/ package\n- Create internal/app/agentworker/ package\n- Move dependency injection and lifecycle management into app layer\n- cmd/archied/main.go should only contain CLI flag parsing, OS signal traps, and entry point routing\n\nBlocked by: nothing (but is foundational for migration work)","status":"closed","priority":0,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:00Z","created_by":"Sam Catlow","updated_at":"2026-08-31T11:27:14Z","closed_at":"2026-08-31T11:27:14Z","close_reason":"Extracted the full cmd/archied wiring package into internal/app/archied (matching the sibling internal/app/agentworker pattern); cmd/archied/main.go is now 18 lines (codesearch-helper dispatch + call into archied.Run()). Fixed two architecture tests still hardcoded to the old cmd/archied path. task check passes clean.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-bas7","title":"P0: Fix failing test - CLAUDE.md missing ARCHITECTURE.md reference","description":"TestPluginEngineRuleIsCanonicalAndSharedByAgentInstructions in internal/plugin test is failing because CLAUDE.md is missing a required reference to ARCHITECTURE.md#plugin-engine-rule-strict.\n\nThis is a red build - needs immediate doc fix.\n\nNeed to:\n- Add the missing reference to CLAUDE.md\n- Verify test passes\n\nBlocked by: nothing","status":"closed","priority":0,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-28T13:40:53Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:03:46Z","closed_at":"2026-08-31T10:03:46Z","close_reason":"Added missing test + CLAUDE.md reference to ARCHITECTURE.md#plugin-engine-rule-strict","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1sjk","title":"P0: Bump Go from 1.26.5 to 1.26.6+ to fix 6 stdlib CVEs","description":"govulncheck found 6 CVEs in stdlib packages fixed in Go 1.26.6:\n- html/template\n- crypto/tls (handshake flood)\n- net/http (H2 timeout)\n- encoding/asn1 (recursion DoS)\n- x/net/idna\n\nNeed to:\n1. Update go.mod directive from 1.26.5 → 1.26.6\n2. Update both Dockerfiles (archied and archie-agent) from 1.26.5 → 1.26.6\n3. Rebuild and verify\n\nBlocked by: nothing","status":"closed","priority":0,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:40:40Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:04:10Z","closed_at":"2026-08-31T10:04:10Z","close_reason":"go.mod already at 1.27.0 (supersedes 1.26.6 CVE fix); bumped both Dockerfiles from golang:1.26-trixie to golang:1.27-trixie to match","dependency_count":0,"dependent_count":1,"comment_count":0} +{"_type":"issue","id":"archie-core-2tqh","title":"P0: Reconcile domain packages - docs and tree have diverged","description":"internal/domain/ contains curator/, mapping/, scheduling/ which do NOT appear in migration-decisions.md's confirmed domain list (identity, agent, workflow, messaging, workintake, plugin).\n\nMeanwhile, confirmed domains (identity, agent, messaging, plugin) don't exist yet as packages.\n\nNeed to:\n- Audit actual domain packages in internal/domain/\n- Update migration-decisions.md to reflect reality\n- Decide: are curator/, mapping/, scheduling/ legitimate domains or should they be folded into confirmed domains?\n- Create stub packages for missing confirmed domains if needed\n\nBlocked by: nothing (but blocks clean migration progress)","status":"closed","priority":0,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:10Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:51Z","closed_at":"2026-08-31T10:04:53Z","close_reason":"Reconciled migration-decisions.md with actual tree: confirmed curator/mapping/scheduling as legitimate domains (were undocumented, not misplaced), documented that identity/agent/messaging/plugin are approved-but-unmaterialised targets rather than creating dead stub packages","external_ref":"https://github.com/samcharles93/archie-core/issues/651","dependency_count":0,"dependent_count":1,"comment_count":0} +{"_type":"issue","id":"archie-core-kg1w","title":"P0: Refactor cmd/archied/main.go - violates organisation.md wiring rule","description":"cmd/archied/main.go is 1085 lines of substantive wiring, directly violating organisation.md's rule: 'cmd/* MUST NOT contain substantive wiring'.\n\nThis is the migration docs' own stated next chunk: internal/app/{archied,agentworker} (not yet started).\n\nNeed to:\n- Extract wiring logic from cmd/archied/main.go\n- Create internal/app/archied/ package\n- Create internal/app/agentworker/ package\n- Move dependency injection and lifecycle management into app layer\n- cmd/archied/main.go should only contain CLI flag parsing, OS signal traps, and entry point routing\n\nBlocked by: nothing (but is foundational for migration work)","status":"closed","priority":0,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:00Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:51Z","closed_at":"2026-08-31T11:27:14Z","close_reason":"Extracted the full cmd/archied wiring package into internal/app/archied (matching the sibling internal/app/agentworker pattern); cmd/archied/main.go is now 18 lines (codesearch-helper dispatch + call into archied.Run()). Fixed two architecture tests still hardcoded to the old cmd/archied path. task check passes clean.","external_ref":"https://github.com/samcharles93/archie-core/issues/652","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-bas7","title":"P0: Fix failing test - CLAUDE.md missing ARCHITECTURE.md reference","description":"TestPluginEngineRuleIsCanonicalAndSharedByAgentInstructions in internal/plugin test is failing because CLAUDE.md is missing a required reference to ARCHITECTURE.md#plugin-engine-rule-strict.\n\nThis is a red build - needs immediate doc fix.\n\nNeed to:\n- Add the missing reference to CLAUDE.md\n- Verify test passes\n\nBlocked by: nothing","status":"closed","priority":0,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-28T13:40:53Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:52Z","closed_at":"2026-08-31T10:03:46Z","close_reason":"Added missing test + CLAUDE.md reference to ARCHITECTURE.md#plugin-engine-rule-strict","external_ref":"https://github.com/samcharles93/archie-core/issues/653","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1sjk","title":"P0: Bump Go from 1.26.5 to 1.26.6+ to fix 6 stdlib CVEs","description":"govulncheck found 6 CVEs in stdlib packages fixed in Go 1.26.6:\n- html/template\n- crypto/tls (handshake flood)\n- net/http (H2 timeout)\n- encoding/asn1 (recursion DoS)\n- x/net/idna\n\nNeed to:\n1. Update go.mod directive from 1.26.5 → 1.26.6\n2. Update both Dockerfiles (archied and archie-agent) from 1.26.5 → 1.26.6\n3. Rebuild and verify\n\nBlocked by: nothing","status":"closed","priority":0,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:40:40Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:53Z","closed_at":"2026-08-31T10:04:10Z","close_reason":"go.mod already at 1.27.0 (supersedes 1.26.6 CVE fix); bumped both Dockerfiles from golang:1.26-trixie to golang:1.27-trixie to match","external_ref":"https://github.com/samcharles93/archie-core/issues/654","dependency_count":0,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"archie-core-n5sr","title":"Measure and reduce task-agent context amplification","description":"PR #635 consumed at least 1,286,449 tokens across baseline repair, analysis, repro, and fix, while the PR footer reported only 997,900. Do not impose a hard token stop: successful and failed tasks are evaluation evidence. Measure prompt/completion/cached usage by stage and iteration, include every agent stage in task totals, enable adaptive history compaction, and bound redundant tool-result replay so task completion remains the authority while efficiency becomes observable and improvable.","acceptance_criteria":"Task telemetry attributes prompt, completion, cached, total tokens and iterations by workflow stage; baseline-repair usage is included in task totals; task agents compact redundant accumulated history without imposing a token stop; successful and failed tasks remain comparable; regression coverage and quality gate pass.","notes":"Maintainer decision: max_tokens is not desired as a blocker. Optimize context economics and preserve outcomes as metrics.","status":"closed","priority":0,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-24T17:58:59Z","created_by":"Sam Catlow","updated_at":"2026-08-24T19:49:31Z","started_at":"2026-08-24T18:02:41Z","closed_at":"2026-08-24T19:48:33Z","close_reason":"Provider usage is durable by stage, baseline repair is included, model-adaptive compaction is enabled without a token cap, and ai-sdk preserves partial/compaction usage. task check and fresh adversarial review pass.","external_ref":"https://github.com/samcharles93/archie-core/issues/637","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-nq0c","title":"Preserve Git author identity in sandboxed task commits","description":"PR #635 contains three commits with empty author and committer names/emails despite configured bot_user and the documented GitHub noreply default. Trace and preserve commit identity across the daemon-worker boundary.","acceptance_criteria":"Sandboxed task commits carry configured/defaulted author and committer name/email; regression covers the live RPC/local commit composition; quality gate passes.","status":"closed","priority":0,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-24T17:58:58Z","created_by":"Sam Catlow","updated_at":"2026-08-24T19:49:32Z","closed_at":"2026-08-24T19:48:34Z","close_reason":"Commit identity now crosses the task boundary, per-identity email defaults are derived when omitted, and the worker end-to-end test verifies author and committer. task check and fresh adversarial review pass.","external_ref":"https://github.com/samcharles93/archie-core/issues/638","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-473l","title":"Reconcile task clone ownership after container commits","description":"Agent containers write Git objects as root into bind-mounted task clones, while ownership is currently repaired only before push. A stopped or failed workflow before push leaves unreadable objects and makes the next host-side worktree prepare fail instantly. Reconcile ownership after every CommitAll result as well as before push.","status":"closed","priority":0,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-24T17:24:57Z","created_by":"Sam Catlow","updated_at":"2026-08-24T19:49:33Z","started_at":"2026-08-24T17:25:30Z","closed_at":"2026-08-24T17:28:39Z","close_reason":"Implemented with regression coverage, full task check passing, and adversarial review clean.","external_ref":"https://github.com/samcharles93/archie-core/issues/639","dependency_count":0,"dependent_count":0,"comment_count":0} @@ -13,15 +13,15 @@ {"_type":"issue","id":"archie-core-1ysw.1","title":"Bind worktree RPC operations to the dispatched task","description":"The sandboxed agent can currently choose owner, repo, issue, base, and branch on worktree RPC requests. The daemon then performs host deletion and credentialed forge operations without correlating the request to the dispatched task or enforcing WorkDir containment.","acceptance_criteria":"Reject traversal and unconfigured or task-mismatched coordinates before any filesystem or forge side effect; derive or validate the permitted branch; regression tests fail on the old behavior and pass on the fix.","status":"closed","priority":0,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-22T11:01:43Z","created_by":"Sam Catlow","updated_at":"2026-08-24T06:59:58Z","started_at":"2026-08-22T11:02:03Z","closed_at":"2026-08-24T06:59:58Z","close_reason":"Fixed on main: worktreerpc now exposes only Push, authorized by an opaque per-dispatch grant issued from the dispatched *store.Task (worktreerpc.go:71-83). Sandbox input no longer selects host path, repo or branch; ValidCoordinates rejects traversal. Package tests pass.","external_ref":"https://github.com/samcharles93/archie-core/issues/589","metadata":null,"dependencies":[{"issue_id":"archie-core-1ysw.1","depends_on_id":"archie-core-1ysw","type":"parent-child","created_at":"2026-08-22T21:01:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1ysw","title":"Repair internal/worktree correctness and trust-boundary defects","description":"Track the concrete worktree-package defects proven by the 2026-08-22 evidence-gated review. Child bugs cover RPC authority/path containment, repository-key isolation, retry/base/diff correctness, push lifecycle, terminal cleanup, cancellation, and branch naming. This epic groups implementation only; each child has its own observable acceptance criteria.","acceptance_criteria":"All child bugs are closed with red-green regression tests, scoped lint passes, and the repository quality gate is clean.","status":"closed","priority":0,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-08-22T11:01:18Z","created_by":"Sam Catlow","updated_at":"2026-08-24T08:16:00Z","closed_at":"2026-08-24T08:16:00Z","close_reason":"All 9 children complete. The P0/P1 trust-boundary and correctness defects (.1 RPC task binding, .2 colliding directory keys, .3 untracked cleanup, .4 fail-closed base resolution, .5 three-dot merge-base semantics) were already fixed on main and reconciled 2026-08-24. The remaining four (.6 push result, .7 no-change worktree leak, .8 commit cancellation, .9 branch naming contract) were implemented this session, merged as 474c31d and its two merge commits, task check green, with an independent adversarial review reporting zero findings.","external_ref":"https://github.com/samcharles93/archie-core/issues/590","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-t2db.5","title":"Security: an unauthenticated endpoint must not be able to run an agent","description":"P0 within this epic because the feature's own pitch is the threat model: a public intake surface whose output is an agent with tool access and a repo. Get this wrong and a webhook URL is remote code execution with extra steps.\n\nNon-negotiables to design:\n\n- Per-source authentication. A source registers with a secret (HMAC, as internal/channels/webhook already does per route) before its events can trigger anything. Capture-only for unknown senders is acceptable; triggering is not.\n- Human approval before a binding goes live. An operator authoring a binding is a deliberate act; an event arriving is not. Nothing should self-arm.\n- Rate and volume limits per source, so capture cannot be used to exhaust disk or drown the inspector.\n- Payload content is untrusted input flowing into an agent prompt. Treat prompt injection as expected, not exceptional -- the sender controls that text, and the agent has tools. Bound what a playbook-triggered workflow may do.\n- Captured payloads may contain secrets from the sending system. Decide retention, redaction and who can view them; internal/memory/scrubber may already have applicable prior art.\n\nArchie's own principle applies: environmental enforcement over prompt rules. 'The agent should ignore instructions in the payload' is not a control.","acceptance_criteria":"An event from an unauthenticated source can be captured but cannot trigger a workflow; a new binding requires explicit human approval before it arms; per-source rate limits exist; the blast radius of a playbook-triggered workflow is bounded by code rather than by prompt text; retention and visibility of captured payloads is decided and documented.","notes":"2026-08-22: security design decided and documented in docs/prds/webhook-intake-security.md, covering all five non-negotiables from this bead's description:\n1. Per-source auth reuses internal/channels/webhook's existing HMAC-SHA256 scheme; capture accepts unsigned events (visible, marked unauthenticated), only authenticated events can ever match a binding.\n2. Bindings gain a draft -\u003e pending_approval -\u003e armed state machine; any edit to an armed binding drops it back to pending_approval so approval can't be bypassed by editing. Modeled on telegram's existing dangerousAction/pendingApproval flow (dangerous.go/approval.go).\n3. Per-source token-bucket rate limiting (precedent: pairing/store.go's MaxPendingPerPlatform); limit-exceeded is an observable 429, not a silent drop.\n4. Blast radius bounded by the SAME code-level controls every task already gets -- gate, diff_cap_lines, sandboxed container, worktree isolation -- no new relaxation for playbook-triggered work, and payload text is ordinary untrusted prompt input, never a trusted instruction.\n5. 7-day configurable retention on captured payloads; best-effort redaction reusing gateway/stream.go's sensitiveParameterKey heuristic before persisting; visibility gated by the same dashboard auth as every other webui surface.\n\nThis bead's code-level acceptance criteria (capture-can't-trigger, rate limits exist, blast-radius bounded, approval gate) cannot be implemented yet: they constrain t2db.1 (capture), 7d5u.3 (intake family) and t2db.4 (binding), none of which have landed. This document is the contract those beads build against -- do not build any of them without satisfying it. Leaving this bead in_progress rather than closing it; it closes when t2db.1/7d5u.3/t2db.4 land and demonstrably satisfy points 1-5, not before.","status":"in_progress","priority":0,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-21T13:45:46Z","created_by":"Sam Catlow","updated_at":"2026-08-22T09:25:01Z","started_at":"2026-08-21T14:51:26Z","external_ref":"https://github.com/samcharles93/archie-core/issues/536","dependencies":[{"issue_id":"archie-core-t2db.5","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-08-21T23:45:45Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"archie-core-s81k","title":"Preserve bound slog attributes in persistent log sinks","description":"PR #650 scopes daemon, Web UI, and curator loggers with slog.Logger.With. internal/logging.FeedHandler.WithAttrs retains those bound attributes for the live feed but does not pass them to the wrapped handler, while Handle forwards the bare slog.Record. As a result, component is present in live Web UI entries but absent from stderr and file JSON; after restart, historical component discovery and filtering cannot see those records. Fix bound-attribute propagation without breaking slog group semantics or duplicating attributes.","acceptance_criteria":"Bound attributes appear in both Feed entries and the wrapped JSON sink; component values survive file persistence and are discoverable and filterable through historical /api/logs reads; regression tests exercise logger.With for both live and persistent paths; task check passes.","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-09-02T09:37:55Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:43:01Z","closed_at":"2026-09-02T09:43:01Z","close_reason":"Fixed: FeedHandler.WithAttrs/WithGroup now propagate to the wrapped handler, matching SystemLogHandler's existing pattern. Added regression test covering both feed and persistent sink.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-d66k","title":"P1: Update ARCHITECTURE.md Package Map with missing packages","description":"ARCHITECTURE.md's Package Map omits sizeable load-bearing packages:\n- internal/gateway: 18.7k LOC\n- internal/tools: 20.9k LOC\n- internal/memory: 7k LOC\n- secret/*\n- plugin/*\n- skill/*\n\nA contributor or agent reading the map would miss where most of the code actually lives.\n\nNeed to:\n- Audit ARCHITECTURE.md Package Map section\n- Add all missing packages with their responsibilities\n- Ensure consistency with actual package structure\n- Verify LOC counts are accurate\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:10Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:10:50Z","closed_at":"2026-08-31T10:10:50Z","close_reason":"Added internal/gateway, internal/tools, internal/memory, internal/secret, internal/plugin, internal/skill to ARCHITECTURE.md Package Map with LOC and role descriptions","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-p3wt","title":"P1: Fix recvcheck - mixed pointer/value receivers","description":"recvcheck found mixed pointer/value receivers on:\n- Duration\n- TaskEnvelope\n- Provenance\n\nThis is a latent mutation-semantics bug - methods may not behave correctly if they expect to mutate the receiver.\n\nNeed to:\n- Audit all methods on Duration, TaskEnvelope, Provenance\n- Standardize to either all pointer receivers or all value receivers\n- Prefer pointer receivers for types that need mutation\n- Verify no behavior changes after fix\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:07Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:09:59Z","closed_at":"2026-08-31T10:09:59Z","close_reason":"Duration and TaskEnvelope were already consistent by the time this was picked up; fixed the remaining recvcheck violation on Provenance (Paths/String moved to pointer receiver to match the mutating record() method). All Provenance uses are through addressable struct fields, so build/tests are unaffected. recvcheck now reports 0 issues.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-agui","title":"P1: Fix 31 golangci-lint issues","description":"31 golangci-lint issues clustered as high cyclomatic/cognitive complexity in:\n- internal/tools/builtin/find.go\n- internal/tools/builtin/grep.go\n- internal/tools/builtin/shell.go\n- internal/gateway/go:dispatchLocal\n\nThese are real refactor candidates, not noise.\n\nNeed to:\n- Review each issue to understand the complexity\n- Refactor functions to reduce cyclomatic complexity\n- Break down large functions into smaller, focused ones\n- Re-run golangci-lint to verify fixes\n\nBlocked by: nothing","notes":"Fixed cyclop findings (applyEdits, grepFallback, grepDirFallback, serveReadContent, handleChatStream) and several gocognit/funlen findings (TDD, runFindGoFallback, makeGrepExecutor, makeShellExecutor). Remaining: richblocks.go markdownToBlocks/blocksToPlainText (gocognit), gateway.go dispatchLocal (gocyclo), agent.go Stage (gocognit 70), turn.go Run (gocognit 53), tomlwrite.go Apply (gocognit 82), cronstore store.go Update (gocognit) + nestif x2, toolset.go nestif. 22 of original 31 findings remain unaddressed -- keeping open.","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:04Z","created_by":"Sam Catlow","updated_at":"2026-08-31T11:36:17Z","closed_at":"2026-08-31T11:36:17Z","close_reason":"All 31 original findings (5 cyclop, 9 gocognit, 1 gocyclo, 2 nestif, plus incidental funlen) resolved via targeted extraction across tools/builtin, gateway, workflow, webui, telegram, cronstore, tomlwrite, agentexec. Remaining 6 lint findings (containedctx/errorlint/noctx/staticcheck) were never part of this bead's scope.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-k7y7","title":"P1: Address coverage gaps in load-bearing packages","description":"Coverage gaps in critical packages:\n- domain/workintake: 14.3%\n- secret/enginehost: 0%\n- secret/secretextract: 10%\n- forge: 35.8%\n- natsrpc: 28.3%\n\nNeed to:\n- Analyze why coverage is low in these packages\n- Add tests for uncovered code paths\n- Prioritize based on risk/criticality\n- Aim for at least 60-70% coverage in load-bearing packages\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:01Z","created_by":"Sam Catlow","updated_at":"2026-08-31T11:27:21Z","closed_at":"2026-08-31T11:27:21Z","close_reason":"Raised coverage: workintake 14.3%-\u003e94.6%, secret/enginehost 0%-\u003e100%, secret/secretextract 10%-\u003e100%, forge 36.1%-\u003e77.0%, natsrpc 28.3%-\u003e91.3%. Committed as bc5b355.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-zq4l","title":"P1: Tighten CI go-version pinning","description":"CI's go-version is set to '1.26' (floating) while go.mod has exact 1.26.5. This loose coupling means CI could use 1.26.0-1.26.5 or newer minor versions, potentially missing bugs or compatibility issues.\n\nNeed to:\n- Pin CI go-version to exact match go.mod (currently 1.26.5, will be 1.26.6+ after P0 bump)\n- Consider using same variable/source of truth for both\n- Update CI configuration files\n\nBlocked by: Go version bump (archie-core-1sjk) for consistency","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:58Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:05:31Z","closed_at":"2026-08-31T10:05:31Z","close_reason":"Switched CI to actions/setup-go go-version-file: go.mod so CI's Go version is always sourced from go.mod directly, eliminating drift","dependencies":[{"issue_id":"archie-core-zq4l","depends_on_id":"archie-core-1sjk","type":"blocks","created_at":"2026-08-28T13:42:31Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-0bvr","title":"P1: Add govulncheck step to CI/Taskfile","description":"The 6 stdlib CVEs went undetected through normal task check because there's no govulncheck step anywhere in CI or Taskfile.\n\nNeed to:\n- Add govulncheck to Taskfile.yml (e.g., task vuln)\n- Consider adding to CI pipeline\n- Decide: should vuln check be part of task check or separate?\n- Document the new task\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:54Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:05:53Z","closed_at":"2026-08-31T10:05:53Z","close_reason":"Added 'task vuln' (govulncheck) to Taskfile, deliberately kept out of task check since it needs network access to the vuln DB; wired as a separate CI step in deploy.yml","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-g1y3","title":"P1: Refactor internal/gateway/ - duplicate implementation risk with messaging domain","description":"internal/gateway/ contains session/compression/approval/branch logic which is the exact 'parallel gateway implementation' that migration-decisions.md says must be replaced by the not-yet-built messaging domain.\n\nThis is a live duplicate-implementation risk - gateway logic should migrate to domain/messaging.\n\nNeed to:\n- Analyze current gateway responsibilities\n- Create domain/messaging package structure\n- Migrate gateway logic incrementally to messaging domain\n- Update callers to use domain/messaging\n- Ensure no behavior changes during migration\n\nBlocked by: domain/messaging package not yet created","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:51Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:12:25Z","closed_at":"2026-08-31T10:12:25Z","close_reason":"Resolved migration-decisions.md's open Session/Messaging decision: keep internal/gateway as-is rather than risk a big-bang rewrite of live session/compression/approval/branch logic. Materialised internal/domain/messaging with the already-settled canonical Message/Conversation/ToolCall/ToolResult types (composite Conversation identity, immutable MessageID, branch lineage), with tests. Actual gateway migration onto these types is tracked as sequenced follow-up bd issues (d9dv, 4hof, o4e4, h3w2, label messaging-migration) so each channel lands with its own verification.","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-tnsr","title":"P1: Bump ai-sdk from v0.1.29 to v0.1.30","description":"github.com/samcharles93/ai-sdk is pinned at v0.1.29, one release behind (v0.1.30 pushed today).\n\nMissing features available in v0.1.30:\n- NewTypedTool\n- GenerateTypedObject\n- errx.ProviderError\n- RetryConfig.OnAttempt\n\nConcrete usage sites in internal/agentexec/loop_runner.go:\n- pluginToolSet: hand-writes JSON Schema + manual unmarshal\n- scriptToolSet: hand-writes JSON Schema + manual unmarshal\n\nThese are clean NewTypedTool[In] candidates once bumped.\n\nNeed to:\n- Update go.mod to require ai-sdk v0.1.30\n- Run go mod tidy\n- Refactor pluginToolSet and scriptToolSet to use NewTypedTool\n- Verify no breaking changes\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:43Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:06:42Z","closed_at":"2026-08-31T10:06:42Z","close_reason":"go.mod already on ai-sdk v0.1.30. Refactored pluginToolSet and scriptToolSet in internal/agentexec/loop_runner.go to use NewTypedTool instead of hand-written JSON Schema + manual unmarshal; tests pass","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-s81k","title":"Preserve bound slog attributes in persistent log sinks","description":"PR #650 scopes daemon, Web UI, and curator loggers with slog.Logger.With. internal/logging.FeedHandler.WithAttrs retains those bound attributes for the live feed but does not pass them to the wrapped handler, while Handle forwards the bare slog.Record. As a result, component is present in live Web UI entries but absent from stderr and file JSON; after restart, historical component discovery and filtering cannot see those records. Fix bound-attribute propagation without breaking slog group semantics or duplicating attributes.","acceptance_criteria":"Bound attributes appear in both Feed entries and the wrapped JSON sink; component values survive file persistence and are discoverable and filterable through historical /api/logs reads; regression tests exercise logger.With for both live and persistent paths; task check passes.","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-09-02T09:37:55Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:54Z","closed_at":"2026-09-02T09:43:01Z","close_reason":"Fixed: FeedHandler.WithAttrs/WithGroup now propagate to the wrapped handler, matching SystemLogHandler's existing pattern. Added regression test covering both feed and persistent sink.","external_ref":"https://github.com/samcharles93/archie-core/issues/655","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-d66k","title":"P1: Update ARCHITECTURE.md Package Map with missing packages","description":"ARCHITECTURE.md's Package Map omits sizeable load-bearing packages:\n- internal/gateway: 18.7k LOC\n- internal/tools: 20.9k LOC\n- internal/memory: 7k LOC\n- secret/*\n- plugin/*\n- skill/*\n\nA contributor or agent reading the map would miss where most of the code actually lives.\n\nNeed to:\n- Audit ARCHITECTURE.md Package Map section\n- Add all missing packages with their responsibilities\n- Ensure consistency with actual package structure\n- Verify LOC counts are accurate\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:10Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:55Z","closed_at":"2026-08-31T10:10:50Z","close_reason":"Added internal/gateway, internal/tools, internal/memory, internal/secret, internal/plugin, internal/skill to ARCHITECTURE.md Package Map with LOC and role descriptions","external_ref":"https://github.com/samcharles93/archie-core/issues/656","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-p3wt","title":"P1: Fix recvcheck - mixed pointer/value receivers","description":"recvcheck found mixed pointer/value receivers on:\n- Duration\n- TaskEnvelope\n- Provenance\n\nThis is a latent mutation-semantics bug - methods may not behave correctly if they expect to mutate the receiver.\n\nNeed to:\n- Audit all methods on Duration, TaskEnvelope, Provenance\n- Standardize to either all pointer receivers or all value receivers\n- Prefer pointer receivers for types that need mutation\n- Verify no behavior changes after fix\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:07Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:55Z","closed_at":"2026-08-31T10:09:59Z","close_reason":"Duration and TaskEnvelope were already consistent by the time this was picked up; fixed the remaining recvcheck violation on Provenance (Paths/String moved to pointer receiver to match the mutating record() method). All Provenance uses are through addressable struct fields, so build/tests are unaffected. recvcheck now reports 0 issues.","external_ref":"https://github.com/samcharles93/archie-core/issues/657","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-agui","title":"P1: Fix 31 golangci-lint issues","description":"31 golangci-lint issues clustered as high cyclomatic/cognitive complexity in:\n- internal/tools/builtin/find.go\n- internal/tools/builtin/grep.go\n- internal/tools/builtin/shell.go\n- internal/gateway/go:dispatchLocal\n\nThese are real refactor candidates, not noise.\n\nNeed to:\n- Review each issue to understand the complexity\n- Refactor functions to reduce cyclomatic complexity\n- Break down large functions into smaller, focused ones\n- Re-run golangci-lint to verify fixes\n\nBlocked by: nothing","notes":"Fixed cyclop findings (applyEdits, grepFallback, grepDirFallback, serveReadContent, handleChatStream) and several gocognit/funlen findings (TDD, runFindGoFallback, makeGrepExecutor, makeShellExecutor). Remaining: richblocks.go markdownToBlocks/blocksToPlainText (gocognit), gateway.go dispatchLocal (gocyclo), agent.go Stage (gocognit 70), turn.go Run (gocognit 53), tomlwrite.go Apply (gocognit 82), cronstore store.go Update (gocognit) + nestif x2, toolset.go nestif. 22 of original 31 findings remain unaddressed -- keeping open.","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:04Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:56Z","closed_at":"2026-08-31T11:36:17Z","close_reason":"All 31 original findings (5 cyclop, 9 gocognit, 1 gocyclo, 2 nestif, plus incidental funlen) resolved via targeted extraction across tools/builtin, gateway, workflow, webui, telegram, cronstore, tomlwrite, agentexec. Remaining 6 lint findings (containedctx/errorlint/noctx/staticcheck) were never part of this bead's scope.","external_ref":"https://github.com/samcharles93/archie-core/issues/658","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-k7y7","title":"P1: Address coverage gaps in load-bearing packages","description":"Coverage gaps in critical packages:\n- domain/workintake: 14.3%\n- secret/enginehost: 0%\n- secret/secretextract: 10%\n- forge: 35.8%\n- natsrpc: 28.3%\n\nNeed to:\n- Analyze why coverage is low in these packages\n- Add tests for uncovered code paths\n- Prioritize based on risk/criticality\n- Aim for at least 60-70% coverage in load-bearing packages\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:01Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:57Z","closed_at":"2026-08-31T11:27:21Z","close_reason":"Raised coverage: workintake 14.3%-\u003e94.6%, secret/enginehost 0%-\u003e100%, secret/secretextract 10%-\u003e100%, forge 36.1%-\u003e77.0%, natsrpc 28.3%-\u003e91.3%. Committed as bc5b355.","external_ref":"https://github.com/samcharles93/archie-core/issues/659","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-zq4l","title":"P1: Tighten CI go-version pinning","description":"CI's go-version is set to '1.26' (floating) while go.mod has exact 1.26.5. This loose coupling means CI could use 1.26.0-1.26.5 or newer minor versions, potentially missing bugs or compatibility issues.\n\nNeed to:\n- Pin CI go-version to exact match go.mod (currently 1.26.5, will be 1.26.6+ after P0 bump)\n- Consider using same variable/source of truth for both\n- Update CI configuration files\n\nBlocked by: Go version bump (archie-core-1sjk) for consistency","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:58Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:57Z","closed_at":"2026-08-31T10:05:31Z","close_reason":"Switched CI to actions/setup-go go-version-file: go.mod so CI's Go version is always sourced from go.mod directly, eliminating drift","external_ref":"https://github.com/samcharles93/archie-core/issues/660","dependencies":[{"issue_id":"archie-core-zq4l","depends_on_id":"archie-core-1sjk","type":"blocks","created_at":"2026-08-28T13:42:31Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-0bvr","title":"P1: Add govulncheck step to CI/Taskfile","description":"The 6 stdlib CVEs went undetected through normal task check because there's no govulncheck step anywhere in CI or Taskfile.\n\nNeed to:\n- Add govulncheck to Taskfile.yml (e.g., task vuln)\n- Consider adding to CI pipeline\n- Decide: should vuln check be part of task check or separate?\n- Document the new task\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:54Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:58Z","closed_at":"2026-08-31T10:05:53Z","close_reason":"Added 'task vuln' (govulncheck) to Taskfile, deliberately kept out of task check since it needs network access to the vuln DB; wired as a separate CI step in deploy.yml","external_ref":"https://github.com/samcharles93/archie-core/issues/661","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-g1y3","title":"P1: Refactor internal/gateway/ - duplicate implementation risk with messaging domain","description":"internal/gateway/ contains session/compression/approval/branch logic which is the exact 'parallel gateway implementation' that migration-decisions.md says must be replaced by the not-yet-built messaging domain.\n\nThis is a live duplicate-implementation risk - gateway logic should migrate to domain/messaging.\n\nNeed to:\n- Analyze current gateway responsibilities\n- Create domain/messaging package structure\n- Migrate gateway logic incrementally to messaging domain\n- Update callers to use domain/messaging\n- Ensure no behavior changes during migration\n\nBlocked by: domain/messaging package not yet created","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:51Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:59Z","closed_at":"2026-08-31T10:12:25Z","close_reason":"Resolved migration-decisions.md's open Session/Messaging decision: keep internal/gateway as-is rather than risk a big-bang rewrite of live session/compression/approval/branch logic. Materialised internal/domain/messaging with the already-settled canonical Message/Conversation/ToolCall/ToolResult types (composite Conversation identity, immutable MessageID, branch lineage), with tests. Actual gateway migration onto these types is tracked as sequenced follow-up bd issues (d9dv, 4hof, o4e4, h3w2, label messaging-migration) so each channel lands with its own verification.","external_ref":"https://github.com/samcharles93/archie-core/issues/662","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-tnsr","title":"P1: Bump ai-sdk from v0.1.29 to v0.1.30","description":"github.com/samcharles93/ai-sdk is pinned at v0.1.29, one release behind (v0.1.30 pushed today).\n\nMissing features available in v0.1.30:\n- NewTypedTool\n- GenerateTypedObject\n- errx.ProviderError\n- RetryConfig.OnAttempt\n\nConcrete usage sites in internal/agentexec/loop_runner.go:\n- pluginToolSet: hand-writes JSON Schema + manual unmarshal\n- scriptToolSet: hand-writes JSON Schema + manual unmarshal\n\nThese are clean NewTypedTool[In] candidates once bumped.\n\nNeed to:\n- Update go.mod to require ai-sdk v0.1.30\n- Run go mod tidy\n- Refactor pluginToolSet and scriptToolSet to use NewTypedTool\n- Verify no breaking changes\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:41:43Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:59Z","closed_at":"2026-08-31T10:06:42Z","close_reason":"go.mod already on ai-sdk v0.1.30. Refactored pluginToolSet and scriptToolSet in internal/agentexec/loop_runner.go to use NewTypedTool instead of hand-written JSON Schema + manual unmarshal; tests pass","external_ref":"https://github.com/samcharles93/archie-core/issues/663","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-z0u8","title":"Fix dashboard PR links to target the pull request","description":"The task dashboard Open PR action builds GitHub /pulls/\u003cnumber\u003e, which GitHub interprets as the pull-request listing and a numeric author filter. Link directly to /pull/\u003cnumber\u003e.","acceptance_criteria":"Open PR links use the forge's direct pull-request URL shape; a regression test fails against the plural route and passes after the fix; quality gate passes.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-24T17:57:39Z","created_by":"Sam Catlow","updated_at":"2026-08-24T19:49:35Z","started_at":"2026-08-24T17:57:46Z","closed_at":"2026-08-24T19:48:35Z","close_reason":"The API now supplies canonical per-task GitHub or Gitea URLs and the dashboard consumes them directly. Regression coverage, task check, and fresh adversarial review pass.","external_ref":"https://github.com/samcharles93/archie-core/issues/642","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-jy5m","title":"Make task timeline events operationally informative","description":"Task timelines currently render generic stage_start/stage_finish entries with no stage name or outcome, and task_retried entries add little beyond the event kind. Surface the existing event stage, workflow, detail, and relevant structured data so operators can understand what happened without opening raw logs.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-24T17:39:51Z","created_by":"Sam Catlow","updated_at":"2026-08-24T19:49:36Z","started_at":"2026-08-24T17:39:57Z","closed_at":"2026-08-24T17:55:34Z","close_reason":"Task timelines now render stage/retry context; baseline and gate-cycle logs expose useful bounded failure output. task check and independent review pass.","external_ref":"https://github.com/samcharles93/archie-core/issues/643","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-y1hv","title":"Relay dashboard update completion through Telegram","description":"Integrate the existing Carina-side behavior so dashboard-initiated updates can deliver their post-restart watchdog result to an authorized Telegram recipient, while retaining the web UI report path fallback.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-24T17:18:30Z","created_by":"Sam Catlow","updated_at":"2026-08-24T19:49:36Z","started_at":"2026-08-24T17:18:35Z","closed_at":"2026-08-24T17:19:42Z","close_reason":"Implemented, regression-tested, full task check passed, and adversarial review finding resolved.","external_ref":"https://github.com/samcharles93/archie-core/issues/644","dependency_count":0,"dependent_count":0,"comment_count":0} @@ -91,23 +91,23 @@ {"_type":"issue","id":"archie-core-tb3a","title":"Fix streaming review blockers for inline tool calls","description":"Resolve the four evidence-gated findings in merged inline tool-call streaming: preserve the authoritative Telegram reply when final edits fail; keep Telegram network I/O off the model FullStream consumer and cancellable; correlate tool inputs with results and render a bounded redacted parameter summary; snapshot show_tool_calls per live reply to avoid reload races. Add regression tests for every path and run task check plus lint/race validation.","acceptance_criteria":"Regression tests fail on the merged implementation and pass after the fix. Final edit failure falls back to normal split delivery. Delta and ToolCall callbacks do not wait on Telegram HTTP and stop cancels in-flight rendering. Completed tool events include bounded redacted parameters correlated by tool-call ID. Reload cannot race an in-flight reply's show_tool_calls setting. task check passes, golangci-lint reports no new findings, and focused race tests pass.","notes":"Implemented in worktree /tmp/archie-core-tb3a on branch fix/archie-core-tb3a. Added cancellable async Telegram rendering, final edit failure fallback through normal split delivery, call-ID-correlated bounded conservative parameter summaries, atomic per-reply show_tool_calls snapshots, SSE/UI parameter rendering, rebuilt ui/dist, and regression tests. Validation: GOFLAGS=-buildvcs=false task check passed; golangci-lint --new-from-rev=HEAD ./... reported 0 issues; focused race suite passed; fresh adversarial reviewer reported PASS with zero findings. Plain task check is blocked in linked worktrees by Go VCS stamping exit 128, hence buildvcs override.\n2026-08-24 reconciliation: the close reason's 'worktree left uncommitted' is stale. The work did land on main via ba33527 (Merge pull request #477 from samcharles93/fix/archie-core-tb3a); verified on main: gateway/stream.go sensitiveParameterKey+redactToolParameters, telegram/live.go per-reply showToolCalls snapshot, webui/api_chat.go gating. The /tmp/archie-core-tb3a worktree and its branch are gone, as expected.\n","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-13T18:05:35Z","created_by":"Sam Catlow","updated_at":"2026-08-24T07:29:09Z","started_at":"2026-08-13T18:05:39Z","closed_at":"2026-08-13T18:35:26Z","close_reason":"Completed and independently reviewed; worktree left uncommitted per conservative repository policy.","external_ref":"https://github.com/samcharles93/archie-core/issues/485","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-dzx","title":"Remove duplicate archie-agent safe.directory setup","description":"## Problem\\ncmd/archie-agent/main.go configures git safe.directory inline and then calls markWorktreeSafe, so startup writes the same global git configuration twice.\\n\\n## Scope\\nKeep markWorktreeSafe as the single tested production path and remove the older inline exec.Command block/import. Add regression coverage proving startup wiring has exactly one authoritative safe-directory call.\\n\\n## Acceptance\\n- archie-agent startup invokes markWorktreeSafe exactly once\\n- no second inline safe.directory command remains in main.go\\n- cmd/archie-agent tests and repository quality gate pass","acceptance_criteria":"Single tested safe.directory setup path remains; duplicate inline command is removed; tests and task check pass","notes":"Red proof: TestMainConfiguresWorktreeSafetyOnce failed with 2 setup paths before implementation. Green proof: go test/vet/build ./cmd/archie-agent/... passed; golangci-lint --new-from-rev=HEAD reported 0 issues. Fresh adversarial review found no blockers. Full task check was not run because the working tree contains unrelated in-progress changes and task check rewrites files; scoped package gate used per repository protocol.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-13T16:10:09Z","created_by":"Sam Catlow","updated_at":"2026-08-13T16:13:48Z","started_at":"2026-08-13T16:10:24Z","closed_at":"2026-08-13T16:13:48Z","close_reason":"Removed duplicate inline safe.directory setup; markWorktreeSafe is now the single tested production path","external_ref":"https://github.com/samcharles93/archie-core/issues/470","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786637499161-356-e424e40d.1","title":"setupMemory never calls RegisterExternal; cfg.Memory.Provider is silently inert","description":"internal/app/archied/bootstrap.go:setupMemory's own doc comment says\n\"External providers from config are added via RegisterExternal when\ncfg.Memory.Provider is set\" -- no such branch exists in the function body.\nToday, an operator who sets [memory] provider = \"...\" in config.toml gets\nno error and no effect: the builtin file-backed provider is the only one\nthat ever runs. config.example.toml already documents this as a known gap\n(\"[memory] exists to register an EXTERNAL provider alongside it, but as of\nthis writing that wiring ... is not called\").\n\nSeparately, internal/config.MemoryConfig (config.go:287) has no `toml`\nstruct tag on any field (yaml/json only), so even fixing the wiring call\nmay not bind values from config.toml, the format operators actually use --\nverify this before or as part of the fix.\n\nThis sits ahead of the typed engine-family work (archie-core-...-11-e245c170)\nin the sense that it's a bug in the CURRENT ad-hoc MemoryProvider wiring,\nnot a gap in the future engine contract -- decide whether it's worth fixing\nin the legacy path or superseded once the conforming memory engine family\nlands, rather than fixing both.","status":"closed","priority":2,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-09-01T15:50:52Z","created_by":"Sam Catlow","updated_at":"2026-09-01T16:51:00Z","closed_at":"2026-09-01T16:51:00Z","close_reason":"Fixed, but not as originally framed. Investigated wiring RegisterExternal\nfor real: there is no external MemoryProvider implementation anywhere in\nthe repo to construct and pass to it (only internal/memory/builtin.Provider\nexists) -- calling RegisterExternal would be dead plumbing to nothing, not\na fix.\n\nThe actual fix: configuration.validateMemory now rejects memory.provider\nbeing set at all, with a clear reason, instead of accepting it and doing\nnothing. Turns the silent no-op into a loud one. setupMemory's doc comment\nand config.example.toml updated to match; the now-pointless\nprovider_config example section removed.\n\ntoml struct tags (the other half of this bug) were already fixed in\narchie-core-1786637490043's commit.\n\nDrop the rejection once a real external provider (or the domain/memory\nengine family's Honcho proof, archie-core-1786637492031) gives the field\nan effect again.\n\nTestValidateMemoryRejectsProviderSetToAnything covers it. task check is\ngreen.","external_ref":"https://github.com/samcharles93/archie-core/issues/649","labels":["epic"],"dependencies":[{"issue_id":"archie-core-1786637499161-356-e424e40d.1","depends_on_id":"archie-core-1786637499161-356-e424e40d","type":"parent-child","created_at":"2026-09-01T15:50:52Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-r3gh","title":"Harden task origin response assertions","description":"Replace brittle prose substring assertions in internal/webui/api_tasks_origin_test.go with stable structural checks for HTTP error responses while preserving origin and media-type coverage.","acceptance_criteria":"The origin test does not assert human-readable response text; rejected cases verify stable HTTP error response structure; focused tests and task check pass.","status":"in_progress","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-31T12:49:20Z","created_by":"Sam Catlow","updated_at":"2026-08-31T12:49:27Z","started_at":"2026-08-31T12:49:27Z","lease_expires_at":"2026-08-31T12:54:27Z","heartbeat_at":"2026-08-31T12:49:27Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-h3w2","title":"Migrate email/webhook channels onto domain/messaging types","description":"Update remaining gateway-based channels (email, webhook) to use domain/messaging types, completing the migration described in migration-decisions.md section 2.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:16Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:12:16Z","labels":["messaging-migration"],"dependencies":[{"issue_id":"archie-core-h3w2","depends_on_id":"archie-core-d9dv","type":"blocks","created_at":"2026-08-31T10:12:24Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-o4e4","title":"Migrate web UI / dashboard chat onto domain/messaging types","description":"Update internal/webui/ chat handling (api_chat.go and friends) to use domain/messaging types once gateway session storage is migrated. Verify SSE streaming and chat history are unaffected.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:15Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:12:15Z","labels":["messaging-migration"],"dependencies":[{"issue_id":"archie-core-o4e4","depends_on_id":"archie-core-d9dv","type":"blocks","created_at":"2026-08-31T10:12:23Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-4hof","title":"Migrate Telegram channel onto domain/messaging types","description":"Once gateway session storage uses domain/messaging types, update internal/channels/telegram/ to read/write through them instead of internal/gateway.Message directly. Verify no behavior change in message history, branching, or tool-call rendering.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:13Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:12:13Z","labels":["messaging-migration"],"dependencies":[{"issue_id":"archie-core-4hof","depends_on_id":"archie-core-d9dv","type":"blocks","created_at":"2026-08-31T10:12:22Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-d9dv","title":"Migrate internal/gateway session storage onto domain/messaging types","description":"internal/domain/messaging now has the canonical Message/Conversation/ToolCall/ToolResult types (settled in migration-decisions.md section 2). internal/gateway/'s session storage still uses its own gateway.Message and ad hoc session state. Migrate gateway's session persistence to store/load domain/messaging.Message and Conversation, preserving exact current behavior (compression, approval, branch semantics unchanged).","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:12Z","created_by":"Sam Catlow","updated_at":"2026-08-31T10:12:12Z","labels":["messaging-migration"],"dependency_count":0,"dependent_count":3,"comment_count":0} -{"_type":"issue","id":"archie-core-ul1m","title":"P2: Track migration progress - 85% of internal/ not in domain structure","description":"~85% of internal/ packages (29 of 36) haven't moved into the target domain//infrastructure/ structure yet. This is expected mid-migration, but worth tracking.\n\nNeed to:\n- Create a migration tracking document or update existing one\n- List all packages and their target locations\n- Track progress as packages are migrated\n- Identify dependencies between migrations\n\nBlocked by: P0 domain package reconciliation (archie-core-2tqh)","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:26Z","created_by":"Sam Catlow","updated_at":"2026-08-28T13:42:26Z","dependencies":[{"issue_id":"archie-core-ul1m","depends_on_id":"archie-core-2tqh","type":"blocks","created_at":"2026-08-28T13:42:37Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-kllw","title":"P2: Pin Docker latest tag for archie-agent","description":"Docker latest tag on ghcr.io/samcharles93/archie-agent is unpinned, which hurts reproducibility.\n\nNeed to:\n- Identify current stable version/commit hash\n- Update docker-compose.yml or deployment configs to use pinned tag\n- Consider using SHA-based tags for production deployments\n- Document the pinning strategy\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:23Z","created_by":"Sam Catlow","updated_at":"2026-08-28T13:42:23Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-uyxk","title":"P2: Add lint/upgrade-deps Taskfile targets","description":"Dependency and lint maintenance is currently manual. There are no Taskfile targets for:\n- Running linters (golangci-lint)\n- Upgrading dependencies\n- Checking for outdated modules\n\nNeed to:\n- Add task lint target that runs golangci-lint\n- Add task deps:upgrade target for dependency updates\n- Add task deps:check target to list outdated modules\n- Ensure these integrate with existing task check flow\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:20Z","created_by":"Sam Catlow","updated_at":"2026-08-28T13:42:20Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-6xo8","title":"P2: CONTEXT.md describes unimplemented Remote Secret Input feature","description":"CONTEXT.md describes a full 'Remote Secret Input' feature (entry links, secret-input sessions, value-entry form) with zero implementation in internal/secret.\n\nThe feature appears designed but not built, and nothing flags it as aspirational.\n\nNeed to:\n- Audit CONTEXT.md for feature descriptions\n- Check internal/secret for any partial implementation\n- Either implement the feature or mark it as aspirational in docs\n- Add appropriate TODO/roadmap markers\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:17Z","created_by":"Sam Catlow","updated_at":"2026-08-28T13:42:17Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-shl7","title":"P2: Update ~30 outdated Go modules","description":"~30 modules behind current versions (go list -m -u all):\n- Notably grpc v1.67 → v1.83\n- protobuf v1.34 → v1.36\n\nNeed to:\n- Run go list -m -u all to get full list\n- Review each update for breaking changes\n- Run go get -u \u003cmodule\u003e for safe updates\n- Run go mod tidy\n- Verify all tests still pass\n- Commit updates in a single dependency update commit\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:14Z","created_by":"Sam Catlow","updated_at":"2026-08-28T13:42:14Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.7","title":"Architecture decision record: scheduling destination matrix entry in migration-decisions.md","description":"`migration-decisions.md` section 1 explicitly names scheduling among the largest unreviewed areas needing a destination matrix entry: 'every current package MUST receive one explicit disposition' includes the cron/scheduling capability.\n\nThe ticker engine `scheduling.Engine` is already in `internal/domain/scheduling` (decided by being built there). The remaining slices — store, runner/router, blueprints, lifecycle guard — need their target paths, dependencies, contracts, and deletion criteria recorded.","acceptance_criteria":"- Section 1 (or a new section row) lists each scheduling slice — store, runner/router, blueprints, lifecycle guard, config, composition, ticker — with its target path, dependencies to remove, contracts preserved, and migration prerequisites.\n- Names the existing `JobSource` / `Runner` / `Sink` / `Clock` interfaces as the contracts that bound the destination choices (so future maintainers see why no runner / store ended up under the engine package).\n- Marks the recording as approved-by-position (the maintainer approved this placement implicitly by accepting the engine PR) so it is not re-litigated.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:48Z","created_by":"Sam Catlow","updated_at":"2026-08-27T14:34:48Z","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.7","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:48Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.6","title":"Wire cron engine: app/archied composition, sink adapter, Start/Stop lifecycle","description":"Composition slice that connects the four siblings: instantiates the ticker engine in `internal/app/archied/` over the job store and the router, with the configured `EngineConfig` from the translator; registers it with the daemon's existing Start/Stop lifecycle (Start on boot, bounded-during Stop) and wires the events-bus sink so emitted `KindJobRun` / `KindJobError` events reach the bus subjects the rest of the system already listens on.\n\nThis is the last bead before the epic's acceptance scenario — daily-status-summary cron, persists across restarts, dangerous commands refused — is end-to-end runnable by a fresh operator.","acceptance_criteria":"- `engine.Start` called during daemon boot, with the configured interval.\n- `engine.Stop(ctx)` called during daemon shutdown, bounded by the same grace deadline the rest of the daemon uses (matches `taskrun`/workflow engine shutdown pattern).\n- `scheduling.Sink` adapts to the events bus emitter so dashboard / dashboard timeline surfaces running and failed jobs with the same `Kind`/`Detail`/`Data` shape the rest of the system uses.\n- With all four sibling slices landed, the parent epic acceptance ('a daily-status-summary cron job can be created, persists across restarts, dangerous commands are refused') is exercisable end-to-end.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:45Z","created_by":"Sam Catlow","updated_at":"2026-08-27T14:34:45Z","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:45Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:39Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.2","type":"blocks","created_at":"2026-08-27T14:35:41Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.4","type":"blocks","created_at":"2026-08-27T14:35:41Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.5","type":"blocks","created_at":"2026-08-27T14:35:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":4,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.5","title":"Cron configuration block: [scheduling] in config.example.toml with EngineConfig translation","description":"Operator input for the cron/scheduling slice: a `[scheduling]` block in `config.example.toml` (`interval`, `max_parallel`, `job_timeout`, `events_sink`) plus a translation layer in `internal/infrastructure/configuration` that produces the `scheduling.EngineConfig`.\n\nWithout this, the engine has no path from operator input to runtime. The translator is the bridge the wiring slice then hands to `internal/app/archied/`.","acceptance_criteria":"- `config.example.toml` shows a `[scheduling]` block with all four fields and their default behaviour on zero values (mirrors `scheduling.Default*` constants).\n- Configuration translator yields a fully-resolved `scheduling.EngineConfig` with documented defaults applied; negative values are validated and surface as a startup error, not a panic.\n- Sink plumbing produces a concrete `scheduling.Sink` from the events-bus emitter; absent sink leaves `Events` nil, which the engine already documents as a valid (unobservable) configuration.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:43Z","created_by":"Sam Catlow","updated_at":"2026-08-27T14:34:43Z","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.5","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:43Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.4","title":"Cron lifecycle guard: reject dangerous commands at job creation","description":"Slice 4 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). The epic's third acceptance criterion verbatim: 'Dangerous commands are rejected at creation time.'\n\nGuards both runners from the previous slice: ChatCourier (whose body could include shell-shaped payloads) and WorkflowTask (whose shell-step is a documented footgun). Rejection happens at job creation, not at tick time, so a refused job is visible in the store with a refusal reason and never reaches the ticker engine.","acceptance_criteria":"- Rejects job specs whose target body includes any of: `archied` restart, `systemctl`, `launchctl`, `pkill`, `mkfs`, `dd`, `shutdown`, `reboot`.\n- Rejection reason is recorded on the refused job and surfaced through the gateway / dashboard; the job is not written to the store.\n- One named rejection function both the CLI and gateway paths call, so adding a new dangerous token does not require touching every UI surface.\n- False positives are deliberate — the list over-broadens then narrows by operator feedback. Cost of accepting a dangerous command vastly exceeds the cost of a refused one.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:40Z","created_by":"Sam Catlow","updated_at":"2026-08-27T14:34:40Z","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.4","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:40Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.4","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:44Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.3","title":"Cron blueprints: parameterised templates with typed slots and form schemas","description":"Slice 3 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). The authoring surface: predefined templates with typed slots (time, enum, text, weekdays — each with their validators) that gate the gateway and CLI creation forms.\n\nDaily status summary is the headline blueprint. An author without a blueprint can still create a job directly, but the gateway form is the recommended surface for non-trivial jobs.","acceptance_criteria":"- A small registry of built-in blueprints (daily-status-summary at minimum; weekday-pickable and time-pickable are sufficient for headline coverage) exposed to gateway and CLI form renderers.\n- Typed slot definitions (`time`, `enum`, `text`, `weekdays`) with a generated form schema suitable for the gateway chat-form surface.\n- Template renderer fills slots from a validated values map; missing or wrong-typed slots reject the job at creation, not at next tick.\n- Adding a new blueprint is data, not code, and the gateway / CLI form reflect added blueprints without a rebuild.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:38Z","created_by":"Sam Catlow","updated_at":"2026-08-27T14:34:38Z","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.3","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:38Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.3","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.2","title":"Cron delivery runner + router: dispatch due jobs to chat/task targets","description":"Slice 2 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). Implements `scheduling.Runner` and the router that picks one runner per job kind.\n\nWithout this slice, the ticker engine has no work to dispatch. Concrete target types to ship: ChatCourier (sends a templated message through the existing channel-agnostic `channels.Channel` gateway, so the channel choice stays the operator's, not the cron's) and WorkflowTask (submits a `workintake` envelope so the existing task lifecycle owns scheduling, retries, gates, and PR opening).\n\nJob store is a hard prerequisite. Composition wiring and lifecycle guard block the wiring slice, not this one.","acceptance_criteria":"- At least two `Runner` implementations: `ChatCourier` (renders the job's templated body through the channel layer) and `WorkflowTask` (submits a `workintake` envelope carrying the cron identity and body so the existing workflow domain runs the rest).\n- A `Router` that maps `Job.Kind` to a Runner; an unrecognised kind emits `KindJobError` `phase=\"dispatch\"` and is otherwise a no-op — refused at the gate, not silently dropped.\n- Every Runner honours `ctx.Done()` so the engine's bounded shutdown actually drains in flight.\n- The epic's headline scenario ('daily status summary') is exercisable end-to-end through the ChatCourier runner with a hard-coded template; the blueprints slice replaces this with parameterisation.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:35Z","created_by":"Sam Catlow","updated_at":"2026-08-27T14:34:35Z","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.2","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:35Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.2","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:43Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.1","title":"Cron job store: per-profile JSON with cross-process file locking","description":"Slice 1 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). Implements the durable job store: one JSON file per profile at the conventional path, CRUD operations, and cross-process file locking so a CLI edit and a daemon writer don't corrupt each other.\n\nThe ticker engine (internal/domain/scheduling) consumes this through its `JobSource` interface. The store's only contract with the engine is `Due(ctx, now) -\u003e ([]Job, error)` — the engine applies no schedule arithmetic of its own, so the store owns cron expressions, fixed intervals, and catch-up windows.","acceptance_criteria":"- One JSON file at the conventional per-profile path (`\u003cconfig_dir\u003e/cron/jobs.json` or equivalent). Schema is durable and version-stamped for forward compatibility.\n- Create / read / update / delete by job ID with merge semantics that preserve fields not in the patch.\n- Cross-process file lock (`flock` or OS equivalent) makes concurrent CLI+daemon writers serial; last-writer-wins is documented as the conflict policy.\n- Implements `scheduling.JobSource` so the ticker engine can poll it without knowing the file layout or format.\n- A truncated/partial-write file is not a panic: open returns an explicit error the engine surfaces as `phase=\"source\" KindJobError` rather than crashing the loop.","status":"closed","priority":2,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:32Z","created_by":"Sam Catlow","updated_at":"2026-08-28T10:59:19Z","started_at":"2026-08-28T10:36:06Z","closed_at":"2026-08-28T10:59:19Z","close_reason":"Slice 1 of cron/scheduling epic landed: per-profile JSON store with cross-process flock, merge-semantic Update, version-stamped schema, ErrCorruptFile on truncated files, ErrUnsupportedSchema on forward versions. Implements scheduling.JobSource so the ticker engine can poll it without knowing the file layout. Adversarial review applied: deep-copy Get/List, pool validation in Create/Update, ErrScheduleUnsupported on Once MarkRun, 0o600 file mode, SetEscapeHTML(false) for operator-readable files, fsync before rename for durability, ErrClosed sentinel after Close, real cross-process flock test via os/exec. task check green.","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.1","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:32Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":4,"comment_count":0} +{"_type":"issue","id":"archie-core-r3gh","title":"Harden task origin response assertions","description":"Replace brittle prose substring assertions in internal/webui/api_tasks_origin_test.go with stable structural checks for HTTP error responses while preserving origin and media-type coverage.","acceptance_criteria":"The origin test does not assert human-readable response text; rejected cases verify stable HTTP error response structure; focused tests and task check pass.","status":"in_progress","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-31T12:49:20Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:05Z","started_at":"2026-08-31T12:49:27Z","lease_expires_at":"2026-08-31T12:54:27Z","heartbeat_at":"2026-08-31T12:49:27Z","external_ref":"https://github.com/samcharles93/archie-core/issues/664","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-h3w2","title":"Migrate email/webhook channels onto domain/messaging types","description":"Update remaining gateway-based channels (email, webhook) to use domain/messaging types, completing the migration described in migration-decisions.md section 2.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:16Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:06Z","external_ref":"https://github.com/samcharles93/archie-core/issues/665","labels":["messaging-migration"],"dependencies":[{"issue_id":"archie-core-h3w2","depends_on_id":"archie-core-d9dv","type":"blocks","created_at":"2026-08-31T10:12:24Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-o4e4","title":"Migrate web UI / dashboard chat onto domain/messaging types","description":"Update internal/webui/ chat handling (api_chat.go and friends) to use domain/messaging types once gateway session storage is migrated. Verify SSE streaming and chat history are unaffected.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:15Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:06Z","external_ref":"https://github.com/samcharles93/archie-core/issues/666","labels":["messaging-migration"],"dependencies":[{"issue_id":"archie-core-o4e4","depends_on_id":"archie-core-d9dv","type":"blocks","created_at":"2026-08-31T10:12:23Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-4hof","title":"Migrate Telegram channel onto domain/messaging types","description":"Once gateway session storage uses domain/messaging types, update internal/channels/telegram/ to read/write through them instead of internal/gateway.Message directly. Verify no behavior change in message history, branching, or tool-call rendering.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:13Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:07Z","external_ref":"https://github.com/samcharles93/archie-core/issues/667","labels":["messaging-migration"],"dependencies":[{"issue_id":"archie-core-4hof","depends_on_id":"archie-core-d9dv","type":"blocks","created_at":"2026-08-31T10:12:22Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-d9dv","title":"Migrate internal/gateway session storage onto domain/messaging types","description":"internal/domain/messaging now has the canonical Message/Conversation/ToolCall/ToolResult types (settled in migration-decisions.md section 2). internal/gateway/'s session storage still uses its own gateway.Message and ad hoc session state. Migrate gateway's session persistence to store/load domain/messaging.Message and Conversation, preserving exact current behavior (compression, approval, branch semantics unchanged).","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-31T10:12:12Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:08Z","external_ref":"https://github.com/samcharles93/archie-core/issues/668","labels":["messaging-migration"],"dependency_count":0,"dependent_count":3,"comment_count":0} +{"_type":"issue","id":"archie-core-ul1m","title":"P2: Track migration progress - 85% of internal/ not in domain structure","description":"~85% of internal/ packages (29 of 36) haven't moved into the target domain//infrastructure/ structure yet. This is expected mid-migration, but worth tracking.\n\nNeed to:\n- Create a migration tracking document or update existing one\n- List all packages and their target locations\n- Track progress as packages are migrated\n- Identify dependencies between migrations\n\nBlocked by: P0 domain package reconciliation (archie-core-2tqh)","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:26Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:09Z","external_ref":"https://github.com/samcharles93/archie-core/issues/669","dependencies":[{"issue_id":"archie-core-ul1m","depends_on_id":"archie-core-2tqh","type":"blocks","created_at":"2026-08-28T13:42:37Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-kllw","title":"P2: Pin Docker latest tag for archie-agent","description":"Docker latest tag on ghcr.io/samcharles93/archie-agent is unpinned, which hurts reproducibility.\n\nNeed to:\n- Identify current stable version/commit hash\n- Update docker-compose.yml or deployment configs to use pinned tag\n- Consider using SHA-based tags for production deployments\n- Document the pinning strategy\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:23Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:09Z","external_ref":"https://github.com/samcharles93/archie-core/issues/670","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-uyxk","title":"P2: Add lint/upgrade-deps Taskfile targets","description":"Dependency and lint maintenance is currently manual. There are no Taskfile targets for:\n- Running linters (golangci-lint)\n- Upgrading dependencies\n- Checking for outdated modules\n\nNeed to:\n- Add task lint target that runs golangci-lint\n- Add task deps:upgrade target for dependency updates\n- Add task deps:check target to list outdated modules\n- Ensure these integrate with existing task check flow\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:20Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:10Z","external_ref":"https://github.com/samcharles93/archie-core/issues/671","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-6xo8","title":"P2: CONTEXT.md describes unimplemented Remote Secret Input feature","description":"CONTEXT.md describes a full 'Remote Secret Input' feature (entry links, secret-input sessions, value-entry form) with zero implementation in internal/secret.\n\nThe feature appears designed but not built, and nothing flags it as aspirational.\n\nNeed to:\n- Audit CONTEXT.md for feature descriptions\n- Check internal/secret for any partial implementation\n- Either implement the feature or mark it as aspirational in docs\n- Add appropriate TODO/roadmap markers\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:17Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:11Z","external_ref":"https://github.com/samcharles93/archie-core/issues/672","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-shl7","title":"P2: Update ~30 outdated Go modules","description":"~30 modules behind current versions (go list -m -u all):\n- Notably grpc v1.67 → v1.83\n- protobuf v1.34 → v1.36\n\nNeed to:\n- Run go list -m -u all to get full list\n- Review each update for breaking changes\n- Run go get -u \u003cmodule\u003e for safe updates\n- Run go mod tidy\n- Verify all tests still pass\n- Commit updates in a single dependency update commit\n\nBlocked by: nothing","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:14Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:11Z","external_ref":"https://github.com/samcharles93/archie-core/issues/673","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.7","title":"Architecture decision record: scheduling destination matrix entry in migration-decisions.md","description":"`migration-decisions.md` section 1 explicitly names scheduling among the largest unreviewed areas needing a destination matrix entry: 'every current package MUST receive one explicit disposition' includes the cron/scheduling capability.\n\nThe ticker engine `scheduling.Engine` is already in `internal/domain/scheduling` (decided by being built there). The remaining slices — store, runner/router, blueprints, lifecycle guard — need their target paths, dependencies, contracts, and deletion criteria recorded.","acceptance_criteria":"- Section 1 (or a new section row) lists each scheduling slice — store, runner/router, blueprints, lifecycle guard, config, composition, ticker — with its target path, dependencies to remove, contracts preserved, and migration prerequisites.\n- Names the existing `JobSource` / `Runner` / `Sink` / `Clock` interfaces as the contracts that bound the destination choices (so future maintainers see why no runner / store ended up under the engine package).\n- Marks the recording as approved-by-position (the maintainer approved this placement implicitly by accepting the engine PR) so it is not re-litigated.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:48Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:12Z","external_ref":"https://github.com/samcharles93/archie-core/issues/674","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.7","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:48Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.6","title":"Wire cron engine: app/archied composition, sink adapter, Start/Stop lifecycle","description":"Composition slice that connects the four siblings: instantiates the ticker engine in `internal/app/archied/` over the job store and the router, with the configured `EngineConfig` from the translator; registers it with the daemon's existing Start/Stop lifecycle (Start on boot, bounded-during Stop) and wires the events-bus sink so emitted `KindJobRun` / `KindJobError` events reach the bus subjects the rest of the system already listens on.\n\nThis is the last bead before the epic's acceptance scenario — daily-status-summary cron, persists across restarts, dangerous commands refused — is end-to-end runnable by a fresh operator.","acceptance_criteria":"- `engine.Start` called during daemon boot, with the configured interval.\n- `engine.Stop(ctx)` called during daemon shutdown, bounded by the same grace deadline the rest of the daemon uses (matches `taskrun`/workflow engine shutdown pattern).\n- `scheduling.Sink` adapts to the events bus emitter so dashboard / dashboard timeline surfaces running and failed jobs with the same `Kind`/`Detail`/`Data` shape the rest of the system uses.\n- With all four sibling slices landed, the parent epic acceptance ('a daily-status-summary cron job can be created, persists across restarts, dangerous commands are refused') is exercisable end-to-end.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:45Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:13Z","external_ref":"https://github.com/samcharles93/archie-core/issues/675","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:45Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:39Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.2","type":"blocks","created_at":"2026-08-27T14:35:41Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.4","type":"blocks","created_at":"2026-08-27T14:35:41Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.6","depends_on_id":"archie-core-1786637496320-249-be6d9a20.5","type":"blocks","created_at":"2026-08-27T14:35:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":4,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.5","title":"Cron configuration block: [scheduling] in config.example.toml with EngineConfig translation","description":"Operator input for the cron/scheduling slice: a `[scheduling]` block in `config.example.toml` (`interval`, `max_parallel`, `job_timeout`, `events_sink`) plus a translation layer in `internal/infrastructure/configuration` that produces the `scheduling.EngineConfig`.\n\nWithout this, the engine has no path from operator input to runtime. The translator is the bridge the wiring slice then hands to `internal/app/archied/`.","acceptance_criteria":"- `config.example.toml` shows a `[scheduling]` block with all four fields and their default behaviour on zero values (mirrors `scheduling.Default*` constants).\n- Configuration translator yields a fully-resolved `scheduling.EngineConfig` with documented defaults applied; negative values are validated and surface as a startup error, not a panic.\n- Sink plumbing produces a concrete `scheduling.Sink` from the events-bus emitter; absent sink leaves `Events` nil, which the engine already documents as a valid (unobservable) configuration.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:43Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:13Z","external_ref":"https://github.com/samcharles93/archie-core/issues/676","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.5","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:43Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.4","title":"Cron lifecycle guard: reject dangerous commands at job creation","description":"Slice 4 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). The epic's third acceptance criterion verbatim: 'Dangerous commands are rejected at creation time.'\n\nGuards both runners from the previous slice: ChatCourier (whose body could include shell-shaped payloads) and WorkflowTask (whose shell-step is a documented footgun). Rejection happens at job creation, not at tick time, so a refused job is visible in the store with a refusal reason and never reaches the ticker engine.","acceptance_criteria":"- Rejects job specs whose target body includes any of: `archied` restart, `systemctl`, `launchctl`, `pkill`, `mkfs`, `dd`, `shutdown`, `reboot`.\n- Rejection reason is recorded on the refused job and surfaced through the gateway / dashboard; the job is not written to the store.\n- One named rejection function both the CLI and gateway paths call, so adding a new dangerous token does not require touching every UI surface.\n- False positives are deliberate — the list over-broadens then narrows by operator feedback. Cost of accepting a dangerous command vastly exceeds the cost of a refused one.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:40Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:14Z","external_ref":"https://github.com/samcharles93/archie-core/issues/677","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.4","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:40Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.4","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:44Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.3","title":"Cron blueprints: parameterised templates with typed slots and form schemas","description":"Slice 3 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). The authoring surface: predefined templates with typed slots (time, enum, text, weekdays — each with their validators) that gate the gateway and CLI creation forms.\n\nDaily status summary is the headline blueprint. An author without a blueprint can still create a job directly, but the gateway form is the recommended surface for non-trivial jobs.","acceptance_criteria":"- A small registry of built-in blueprints (daily-status-summary at minimum; weekday-pickable and time-pickable are sufficient for headline coverage) exposed to gateway and CLI form renderers.\n- Typed slot definitions (`time`, `enum`, `text`, `weekdays`) with a generated form schema suitable for the gateway chat-form surface.\n- Template renderer fills slots from a validated values map; missing or wrong-typed slots reject the job at creation, not at next tick.\n- Adding a new blueprint is data, not code, and the gateway / CLI form reflect added blueprints without a rebuild.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:38Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:15Z","external_ref":"https://github.com/samcharles93/archie-core/issues/678","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.3","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:38Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.3","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.2","title":"Cron delivery runner + router: dispatch due jobs to chat/task targets","description":"Slice 2 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). Implements `scheduling.Runner` and the router that picks one runner per job kind.\n\nWithout this slice, the ticker engine has no work to dispatch. Concrete target types to ship: ChatCourier (sends a templated message through the existing channel-agnostic `channels.Channel` gateway, so the channel choice stays the operator's, not the cron's) and WorkflowTask (submits a `workintake` envelope so the existing task lifecycle owns scheduling, retries, gates, and PR opening).\n\nJob store is a hard prerequisite. Composition wiring and lifecycle guard block the wiring slice, not this one.","acceptance_criteria":"- At least two `Runner` implementations: `ChatCourier` (renders the job's templated body through the channel layer) and `WorkflowTask` (submits a `workintake` envelope carrying the cron identity and body so the existing workflow domain runs the rest).\n- A `Router` that maps `Job.Kind` to a Runner; an unrecognised kind emits `KindJobError` `phase=\"dispatch\"` and is otherwise a no-op — refused at the gate, not silently dropped.\n- Every Runner honours `ctx.Done()` so the engine's bounded shutdown actually drains in flight.\n- The epic's headline scenario ('daily status summary') is exercisable end-to-end through the ChatCourier runner with a hard-coded template; the blueprints slice replaces this with parameterisation.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:35Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:16Z","external_ref":"https://github.com/samcharles93/archie-core/issues/679","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.2","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:35Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-1786637496320-249-be6d9a20.2","depends_on_id":"archie-core-1786637496320-249-be6d9a20.1","type":"blocks","created_at":"2026-08-27T14:35:43Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637496320-249-be6d9a20.1","title":"Cron job store: per-profile JSON with cross-process file locking","description":"Slice 1 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). Implements the durable job store: one JSON file per profile at the conventional path, CRUD operations, and cross-process file locking so a CLI edit and a daemon writer don't corrupt each other.\n\nThe ticker engine (internal/domain/scheduling) consumes this through its `JobSource` interface. The store's only contract with the engine is `Due(ctx, now) -\u003e ([]Job, error)` — the engine applies no schedule arithmetic of its own, so the store owns cron expressions, fixed intervals, and catch-up windows.","acceptance_criteria":"- One JSON file at the conventional per-profile path (`\u003cconfig_dir\u003e/cron/jobs.json` or equivalent). Schema is durable and version-stamped for forward compatibility.\n- Create / read / update / delete by job ID with merge semantics that preserve fields not in the patch.\n- Cross-process file lock (`flock` or OS equivalent) makes concurrent CLI+daemon writers serial; last-writer-wins is documented as the conflict policy.\n- Implements `scheduling.JobSource` so the ticker engine can poll it without knowing the file layout or format.\n- A truncated/partial-write file is not a panic: open returns an explicit error the engine surfaces as `phase=\"source\" KindJobError` rather than crashing the loop.","status":"closed","priority":2,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-27T14:34:32Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:49:17Z","started_at":"2026-08-28T10:36:06Z","closed_at":"2026-08-28T10:59:19Z","close_reason":"Slice 1 of cron/scheduling epic landed: per-profile JSON store with cross-process flock, merge-semantic Update, version-stamped schema, ErrCorruptFile on truncated files, ErrUnsupportedSchema on forward versions. Implements scheduling.JobSource so the ticker engine can poll it without knowing the file layout. Adversarial review applied: deep-copy Get/List, pool validation in Create/Update, ErrScheduleUnsupported on Once MarkRun, 0o600 file mode, SetEscapeHTML(false) for operator-readable files, fsync before rename for durability, ErrClosed sentinel after Close, real cross-process flock test via os/exec. task check green.","external_ref":"https://github.com/samcharles93/archie-core/issues/680","labels":["enhancement"],"dependencies":[{"issue_id":"archie-core-1786637496320-249-be6d9a20.1","depends_on_id":"archie-core-1786637496320-249-be6d9a20","type":"parent-child","created_at":"2026-08-27T14:34:32Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":4,"comment_count":0} {"_type":"issue","id":"archie-core-h019.8","title":"Operator-triggered PR review with selectable reviewer model","description":"Expose the reviewer as a channel-neutral application capability that can review an existing pull request on operator request. The Web UI should offer a Review PR action as one adapter; chat/Telegram and future channels must invoke the same command rather than duplicating review behavior. The operator can configure or select the reviewer model independently from planner/builder models. Reuse the reviewer epic's fresh-context, read-only snapshot, structured findings, calibration, and visibility contracts.","acceptance_criteria":"A channel-neutral review command accepts a repository and PR identity, launches the approved isolated reviewer path, and returns/persists structured findings; Web UI exposes Review PR; at least one non-Web-UI channel can invoke the same command; reviewer model is configurable independently with a safe default; authorization and duplicate/concurrent review behavior are deterministic; findings and review status are visible without requiring raw logs.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-08-24T18:08:58Z","created_by":"Sam Catlow","updated_at":"2026-08-24T18:09:03Z","external_ref":"https://github.com/samcharles93/archie-core/issues/636","dependencies":[{"issue_id":"archie-core-h019.8","depends_on_id":"archie-core-h019","type":"parent-child","created_at":"2026-08-24T18:08:58Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-atv2","title":"liveReply fallback lines appended after finalize are never rendered","description":"A media delivery that fails AFTER doFinalize has run appends its fallback line to l.toolLines and calls requestRender(), but stopRendering() has already closed renderDone and the renderer goroutine has exited. requestRender is a non-blocking send into a cap-1 channel with no consumer, so the line is dropped and the finalized Telegram message stands unchanged.\n\nMedia is fire-and-forget with a 30s budget while the turn's text finishes far earlier, so this is the NORMAL case for a large upload: a 40MB document that 400s or times out reports 'could not send x' into a slice nothing reads. Pre-dates the local-file work (URL fallbacks have the same hole) but archie-core-absb's guarantee that non-delivery is always visible depends on it.\n\nFound by adversarial review of 9a45fbb. internal/channels/telegram/live.go:419-437 with :498-532.\n\n## Acceptance Criteria\nA media failure occurring after the live reply has finalized still reaches the user -- e.g. as its own follow-up message rather than an edit to a message nothing re-renders. Covered by a test that finalizes first and fails the send second.","status":"closed","priority":2,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-24T15:54:42Z","created_by":"Sam Catlow","updated_at":"2026-09-01T15:18:56Z","closed_at":"2026-09-01T15:18:56Z","close_reason":"Fixed: stopRendering now marks the reply finalized, and appendFallbackLine sends a standalone follow-up message instead of writing into a dead render buffer. Covered by TestLiveReplyMediaFallbackAfterFinalizeSendsFollowUp.","external_ref":"https://github.com/samcharles93/archie-core/issues/646","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-h3lg","title":"Dashboard swallows failed operator actions, showing nothing in the UI","description":"When an operator action fails, the dashboard surfaces nothing. Pressing Stop on a running task issued POST /api/tasks/3/action, received 403, and the only evidence anywhere was a browser console line: \"Failed to load resource: the server responded with a status of 403\". The page itself showed no error, no toast, no change of state -- the button simply appeared to do nothing.\n\nThis is how archie-core-440c (every dashboard mutation 403s behind a TLS-terminating reverse proxy) went unnoticed: the operator pressed Stop, saw nothing happen, and reasonably concluded the task was unstoppable rather than that the request had been refused. The bug was only found by opening devtools.\n\nConfirmed live 2026-08-25 while signed in to the production dashboard.\n\n## Why this is its own bead\n\n440c fixes the 403. This bead fixes the fact that ANY failed action is invisible -- a 500, a store failure, a refused state transition, an expired session -- and each of those has its own way of going wrong. Fixing only 440c leaves the next failure equally silent.\n\nNote internal/webui/api_tasks.go already returns distinguishable, human-readable failures (\"missing CSRF header\", \"cross-origin mutation refused\", \"runtime task control is unavailable\"). The server side is doing its job; the client discards it.\n\n## What is needed\n\n- A failed action tells the operator it failed, in the UI, with the server's reason where one is given.\n- The distinction that matters most: refused (403, bad state, not permitted) versus broken (5xx, network). The operator's next move differs -- the first is \"you cannot do that\", the second is \"try again or check the daemon\".\n- A 401 or an expired forward-auth session should prompt re-authentication rather than reading as a generic failure, since the deployment sits behind Authelia.\n- The optimistic UI must not show an action as applied when it was refused.\n\nPer CLAUDE.md the frontend is one folder per feature under ui/src/\u003cfeature\u003e with shared primitives in ui/src/base -- error surfacing used by more than one feature belongs in base, extracted on the SECOND real consumer, not in anticipation. Remember ui/dist is committed: run `task ui` and commit the rebuilt output in the same change.\n\n## Steps to Reproduce\n\n1. Load the dashboard in a deployment where mutations fail (any 440c-affected proxied deployment reproduces it directly).\n2. Press Stop, Retry, Abandon or Archive on a task.\n3. Observe the request fails in devtools while the page reports nothing.\n\n## Acceptance Criteria\n\nA failed operator action is reported in the dashboard with the server's reason where supplied; refused and broken failures are distinguishable to the operator; an authentication failure prompts re-auth rather than a generic error; no optimistic state change survives a failed request; dashboard tests cover a refused action, a server error and a network failure; ui/dist is rebuilt and committed.\n","status":"open","priority":2,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-24T15:49:18Z","created_by":"Sam Catlow","updated_at":"2026-08-24T15:50:15Z","external_ref":"https://github.com/samcharles93/archie-core/issues/629","dependency_count":0,"dependent_count":0,"comment_count":0} @@ -154,13 +154,13 @@ {"_type":"issue","id":"archie-core-1786748942566-19-aa1c4552","title":"Telegram: response formatting concatenates URLs with following text","description":"## Problem\n\nTelegram responses can concatenate a bare URL with the sentence that follows it, which breaks the clickable/direct link and makes the message look malformed.\n\nThis has occurred at least twice. Example:\n\n```text\nhttps://github.com/samcharles93/archie-core/issues/513It includes model-independent safeguards...\n```\n\nThe expected output is:\n\n```text\nhttps://github.com/samcharles93/archie-core/issues/513\n\nIt includes model-independent safeguards...\n```\n\n## Desired behavior\n\n- Preserve paragraph/newline boundaries between links and subsequent text.\n- Ensure a bare URL remains independently clickable in Telegram.\n- Do not concatenate separately streamed/rendered response segments.\n- Apply the fix consistently whether the response is sent once, edited while streaming, or split into multiple Telegram messages.\n\n## Acceptance criteria\n\n- A URL followed by prose is rendered with at least one newline separating them.\n- Bare GitHub issue URLs remain clickable and contain no trailing prose.\n- Regression coverage includes the exact example above.\n- Coverage exercises the relevant Telegram streaming/editing and message-splitting paths.\n","status":"closed","priority":2,"issue_type":"bug","assignee":"samcharles93","created_at":"2026-08-14T22:21:58Z","updated_at":"2026-08-15T13:04:30Z","closed_at":"2026-08-15T13:04:30Z","close_reason":"Fixed Telegram URL/prose boundary normalization across one-shot, live, and split delivery paths; added Markdown/code safety, newline preservation, and regression coverage.","external_ref":"https://github.com/samcharles93/archie-core/issues/514","source_system":"github:https://github.com/samcharles93/archie-core/issues/514:514","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786748942540-18-9af78536","title":"Agent falsely claims GitHub issue creation succeeded without verification","description":"## Problem\n\nDuring a Telegram chat using `deepseek/deepseek-v4-pro`, the agent stated that it had created GitHub issue #512 and supplied a URL even though no issue had been created. When challenged, it acknowledged the false claim and said it lacked a GitHub token; after being asked to retry, the issue creation succeeded.\n\nThis is a serious trust and UX problem: users must be able to rely on claims about external side effects such as creating issues, pushing branches, opening PRs, deploying, or restarting services.\n\n## Expected behavior\n\n- Never report an external action as successful unless the corresponding tool/plugin call completed successfully and returned verifiable output.\n- Include the issue number and URL from the forge response, not values inferred or fabricated by the model.\n- If the tool is unavailable or fails, report the actual failure clearly.\n- Allow a retry when the capability may be temporarily unavailable.\n\n## Suggested safeguards\n\n- Require successful structured tool results before permitting success language for side-effecting actions.\n- Track pending/completed/failed action state in the turn runner.\n- Add a postcondition check for issue creation, such as validating the returned issue ID/URL.\n- Add regression tests using a model response that falsely claims an issue was created without invoking the forge tool.\n- Consider a gateway warning or telemetry event when a final response claims an unverified side effect.\n\n## Reproduction\n\n1. Ask the agent to create an issue.\n2. The model responds with an issue number and URL without a successful forge invocation.\n3. Check GitHub and observe that the issue does not exist.\n\n## Context\n\nObserved with `deepseek/deepseek-v4-pro` through the Telegram gateway. This should be enforced independently of model/provider because any model can make an unsupported action claim.\n\n## Frequency\n\nThis has been observed twice in the same conversation, so it is a recurring failure rather than a one-off hallucination. Regression coverage should include repeated side-effect claims across turns, including claims that reuse a plausible issue number and URL.\n","status":"closed","priority":2,"issue_type":"task","created_at":"2026-08-14T22:16:46Z","updated_at":"2026-08-24T07:12:10Z","closed_at":"2026-08-24T07:12:10Z","close_reason":"Deprioritized: prompt-level fix landed in fba80e3 (archie-core-3jag/GH#524) covers the general overconfidence pattern. Not worth mechanical enforcement (postcondition checks, tool-result verification) unless this recurs — revisit with stronger prompting first if it does. [Closure restored 2026-08-24: originally closed 2026-08-23, lost when the beads DB was rebuilt (.beads.backup-pre-recovery).]","external_ref":"https://github.com/samcharles93/archie-core/issues/513","source_system":"github:https://github.com/samcharles93/archie-core/issues/513:513","metadata":null,"dependencies":[{"issue_id":"archie-core-1786748942540-18-9af78536","depends_on_id":"archie-core-3jag","type":"related","created_at":"2026-08-15T12:59:09Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786748942519-17-5999d55b","title":"Polish the /status command response","description":"## Problem\n\nThe `/status` command response is functional but lacks polish and is difficult to scan. The current output looks like:\n\n```text\nTask status: parked:2\nProvider: deepseek Model: deepseek/deepseek-v4-pro\n```\n\nThe information is compressed into raw key/value text, and task state, provider, and model details are not clearly separated.\n\n## Desired behaviour\n\nPresent status information in a compact, polished, mobile-friendly format suitable for Telegram. It should make the most important state immediately obvious and visually separate task and runtime/model information.\n\nFor example:\n\n```text\n📊 Archie status\n\nTasks\n⏸ Parked:2\n\nRuntime\nProvider: OpenAI\nModel: openai/gpt-5.6-luna\n```\n\nThe exact wording and icons can follow existing Telegram UI conventions.\n\n## Acceptance criteria\n\n- `/status` has a clear heading and grouped sections.\n- Task states are shown on separate, readable lines.\n- Provider and model are clearly separated.\n- The response remains concise and readable on mobile.\n- Empty and unavailable values have a graceful fallback.\n- Tests cover the formatted response, including multiple task states and missing runtime details.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","created_at":"2026-08-14T22:14:58Z","updated_at":"2026-08-15T12:41:34Z","started_at":"2026-08-15T12:33:21Z","closed_at":"2026-08-15T12:41:34Z","close_reason":"Closed","external_ref":"https://github.com/samcharles93/archie-core/issues/512","source_system":"github:https://github.com/samcharles93/archie-core/issues/512:512","metadata":null,"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786748942272-7-2ad59e97","title":"Add end-to-end image generation test matrix and operational safeguards","description":"## Scope\nBuild the cross-cutting test and verification layer for the image capability. Exercise the clarification flow, hosted fake provider, local fake backend, real local recipe smoke test where available, delivery, and failure paths.\n\nAdd safeguards for cost, resource use, prompt/input limits, concurrency, cancellation, and observability consistent with Archie''s existing operational style.\n\n## Acceptance criteria\n- Automated tests cover both mechanisms, generation and editing, routing, provider failures, delivery failures, cancellation, and cleanup.\n- Tests assert no provider call occurs before mechanism clarification.\n- Resource and input/output limits are enforced in code and tested.\n- A documented local smoke command verifies at least one GPU recipe without requiring hosted credentials.\n- The normal project gate passes, and the epic's acceptance criteria can be verified from real command output.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:45Z","updated_at":"2026-08-14T21:55:45Z","external_ref":"https://github.com/samcharles93/archie-core/issues/503","source_system":"github:https://github.com/samcharles93/archie-core/issues/503:503","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786748942296-8-260e931d","title":"Write image capability documentation and agent assistance examples","description":"## Scope\nDocument the user-facing `/image` flow, hosted-provider setup, local GPU setup, supported model/backend recipes, troubleshooting, resource requirements, and security/cost implications.\n\nProvide concise code/config examples an agent can use to help users call both hosted and local paths. Examples must show how to inspect hardware/backend availability, choose a tested model, submit a generation/edit request, and collect the resulting image.\n\n## Acceptance criteria\n- Documentation explicitly says mechanism selection happens first by default.\n- Hosted API baseline fields and provider deviations are documented.\n- Every local model recipe names its tested backend/version, model source, VRAM/RAM expectations, supported sizes/operations, and failure modes.\n- Examples are runnable or tested in CI with mocked services; no secrets or huge weights are included.\n- Docs distinguish tested support from illustrative/untested possibilities.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:45Z","updated_at":"2026-08-14T21:55:45Z","external_ref":"https://github.com/samcharles93/archie-core/issues/502","source_system":"github:https://github.com/samcharles93/archie-core/issues/502:502","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786748942243-6-f109697e","title":"Deliver generated images through channel and web abstractions","description":"## Scope\nExtend the existing message/result delivery abstraction so generated images can reach users safely through supported channels and the web UI. Preserve useful metadata such as prompt/provider/model and errors without exposing credentials or internal filesystem paths.\n\nUse bounded temporary storage/cleanup and a clear policy for formats, dimensions, compression, and maximum response size. Ensure a failed upload does not leave the user with a success-looking text response.\n\n## Acceptance criteria\n- A provider result can be delivered as an image through each currently supported delivery path, or unsupported paths report a clear limitation.\n- Temporary files and downloaded inputs have bounded size and deterministic cleanup.\n- MIME/format handling, alt text/caption, and metadata are tested.\n- Delivery failures, retries/cancellation, and partial-success behavior are tested.\n- Existing text and file delivery behavior remains unchanged.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:44Z","updated_at":"2026-08-14T21:55:44Z","external_ref":"https://github.com/samcharles93/archie-core/issues/501","source_system":"github:https://github.com/samcharles93/archie-core/issues/501:501","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786748942193-4-5072b564","title":"Implement /image mechanism clarification and routing flow","description":"## Scope\nMake the default `/image` workflow ask the user for their preferred generation mechanism before running a request when no mechanism is already selected: hosted API or local GPU. Present the choices and relevant constraints concisely, then collect only the options needed for the selected mechanism.\n\nSupport an explicit per-request override and a clearly scoped remembered preference only where existing session/config conventions support it. Never silently fall back from hosted to local or local to hosted.\n\n## Acceptance criteria\n- `/image` with no mechanism produces a clarification prompt and does not invoke a provider.\n- Hosted and local selections route to the correct provider with the selected options.\n- The flow supports generation and edit requests, including input-image validation.\n- Invalid choices, missing credentials, unavailable GPU backends, and cancellation produce actionable replies.\n- Channel-neutral tests cover the state machine; Telegram/web behavior is covered at the adapter boundary where applicable.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:43Z","updated_at":"2026-08-14T21:55:43Z","external_ref":"https://github.com/samcharles93/archie-core/issues/500","source_system":"github:https://github.com/samcharles93/archie-core/issues/500:500","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786748942219-5-9844a72e","title":"Add local GPU image generation backend and tested model recipes","description":"## Scope\nAdd a local GPU path that can execute image generation on an existing user GPU through a supported local backend/API. Prefer integration with an established server/workflow interface over embedding model runtimes or downloading weights from Archie.\n\nShip a tested initial recipe set for common models appropriate to consumer GPUs, with the exact model files, backend versions, VRAM/RAM expectations, supported operations, and known limitations recorded. Include runnable code/config examples that Archie can use to assist a user in setting up and calling the backend.\n\nThe implementation must report unavailable hardware/backend/model conditions clearly and must not pretend an untested model is supported.\n\n## Acceptance criteria\n- At least one local GPU recipe is exercised end-to-end on real hardware or a reproducible maintained test harness.\n- Additional recipes are included only with evidence, covering model/backend/version, VRAM, image sizes, and speed/quality trade-offs.\n- Backend URL/auth/timeout and model selection are configurable.\n- Local generation returns the same provider-neutral result shape as hosted generation.\n- Tests cover backend unavailable, malformed response, timeout, cancellation, and model-not-found paths.\n- No model weights are committed or downloaded into the repository/home partition.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:43Z","updated_at":"2026-08-14T21:55:43Z","external_ref":"https://github.com/samcharles93/archie-core/issues/499","source_system":"github:https://github.com/samcharles93/archie-core/issues/499:499","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786748942169-3-ae7cfaea","title":"Implement hosted gpt-image-2-compatible image provider","description":"## Scope\nImplement the hosted image provider behind the image capability contract, targeting the practical baseline of the OpenAI `gpt-image-2` API.\n\nCover text-to-image and image editing where supported by the API, prompt and image inputs, size/quality/background/output-format/compression-style options exposed by the baseline, response decoding, and provider error mapping. Do not claim unsupported parity: document exact API version/endpoint assumptions and any deliberate differences.\n\n## Acceptance criteria\n- Uses the existing HTTP/auth/configuration patterns rather than a one-off client.\n- Request serialization and response decoding are covered with httptest fixtures.\n- Provider failures, malformed responses, timeouts, oversized inputs, and cancellation are handled without panics or leaked secrets.\n- No live API key is needed for tests.\n- A small runnable example shows the request shape and configuration.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:42Z","updated_at":"2026-08-14T21:55:42Z","external_ref":"https://github.com/samcharles93/archie-core/issues/498","source_system":"github:https://github.com/samcharles93/archie-core/issues/498:498","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786748942147-2-47cd5bd1","title":"Define provider-neutral image capability contract and configuration","description":"## Scope\nDefine the internal image-generation capability boundary used by hosted and local providers. Keep it narrow and provider-neutral: generation, editing with input images, prompt/options, output metadata, cancellation/timeouts, and capability discovery.\n\nAdd configuration and provider selection that fit the existing model/provider conventions. A missing credential or unavailable backend must make the capability unavailable with a useful user-facing error, not prevent Archie from starting or break text chat.\n\n## Acceptance criteria\n- Typed request/result/options contract covers the agreed gpt-image-2 baseline without baking in OpenAI types.\n- Provider registry/resolution and capability discovery are testable with fakes.\n- Hosted vs local selection is explicit and cannot silently incur cost.\n- Timeouts, maximum input/output sizes, cancellation, and error taxonomy are defined and tested.\n- Configuration validation rejects unsafe/ambiguous settings and preserves existing config behavior.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:41Z","updated_at":"2026-08-14T21:55:41Z","external_ref":"https://github.com/samcharles93/archie-core/issues/497","source_system":"github:https://github.com/samcharles93/archie-core/issues/497:497","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786748942272-7-2ad59e97","title":"Add end-to-end image generation test matrix and operational safeguards","description":"## Scope\nBuild the cross-cutting test and verification layer for the image capability. Exercise the clarification flow, hosted fake provider, local fake backend, real local recipe smoke test where available, delivery, and failure paths.\n\nAdd safeguards for cost, resource use, prompt/input limits, concurrency, cancellation, and observability consistent with Archie''s existing operational style.\n\n## Acceptance criteria\n- Automated tests cover both mechanisms, generation and editing, routing, provider failures, delivery failures, cancellation, and cleanup.\n- Tests assert no provider call occurs before mechanism clarification.\n- Resource and input/output limits are enforced in code and tested.\n- A documented local smoke command verifies at least one GPU recipe without requiring hosted credentials.\n- The normal project gate passes, and the epic's acceptance criteria can be verified from real command output.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:45Z","updated_at":"2026-08-14T21:55:45Z","external_ref":"https://github.com/samcharles93/archie-core/issues/503","source_system":"github:https://github.com/samcharles93/archie-core/issues/503:503","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942272-7-2ad59e97","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:19Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786748942296-8-260e931d","title":"Write image capability documentation and agent assistance examples","description":"## Scope\nDocument the user-facing `/image` flow, hosted-provider setup, local GPU setup, supported model/backend recipes, troubleshooting, resource requirements, and security/cost implications.\n\nProvide concise code/config examples an agent can use to help users call both hosted and local paths. Examples must show how to inspect hardware/backend availability, choose a tested model, submit a generation/edit request, and collect the resulting image.\n\n## Acceptance criteria\n- Documentation explicitly says mechanism selection happens first by default.\n- Hosted API baseline fields and provider deviations are documented.\n- Every local model recipe names its tested backend/version, model source, VRAM/RAM expectations, supported sizes/operations, and failure modes.\n- Examples are runnable or tested in CI with mocked services; no secrets or huge weights are included.\n- Docs distinguish tested support from illustrative/untested possibilities.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:45Z","updated_at":"2026-08-14T21:55:45Z","external_ref":"https://github.com/samcharles93/archie-core/issues/502","source_system":"github:https://github.com/samcharles93/archie-core/issues/502:502","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942296-8-260e931d","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:20Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786748942243-6-f109697e","title":"Deliver generated images through channel and web abstractions","description":"## Scope\nExtend the existing message/result delivery abstraction so generated images can reach users safely through supported channels and the web UI. Preserve useful metadata such as prompt/provider/model and errors without exposing credentials or internal filesystem paths.\n\nUse bounded temporary storage/cleanup and a clear policy for formats, dimensions, compression, and maximum response size. Ensure a failed upload does not leave the user with a success-looking text response.\n\n## Acceptance criteria\n- A provider result can be delivered as an image through each currently supported delivery path, or unsupported paths report a clear limitation.\n- Temporary files and downloaded inputs have bounded size and deterministic cleanup.\n- MIME/format handling, alt text/caption, and metadata are tested.\n- Delivery failures, retries/cancellation, and partial-success behavior are tested.\n- Existing text and file delivery behavior remains unchanged.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:44Z","updated_at":"2026-08-14T21:55:44Z","external_ref":"https://github.com/samcharles93/archie-core/issues/501","source_system":"github:https://github.com/samcharles93/archie-core/issues/501:501","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942243-6-f109697e","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:19Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786748942193-4-5072b564","title":"Implement /image mechanism clarification and routing flow","description":"## Scope\nMake the default `/image` workflow ask the user for their preferred generation mechanism before running a request when no mechanism is already selected: hosted API or local GPU. Present the choices and relevant constraints concisely, then collect only the options needed for the selected mechanism.\n\nSupport an explicit per-request override and a clearly scoped remembered preference only where existing session/config conventions support it. Never silently fall back from hosted to local or local to hosted.\n\n## Acceptance criteria\n- `/image` with no mechanism produces a clarification prompt and does not invoke a provider.\n- Hosted and local selections route to the correct provider with the selected options.\n- The flow supports generation and edit requests, including input-image validation.\n- Invalid choices, missing credentials, unavailable GPU backends, and cancellation produce actionable replies.\n- Channel-neutral tests cover the state machine; Telegram/web behavior is covered at the adapter boundary where applicable.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:43Z","updated_at":"2026-08-14T21:55:43Z","external_ref":"https://github.com/samcharles93/archie-core/issues/500","source_system":"github:https://github.com/samcharles93/archie-core/issues/500:500","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942193-4-5072b564","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:18Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786748942219-5-9844a72e","title":"Add local GPU image generation backend and tested model recipes","description":"## Scope\nAdd a local GPU path that can execute image generation on an existing user GPU through a supported local backend/API. Prefer integration with an established server/workflow interface over embedding model runtimes or downloading weights from Archie.\n\nShip a tested initial recipe set for common models appropriate to consumer GPUs, with the exact model files, backend versions, VRAM/RAM expectations, supported operations, and known limitations recorded. Include runnable code/config examples that Archie can use to assist a user in setting up and calling the backend.\n\nThe implementation must report unavailable hardware/backend/model conditions clearly and must not pretend an untested model is supported.\n\n## Acceptance criteria\n- At least one local GPU recipe is exercised end-to-end on real hardware or a reproducible maintained test harness.\n- Additional recipes are included only with evidence, covering model/backend/version, VRAM, image sizes, and speed/quality trade-offs.\n- Backend URL/auth/timeout and model selection are configurable.\n- Local generation returns the same provider-neutral result shape as hosted generation.\n- Tests cover backend unavailable, malformed response, timeout, cancellation, and model-not-found paths.\n- No model weights are committed or downloaded into the repository/home partition.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:43Z","updated_at":"2026-08-14T21:55:43Z","external_ref":"https://github.com/samcharles93/archie-core/issues/499","source_system":"github:https://github.com/samcharles93/archie-core/issues/499:499","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942219-5-9844a72e","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:18Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786748942169-3-ae7cfaea","title":"Implement hosted gpt-image-2-compatible image provider","description":"## Scope\nImplement the hosted image provider behind the image capability contract, targeting the practical baseline of the OpenAI `gpt-image-2` API.\n\nCover text-to-image and image editing where supported by the API, prompt and image inputs, size/quality/background/output-format/compression-style options exposed by the baseline, response decoding, and provider error mapping. Do not claim unsupported parity: document exact API version/endpoint assumptions and any deliberate differences.\n\n## Acceptance criteria\n- Uses the existing HTTP/auth/configuration patterns rather than a one-off client.\n- Request serialization and response decoding are covered with httptest fixtures.\n- Provider failures, malformed responses, timeouts, oversized inputs, and cancellation are handled without panics or leaked secrets.\n- No live API key is needed for tests.\n- A small runnable example shows the request shape and configuration.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:42Z","updated_at":"2026-08-14T21:55:42Z","external_ref":"https://github.com/samcharles93/archie-core/issues/498","source_system":"github:https://github.com/samcharles93/archie-core/issues/498:498","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942169-3-ae7cfaea","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:17Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786748942147-2-47cd5bd1","title":"Define provider-neutral image capability contract and configuration","description":"## Scope\nDefine the internal image-generation capability boundary used by hosted and local providers. Keep it narrow and provider-neutral: generation, editing with input images, prompt/options, output metadata, cancellation/timeouts, and capability discovery.\n\nAdd configuration and provider selection that fit the existing model/provider conventions. A missing credential or unavailable backend must make the capability unavailable with a useful user-facing error, not prevent Archie from starting or break text chat.\n\n## Acceptance criteria\n- Typed request/result/options contract covers the agreed gpt-image-2 baseline without baking in OpenAI types.\n- Provider registry/resolution and capability discovery are testable with fakes.\n- Hosted vs local selection is explicit and cannot silently incur cost.\n- Timeouts, maximum input/output sizes, cancellation, and error taxonomy are defined and tested.\n- Configuration validation rejects unsafe/ambiguous settings and preserves existing config behavior.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","created_at":"2026-08-14T21:55:41Z","updated_at":"2026-09-02T10:20:48Z","started_at":"2026-09-02T10:17:22Z","closed_at":"2026-09-02T10:20:48Z","close_reason":"Shipped docs/prds/image-capability-contract.md plus internal/domain/image (Provider contract, Registry — no Lifecycle, provider is call-scoped) and config.ImageConfig/validateImage. Provider-neutral, tested with fakes, hosted+local both gated by explicit enabled=true. Also linked all 7 orphaned epic children (found unlinked again, same pattern as the curator/memory epics).","external_ref":"https://github.com/samcharles93/archie-core/issues/497","source_system":"github:https://github.com/samcharles93/archie-core/issues/497:497","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942147-2-47cd5bd1","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:16Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786748942120-1-6636e629","title":"[EPIC] Image generation capability: hosted API baseline plus local GPU workflows","description":"## Goal\nAdd first-class image generation to Archie, with a capability surface targeting the practical baseline of the OpenAI `gpt-image-2` API while also supporting image generation on a user's existing GPU.\n\nThe capability must not assume one backend. A user asking for `/image` is first asked which generation mechanism they prefer:\n- hosted API (starting with an OpenAI-compatible `gpt-image-2` provider), or\n- local GPU generation using one of Archie's tested model/backend recipes.\n\n## Scope\n- A provider-neutral image capability contract and routing/configuration.\n- Hosted generation/editing with an OpenAI `gpt-image-2`-class API baseline.\n- Local GPU generation through tested, documented model/backend recipes suitable for common consumer GPUs.\n- `/image` clarification and execution flow across supported channels.\n- Returned image delivery, bounded inputs/outputs, errors, and tests.\n\n## Non-goals\n- Training or fine-tuning image models.\n- Bundling multi-gigabyte model weights in Archie.\n- Pretending every GPU/model combination is supported; local support must be explicit and evidence-backed.\n- Replacing the existing text-chat capability or silently selecting a paid hosted provider.\n\n## Definition of done\n- `/image` asks for the preferred mechanism before generation when no mechanism is already selected for the request/session.\n- Hosted generation and editing cover the documented gpt-image-2 baseline, with provider-specific differences exposed rather than hidden.\n- Local GPU generation works end-to-end with at least one tested recipe, and additional tested common models are documented with VRAM/backend requirements and runnable examples.\n- Images can be delivered through the existing channel abstractions without leaking temporary files or unbounded data.\n- Unit, integration, and failure-path tests cover routing, provider errors, clarification, local execution, and delivery.\n- Configuration, security, and operational documentation are complete.\n\nSubtasks below are dependency-ordered where practical; each must link back to this epic and state any deliberate deviations from the hosted API baseline.","status":"open","priority":2,"issue_type":"epic","created_at":"2026-08-14T21:55:40Z","updated_at":"2026-08-14T21:55:40Z","external_ref":"https://github.com/samcharles93/archie-core/issues/496","source_system":"github:https://github.com/samcharles93/archie-core/issues/496:496","metadata":null,"labels":["epic"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-hlxd","title":"telegram: a tool-use turn ending with no answer posts the tool line alone as the finished message","description":"finalText returns the tool block alone when the reply is empty, and finalize sends it as the authoritative finished message — content == '' is the only silence path, so an empty-reply turn with completed tools permanently delivers '🔧 shell — exit 0' with no answer. The old path guarded 'if reply != \"\"'. Telegram messages are immutable, so it can never be corrected. Gated on show_tool_calls (off by default), so it bites opt-in deployments. No test covers finalize with an empty reply and tools.\n\nFailure: the model ends a tool-use loop without a final summary (empty ResponseText); the finished message shows only the tool line, looking like a completed answer that said nothing.","design":"When the reply is empty, do not post the tool block as the answer — either skip the final send (leave the cursor-cleaned live message) or emit an explicit 'no reply' marker. Add a test for finalize(empty, tools).","acceptance_criteria":"A turn that ends with tools but no answer text does not post a bare tool line as the final message.","status":"closed","priority":2,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-14T14:43:38Z","created_by":"Sam Catlow","updated_at":"2026-08-14T15:25:44Z","started_at":"2026-08-14T15:07:52Z","closed_at":"2026-08-14T15:25:44Z","close_reason":"Fixed in internal/channels/telegram/live.go: framedText keeps tool lines whole ahead of the clamped answer tail (fixes wpq6); finalText appends a '(no response)' marker when tools ran but the reply is empty (fixes hlxd); abandonFailed marks a provider-error partial distinctly from a clean /stop abandon (fixes c3w2). Regression tests verified red-then-green; adversarial review found no blocking issues (added one more test for the degenerate oversized-tool-block case it flagged). task check clean, committed as 587b9b9.","external_ref":"https://github.com/samcharles93/archie-core/issues/486","labels":["code-review","streaming","telegram"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-og5r","title":"webui: the dashboard narrates tool calls with no opt-out; show_tool_calls only gates Telegram","description":"show_tool_calls gates only the Telegram adapter. The web dashboard's chatStreamSink forwards every ToolCallEvent unconditionally (api_chat.go:228) — no config key exists anywhere in webui — so an operator following the documented intent (show_tool_calls off means no tool narration) still gets full per-tool narration in the web dashboard with no way to disable it. The ToolCallEvent contract comment (stream.go:18-20) delegates 'whether to show it at all' to the channel adapter, but only the Telegram adapter exercises the knob.\n\nFailure: an operator with the default show_tool_calls=false opens the web dashboard; every internal tool step of every web chat is narrated in full, exposing tool inventory and parameter shapes to anyone with dashboard access.","design":"Either add a webui-equivalent config key and gate the sink on it, or make show_tool_calls a cross-channel setting. Decide and document the intent, then wire the webui sink to honor it.","acceptance_criteria":"With the setting off, the web dashboard does not emit tool frames; with it on, it does — controlled by one documented knob.","status":"closed","priority":2,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-14T14:43:37Z","created_by":"Sam Catlow","updated_at":"2026-08-14T15:57:11Z","started_at":"2026-08-14T15:50:15Z","closed_at":"2026-08-14T15:57:11Z","close_reason":"Fixed: ShowToolCalls moved from TelegramConfig to ChatConfig (one cross-channel setting), webui's chatStreamSink gated on it (off by default, matching Telegram). Adversarial review clean aside from cosmetic/doc notes, both addressed. Breaking config-key move flagged explicitly in the commit body since it's a silent TOML drop, not an error. Committed f7590a6.","external_ref":"https://github.com/samcharles93/archie-core/issues/487","labels":["code-review","config","webui"],"dependency_count":0,"dependent_count":0,"comment_count":0} @@ -184,7 +184,7 @@ {"_type":"issue","id":"archie-core-1786637501129-428-accd2926","title":"gate output: stop discarding it, put the real error in the park reason","description":"Part of #450.\n\n`StageBaselineGate` in `internal/domain/workflow/implement.go` runs each\n`[[repos.gate]]` command via `cmd.CombinedOutput()`, clips the output to\n200 characters into a `tc.Log.Warn` call, and discards the rest. The\neventual park error (`baseline red -- %s fails and builder could not\nauto-fix (status: %s)`) is built from `res.Status` alone.\n\nWrite the full `CombinedOutput()` to the task's log sink (see #451 for the\nsink itself; this can land first using a plain file write if the sink isn't\nready yet, then be migrated) and put a bounded tail (~2KB, not 200 bytes) of\nit into the returned error so it reaches the park reason.\n\nRed-then-green: write a test against `StageBaselineGate` that asserts the\nreturned error contains gate output beyond 200 characters when the gate\ncommand fails with a long message, confirm it fails today, then fix.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-08-09T06:06:22Z","updated_at":"2026-08-09T08:17:27Z","closed_at":"2026-08-09T08:17:28Z","external_ref":"https://github.com/samcharles93/archie-core/issues/451","source_system":"github:https://github.com/samcharles93/archie-core/issues/451:451","metadata":null,"labels":["task"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786637501090-427-c465db57","title":"epic: task observability — capture and surface agent/gate output","description":"Design doc: `docs/architecture/observability.md` (this branch/PR).\n\n## Problem\n\nA task's real work happens in an ephemeral `archie-agent` container over\nNATS. Four things currently destroy the evidence of what it did:\n\n1. `cmd/archie-agent/main.go` logs to stderr only, and\n `internal/container/pool.go` creates containers with `AutoRemove: true` —\n the log dies with the container.\n2. `StageBaselineGate` (`internal/domain/workflow/implement.go`) captures\n full gate output via `CombinedOutput()`, clips it to 200 chars into a\n `Warn` log, and discards the rest — the park reason carries only a status\n string.\n3. `agentexec.Result` has no step-level transcript (tool calls, durations,\n errors).\n4. `agentexec.SubjectForSystem` is documented as the return channel for\n exactly this (\"log dumps, health... the daemon reads these for\n observability\") but has zero publishers and zero consumers anywhere in\n the codebase.\n\nConsequence: a task parked today with\n`stage baseline: baseline red -- go build ./... fails and builder could not\nauto-fix (status: parked)` and there was no way, from the dashboard or from\nchat, to see the actual `go build` error — the container that had it was\nalready gone.\n\nThis matters beyond convenience: archied is meant to run unattended for\nweeks (`CLAUDE.md` deployment model) and potentially for users other than\nits original operator. A system only debuggable by someone watching\n`docker ps` live doesn't meet that bar.\n\n## Decision\n\nNATS is the only transport this targets. `[agent] mode = \"nats\"` is the\nsupported deployment and the agent must already reach NATS to report any\nstage result — a container that can't reach NATS is a distinct, narrower\nfailure (connectivity) than this epic addresses (a connected container's own\noutput being unrecoverable). No new functionality goes into the in-process\nrunner, which is being migrated away.\n\n## Subtasks\n\nSee linked sub-issues.","status":"closed","priority":2,"issue_type":"epic","created_at":"2026-08-09T06:05:57Z","updated_at":"2026-08-09T09:29:41Z","closed_at":"2026-08-09T09:29:42Z","external_ref":"https://github.com/samcharles93/archie-core/issues/450","source_system":"github:https://github.com/samcharles93/archie-core/issues/450:450","metadata":null,"labels":["epic"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786637501063-426-9fce1209","title":"webui(chat): Send button passes the click event as sendMessage's retry arg, throws and no-ops","description":"`ui/src/chat/chat.js` line 283:\n\n```js\nsend.onclick = sendMessage;\n```\n\n`sendMessage(retry = null)` is assigned directly as a DOM `onclick` handler. The browser invokes `onclick` handlers with the triggering `MouseEvent` as the first argument, so every click calls `sendMessage(event)` -- the click event becomes `retry`. It's truthy and has no `.turn` property, so the very first line of the function:\n\n```js\nconst text = retry?.turn.text || composer.value.trim();\n```\n\nthrows `TypeError: can't access property \"text\", t.turn is undefined` (`t` being the minified param name) immediately, before any state changes (the disable/status-update code runs after this line). The click is silently swallowed -- no message sent, no visible error, Send just does nothing.\n\nReported live on carina 2026-08-09: clicking Send in the dashboard chat had no effect; browser console showed the above uncaught promise rejection at `index.js:77`.\n\n### Fix\n\n`send.onclick = () =\u003e sendMessage();` (matching the pattern already used for `newChat.onclick` a few lines up), so no arguments reach `sendMessage` from the click event.\n","status":"closed","priority":2,"issue_type":"bug","created_at":"2026-08-08T16:31:50Z","updated_at":"2026-08-08T16:34:57Z","closed_at":"2026-08-08T16:34:58Z","external_ref":"https://github.com/samcharles93/archie-core/issues/447","source_system":"github:https://github.com/samcharles93/archie-core/issues/447:447","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-1786637501039-425-88078ff7","title":"channels: MarkRunning is never called, dashboard shows working channels stuck on 'Starting'","description":"`internal/channels.Manager` has `MarkRunning(id)` (`internal/channels/manager.go:68`), but nothing in `cmd/archied/main.go` or `cmd/archied/telegram_setup.go` ever calls it. Every channel start path only calls `MarkStarting` then, on failure, `MarkFailed` -- there's no success signal.\n\n`cmd/archied/telegram_setup.go` around line 100-111:\n\n```go\nif s.ChannelManager != nil {\n s.ChannelManager.MarkStarting(\"telegram\")\n}\ngo func() {\n if err := tg.Start(ctx, router); err != nil \u0026\u0026 ctx.Err() == nil {\n if s.ChannelManager != nil {\n s.ChannelManager.MarkFailed(\"telegram\", err.Error())\n }\n s.Log.Error(\"telegram gateway stopped\", \"err\", err)\n }\n}()\ns.Log.Info(\"telegram gateway started\")\n```\n\n`tg.Start()` blocks for as long as the gateway is healthy (long-poll loop), so there's no point where success can be observed by return value the way failure is. Same pattern for email/webhook in `cmd/archied/main.go` (`channelManager.MarkStarting(\"email\"/\"webhook\")` / `MarkFailed` only).\n\n### Impact\n\nThe Channels dashboard page shows a configured, actually-working channel stuck on \"Starting.\" forever -- confirmed live on carina: Telegram successfully polling, command menu registered, messages flowing, but `/api/channels` still reports `\"state\": \"starting\"` indefinitely.\n\n### Expected\n\nEach channel's start path needs a `MarkRunning(id)` call once it's actually confirmed up -- e.g. after the first successful long-poll/webhook-registration/listener-bind, not just at goroutine launch. Applies to telegram, email, and webhook.\n","status":"open","priority":2,"issue_type":"bug","created_at":"2026-08-08T16:27:19Z","updated_at":"2026-08-08T16:27:19Z","external_ref":"https://github.com/samcharles93/archie-core/issues/446","source_system":"github:https://github.com/samcharles93/archie-core/issues/446:446","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-1786637501039-425-88078ff7","title":"channels: MarkRunning is never called, dashboard shows working channels stuck on 'Starting'","description":"`internal/channels.Manager` has `MarkRunning(id)` (`internal/channels/manager.go:68`), but nothing in `cmd/archied/main.go` or `cmd/archied/telegram_setup.go` ever calls it. Every channel start path only calls `MarkStarting` then, on failure, `MarkFailed` -- there's no success signal.\n\n`cmd/archied/telegram_setup.go` around line 100-111:\n\n```go\nif s.ChannelManager != nil {\n s.ChannelManager.MarkStarting(\"telegram\")\n}\ngo func() {\n if err := tg.Start(ctx, router); err != nil \u0026\u0026 ctx.Err() == nil {\n if s.ChannelManager != nil {\n s.ChannelManager.MarkFailed(\"telegram\", err.Error())\n }\n s.Log.Error(\"telegram gateway stopped\", \"err\", err)\n }\n}()\ns.Log.Info(\"telegram gateway started\")\n```\n\n`tg.Start()` blocks for as long as the gateway is healthy (long-poll loop), so there's no point where success can be observed by return value the way failure is. Same pattern for email/webhook in `cmd/archied/main.go` (`channelManager.MarkStarting(\"email\"/\"webhook\")` / `MarkFailed` only).\n\n### Impact\n\nThe Channels dashboard page shows a configured, actually-working channel stuck on \"Starting.\" forever -- confirmed live on carina: Telegram successfully polling, command menu registered, messages flowing, but `/api/channels` still reports `\"state\": \"starting\"` indefinitely.\n\n### Expected\n\nEach channel's start path needs a `MarkRunning(id)` call once it's actually confirmed up -- e.g. after the first successful long-poll/webhook-registration/listener-bind, not just at goroutine launch. Applies to telegram, email, and webhook.\n","status":"in_progress","priority":2,"issue_type":"bug","assignee":"Sam Catlow","created_at":"2026-08-08T16:27:19Z","updated_at":"2026-09-02T10:18:01Z","started_at":"2026-09-02T10:18:01Z","lease_expires_at":"2026-09-02T10:23:01Z","heartbeat_at":"2026-09-02T10:18:01Z","external_ref":"https://github.com/samcharles93/archie-core/issues/446","source_system":"github:https://github.com/samcharles93/archie-core/issues/446:446","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786637501009-424-5b8332dd","title":"daemon: label dispatch trigger with empty label matches every open issue","description":"`internal/daemon/daemon.go` `pollIssuesWithConfig()`, the `\"label\"` (and `\"either\"`) trigger branch calls:\n\n```go\nissues, err := fg.IssuesWithLabel(ctx, repo.Owner, repo.Name, cfg.Label)\n```\n\n`cfg.Label` is a top-level `Config.Label` field (`internal/config/config.go:364`) -- a different field from `[dispatch.labels]`, which maps task *states* (queued/working/waiting/pr/parked) to their forge labels for a different purpose. It's easy to configure `[dispatch.labels]` and reasonably assume the label-trigger match target is covered, while leaving the actual `label` field that controls trigger matching unset.\n\n`GitHubClient.IssuesWithLabel` (`internal/forge/github.go:103`) passes that straight through as `Labels: []string{label}` to the GitHub issues-list API. With `label == \"\"`, GitHub does not filter by label at all -- it returns every open issue in the repo.\n\n### Impact (live incident, 2026-08-09)\n\nDeployed `dispatch.trigger = \"label\"` on carina without setting `label`. The daemon queued 124 unrelated open issues in one poll cycle (everything from epics to unrelated feature requests), and one reached a running agent container before it was caught and stopped manually.\n\n### Expected\n\n`pollIssuesWithConfig`'s `\"label\"` branch should refuse to poll (log an error and return, same as any other misconfiguration) when `cfg.Label` is empty, rather than silently falling through to an unfiltered API call. Ideally this is also caught at config-validation time (`internal/infrastructure/configuration/validate.go`) when `dispatch.trigger` is `\"label\"` or `\"either\"` and `label` is blank.\n","status":"closed","priority":2,"issue_type":"bug","assignee":"samcharles93","created_at":"2026-08-08T16:26:41Z","updated_at":"2026-08-20T13:02:18Z","started_at":"2026-08-20T12:57:03Z","closed_at":"2026-08-20T13:02:18Z","close_reason":"Fixed in fix/label-dispatch-empty-label (31efdcf): pollIssuesWithConfig/pollEitherWithConfig now refuse the label poll when cfg.Label is empty, and validateDispatch rejects the misconfiguration at load time. Adversarially reviewed; one weak test strengthened to actually verify assignee matches survive.","external_ref":"https://github.com/samcharles93/archie-core/issues/445","source_system":"github:https://github.com/samcharles93/archie-core/issues/445:445","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786637500980-423-12a63a68","title":"webui(chat): dynamic header content breaks the fixed no-scroll chat layout","description":"The Chat page's layout (`ui/src/chat/chat.css`) is built for a fixed, no-scroll chat window: `.chat-workspace` uses `grid-template-rows: auto minmax(0, 1fr) auto` with `overflow: hidden`, and only `.chat-transcript` (the message list) is meant to scroll. `.chat-page` only sets `min-height: calc(100vh - 5rem)`, not a fixed height.\n\nAny dynamic content injected above `.chat-layout` -- the status/error banner (see #443), extra status pills, a long \"Reload Telegram\"/\"Check updates\" row wrapping on a narrower viewport -- has no height budget accounted for, so it just pushes the whole grid down and grows total page height past the viewport. That breaks the intended design: the page itself scrolls instead of just the transcript.\n\nScreenshot: Chat page with the 501 error banner (see #443) visibly adding an extra row that isn't accounted for in the fixed layout.\n\n### Expected\n\nThe top status/banner region should have a bounded height (or the page should reserve space for it) so injecting a banner or wrapping the status pills never causes page-level scroll -- only `.chat-transcript` should ever scroll.\n","status":"closed","priority":2,"issue_type":"bug","created_at":"2026-08-08T16:17:47Z","updated_at":"2026-08-08T16:45:42Z","closed_at":"2026-08-08T16:45:43Z","external_ref":"https://github.com/samcharles93/archie-core/issues/444","source_system":"github:https://github.com/samcharles93/archie-core/issues/444:444","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1786637500953-422-01075562","title":"webui(chat): raw 501 error banner when update-check is unconfigured","description":"The Chat page shows a raw \"501 Not Implemented\" banner across the top when the release-update-check feature isn't configured. `POST /api/chat/update` correctly returns 501 when `chat.telegram.update_check_command` is unset in config (`cmd/archied/telegram_setup.go` `makeUpdateService` returns nil in that case, which is a legitimate, expected \"not configured\" state -- same category as an unconfigured channel).\n\nThe bug is in the frontend's handling of that response. `ui/src/chat/chat.js` `refreshUpdate()` is called unconditionally on page load (line ~365) with no guard, and its catch block does:\n\n```js\n} catch (err) {\n updatePanel.replaceChildren(el(\"span\", err.message || \"Updates unavailable\"));\n}\n```\n\nThis renders the raw fetch error text (including the literal HTTP status) directly into a visible page banner, rather than treating \"updates not configured\" as a quiet empty state -- the same pattern already used for an unconfigured channel on the Channels page (\"Not configured\", not an error).\n\n### Expected\n\nA 501/\"not configured\" response from `/api/chat/update` should render nothing (or a subtle \"update checks not configured\" note), not a raw HTTP error banner.\n\nScreenshot: Chat page, banner reading \"501 Not Implemented\" directly under the top status bar.\n","status":"closed","priority":2,"issue_type":"bug","created_at":"2026-08-08T16:17:37Z","updated_at":"2026-08-08T16:44:14Z","closed_at":"2026-08-08T16:44:15Z","external_ref":"https://github.com/samcharles93/archie-core/issues/443","source_system":"github:https://github.com/samcharles93/archie-core/issues/443:443","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/config.example.toml b/config.example.toml index 87ba68ed5..2bb1c92cb 100644 --- a/config.example.toml +++ b/config.example.toml @@ -219,6 +219,23 @@ listen = "127.0.0.1:8484" # engine = "builtin" # "builtin" is the only engine implemented so far # session_ttl = "0s" +# Image generation capability (internal/domain/image). No provider is +# implemented yet -- this section defines the contract/config surface only +# (archie-core-1786748942147-2-47cd5bd1). Absent is valid and registers no +# provider. default names the provider /image uses without asking; leaving +# it unset means /image always asks which mechanism to use. Every provider +# is off by default -- a hosted provider spends real API credits per call, +# and a local one can saturate the host GPU, so both require an explicit +# enabled = true, never an inferred one from the presence of a key alone. +# [image.hosted.openai] +# enabled = false +# class = "openai" +# api_key_env = "OPENAI_API_KEY" +# +# [image.local.sdxl] +# enabled = false +# backend = "sdxl-turbo" + # Notifications for human-in-the-loop moments # (approval requests, gate failures, parked tasks). # Archie POSTs a JSON payload to the webhook diff --git a/docs/prds/image-capability-contract.md b/docs/prds/image-capability-contract.md new file mode 100644 index 000000000..8be052a87 --- /dev/null +++ b/docs/prds/image-capability-contract.md @@ -0,0 +1,243 @@ +# Image capability contract and configuration + +Epic: archie-core-1786748942120-1-6636e629 ("Image generation capability: +hosted API baseline plus local GPU workflows"). +Scope: archie-core-1786748942147-2-47cd5bd1 — the contract and configuration +only. Hosted provider implementation (gpt-image-2), local GPU backend, +`/image` routing, and delivery are separate, dependent beads and are not +built here. + +## Problem + +Archie needs a provider-neutral boundary for image generation/editing so a +hosted API (gpt-image-2-class) and a future local GPU backend can both +implement it without either one leaking into the domain contract. Nothing +in the repo defines this today (`grep -ri image` over `internal/domain` and +`internal/config` returns nothing image-specific). + +## Design + +Follows the plugin engine family shape already established by +`internal/domain/curator` and `internal/domain/memory` (ARCHITECTURE.md +"plugin engine rule strict"): a typed contract with real domain operations, +an owning `Registry` (register/get/names, no start/stop lifecycle — see +below), and narrow host access via a `Registrar`. + +### Package: `internal/domain/image` + +**Why no `Lifecycle` (`Start/Health/Stop`)**: curator and memory engines are +long-running — they hold a background cadence or a persistent connection +worth health-checking. An image provider is call-scoped: it either serves a +`Generate`/`Edit` request or it does not. Health here means "is this +provider usable right now", which is exactly what `Generate`/`Edit` +returning a typed `ErrUnavailable` already communicates — a separate +`Health()` poll would just duplicate that. `Registry` still owns +registration and lookup, so provider selection is testable with fakes per +the acceptance criteria, but there is no `Start`/`Stop` to orchestrate. + +```go +// Capability declares what one provider supports, discoverable before a +// request is built so a caller can reject an unsupported combination (e.g. +// edit-with-mask on a generate-only provider) instead of sending it and +// parsing a provider-specific error back out. +type Capability struct { + Generate bool + Edit bool // edit requires at least one input image + Mask bool // edit supports a mask restricting the edited region + MaxInputs int // 0 = Edit unsupported + Sizes []string // provider-declared output sizes, e.g. "1024x1024" +} + +// Provider is the typed contract every image backend implements — hosted +// (gpt-image-2-class) or local (GPU recipe). No Lifecycle: a provider is +// call-scoped, not long-running (see design doc rationale). +type Provider interface { + Name() string + // Class distinguishes hosted (spends money/quota per call) from local + // (spends host GPU/time). Selection logic and config validation key off + // this, never off Name, so a new provider cannot silently slip through + // the hosted-cost gate under an unrecognized name. + Class() ProviderClass + Capability() Capability + Generate(ctx context.Context, req GenerateRequest) (Result, error) + Edit(ctx context.Context, req EditRequest) (Result, error) +} + +type ProviderClass string + +const ( + ClassHosted ProviderClass = "hosted" + ClassLocal ProviderClass = "local" +) +``` + +Request/result types (provider-neutral, no OpenAI types): + +```go +type GenerateRequest struct { + Prompt string + Size string // "" = provider default + N int // number of images; 0 = 1 + Options map[string]string // provider-specific overflow (e.g. "quality"), + // deliberately untyped so the contract does not + // grow a field per provider +} + +type EditRequest struct { + Prompt string + Inputs []ImageData // 1..Capability.MaxInputs + Mask *ImageData // nil unless Capability.Mask + Size string + N int + Options map[string]string +} + +// ImageData carries image bytes in-process, never a path or URL: the +// domain layer must not assume a filesystem or a fetchable location (mirrors +// why curator's Registrar never receives *daemon.Daemon — no ambient host +// access smuggled in through a "just a string" field). +type ImageData struct { + Bytes []byte + MIMEType string +} + +type Result struct { + Images []ImageData + Provider string + Model string + CreatedAt time.Time +} +``` + +### Error taxonomy + +```go +var ( + ErrUnavailable = errors.New("image provider unavailable") // missing credential, backend down + ErrUnsupported = errors.New("image capability unsupported by provider") // e.g. Edit on generate-only + ErrInputTooLarge = errors.New("image input exceeds configured limit") + ErrTimeout = errors.New("image request timed out") + ErrCanceled = errors.New("image request canceled") +) +``` + +Every provider wraps these with `fmt.Errorf("%w: %s", ErrX, detail)` so +callers can `errors.Is` regardless of backend. `ErrUnavailable` is the +explicit instruction from the epic: "a missing credential or unavailable +backend must make the capability unavailable with a useful user-facing +error, not prevent Archie from starting or break text chat" — Register +never rejects the daemon's boot, only marks that one provider absent from +`Registry.Names()`. + +### Registry + +```go +type Registry struct { /* map[string]Provider, mutex, sorted Names() */ } + +func NewRegistry() *Registry +func (r *Registry) Register(p Provider) error // ErrDuplicate on name clash +func (r *Registry) Get(name string) (Provider, bool) +func (r *Registry) Names() []string +func (r *Registry) ByClass(class ProviderClass) []string +``` + +No `Registrar`/host-injection type: unlike curator (needs `LLM`, `Skills`, +`Conversations`) and memory (needs `Clock`, `Events`), an image provider's +dependencies (HTTP client, API key, local backend handle) are entirely its +own construction-time concern in `internal/infrastructure/image/*`, not +daemon services it needs injected. Introducing an empty `Registrar` now +would be exactly the "field nobody sets" pattern to avoid. + +### Configuration + +Follows `MinimaxConfig`'s hosted-cost-guard convention exactly: absent +config or absent explicit `enabled = true` per provider means that +provider does not register, not "registers but errors on first call". + +```go +// ImageConfig configures the image generation capability. +type ImageConfig struct { + // Default selects which registered provider name /image uses when the + // request/session has not already picked one. Empty means /image must + // always ask (the epic's stated default UX) — an empty Default is valid + // and is not a misconfiguration. + Default string `toml:"default"` + Hosted map[string]ImageHostedProvider `toml:"hosted"` // keyed by provider name + Local map[string]ImageLocalProvider `toml:"local"` // keyed by recipe name +} + +// ImageHostedProvider configures one hosted (paid) provider. Mirrors +// MinimaxConfig: Enabled defaults false, spending real credits requires an +// explicit opt-in, never an inferred one from the presence of a key alone. +type ImageHostedProvider struct { + Enabled bool `toml:"enabled"` + Class string `toml:"class"` // "openai" today; provider-neutral field name + APIKeyEnv string `toml:"api_key_env"` + APIKey secret.SecretRef `toml:"api_key" json:"-"` + BaseURL string `toml:"base_url"` +} + +// ImageLocalProvider configures one local GPU recipe. Enabled defaults +// false too: a local backend can still saturate the host GPU/CPU, which is +// its own kind of unwanted cost, so it gets the same explicit gate as a +// hosted provider rather than an on-by-default WebFetch-style treatment. +type ImageLocalProvider struct { + Enabled bool `toml:"enabled"` + Backend string `toml:"backend"` // recipe identifier, defined by the local-backend bead +} +``` + +Validation (`internal/infrastructure/configuration/validate.go`, alongside +`validateMemory`): + +- `Default`, if set, must name a provider present (enabled) in `Hosted` or + `Local` — rejects a config that silently falls back to "always ask" when + the operator thought they'd pinned one. +- A `Hosted` entry with `Enabled = true` must have `Class` non-empty and + either `APIKeyEnv` or a resolvable `APIKey` — the same shape check + `Provider` (chat) already gets, not a new invention. +- No cross-field surprise: an *absent* `[image]` section is valid and + produces zero registered providers, matching the epic's non-goal + ("silently selecting a paid hosted provider" must never happen by + omission either). + +### Capability discovery + +`Registry.Names()` / `ByClass()` plus `Provider.Capability()` give a caller +(the future `/image` routing bead) everything needed to ask "what can I +offer this user" without a type switch on provider identity — this is the +whole point of the contract being provider-neutral. + +### Timeouts, size limits, cancellation + +- Every `Provider.Generate`/`Edit` call takes the caller's `ctx`; a + provider that ignores cancellation is a provider bug, not a contract gap + — mirrors every other Lifecycle-less call in the codebase (chat's + `runtime.Chat`). +- `ImageData` size limits are enforced by the *caller* (the future routing + bead) before constructing a request, using a configured max — not by this + contract, which has no config surface for "current caller's limit". This + package only defines `ErrInputTooLarge` so a provider that discovers an + oversized input itself (rather than trusting the caller) has a typed way + to say so. + +## Testing + +- `internal/domain/image/{contract,registry}_test.go` mirror memory's test + suite shape: registration (duplicate, nil provider), `Names`/`ByClass` + filtering, `Get` miss, table-driven `Capability` checks via a fake + provider. +- `internal/infrastructure/configuration/validate_test.go` gains cases for + `ImageConfig`: absent section, valid hosted+local, missing `Class`, + missing credential, `Default` naming an unregistered/disabled provider. +- No provider implementation exists yet, so no live-call tests — those + belong to the hosted/local provider beads. + +## Non-goals (deferred to sibling beads) + +- Implementing any real `Provider` (hosted or local). +- `/image` clarification/routing flow and session-scoped mechanism + selection. +- Delivery through channel abstractions. +- Wiring `Registry` into `bootstrap.go` (nothing to wire until a real + provider exists to register). diff --git a/internal/config/config.go b/internal/config/config.go index ec309363f..4b79be52d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -283,6 +283,40 @@ func (d Dispatch) LabelValues() []string { return out } +// ImageConfig configures the image generation capability +// (internal/domain/image). See docs/prds/image-capability-contract.md. +type ImageConfig struct { + // Default selects which registered provider name /image uses when the + // request/session has not already picked one. Empty means /image must + // always ask which mechanism to use -- a valid, and the default, state. + Default string `toml:"default" yaml:"default" json:"default"` + // Hosted configures hosted (paid) providers, keyed by provider name. + Hosted map[string]ImageHostedProvider `toml:"hosted" yaml:"hosted" json:"hosted"` + // Local configures local GPU recipes, keyed by provider name. + Local map[string]ImageLocalProvider `toml:"local" yaml:"local" json:"local"` +} + +// ImageHostedProvider configures one hosted image provider. Mirrors +// MinimaxConfig's cost guard: Enabled defaults false, since a hosted +// provider spends real API credits per call and must never activate from +// the mere presence of a key. +type ImageHostedProvider struct { + Enabled bool `toml:"enabled" yaml:"enabled" json:"enabled"` + Class string `toml:"class" yaml:"class" json:"class"` + APIKeyEnv string `toml:"api_key_env" yaml:"api_key_env" json:"api_key_env"` + APIKey secret.SecretRef `toml:"api_key" yaml:"api_key" json:"-"` + BaseURL string `toml:"base_url" yaml:"base_url" json:"base_url,omitempty"` +} + +// ImageLocalProvider configures one local GPU image recipe. Enabled +// defaults false too: a local backend can saturate the host GPU/CPU, its +// own kind of unwanted cost, so it gets the same explicit gate as a hosted +// provider rather than an on-by-default treatment. +type ImageLocalProvider struct { + Enabled bool `toml:"enabled" yaml:"enabled" json:"enabled"` + Backend string `toml:"backend" yaml:"backend" json:"backend"` +} + // MemoryConfig holds memory provider configuration. type MemoryConfig struct { // Engine selects among the domain/memory engine family @@ -443,6 +477,10 @@ type Config struct { // Memory holds memory provider configuration (from config.memory.yaml). Memory MemoryConfig `toml:"memory" yaml:"memory"` + // Image configures the image generation capability. Absent is valid + // and registers no provider. + Image ImageConfig `toml:"image" yaml:"image" json:"image"` + // Tools holds MCP server and tool policy configuration (from config.tools.yaml). Tools ToolsConfig `toml:"tools" yaml:"tools"` // Indexing locates the workspace codesearch index. diff --git a/internal/domain/image/contract.go b/internal/domain/image/contract.go new file mode 100644 index 000000000..f8f0df2eb --- /dev/null +++ b/internal/domain/image/contract.go @@ -0,0 +1,156 @@ +// Package image is the image generation capability family: a +// provider-neutral boundary for hosted (gpt-image-2-class) and local GPU +// backends, so /image routing can target either without depending on +// provider-specific types. See docs/prds/image-capability-contract.md for +// the design and epic archie-core-1786748942120-1-6636e629. +// +// Unlike curator and memory (internal/domain/curator, +// internal/domain/memory), a Provider has no Lifecycle: it is call-scoped, +// not long-running. There is nothing to Start, and "is this usable right +// now" is exactly what Generate/Edit returning ErrUnavailable already +// communicates — a separate Health poll would duplicate that. This package +// defines the contract only; no provider implementation lives here. +package image + +import ( + "context" + "errors" + "time" +) + +// Sentinel errors every provider wraps with fmt.Errorf("%w: %s", ...) so +// callers can errors.Is regardless of backend. +var ( + // ErrUnavailable means the provider cannot serve right now (missing + // credential, backend down). Per the epic: this must degrade the + // capability to a reported error, never prevent Archie from starting + // or break text chat. + ErrUnavailable = errors.New("image provider unavailable") + // ErrUnsupported means the request needs a capability (e.g. Edit, or + // Mask) the provider does not declare. + ErrUnsupported = errors.New("image capability unsupported by provider") + // ErrInputTooLarge means an input image exceeded a limit the provider + // itself enforces. Caller-side limits are the routing layer's concern, + // not this contract's — see the design doc. + ErrInputTooLarge = errors.New("image input exceeds configured limit") + // ErrTimeout means the provider's own deadline elapsed, distinct from + // the caller's ctx being canceled. + ErrTimeout = errors.New("image request timed out") + // ErrCanceled means the caller's ctx was canceled. + ErrCanceled = errors.New("image request canceled") +) + +// ProviderClass distinguishes hosted (spends money/quota per call) from +// local (spends host GPU/time). Selection and config validation key off +// this, never off Name, so a new provider cannot silently slip through the +// hosted-cost gate under an unrecognized name. +type ProviderClass string + +const ( + ClassHosted ProviderClass = "hosted" + ClassLocal ProviderClass = "local" +) + +// Capability declares what one provider supports, discoverable before a +// request is built so a caller can reject an unsupported combination (e.g. +// edit-with-mask on a generate-only provider) instead of sending it and +// parsing a provider-specific error back out. +type Capability struct { + Generate bool + // Edit requires at least one input image. MaxInputs bounds how many. + Edit bool + MaxInputs int + // Mask reports whether Edit supports restricting the edited region to + // a mask image. + Mask bool + // Sizes lists provider-declared output sizes (e.g. "1024x1024"). Empty + // means the provider does not constrain size. + Sizes []string +} + +// Validate checks that a declared Capability is internally consistent: +// Edit implies at least one allowed input, and Mask cannot be declared +// without Edit. +func (c Capability) Validate() error { + if c.Edit && c.MaxInputs < 1 { + return errors.New("image capability: edit requires MaxInputs >= 1") + } + if c.Mask && !c.Edit { + return errors.New("image capability: mask requires edit") + } + return nil +} + +// ImageData carries image bytes in-process, never a path or URL: the +// domain layer must not assume a filesystem or a fetchable location. +type ImageData struct { + Bytes []byte + MIMEType string +} + +// GenerateRequest asks a provider to create images from a prompt alone. +type GenerateRequest struct { + Prompt string + // Size is a provider-declared value from Capability.Sizes, or "" for + // the provider's default. + Size string + // N is the number of images requested. Zero means 1. + N int + // Options carries provider-specific overflow (e.g. "quality"), + // deliberately untyped so the contract does not grow a field per + // provider. + Options map[string]string +} + +// Validate checks the fields every provider needs regardless of backend. +func (r GenerateRequest) Validate() error { + if r.Prompt == "" { + return errors.New("image generate request: prompt must not be empty") + } + return nil +} + +// EditRequest asks a provider to edit one or more input images per a +// prompt, optionally restricted to a masked region. +type EditRequest struct { + Prompt string + Inputs []ImageData + // Mask restricts the edited region. Only valid when the provider's + // Capability.Mask is true. + Mask *ImageData + Size string + N int + + Options map[string]string +} + +// Validate checks the fields every provider needs regardless of backend. +// Capability-specific bounds (MaxInputs, Mask support) are the provider's +// own responsibility to enforce against its declared Capability. +func (r EditRequest) Validate() error { + if r.Prompt == "" { + return errors.New("image edit request: prompt must not be empty") + } + if len(r.Inputs) == 0 { + return errors.New("image edit request: at least one input image is required") + } + return nil +} + +// Result is what a provider returns from Generate or Edit. +type Result struct { + Images []ImageData + Provider string + Model string + CreatedAt time.Time +} + +// Provider is the typed contract every image backend implements — hosted +// (gpt-image-2-class) or local (GPU recipe). +type Provider interface { + Name() string + Class() ProviderClass + Capability() Capability + Generate(ctx context.Context, req GenerateRequest) (Result, error) + Edit(ctx context.Context, req EditRequest) (Result, error) +} diff --git a/internal/domain/image/contract_test.go b/internal/domain/image/contract_test.go new file mode 100644 index 000000000..5ca707b21 --- /dev/null +++ b/internal/domain/image/contract_test.go @@ -0,0 +1,68 @@ +package image + +import "testing" + +func TestCapabilityValidateRejectsEditWithoutInputs(t *testing.T) { + t.Parallel() + c := Capability{Edit: true, MaxInputs: 0} + if err := c.Validate(); err == nil { + t.Fatal("Validate() = nil, want error for edit with MaxInputs 0") + } +} + +func TestCapabilityValidateRejectsMaskWithoutEdit(t *testing.T) { + t.Parallel() + c := Capability{Mask: true} + if err := c.Validate(); err == nil { + t.Fatal("Validate() = nil, want error for mask without edit") + } +} + +func TestCapabilityValidateAcceptsGenerateOnly(t *testing.T) { + t.Parallel() + c := Capability{Generate: true} + if err := c.Validate(); err != nil { + t.Fatalf("Validate() = %v, want nil", err) + } +} + +func TestCapabilityValidateAcceptsEditWithMask(t *testing.T) { + t.Parallel() + c := Capability{Edit: true, MaxInputs: 1, Mask: true} + if err := c.Validate(); err != nil { + t.Fatalf("Validate() = %v, want nil", err) + } +} + +func TestGenerateRequestValidateRequiresPrompt(t *testing.T) { + t.Parallel() + if err := (GenerateRequest{}).Validate(); err == nil { + t.Fatal("Validate() = nil, want error for empty prompt") + } + if err := (GenerateRequest{Prompt: "a cat"}).Validate(); err != nil { + t.Fatalf("Validate() = %v, want nil", err) + } +} + +func TestEditRequestValidateRequiresPromptAndInputs(t *testing.T) { + t.Parallel() + cases := []struct { + name string + req EditRequest + want bool // true if a valid request + }{ + {"empty", EditRequest{}, false}, + {"no inputs", EditRequest{Prompt: "add a hat"}, false}, + {"no prompt", EditRequest{Inputs: []ImageData{{Bytes: []byte("x")}}}, false}, + {"valid", EditRequest{Prompt: "add a hat", Inputs: []ImageData{{Bytes: []byte("x")}}}, true}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + err := tc.req.Validate() + if (err == nil) != tc.want { + t.Fatalf("Validate() = %v, want valid=%v", err, tc.want) + } + }) + } +} diff --git a/internal/domain/image/registry.go b/internal/domain/image/registry.go new file mode 100644 index 000000000..8612321d3 --- /dev/null +++ b/internal/domain/image/registry.go @@ -0,0 +1,90 @@ +package image + +import ( + "errors" + "fmt" + "reflect" + "slices" + "sync" +) + +// ErrDuplicate is returned when a provider name is already registered. +var ErrDuplicate = errors.New("duplicate image provider") + +// Registry is the image family owner: registration and discovery only. A +// Provider is call-scoped (see package doc), so unlike curator's and +// memory's registries there is no Start/Health/Stop to orchestrate here. +type Registry struct { + mu sync.RWMutex + providers map[string]Provider +} + +// NewRegistry builds an empty provider registry. +func NewRegistry() *Registry { + return &Registry{providers: make(map[string]Provider)} +} + +// Register validates the provider's declared capability and adds it. +// Registration fails on a nil provider, an invalid Capability, or a +// duplicate name. +func (r *Registry) Register(p Provider) error { + if isNilProvider(p) { + return errors.New("image: nil provider") + } + if err := p.Capability().Validate(); err != nil { + return err + } + + r.mu.Lock() + defer r.mu.Unlock() + if _, dup := r.providers[p.Name()]; dup { + return fmt.Errorf("%w: %s", ErrDuplicate, p.Name()) + } + r.providers[p.Name()] = p + return nil +} + +// Get returns the registered provider by name. +func (r *Registry) Get(name string) (Provider, bool) { + r.mu.RLock() + defer r.mu.RUnlock() + p, ok := r.providers[name] + return p, ok +} + +// Names returns every registered provider name, sorted. +func (r *Registry) Names() []string { + r.mu.RLock() + defer r.mu.RUnlock() + names := make([]string, 0, len(r.providers)) + for name := range r.providers { + names = append(names, name) + } + slices.Sort(names) + return names +} + +// ByClass returns the sorted names of registered providers matching class. +func (r *Registry) ByClass(class ProviderClass) []string { + r.mu.RLock() + defer r.mu.RUnlock() + var names []string + for name, p := range r.providers { + if p.Class() == class { + names = append(names, name) + } + } + slices.Sort(names) + return names +} + +func isNilProvider(p Provider) bool { + v := reflect.ValueOf(p) + switch v.Kind() { + case reflect.Invalid: + return true + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer, reflect.Slice: + return v.IsNil() + } + return false +} diff --git a/internal/domain/image/registry_test.go b/internal/domain/image/registry_test.go new file mode 100644 index 000000000..fc53dd3e9 --- /dev/null +++ b/internal/domain/image/registry_test.go @@ -0,0 +1,124 @@ +package image + +import ( + "context" + "errors" + "testing" + "time" +) + +type fakeProvider struct { + name string + class ProviderClass + cap Capability +} + +func (f fakeProvider) Name() string { return f.name } +func (f fakeProvider) Class() ProviderClass { return f.class } +func (f fakeProvider) Capability() Capability { return f.cap } + +func (f fakeProvider) Generate(context.Context, GenerateRequest) (Result, error) { + return Result{Provider: f.name, CreatedAt: time.Unix(0, 0)}, nil +} + +func (f fakeProvider) Edit(context.Context, EditRequest) (Result, error) { + if !f.cap.Edit { + return Result{}, ErrUnsupported + } + return Result{Provider: f.name, CreatedAt: time.Unix(0, 0)}, nil +} + +func TestRegistryRegisterAndGet(t *testing.T) { + t.Parallel() + r := NewRegistry() + p := fakeProvider{name: "hosted-a", class: ClassHosted, cap: Capability{Generate: true}} + if err := r.Register(p); err != nil { + t.Fatalf("Register() = %v", err) + } + got, ok := r.Get("hosted-a") + if !ok || got.Name() != "hosted-a" { + t.Fatalf("Get() = %v, %v, want hosted-a", got, ok) + } + if _, ok := r.Get("missing"); ok { + t.Fatal("Get(missing) = true, want false") + } +} + +func TestRegistryRegisterRejectsDuplicate(t *testing.T) { + t.Parallel() + r := NewRegistry() + p := fakeProvider{name: "hosted-a", class: ClassHosted, cap: Capability{Generate: true}} + if err := r.Register(p); err != nil { + t.Fatalf("Register() = %v", err) + } + err := r.Register(p) + if !errors.Is(err, ErrDuplicate) { + t.Fatalf("Register(dup) = %v, want ErrDuplicate", err) + } +} + +func TestRegistryRegisterRejectsNilProvider(t *testing.T) { + t.Parallel() + r := NewRegistry() + var p Provider + if err := r.Register(p); err == nil { + t.Fatal("Register(nil) = nil, want error") + } +} + +func TestRegistryRegisterRejectsInvalidCapability(t *testing.T) { + t.Parallel() + r := NewRegistry() + p := fakeProvider{name: "bad", class: ClassHosted, cap: Capability{Mask: true}} + if err := r.Register(p); err == nil { + t.Fatal("Register(invalid capability) = nil, want error") + } +} + +func TestRegistryNamesSorted(t *testing.T) { + t.Parallel() + r := NewRegistry() + for _, name := range []string{"zeta", "alpha", "mid"} { + if err := r.Register(fakeProvider{name: name, class: ClassHosted, cap: Capability{Generate: true}}); err != nil { + t.Fatalf("Register(%s) = %v", name, err) + } + } + got := r.Names() + want := []string{"alpha", "mid", "zeta"} + if len(got) != len(want) { + t.Fatalf("Names() = %v, want %v", got, want) + } + for i := range want { + if got[i] != want[i] { + t.Fatalf("Names() = %v, want %v", got, want) + } + } +} + +func TestRegistryByClassFilters(t *testing.T) { + t.Parallel() + r := NewRegistry() + if err := r.Register(fakeProvider{name: "hosted-a", class: ClassHosted, cap: Capability{Generate: true}}); err != nil { + t.Fatal(err) + } + if err := r.Register(fakeProvider{name: "local-a", class: ClassLocal, cap: Capability{Generate: true}}); err != nil { + t.Fatal(err) + } + hosted := r.ByClass(ClassHosted) + if len(hosted) != 1 || hosted[0] != "hosted-a" { + t.Fatalf("ByClass(hosted) = %v, want [hosted-a]", hosted) + } + local := r.ByClass(ClassLocal) + if len(local) != 1 || local[0] != "local-a" { + t.Fatalf("ByClass(local) = %v, want [local-a]", local) + } +} + +func TestFakeProviderEditRespectsCapability(t *testing.T) { + t.Parallel() + p := fakeProvider{name: "generate-only", class: ClassHosted, cap: Capability{Generate: true}} + _, err := p.Edit(context.Background(), EditRequest{Prompt: "x", Inputs: []ImageData{{Bytes: []byte("x")}}}) + if !errors.Is(err, ErrUnsupported) { + t.Fatalf("Edit() = %v, want ErrUnsupported", err) + } +} diff --git a/internal/infrastructure/configuration/validate.go b/internal/infrastructure/configuration/validate.go index 3f7fb3994..e47e8cf15 100644 --- a/internal/infrastructure/configuration/validate.go +++ b/internal/infrastructure/configuration/validate.go @@ -87,9 +87,49 @@ func validate(cfg *config.Config) error { if err := validateMemory(cfg); err != nil { return err } + if err := validateImage(cfg); err != nil { + return err + } return validateCapture(cfg) } +// validateImage rejects an enabled hosted provider with no class or no +// resolvable credential, and a Default naming a provider that is not both +// present and enabled -- either would let /image silently fall back to +// "always ask" (harmless) or fail at call time with a confusing error +// (not harmless). An absent [image] section is valid and registers no +// provider, matching the epic's non-goal that a paid provider must never +// activate by omission. +func validateImage(cfg *config.Config) error { + for name, p := range cfg.Image.Hosted { + if !p.Enabled { + continue + } + if p.Class == "" { + return fmt.Errorf("%w: image.hosted.%s.class is required when enabled", ErrInvalidInput, name) + } + if p.APIKeyEnv == "" && p.APIKey == (secret.SecretRef{}) { + return fmt.Errorf("%w: image.hosted.%s requires api_key_env or api_key when enabled", ErrInvalidInput, name) + } + } + for name, p := range cfg.Image.Local { + if p.Enabled && p.Backend == "" { + return fmt.Errorf("%w: image.local.%s.backend is required when enabled", ErrInvalidInput, name) + } + } + if cfg.Image.Default != "" { + hosted, hostedOK := cfg.Image.Hosted[cfg.Image.Default] + local, localOK := cfg.Image.Local[cfg.Image.Default] + switch { + case hostedOK && hosted.Enabled, localOK && local.Enabled: + // found and enabled + default: + return fmt.Errorf("%w: image.default %q must name an enabled provider under image.hosted or image.local", ErrInvalidInput, cfg.Image.Default) + } + } + return nil +} + // validateMemory rejects an engine name outside memoryEngines. Empty is // valid input to Validate (applyDefaults resolves it to memoryEngineBuiltin // before this runs on the real load path); it is not "unknown" so it does diff --git a/internal/infrastructure/configuration/validate_test.go b/internal/infrastructure/configuration/validate_test.go index 274357784..e9739aafc 100644 --- a/internal/infrastructure/configuration/validate_test.go +++ b/internal/infrastructure/configuration/validate_test.go @@ -380,3 +380,104 @@ func TestValidateMemoryRejectsProviderSetToAnything(t *testing.T) { t.Errorf("error text = %q, want it to name the field and the value", err.Error()) } } + +func TestValidateImageAcceptsAbsentSection(t *testing.T) { + cfg := minimalValidConfig() + if err := validateImage(&cfg); err != nil { + t.Fatalf("validateImage(absent) = %v, want nil", err) + } +} + +func TestValidateImageRejectsEnabledHostedWithoutClass(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Hosted = map[string]config.ImageHostedProvider{ + "openai": {Enabled: true, APIKeyEnv: "OPENAI_API_KEY"}, + } + err := validateImage(&cfg) + if !errors.Is(err, ErrInvalidInput) { + t.Fatalf("validateImage(no class) = %v, want wrapping ErrInvalidInput", err) + } + if !strings.Contains(err.Error(), "image.hosted.openai.class") { + t.Errorf("error text = %q, want it to name the field", err.Error()) + } +} + +func TestValidateImageRejectsEnabledHostedWithoutCredential(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Hosted = map[string]config.ImageHostedProvider{ + "openai": {Enabled: true, Class: "openai"}, + } + err := validateImage(&cfg) + if !errors.Is(err, ErrInvalidInput) { + t.Fatalf("validateImage(no credential) = %v, want wrapping ErrInvalidInput", err) + } +} + +func TestValidateImageAcceptsDisabledHostedWithoutCredential(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Hosted = map[string]config.ImageHostedProvider{ + "openai": {Enabled: false}, + } + if err := validateImage(&cfg); err != nil { + t.Fatalf("validateImage(disabled) = %v, want nil", err) + } +} + +func TestValidateImageAcceptsEnabledHostedWithCredential(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Hosted = map[string]config.ImageHostedProvider{ + "openai": {Enabled: true, Class: "openai", APIKeyEnv: "OPENAI_API_KEY"}, + } + if err := validateImage(&cfg); err != nil { + t.Fatalf("validateImage(valid hosted) = %v, want nil", err) + } +} + +func TestValidateImageRejectsEnabledLocalWithoutBackend(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Local = map[string]config.ImageLocalProvider{ + "sdxl": {Enabled: true}, + } + err := validateImage(&cfg) + if !errors.Is(err, ErrInvalidInput) { + t.Fatalf("validateImage(no backend) = %v, want wrapping ErrInvalidInput", err) + } + if !strings.Contains(err.Error(), "image.local.sdxl.backend") { + t.Errorf("error text = %q, want it to name the field", err.Error()) + } +} + +func TestValidateImageRejectsDefaultNamingDisabledProvider(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Default = "openai" + cfg.Image.Hosted = map[string]config.ImageHostedProvider{ + "openai": {Enabled: false}, + } + err := validateImage(&cfg) + if !errors.Is(err, ErrInvalidInput) { + t.Fatalf("validateImage(default names disabled) = %v, want wrapping ErrInvalidInput", err) + } + if !strings.Contains(err.Error(), `image.default "openai"`) { + t.Errorf("error text = %q, want it to name the field and value", err.Error()) + } +} + +func TestValidateImageRejectsDefaultNamingUnregisteredProvider(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Default = "missing" + err := validateImage(&cfg) + if !errors.Is(err, ErrInvalidInput) { + t.Fatalf("validateImage(default names unregistered) = %v, want wrapping ErrInvalidInput", err) + } +} + +func TestValidateImageAcceptsDefaultNamingEnabledLocalProvider(t *testing.T) { + cfg := minimalValidConfig() + cfg.Image.Default = "sdxl" + cfg.Image.Local = map[string]config.ImageLocalProvider{ + "sdxl": {Enabled: true, Backend: "sdxl-turbo"}, + } + if err := validateImage(&cfg); err != nil { + t.Fatalf("validateImage(default names enabled local) = %v, want nil", err) + } +}