task_logs could only read the newest N entries with no way to walk the
rest, so a task's log beyond the page cap was unreachable and the agent
had no honest way to say what was missing. Add logging.Page -- a
byte-offset cursor over the tail-most 8 MiB scan window -- plus
Query.Since/Until time bounds, and wire the gateway's task_logs tool to
expose level/since/until/after_id with cursor and more_available in the
result.
The reader now reads the scan window into a single in-memory buffer and
walks it by exact slice offsets. Offsets into a contiguous buffer are
trivially correct, which an incremental reader over the file is not:
bufio.Reader buffers ahead, so its underlying file position runs one
buffer past its logical position and cannot be used as a cursor. The
same rewrite removes f.Read in favour of f.ReadAt (full-or-error), since
a silent short read would drop the newest entries and still report
success.
The scan window is a documented hard ceiling: for a log over 8 MiB the
oldest bytes are unreachable by any cursor -- that is what Truncated
reports, and send_file remains the path for a complete archive. The
tool description teaches the model the difference between more_available
(more this call did not return) and truncated (older entries the scan
cap hides).
Closes archie-core-vq92 (#625).
Task runs now preserve real model context limits, provider usage, baseline-repair spend, commit identity, durable agent-finish telemetry, and useful timeline details without imposing a token cap. Dashboard forge links are canonical per owning GitHub or Gitea identity. Chat turn claims acquire SQLite writer intent before reading, eliminating the concurrent SQLITE_BUSY snapshot race.
Dashboard-initiated updates also retain a configured Telegram restart-report route, while falling back to the web UI report when Telegram is unavailable.
task check's go fix pass rewrote the test helper to Go 1.26's generic
new(v) and marked it //go:fix inline. Committed from the gate rather than
left dirty in the tree.
Origin validation compared the request's Origin against the daemon's own
direct connection: scheme from r.TLS, host from r.Host. Behind a TLS-
terminating reverse proxy the browser sends Origin: https://host while the
daemon sees a plain HTTP connection, so every dashboard mutation was
refused as cross-origin.
Taking X-Forwarded-Proto/-Host unconditionally would be worse than the bug:
any client can set them, so an exposed daemon would let an attacker forge
the scheme half of the CSRF check. They are honoured only when
web.trust_forwarded_headers is explicitly enabled, which is off by default
and documented as safe only behind a proxy that overwrites or strips
untrusted forwarded headers.
authorizeTaskMutation becomes a method because the decision now depends on
server configuration; its three call sites move with it.
Follow-up to 0b2398f, which claimed non-delivery is never silent and that
oversized files fail visibly. Both claims had gaps.
chatStreamSink.Media skipped any attachment with an empty URL, exactly as
liveReply.Media used to. The tool registry is shared between the Telegram
and dashboard chat setups, so send_file is offered on the dashboard too:
the model announced a sent file, the sink dropped the event, and nothing
reached the transcript. The dashboard cannot upload at all, so the fix is
to REPORT the file as undeliverable and name where it is on the host,
rather than to stay quiet. The skip was right while media meant a hosted
URL; it stopped being right when a host path could arrive here.
send_file applied one 50MB ceiling to every type while the sender enforces
10MB for photos, so an 11-50MB image passed the early check, was reported
sent, and was rejected by a layer the model cannot see. The early check is
now per-type and mirrors the sender's limits.
MediaType called every image/* an image, but a photo endpoint rejects
image/svg+xml and image/tiff outright. Photo-safe formats are now an
explicit set, so an svg goes as a document and arrives, which is what the
"unrecognised means document" reasoning intended all along.
Also tests the readability probe's own error path (mode 0000), which was
the one case it exists for and the one case not covered; verified it fails
with the probe removed.
Remaining review findings are filed, not fixed: fallback lines appended
after the live reply finalizes are dropped by a stopped renderer
(archie-core-atv2), confinement is symlink-blind and re-opens after
checking (archie-core-jkmu), and concurrent uploads are uncapped
(archie-core-3svc).
The agent could produce a file -- a transcript, a log dump, a screenshot --
and had no way to hand it over. Asked to send one it offered a "download"
link; nothing arrived and it had no signal that anything had failed. The
defect was not that it lied: success and silent non-delivery were
indistinguishable to it.
Three places made a local file undeliverable, and each is fixed here:
- liveReply.Media skipped any attachment with an empty URL, so a local
file was dropped before it ever reached a sender.
- telegramMediaSender built every attachment as models.InputFileString,
which tells Telegram to FETCH the string as a URL. A host path is not
fetchable, so the send did nothing while reporting success. It now
chooses by what the attachment carries: URL -> fetch, Path -> upload
via models.InputFileUpload over an open file.
- Nothing let the agent ask for a send at all. New send_file tool
(internal/tools/sendfile) validates the file and returns a
MultimodalResult naming it; the turn's channel delivers it.
Meaning changes, called out because the names did not:
- MediaAttachment gains Path, the alternative to URL. Exactly one is
meaningful for an outbound send.
- tools.MultimodalResult.URLs used to mean remote-hosted media only; it
now means media this result wants delivered, which may be local. JSON
name unchanged so existing producers keep working.
- errNoURL is now errNoSource: having neither source, not having no URL,
is what makes an attachment undeliverable.
Failures are visible at every layer, which is the actual fix. send_file
errors on an absent, irregular, unreadable, oversized or confinement-
refused path, so the model sees it and can report it. The sender checks
Telegram's ceilings (10 MB photos, 50 MB otherwise) before the request and
reports the real size rather than leaving a 400 nobody reads. A delivery
that still fails now appends "could not send <name>" to the reply instead
of an empty link, which read as a delivered file.
Exposing a public URL for local files was explicitly rejected: it trades a
missing feature for a hosting and access-control problem.
send_file resolves paths through builtin.ResolveReadable -- the read tool's
own policy, exported rather than reimplemented -- so sending cannot reach
what reading cannot, whatever [chat] unrestricted_filesystem is set to.
When an operator stopped a running task via chat /stop or the dashboard
Stop button, the task's context was cancelled. Container teardown
correctly completed (as Pool.Release detached its context), but terminal
state recording in Daemon.runViaAgent and worktree cleanup in
Daemon.cleanupTerminalTaskWorktree executed using the same cancelled
context. Consequently, SQLite transactions in store.Transition failed
immediately and errors were discarded, leaving the task row in 'running'
indefinitely until a daemon restart.
Extract parkRunningTask in internal/daemon/daemon.go to perform guarded
state transitions (store.StatusRunning -> store.StatusParked) using a
detached context (context.WithoutCancel) with a bounded 10-second timeout.
Update cleanupTerminalTaskWorktree to also use a detached 10-second
context for looking up the task status. Check transition errors and log
warnings for unexpected database failures while suppressing expected
ErrStaleTransition returns when workers have already completed. Add
comprehensive table-driven regression tests covering task cancellation,
worktree cleanup, and logging behavior.
Adds the task_action tool to internal/gateway/task_tools.go and wires it via
chatTaskActorAdapter in cmd/archied. This enables operators in chat to execute
lifecycle actions (abandon, archive, retry, stop, cancel, approve, reject) on
tasks using the same action path and state machine as the dashboard.
Enforces identity scoping so an instance cannot mutate another identity's
tasks, verifies status permissions via internal/taskstate, and classifies the
tool as mutating with required human approval.
Section 1 of the adversarial self-review decision was superseded on
2026-08-24: it assumed daemon-owned in-process execution and a daemon-side
second Pool.Acquire, both removed by archie-core-q15y. It is now re-decided
rather than merely marked dead, so the document is Active again.
The reviewer is an agent.Subagent run from inside the task-scoped worker.
ai-sdk v0.1.22 is already pinned, so this needs no SDK bump, and it adds no
host executor, no second container acquire and no nested container lifecycle
-- the open question the supersession left.
Subagent.Run passes Prompt and never populates Messages, so conversation
isolation is a construction fact rather than prompt text. It does NOT give
filesystem isolation: the sub-agent shares the parent's process, working
directory and credentials, so the .git-stripped snapshot survives from the
original design and is load-bearing, and the reviewer's toolset must be
read-only, rooted at the snapshot, and must exclude the worktreerpc
publication grant -- otherwise a reviewer could push the branch it exists to
block. Run() not Tool(), so the implementer cannot elect to review itself.
Findings return through a closure-captured tool because Run yields only text,
and are read even when Run errors, since captured findings survive.
Also decides fail-closed: a review that fails to RUN parks the task rather
than opening an unreviewed PR. ReviewEnabled is opt-in, so an operator who
turned the gate on wants the gate. This is why h019.2 models "ran and found
nothing" separately from "did not run" -- collapsing them would make an
outage indistinguishable from a clean review.
h019.3 is unblocked and rewritten with the construction rules. h019.4's
description said the task parks as waiting_human, contradicting section 4's
decision of StatusParked; corrected, and the fail-closed rule added.
Delete the redundant package doc comment from review_findings.go to preserve
workflow.go as the single canonical package comment, and consolidate the
package-level decision function to a single ReviewBlocking export mirroring
gate.Blocking.
Define the ReviewFinding and ReviewReport domain types, enums (verdict,
level, category, disposition, status), and pure decision functions for
adversarial review stages.
Enforces the load-bearing rule that only confirmed error findings may
block workflow execution; plausible findings, regardless of severity,
never block. Explicitly models the distinction between an unexecuted
review stage (ReviewStatusNotRun) and one that completed with zero
findings (ReviewStatusCompleted), ensuring data boundaries across JSON
are robust and unambiguous.
strings.Index plus slicing becomes strings.Cut. Semantics are unchanged:
Cut splits on the first separator, so before/after equal the previous
title[:idx] and title[idx+1:], and ok mirrors idx != -1.
Tasks completing with BuildNoChanges transitioned directly to StatusMerged
without opening a pull request, bypassing the only production worktree
cleanup path inside reconcilePRs (which only queries StatusPROpen tasks).
As a result, every no-change task leaked a full git clone on disk.
Clean up the identity-correct worktree on terminal non-PR completions:
- In daemon.process, invoke cleanupTerminalTaskWorktree using the task's
identity-resolved worktree manager when the task reaches a terminal
status (Merged/Rejected/ClosedWontDo) with PRNumber == 0.
- Ensure parked tasks and open-PR tasks retain their worktrees for
post-mortem triage and PR reconciliation respectively.
- Add lifecycle regression tests in internal/daemon/terminal_cleanup_test.go.
Fix three distinct bugs in worktree operations:
- Push post-publication metadata failure no longer reports a push error after successful ref publication; errors recording upstream tracking are logged as warnings via Manager.Log/slog.Default().
- CommitAll honours context cancellation and deadline expiration before and between go-git staging and committing phases, preventing unintended index or HEAD mutations.
- Align branch naming precedence by deriving conventional commit prefixes from issue titles first before falling back to labels and defaulting to feat; remove dead parameters and TrimSuffix no-op; align branchSlug documentation and boundary limit to 60 characters.
The beads DB rebuild that left .beads.backup-pre-recovery/ reverted every
closure recorded after its backup point. The code was never lost, only the
tracker state, so 16 issues sat open against work that had already shipped.
Restored those 16 from .beads/interactions.jsonl, taking the last status
change per issue and keeping each original close reason verbatim. Closed a
further 12 after verifying the work on main: the whole q15y epic
(1b7bc00, cc6b093, 5d00ec7, 972fb5b), mzok, bia3, hqst, and 1ysw.1/.2/.4/.5.
Superseded two orphaned re-imports of t2db.3 and t2db.5.
Rewrote the four surviving 1ysw descriptions with verified reproductions;
1ysw.9 in particular claimed a checked-in FIXME that no longer exists.
GitHub is now 561/561 in agreement with beads. dfck's close reason said its
opt-in lived in InProcessRunner, which q15y.3 deleted; the mechanism moved to
agentexec.NewLoopRunner (loop_runner.go:106) and the reason now records that.
tb3a's said its worktree was left uncommitted; it merged as 1e5e1fb (PR #477).
Autonomous workflows now always hand a complete task to a scoped archie-agent container. Embedded NATS is the default and external NATS changes only broker placement; legacy agent and containers.enabled inputs decode for migration but cannot select an execution path. The daemon flushes task-event subscriptions before a worker can publish, and runtime updates snapshot and restore the configured worker image.
Autonomous workflows now have exactly one production boundary: a task-scoped archie-agent receives a full-task core-NATS request and runs the worker-local stage loop. The legacy [agent] section remains decode-only for migration; it no longer selects runtime behavior.
Autonomous tasks no longer execute workflow stages inside archied; missing worker capability parks before worktree preparation.
A transition to parked now atomically makes its detail the task park reason, so daemon-side failures remain visible in task APIs and the dashboard.