Commit Graph
1477 Commits
Author SHA1 Message Date
sam 1deac797b9 chore(release): archied v1.27.0 archie v1.27.0 2026-09-17 13:42:26 +00:00
sam 3b801af68a Merge pull request #845 from samcharles93/feat/839-telegram-tool-activity-block-is-uncapped-and-crowds-out-the
Telegram tool-activity block is uncapped and crowds out the answer (archie)
2026-09-17 22:40:21 +10:00
sam e338473414 Merge pull request #846 from samcharles93/feat/835-disk-readiness-probe-watches-only-work-dir-so-a-full-root-fi
Disk readiness probe watches only work_dir, so a full root filesystem goes unreported (archie)
2026-09-17 22:39:15 +10:00
sam 4ef56edd77 Merge pull request #848 from samcharles93/feat/state-store-task-log-download
feat(staterpc): read task logs through the State Store and make them downloadable
2026-09-17 22:38:16 +10:00
sam 10c2543527 fix(webui): do not hand back an error as a .log download
The download sets its attachment headers before the read, because the body
streams straight from the reader and a log is unbounded input -- buffering it
to size the response would defeat the reason it streams. Nothing then cleared
those headers, so a 404 for an attempt with no log went out as

	Content-Disposition: attachment; filename="task-1-attempt-0.log"
	Content-Type: application/x-ndjson

A browser treats that as a download: the caller gets a .log file containing
the text "no log recorded for this attempt". A stale or direct download URL is
enough to trigger it. The 503 for a process with no reader had the same shape.

Both error paths now clear the attachment headers before writing, so the
response is an error rather than a file. The successful path is unchanged.

Red first: the existing test asserted the status only, which is how this
passed. It now asserts the headers are cleared on a 404 and on a 503.
2026-09-17 12:33:45 +00:00
sam dc744c0b4f feat(ui): download a task attempt's log, and stop blaming a setting for it
The attempt-log panel offered no way to get a log out of the dashboard, and
its failure copy asserted that task logging was not enabled for the run. The
first is the feature: the panel now links to the download route for the attempt
it is showing, so the browser owns the filename the server sets and streams the
body to disk rather than the client holding a whole log in memory.

The second is the honesty fix. "No log recorded for this attempt" is a fact
about the attempt; "this dashboard cannot read task logs" is a fact about the
deployment, and only the second is worth sending an operator to a setting for.
The panel renders them differently off the response's found/disabled markers.

Rebuilds ui/dist, which is a committed asset.
2026-09-17 12:12:47 +00:00
sam 21d8250cde feat(webui): read a task's log through the State Store and let it be downloaded
The dashboard's attempt-log panel answered every read with "task logging is
optional and was not enabled for this run". That message was false: logging is
wired unconditionally in the daemon, and the log files exist. The dashboard
process simply had no reader -- composition left TaskLogs absent because no
contract carried it -- so the handler saw a nil registry and reported the
disabled shape, which the page rendered as a claim about configuration.

internal/logging now answers whether an attempt has a log at all: Tail sets
Result.Found, so "this attempt has no log" is a value rather than an empty
list indistinguishable from a read that never happened. Its registry gains
TaskLog (a decoded page) and TaskLogContent (the file verbatim, streamed,
because a log is unbounded input), and an absent reader reports
ErrTaskLogsUnavailable rather than an empty page -- a process that cannot read
logs must not implicate the attempt.

Those two answers travel the State Store contract as storecontract.TaskLogStore
(ReadTaskLog, StreamTaskLogContent) and are rehydrated on the client by
(Unavailable, canonical message), so archie-ui composes the reader from its own
store client instead of opening another process's files. The daemon's registry
is wired as the server-side reader in the State Store process only.

On top of that read, GET /api/tasks/{id}/logs/download serves the attempt's log
as a Content-Disposition attachment named task-<id>-attempt-<n>.log, and the
panel offers it. The JSON route keeps its shape and gains found, so the page
states the attempt has no log instead of blaming a setting.

Task log files stay owned by their directory's owner: archiving still removes a
task's log directory, and that removal is the daemon's, not the dashboard's.
2026-09-17 12:12:43 +00:00
sam 781358c862 feat(staterpc): add the task-log read contract to the State Store service
One task attempt's persisted log lives in the state directory the State Store
process owns, and no contract carried it: the dashboard process therefore had
no way to read a log at all, and answered every attempt with "task logging is
optional and was not enabled for this run" in a deployment where logging is
unconditional.

ReadTaskLog returns a decoded page and StreamTaskLogContent returns the raw
bytes server-streamed -- a log rotates at 20 MB, past gRPC's unary cap, the
same reason StreamCaptures superseded ListCaptures. found=false with no error
means the attempt has no log; a service with no reader answers Unavailable,
and keeping those apart is the point: only the second is a deployment
condition.
2026-09-17 12:09:43 +00:00
sam 2cd796a3a3 feat(gateway): persist the channel-native sender id on messages
Slice 1 of docs/prds/memory-engine-unification.md: persist the
participant, so a later curator can address agent-user memory scope.

- messages gains sender_id: schema, ALTER migration (idempotent via
  duplicate-column detection), both inserts, and both history selects.
  Pre-existing rows default to empty.
- curator.SessionSummary gains AgentID and ConversationMessage gains
  SenderID; the sessioncurator adapter fills them from the session's bot
  identity and the stored record.

The memory contract is untouched and nothing consumes the new fields
yet. Deriving a session's participant from its user-role messages, and
failing closed on ambiguity, stays with the curator rewrite.
2026-09-17 22:06:54 +10:00
sam 51a05c0f33 fix(readiness): keep required status when an optional target shares a path
Targets are deduplicated by path so a shared filesystem is probed once, but
the first target seen won. With root, then an optional /var, then a required
data path that resolves to /var, the optional target is the one that survived
-- so its rules were applied to a path the daemon requires. An absent /var is
skipped as "optional absent", and with another healthy target present the
probe reported OK while a required path was unavailable.

Deduplication now keeps the strictest requirement any target places on a
path, and its name, so the failure is both visible and correctly attributed
rather than reported against the optional target that happened to come first.

Red first: the new test drives the reported scenario through an injected
statfs and failed with `status = "ok", want degraded` before the fix.
Verified by mutation -- restoring first-wins dedup fails it again.
2026-09-17 11:48:23 +00:00
sam 3b266c71ce fix(telegram): keep every tool line that fits and mark every answer cut
Two defects in the activity/answer budget, both found in review.

The tool block returned as soon as the newest line alone fit, so a turn with
several short tool calls discarded history that was never over budget and
reported a "+N earlier" that was untrue -- those lines had room. The window
now widens from the newest line backwards while the result still fits, so
every line that fits is kept. The indicator appears only when something is
genuinely left out.

The opening frame sliced the answer to its budget without an ellipsis, so a
large first chunk -- or a turn that never opened a reply, leaving messageID 0
-- rendered text that appeared to begin mid-sentence, while later frames
marked the same cut. Telegram messages are immutable, so it could never be
corrected. Every frame now marks the cut; the special case only ever bought
one rune.

TestLiveReplyFramesStayWithinOneMessage asserted the ellipsis on the last
frame only, which is what let the unmarked opening frame through. It now
checks every frame, and the count bound follows: identical frames are
deduplicated by render(), so an unmarked opening frame was previously a
distinct body where a marked one is not. Verified by mutation -- restoring an
unmarked opening cut fails the test on frame 0.
2026-09-17 11:40:08 +00:00
samcharles93 8378c92739 Disk readiness probe watches only work_dir, so a full root filesystem goes unreported (archie)
Implements #835
2026-09-17 11:34:38 +00:00
sam 9bbce39df2 chore(telegram): resolve the state-store test conflict and drop dead clamp helper
Rebased onto main, which now carries an equivalent STATE_STORE_TOKEN isolation
guard in state_store_client_test.go from an independent baseline repair. The
two changes were the same fix expressed twice, so main's wording is kept and
this branch's duplicate is dropped -- the file is now identical to main and no
longer appears in the diff.

That leaves one commit, touching only internal/channels/telegram/live.go.

Removing clampToOneMessage, which this change orphaned: all three of its call
sites were replaced with clampToRunes directly, and `unused` flagged it. Dead
code left behind by a rewrite does not ship.
2026-09-17 11:31:05 +00:00
samcharles93 8dd8841a7a Telegram tool-activity block is uncapped and crowds out the answer (archie)
Implements #839
2026-09-17 11:27:52 +00:00
sam b215636f99 Merge pull request #844 from samcharles93/fix/archied-watchdog-test-flake
fix(archied): stop the shutdown-watchdog test racing the scheduler
2026-09-17 21:24:29 +10:00
sam 405e525c76 Merge pull request #843 from samcharles93/feat/840-repeated-successful-tool-calls-are-never-collapsed-into-a-co
Repeated successful tool calls are never collapsed into a counted entry (archie)
2026-09-17 21:23:52 +10:00
samandgreptile-apps[bot] e39b02d7ee Update internal/gateway/stream.go
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-09-17 21:19:53 +10:00
sam bd7fb053a7 fix(archied): stop the shutdown-watchdog test racing the scheduler
TestShutdownWatchdogHangingPastLeashForcesExit gave the watchdog two leash
lengths (60ms) to force an exit, but the 30ms leash only starts the timer --
the firing goroutine must then be scheduled before the injected exit is
observable. Measured margin is ~29.7ms, so the test is a wall-clock race
against the Go scheduler and fails intermittently on a loaded machine, where
it parks real work behind a gate failure unrelated to the change under test.

The assertion is now the contract that actually matters and that scheduling
jitter cannot falsify: the exit must not happen before the leash, and it must
happen. Waiting for it uses a generous ceiling, and the new elapsed >= leash
check catches an early fire strictly -- something the old test could not do,
because it only bounded lateness.

The inverse test asserts the ABSENCE of a forced exit, which load cannot
falsify (a slow runner only delays the exit being checked for), so it keeps a
tight bound and the suite stays fast.

Verified by mutation: removing the forced exit fails the first test, and
firing before the leash now fails it on the new elapsed check.
2026-09-17 11:17:19 +00:00
samcharles93 cca71a5dd6 fix: Repeated successful tool calls are never collapsed into a counted entry (archie)
Fixes #840
2026-09-17 11:13:11 +00:00
samcharles93 38036912fd test: failing repro
Refs #840
2026-09-17 11:10:30 +00:00
samcharles93 f93792d1c0 fix: baseline gate repair (go test ./... -count=1) 2026-09-17 11:03:29 +00:00
sam 884fcd0ce8 Merge pull request #838 from samcharles93/fix/telegram-output-and-bot-upgrade
fix(telegram): summarise tool results instead of quoting an arbitrary line
2026-09-17 20:31:50 +10:00
sam 5539f2b343 fix(telegram): require the truncation wrapper before treating a count as metadata
Review found that a bare "showing 3/197 lines" inside ordinary output was
accepted as truncation metadata and replaced by a summary, hiding the real
result. Both built-in producers wrap the notice as "[truncated: …]"
(internal/tools/builtin/truncate.go), so the wrapper is now required rather
than tolerated: it is the only marker separating a notice the tool printed
from content that merely mentions a count.
2026-09-17 10:13:07 +00:00
sam d783bebf37 fix(telegram): address greptile review on tool-result rendering
Four findings from review, all valid:

1. Search detection is now gated on the tool name rather than applied to every
   result. A compiler diagnostic ("file.go:42: message") has the same shape as
   a search hit, so counting it reported a build error as "N matches" and hid
   the diagnostic.

2. Only ripgrep match lines are counted. The hyphen context form
   ("path-N-text") and "--" group separators were being counted as matches, so
   a search with context requested reported the match count plus every
   surrounding context line.

3. The notice parser accepts shell's "showing last N/M lines" form as well as
   the plain "showing N/M lines" one. Shell emits the "last" form, which failed
   integer parsing and was not recognised as metadata -- so a truncated shell
   result quoted the raw truncation notice as its preview, the exact defect this
   change set out to remove. The summary now also states which end was kept
   ("97 lines total; showing last 66" for a tail truncation).

4. The renderer cases are consolidated into one table-driven test per the
   development protocol in AGENTS.md, covering all four defects above plus
   singular/plural, colons in paths, and module-cache noise.
2026-09-17 09:49:49 +00:00
sam 72bc95cc00 fix(telegram): summarise tool results instead of quoting an arbitrary line
Operator report: tool output in the Telegram channel was unreadable during
search-heavy turns -- a wall of fenced blocks each showing one arbitrary
match line ("/path/config.json-322-          }") under a heading that said
only "grep -- done".

The renderer quoted the first non-module-cache line of a result and appended
a line count recomputed from its own truncated sample, which could not agree
with the total the tool had already reported: one search rendered the tool's
"194 more lines" beside our "… 3 more lines". Two different numbers for one
result set read as noise, and the quoted line carried no context at all.

- Describe, don't quote: a search is reported as "N matches", a truncated
  result as "<total> lines total; showing <n>", and every other tool falls
  back to its first informative line. Truncation notices are skipped, since
  they are metadata rather than content.
- Never invent a count: the tool's own reported total is the only
  trustworthy source, parsed from its truncation notice rather than
  recomputed from the visible sample.
- Remove the now-dead compactToolPreview and countNonEmptyOrContentLines.

Also bump go-telegram/bot v1.25.0 -> v1.27.0, which fixes a streaming bug
that lands squarely on this path: rawRequest sent the multipart body through
an io.Pipe, which net/http cannot replay, so sendMessage/editMessageText
failed until the connection was dropped.

Remaining work from the report (collapsing repeated calls into one counted
entry, and a ring of recent activity lines with a capped frame) is tracked
in #837.
2026-09-17 09:36:28 +00:00
sam b250dc47d1 docs(release): document what a release publishes
The zip and its Release were undocumented: RELEASING.md described the
images and the gate, and nothing about dist-zip, the Release asset, or
that a gateway-only release does not rebuild the agent image. Adds that,
plus the consequence that bit this release -- Actions runs the workflow
from the tagged commit, so a deploy.yml fix must be an ancestor of the
tag rather than a commit on top of it.
2026-09-17 07:20:33 +00:00
sam 6dfbc5180d chore(release): archied v1.26.0 archie v1.26.0 2026-09-17 07:17:34 +00:00
sam 5a778065a8 ci(deploy): publish a GitHub Release with the distribution zip
The dist-zip job built the linux/amd64 zip and uploaded it as an Actions
artifact, then stopped. An artifact is reachable only from the run's page,
behind an Actions login, and expires after 90 days -- so every release since
the zip job landed produced a download an operator could not find. The one
Release on this repo (archied/v1.22.0) was created by hand and carries no
asset at all: nothing in CI has ever created one.

Publish the Release from this job and attach the zip:

- Job-level `permissions: contents: write`. The workflow default is
  contents:read, so a publish step would fail without it; scoping it to this
  job keeps the build-and-push jobs read-only.
- The body is this version's changelog section, extracted from the "## [x.y.z]"
  heading to the next "## [" heading rather than pasting the whole file. The
  changelog stays the single source of truth, and the tag/changelog gate in
  `gate` has already proven the section exists.
- Attached to the archied tag, because the zip is named and versioned for
  archied; `--follow-tags` pushes both tags at one commit, so the runtime
  release is the same commit.
- Idempotent: `gh release view` decides between `create` and
  `upload --clobber`, so a retried or superseded deploy run cannot fail on an
  existing Release or duplicate the asset.
- Fails loudly when the section extracts empty, rather than publishing a
  Release with no notes.
2026-09-17 07:17:27 +00:00
sam 8c4a10d6d0 chore(fmt): adopt gofumpt wrapping in contractaudit
task fmt reformatted this file's fmt.Fprintf call; committing it rather than
letting it ride in the release commit, so the release diff stays the changelogs
alone. AGENTS.md: formatter changes are adopted verbatim.
2026-09-17 07:10:03 +00:00
sam 592a6262b5 docs(prds): land the memory engine unification decision
Approved for implementation, dated 2026-09-16, previously untracked.
Settles four open items in docs/architecture/migration-decisions.md#5 and
supersedes the memory-turn-context.md draft.

Section 8's deletion list no longer names config.Memory.SessionTTL: the
council carried that deletion standalone and f25dd1e removed the field,
so listing it here would schedule work already done. Provider and
ProviderConfig are unchanged, both still present.
2026-09-17 00:34:01 +10:00
sam f25dd1e867 refactor(config): delete the two decoded-but-unread policy fields
MemoryConfig.SessionTTL and ToolPolicy.ParallelExecution were decoded by
config loading and read nowhere, so setting either silently did nothing.
Removing them routes both keys into the unknown-key detector, which names
them in a boot warning instead. A live-looking knob wired to nothing is
the worse state, and the sibling memory.provider already earned a loud
load-time rejection for exactly this.

Also drops the config.example.toml line that shipped session_ttl into
every first-run config.toml via configtemplate.go, and the commented-out
dir_test.go assertions that would have re-created both fields under that
file's "make these pass without modifying them" header.
2026-09-17 00:32:02 +10:00
sam 0de7d07519 fix(skills): correct the diagnostics scripts and rebuild the baseline
Three defects made every archie-diagnostics-and-tooling measurement wrong:

- source-metrics.go and config-use-candidates.go walked .worktrees/, the
  live git worktrees nested inside the repo root. Each is a near-complete
  copy of the module, so counts were multiplied by the number of checkout
  worktrees: production_go_files read 1234 against 422 tracked, and 248 of
  421 PACKAGE/HOTSPOT rows were duplicates. Selector counts were inflated
  ~3x, which hid Repo.TestGlob behind a real candidate and buried the rest.
- delivery-snapshot.sh scanned .gitea/workflows, deleted in e539048. Under
  `set -eu` that aborted the run at rc=2 after 10 of 26 rows, silently
  dropping every HYGIENE and MODULE row.
- Its composition-root anchors pointed at cmd/archied/main.go, now a ~30
  line dispatcher, so all five rows reported a misleading 0. Repointed at
  internal/app/archied, where the wiring actually lives.

Both filesystem walkers now skip .worktrees (package-shape.sh reads
`go list` and was already immune), the CI scan covers the surviving GitHub
workflow including docker/build-push-action, and the MODULE find prunes
.worktrees.

Refresh SKILL.md to HEAD d565fb8: the dated snapshot, the delivery and
coverage claims, and notes on why only one candidate status is a signal
and why a composition-root zero is evidence about the anchor.

source-metrics.go now reconciles exactly with git ls-files: 408 + 9
production and 397 test files, plus the tools module's 5 / 2 / 0, against
422 non-test and 398 test tracked files.
2026-09-16 23:37:13 +10:00
sam d565fb8ade refactor(forge): delete the unwired RepliesAfter surface
DELETE: IssueForge.RepliesAfter and its Reply type had no production caller --
the waiting_human status exists and is reachable, but automatic detection of a
human reply never landed, so the intended poller was never built. Neither
implementation paginated either (both read one page of 50), so the method
would have been wrong if wired as-is.

The manual path is untouched: waiting_human remains reachable and an operator
requeues through the existing task-action flow. Removing the interface method
also removes seven test fakes that existed only to satisfy it.

No behavioural test accompanies this: a pure deletion has no assertion to
make fail, and the compiler enforces completeness across every implementation.
2026-09-15 16:54:16 +10:00
sam 0fdf7a2adb docs(architecture): record the NATS scaffolds as deliberate deferrals
servicediscovery/nats and gatewayrpc.StoreClient are implemented and fully
tested, but neither has a production caller and no config surface exposes
either. Both were previously unrecorded, which made them indistinguishable
from oversight. The register now names them: StoreClient under the session
migration that will consume it, service discovery under shared mechanics,
alongside the runtime boundary that pins container addressing by injected NATS
URL instead. Kept rather than deleted because re-deriving tested wire code
later is pure cost.
2026-09-15 16:54:12 +10:00
sam 61f7cb2dd8 docs(architecture): record the embeddings client as deliberately inert
setupEmbeddings constructs a client at boot and holds it on b.embeddings, but
no production code reads that field yet, so a resolved models.embedding role
currently produces a client whose only observable effect is a boot log line.
The document already notes that no curator consumes a Sampler yet; it now says
the same of the embeddings client, so the inert state is stated rather than
implied. Both are prerequisites waiting on #437, not unwired defects.
2026-09-15 16:54:12 +10:00
sam c15d14557c fix(tools): stop testing on the text of other files, and ungate contractaudit
Six tests asserted on the wording and formatting of source and config files
rather than on behaviour: four injected text into fixtures and checked that a
regex noticed, and two asserted on api.jsx's contents. They break on an extra
space, a newline, a rename, or a comment that merely mentions the token -- the
single-fetch check had already false-positived on a comment, and I patched it
with a comment-stripper instead of deleting it. A test that cannot tell "the
code is wrong" from "the file is formatted differently" tests the wrong thing,
and the maintenance cost is permanent.

Deleted: tools/contractaudit/negative_test.go in full, and the source-scanning
"api.jsx holds exactly one fetch call" check with its stripComments helper. The
dashboard suite still asserts the browser mutation contract behaviourally, per
method, by inspecting the request each one makes -- which is where the real
defect was found. 142 UI tests pass; the 45 methods remain fully covered by the
two inventories and the completeness check.

The tool's own decoding is now testable without a file: parseDeclarations takes
an io.Reader, so its rules are exercised with in-memory input, and only the
absent-file branch still touches a path (which is never created).

contractaudit is no longer part of task check. Its surfaces are discovered by
scanning source text, so a rename or reformat elsewhere can change its output
with nothing actually wrong -- it reported 16 live routes as unconsumed once,
when the dashboard's request helper was renamed. A check that can fail for
reasons unrelated to what it measures must not be able to break a build. It now
matches tools/reachaudit: advisory, run by hand, --strict available on request.

Also removes five unused indirect requires from tools/go.mod (go mod tidy).
They were residue from the reflection-based first implementation of the RPC
scan, which was replaced by text scanning without tidying. -mod=readonly cannot
catch a superfluous require, so nothing would ever have found them.

Rewrites docs/prds/contract-conformance-audit.md, which claimed RPC coverage was
derived by reflection over the exported client type -- it never was -- listed
surface sizes of 43/12/52 against real counts of 45/21/49, described three
classification classes where the code has four, invented a five-surface Shape
with files that were never written, and blamed raw fetch calls for a 401 defect
that did not exist. Each false claim is now recorded in an errata section rather
than quietly dropped, and the document states plainly that the audit has found
nothing actionable: the 415 refusals and the duplicated client plumbing were
both found by reading the handler and reproducing the request.

Testing rule added to the document, since this is the second time: assert on the
observable effect, never on the content or formatting of generated or
hand-authored text and config files.
2026-09-15 14:17:53 +10:00
sam 18e8f8f0e6 fix(ui): unbreak binding approve and the two deletes, and centralise the client
Three dashboard mutations were refused 415 on every use. archied's
authorizeTaskMutation runs before the handler body and answers
"Content-Type must be application/json" unless the request declares a JSON
body -- including when there is no body to send, because that requirement is
what makes a simple cross-origin form post inexpressible. bindingApprove,
mappingDelete and bindingDelete sent Accept and X-Archie-CSRF but no
Content-Type, so approving a binding or deleting a mapping or binding never
worked from the dashboard.

Reproduced against the real handler with the browser's exact headers: 415,
where the same request plus Content-Type returns 200 and arms the binding.
The Go tests missed it because doJSONWithHeaders sets Content-Type
unconditionally, even for a nil body, so no test ever exercised the shape the
client actually sends.

Every api.* method now goes through one request() (and one send()), which
sets Content-Type and the CSRF marker on every mutation rather than only
where a payload happens to exist. The module already claimed to be "the
single place that knows how to talk to archied" while 22 call sites built
their own fetch, headers, timeout and error handling inline and chat.jsx
built a 23rd; that claim is now true, and chat.jsx's stream goes through
api.chatStream so only the URL, headers and failure shape are shared while
chat.jsx keeps its abort/timeout and SSE parsing.

Behaviour deliberately preserved: 204 deletes still parse no body, the
install timeout stays 120s, and 401 still classifies as session-expired. One
intentional change -- a 401 message is now the server's own text ("open the
dashboard URL archied logged at startup") rather than a bare "unauthorised",
since errorMessage already prefers the actionable reason and the classification
is derived from the status either way.

ui/test/api-client.test.js asserts the browser mutation contract for every
method, that reads carry no mutation marker, that a 204 resolves without
parsing, that api.jsx holds exactly one fetch call, and that every api method
is classified by the suite so a new one cannot be added uncovered. ui/dist is
rebuilt, being a committed asset.

I had claimed this work was needed to fix a 401 defect. It was not: all 22 raw
call sites passed res.status to ApiError, so classifyActionError already mapped
401 to session-expired, and chat.jsx never classified at all. The missing
Content-Type was the real defect.
2026-09-15 13:49:53 +10:00
sam 22cb0c6de5 fix(tools): stop contractaudit crediting dead paths as live consumers
Renaming the dashboard's request helper from req( to request( broke the
consumer extractor: it matched the call by name, so 16 live routes were
reported unconsumed. The extractor now keys on the call argument instead,
which survives a rename.

The first attempt at that fix was worse than the bug, and is recorded here
because the direction of the error is the whole point. Crediting any quoted
/api/... literal meant a comment, a retired-route array, or a display label
counted as proof a route was reachable -- so deleting every real request
still reported the surface as healthy. A false "unconsumed" is a loud,
fixable failure; a false "consumed" is a silent hole in the gate, which is
worse than having no gate at all.

A path now counts as a consumer only when it is the first argument of a call
in code. That excludes bare constants, dead arrays, object properties, and
commented-out calls, while still accepting any function name. Both halves are
pinned by tests: TestScanFileCreditsAnyCallSignature and
TestScanFileIgnoresNonCallLiterals, plus a surface-level
TestNegativeCommentedOutCallIsStillReported that the vacuous version fails.
Re-injecting either half of the bug fails the suite.

Requiring a call lost no real consumer: internal/webui still reads 49/49.
The remaining limits (path must be the first argument; template
interpolations unseen; routes credited per path rather than per verb) are
declared in docs/contract-declarations.json and the PRD rather than left
implicit.

Also corrects a measurement I had quoted inconsistently: proto/state/v1
declares 45 RPCs, not 43 or 46.
2026-09-15 13:49:47 +10:00
sam 7b3bfe5b2f merge: lane G (tools-builtin-3, tools-mcp-3, infra-misc-2, persistence-5) 2026-09-15 13:40:46 +10:00
sam 302187e7a3 refactor(store): use taskstate status constants in SQL
WIRE: internal/taskstate documents itself as the single source for the
persisted task status strings, but store.go re-declared them as bare SQL
literals. Reference the workflow status constants (aliases of taskstate)
so a rename of a status is a compile-time-visible migration instead of a
silent change in what ClaimNext/RecoverStale/OpenPRs/ClearTerminalTasks
match.
2026-09-15 13:39:15 +10:00
sam 530c8ea090 fix(container): enforce MaxUptime lifetime cap with a timer
WIRE: Config.MaxUptime and Acquire documented a hard container lifetime cap
(PRD section 4), but the code only wrapped ContainerCreate/ContainerStart in
a MaxUptime deadline that was cancelled when Acquire returned, so no running
container was ever killed. Wire the documented cap with a per-container
timer that stops and removes the container once the cap elapses.
2026-09-15 13:33:48 +10:00
sam 7ac7a3df6b fix(mcp): cancel in-flight SSE reconnect on Stop
WIRE: the SSE transport's Stop contract already says it closes the
connection and waits for background readers, but the reconnect loop issued
its HTTP GET with the Start context, which Stop could not cancel, so Stop
blocked on readerWg.Wait() against an unreachable endpoint. Wire a
per-lifecycle cancel (mirroring the stdio transport's stopCh plus guarded
commit) so Stop interrupts the in-flight reconnect request.
2026-09-15 13:30:29 +10:00
sam 0020867b3e docs(skill): drop comments that named the deleted skill.Discover
Lane F deleted skill.Discover/skill.DiscoverPlugins/skill.Skill (no
production caller) in 6f4e420, which left three comments in packages it did
not own describing or contrasting behaviour against a symbol that no longer
exists -- a dangling reference is the same drift class as an unreachable
code path, just cheaper to fix.

The behavioural statements are kept; only the dead names go. internal/skill's
Catalog skips a SKILL.md it cannot read, while this curator's store reports
the per-skill failure as an Action, so the test's rationale still holds
without naming the removed function.

Comment-only: no behaviour change, task check exit 0.
2026-09-15 13:17:54 +10:00
sam 28ec1f85aa merge: lane F (skill-2, workflow-engine-2, domain-records-2, forge-3) 2026-09-15 13:15:18 +10:00
sam 2a6b9f9284 refactor(forge): delete dead CreateIssue surface
DELETE: no document in docs/architecture/ or docs/prds/ specifies a
production consumer for forge.IssueForge.CreateIssue. It has no
production caller -- the remaining repo matches are the GitHub
CreateIssueReaction and Gitea CreateIssueComment SDK methods. Removing
the interface method and the GitHub/Gitea/Noop implementations; the
other fakes that still define CreateIssue are test-only and out of lane
ownership, and an interface with one fewer method keeps them satisfying.
RepliesAfter and forge.Reply are untouched (a parallel FLAG record).
2026-09-15 13:13:55 +10:00
sam 41ad0d48ec refactor(binding): delete dead Matcher.Overlaps method
DELETE: no document in docs/architecture/ or docs/prds/ specifies a
consumer for binding.Matcher.Overlaps, and it has no caller or test
caller. The store enforces the overlap invariant with its own SQL
(internal/store/bindings.go InsertBinding/UpdateBinding), which is out
of this lane's ownership and left untouched. The doc comment's
empty-Source rule is already covered by Binding.validateCommon's
"matcher.source is required" check, so nothing needs moving.
2026-09-15 13:12:22 +10:00
sam 39053570c4 fix(builtin): bound read/edit filesystem work by DefaultToolTimeout
WIRE: read and edit each declared a DefaultToolTimeout deadline and then
discarded it, so the documented contract (Tools that exceed this are
cancelled) was a no-op on the live tool-executor path. Wire the deadline
through runWithContext, the same helper write already uses, so a hung
filesystem cannot block the tool executor.
2026-09-15 13:12:21 +10:00
sam 27f7053351 refactor(skillbuild): delete dead AugmentRegistry path
DELETE: no document in docs/architecture/ or docs/prds/ names
AugmentRegistry as a consumer. The live per-task registry construction is
skillbuild.BuildRegistry(workDir) at internal/app/agentworker/
task_execution.go; AugmentRegistry was an unwired alternate merge-over-
base path (with collision/override and nil-base semantics) that only
tests exercised. mergeSkillWorkflows remains reachable through
BuildCatalog/BuildRegistry.
2026-09-15 13:10:51 +10:00
sam 6f4e420b3a refactor(skill): delete dead Discover/DiscoverPlugins/Skill path
DELETE: no document in docs/architecture/ or docs/prds/ specifies a
consumer for skill.Discover, skill.DiscoverPlugins, or the skill.Skill
type. Live per-skill loading is reimplemented inline in
internal/domain/workflow/agent.go loadSkillBody via
Catalog/SkillForWorkflow/Parse/LoadPlugins, and daemon startup and webui
use Catalog/CatalogRoots. The parallel fully-tested path had no caller
to keep it honest, so it is removed together with its now-dead tests.
2026-09-15 13:08:43 +10:00
sam 3428425af8 merge: lane B (forge-2 flagged, daemon-1, persistence-2) 2026-09-15 13:04:28 +10:00