22 Commits
Author SHA1 Message Date
sam f4c304cfba refactor: log through the injected logger with context; NATS handlers root in the registering context (#1927) 2026-11-13 03:56:12 +11:00
sam e3ffefdc7d fix(identity): use System as the one root identity and record who created every task (#1851)
deploy / plan (push) Successful in 25s
deploy / gate (push) Successful in 7m57s
deploy / agent-image (push) Successful in 21s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 2m12s
Drop the bot_user-derived root identity and the empty-identity sentinel. System
polls forge connections and owns instance-level work; a polled task stores the
polling identity, task_queued and work_request_submitted carry task id, actor
and principal, and an empty task identity is refused. Migration 0072 moves
empty tasks.identity, the identity-grants root key and the old root's
connection permits to System so a re-poll dedups.
2026-11-10 20:01:16 +11:00
sam d11a0cd245 fix(workflow): one baseline fix per repository revision, drop download noise from gate output (#1806)
deploy / plan (push) Successful in 14s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 1m2s
2026-11-08 17:23:21 +11:00
sam 0880e6a01c feat(natsrpc): propagate trace context across NATS and into task runs 2026-10-25 23:03:55 +11:00
sam 958561d255 feat(egress): record a test run's deliveries instead of sending them
A test run used to suppress only forge and push writes, which named one
destination among many. Deliveries now have one seam: TaskContext.Deliveries
records each as "would ..." and performs none, and a recording egress
session does the same for a Kit run's HTTP writes and central tool calls,
answering them synthetically. Provider hosts stay live, since model traffic
is how a test run reads. Native containers have no proxy (archie-core-n8d3).
2026-10-25 16:01:06 +11:00
sam 01acb97f96 chore: delete code no binary or test reaches 2026-10-17 10:14:26 +11:00
sam 05987f04e2 feat(daemon): execute and verify organisation repository connections 2026-10-17 09:32:39 +11:00
sam 1f4910a651 feat(workflows): test-run unsaved drafts and browse workflow version history
A test run pins a validated draft, runs with forge and push writes
suppressed and recorded per step, and is excluded from workflow stats.
The History tab lists revisions that changed a workflow, diffs them as
YAML and on the canvas, restores into the editor, and ties runs to the
revision they used.
2026-10-13 12:27:40 +11:00
sam 2aea980a01 refactor(forgerpc): identity RPC subjects are keyed by identity ID 2026-10-04 18:58:10 +11:00
sam 40d1062e08 feat(staterpc): one run credential per task, kept in the State Store, authorizes its store calls and its push 2026-10-04 18:32:45 +11:00
sam cb6b8618c2 refactor: cut remaining long comments down to what the code does 2026-10-03 22:06:57 +10:00
sam 780bc44d82 refactor: testing from the beginning. a journey in 150k lines of tests to none 2026-10-03 21:16:25 +10:00
sam 4e5b91d791 fix(daemon): resume a retry whose worktree is gone
prepareWorkspace chose between Manager.Prepare (refresh onto base) and a
separate Manager.Resume, and Manager.Resume only opened an
already-prepared clone. A remediation whose local worktree the terminal
cleanup removed, an expired volume dropped, or a different host never had
could therefore never be resumed, and the retry path had no way to select
the mode that continues pushed work.

Unify the two matched methods into Prepare(..., Target): Fresh resets onto
origin/<base>, a non-empty Target resets onto origin/<that branch>, and
either target clones a missing worktree. The daemon's retry path selects
the target from the task row and passes the persisted branch, so a resume
lands on the branch the open PR lives on and fails closed when it is not
on the remote.

Delete the container-mode no-op resume (hybridTrees.Resume and the
resumableTrees capability) now that the daemon owns it. The remediate
workflow no longer stages a resume, and the retired remediate.resume step
word stays resolvable as an inert stage: a stored definition is validated
as a whole collection, so a removed word would fail every workflow to
decode, not just its own.
2026-10-02 10:24:52 +10:00
sam 5c0efaceaf refactor(workflow): relocate Task/Status/Source and define workflow.Store (#754)
* refactor(workflow,store): relocate Task/Status/Source and define workflow.Store

Move store.Task, store.Status*/store.Source*, and the 3-method workflow
store interface out of internal/store into internal/domain/workflow as
workflow.Task/workflow.Status/workflow.Source plus a consumer-owned
workflow.Store, superseding store.WorkflowStore. internal/domain/workflow
now imports zero internal/store symbols; internal/store persists the
domain type instead (infrastructure depends on domain), and its Store
satisfies workflow.Store.

Updates every production and test caller of the relocated symbols across
daemon, webui, gateway, agentworker, agenttransport/nats, storerpc,
taskrun, and worktreerpc, and removes TestRecordDispatchViaExplicitTx per
docs/prds/state-store-contract.md (rev. 2c) sections 4 and 12 step 2.

Two workflow-package integration tests that exercise the real *store.Store
move to an external workflow_test package (store_integration_test.go) to
avoid a workflow(test)->store->workflow(prod) import cycle now that store
depends on workflow.

* no-mistakes(document): docs(state-store): mark §4.8 relocation done in state-store-contract
2026-09-07 00:39:26 +10:00
sam dbb6550ab3 fix(worktree): bind publication to dispatch grants
Worktree RPC used to accept repository coordinates from the sandbox. It now accepts only an opaque per-dispatch grant, and the daemon derives the repository path and branch from grant-owned state.

Repository worktree paths also move from an ambiguous flattened key to encoded owner/repo components. Origin-matched legacy clones migrate safely; mismatched legacy paths are preserved.
2026-08-22 22:06:54 +10:00
sam 1081a6c3ed feat(daemon): identity-scoped isolation + gateway session titles and /delete
Multi-identity daemon isolation:
- Split runIdentities into per-identity poll loops plus one shared
  maintenance-and-drain loop, so reconcilePRs and storage cleanup run in
  multi-identity mode and the global max_concurrency / per-repo
  serialization holds across identities.
- Make the poll path identity-aware: each identity polls with its own
  forge client, bot user, label, trigger, and ack reaction.
- Make allowConcurrentFor task-based and identity-aware via repoFor.
- Roll back storage mounts when container acquisition fails; log
  Store.Update failures after branch set.

Container-mode RPC identity routing:
- forgerpc/worktreerpc gain identity-scoped subjects (SubjectFor,
  RegisterFor) and identity-carrying clients.
- registerTaskRPCServers registers one server pair per identity (plus
  root), so a container-mode task owned by a non-root identity is served
  by its own forge client and worktree manager.

Gateway/Telegram:
- LLM-proposed session titles generated in the background after turns
  (TitleGenerator + chatTitleGenerator), persisted by the gateway.
- /delete session command with prefix guard and tracker forget.
- Shared session display helpers (shortSessionID, sessionDisplayTitle,
  resolveSessionRef).
2026-08-08 01:32:35 +10:00
sam 6ee605a4fc fix(worktreerpc): bound handler contexts and drop the git binary from tests
Missed in f800e1d, which ported internal/worktree but stopped at "the
sibling package still compiles".

Both NATS handlers ran their work under context.Background(). The client
side has a Timeout and passes a context, but the server discarded it, so
a prepare or push ran unbounded. That was survivable when the work was a
git child process that could be killed; after f800e1d it is an in-process
go-git clone, so an unresponsive forge wedges the handler goroutine
permanently. Removing the per-repo object cache in that same commit made
clones longer, which widens the window further.

Server now has a Timeout (defaulting to 15 minutes, sized for a large
clone over a slow link) applied via handlerContext, with a table test
asserting both the explicit and default paths produce a bounded deadline.

The fixtures also still shelled out to git, so every test in the package
skipped when no git binary was present and the helpers tripped noctx.
Rebuilt on go-git to match internal/worktree's suite, including pinning
commit.gpgSign=false on the seed repo so fixtures do not inherit signing
from the host's global config.
2026-07-28 02:05:06 +10:00
sam f6d51416f0 chore: replace 607 em-dashes with double hyphens project-wide
Includes MCP crash-after-init test fix (crash moved from handle() to serve()
entry point so transport sees immediate subprocess death).
2026-07-26 09:53:33 +10:00
sam 6ebbd3b2cf fix: add missing LinkBranch stubs to test doubles
Fix go vet/test failures by adding LinkBranch methods to stubForge, prCapturingForge, testForge, and fakeForge. Update test data from 'sam/archie' to 'acme/widget' and state label defaults from 'archie:*' to 'agent:*'. Add Taskfile.yml for project build automation. Implement container self-network detection so spawned agents join the daemon's Docker network.
2026-07-24 13:32:50 +10:00
sam d80401d595 feat: add config overlay and shared RPC/Yaegi packages
- Introduce `-config-overlay` flag and `config.LoadOverlay()` to merge a base config with an overlay file, only overriding fields the overlay sets. This enables docker-compose to mount the base config from the host and apply only deployment-specific overrides.
- Create `internal/natsrpc` package with reusable NATS request/reply primitives (Envelope, Client, Call, RegisterAll, Respond). Migrate storerpc, worktreerpc, and forgerpc to use it, eliminating duplicated marshal/unmarshal and error handling.
- Create `internal/yaegiutil` package with shared interpreter construction (stdlib + extra symbols), generic export resolution (Resolve), and panic recovery (Safe). Migrate all Yaegi-based surfaces (gate scripts, daemon plugins, skill plugins, workflow stages, skill scripts) to use it, reducing boilerplate and centralizing panic safety.
- Simplify `config.docker.toml` to contain only overlay fields (paths, container config) and remove the duplicated repos list – the base config is now the single source of truth.
- Update docker-compose.yml to pass both -config and -config-overlay flags and mount the base config from the host.
- Add tests for LoadOverlay, DockerConfigOverlaysExampleConfig, Envelope, and yaegiutil utilities.
2026-07-24 12:57:10 +10:00
sam 1369ab1c84 fix: proxy worktree Prepare too, not just Push (archie-core-5zh.3 follow-up)
Discovered while scoping archie-core-5zh.4: Trees.Prepare's fetch/checkout/
reset also run through the token-authenticated askpass helper, and workflow
stages call tc.Trees.Prepare directly (internal/workflow/steps.go), not
just the daemon's pre-container clone. So Prepare needs the same proxy
treatment as Push — both are network git ops requiring the credential;
CommitAll/Diff/ChangedFiles/ChangedLines stay local as originally scoped.
2026-07-24 08:27:35 +10:00
sam afa8c05ca7 feat: worktree push RPC proxy for archie-agent (archie-core-5zh.3)
Add internal/worktreerpc: core NATS request/reply so archie-agent can
request a git push without holding the forge push token. The server
resolves the worktree directory itself from owner/repo/issue rather than
trusting a path from the sandboxed agent, then calls the daemon's own
worktree.Manager.Push (which already holds the token). Prepare, CommitAll,
Diff, ChangedFiles, and ChangedLines stay local git ops the agent can run
directly against its bind-mounted worktree — only Push needed proxying.

All three RPC proxies for archie-core-5zh now exist (Store, Forge,
worktree push); archie-core-5zh.4 (the actual stage-loop move) is
unblocked.
2026-07-24 08:05:15 +10:00