chore(beads): narrow LSP dependency candidates for t2db.20

This commit is contained in:
sam committed 2026-09-03 06:31:20 +10:00
1 parent 9815a0f831
commit 353b4fd7e7
1 file changed
+1 -1
+1 -1
View File
@@ -95,7 +95,7 @@
{"_type":"issue","id":"archie-core-g7tm","title":"telegram: finalize the reply through a live context, matching the error branch","description":"The success path calls live.finalize(turnCtx, reply) with the raw cancellable turn context (telegram.go:582), while the error branch two lines above deliberately uses context.WithoutCancel(turnCtx). If /stop lands during finalize, the rich edit, the plain-text retry, and the split-send fallback all abort with context.Canceled (go-telegram/bot builds requests with NewRequestWithContext), so the authoritative reply is never delivered and the live message keeps the ▌ cursor forever. The reply is persisted to the ledger, so the loss is delivery-level — but the user sees a frozen half-answer.\n\nFailure: a long tool-using turn is /stop-ped as it completes; turnCtx is cancelled mid-finalize; every send fails on the dead context; the chat shows the last live frame with a blinking cursor and no final answer.\n\nFound by code-review of PR #476 (feat/467, merged 98e8dda).","design":"live.finalize(context.WithoutCancel(turnCtx), reply) — the one-liner the error branch already uses. Consider making finalize take a live context internally rather than trusting each caller to remember.","acceptance_criteria":"A /stop landing mid-finalize still delivers the authoritative reply and drops the cursor; a test covers the cancellable-context finalize path.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-14T14:43:08Z","created_by":"Sam Catlow","updated_at":"2026-08-14T15:07:36Z","started_at":"2026-08-14T14:53:28Z","closed_at":"2026-08-14T15:03:28Z","close_reason":"Fixed in internal/channels/telegram/live.go and telegram.go: finalize/abandon strip context cancellation before sending (mirroring each other), ToolCall escapes Markdown metacharacters via bot.EscapeMarkdown, splitLongMessage splits on rune boundaries. All new/changed tests verified red-then-green; task check clean; adversarial review pass found no blocking issues.","external_ref":"https://github.com/samcharles93/archie-core/issues/484","labels":["code-review","streaming","telegram"],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_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-t2db.20","title":"eda: LSP/serve mode for cmd/archie-playbooks","description":"Second entrypoint of the gopls-shaped standalone binary from t2db.12 (lint mode already shipped). Sam explicitly kept this in scope, not deferred, because it's the same schema source as the linter, just a different consumer -- the design doc's shared-package, thin-consumer principle.\n\nGrounded by a crew investigation pass (2026-09-03): the loader decodes with yaml.Unmarshal into a plain map, which discards line numbers -- today's lint findings are file-granular only. A useful LSP (hover/completion/inline errors) needs real positions, so the yaml.Node decoding upgrade is a practical prerequisite, not a nice-to-have. internal/domain/eda/expr's Compile/Eval already return structured errors that should map cleanly to diagnostics -- confirm this rather than re-deriving error shapes.","design":"Two-part scope, decide whether to split into two tickets or do both together once you've read the code:\n1. yaml.Node decoding upgrade: replace the plain-map yaml.Unmarshal decode path (internal/domain/workflow/routing.go -- three call sites at time of writing, all doing 'var raw map[string]string; yaml.Unmarshal(data, \u0026raw)') with yaml.Node-based decoding that retains line/column info, without changing any existing collision-detection behavior.\n\nVERIFIED FEASIBLE, concrete shape (2026-09-03): gopkg.in/yaml.v3's Node type has Line/Column fields populated directly by the decoder (confirmed in the vendored source). For a mapping node (Kind == MappingNode), Content is a flat []*Node alternating key-node, value-node pairs -- so decoding into *yaml.Node instead of map[string]string gives Content[i].Line for the i-th key's line number directly, no manual line-counting needed. The upgrade is: yaml.Unmarshal(data, \u0026node) into a *yaml.Node instead of the map, then walk node.Content in pairs extracting key.Value/value.Value (same strings as today) plus key.Line (new). This is a pure additive capability -- existing collision error MESSAGES should stay byte-identical where line info isn't yet surfaced in them, add line numbers to the error format once available. Do not change collision-detection LOGIC, only the decode representation.\n\n2. serve/lsp command: add a new entry to cmd/archie-playbooks's existing command table (do not restructure -- t2db.12 built it explicitly to take this addition without restructuring, confirmed by reading cmd/archie-playbooks/main.go's commands map). Scope: a minimal LSP surface (diagnostics at minimum; hover/completion if straightforward) over the same compile/validate path the lint command already uses. Weigh a tiny hand-rolled LSP protocol implementation (fits organisation.md's thin cmd/ rule and the narrow-capability-family principle) against pulling in an LSP library -- vet any new dependency via the vetting-dependencies skill before adding it, same rigor as the CEL decision (docs/prds/eda-playbook-engine.md's resolved open question 1) -- this is a real, undecided choice, not preempted here.","acceptance_criteria":"cmd/archie-playbooks gains a serve (or lsp) subcommand alongside lint, using the same underlying compile/validate calls -- no second validation path. Diagnostics report file:line where the yaml.Node upgrade provides it. Existing lint-mode tests and behavior are unchanged (regression-tested). task check passes.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-09-02T18:12:41Z","created_by":"Sam Catlow","updated_at":"2026-09-02T18:29:12Z","dependencies":[{"issue_id":"archie-core-t2db.20","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-09-02T18:12:41Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-t2db.20","title":"eda: LSP/serve mode for cmd/archie-playbooks","description":"Second entrypoint of the gopls-shaped standalone binary from t2db.12 (lint mode already shipped). Sam explicitly kept this in scope, not deferred, because it's the same schema source as the linter, just a different consumer -- the design doc's shared-package, thin-consumer principle.\n\nGrounded by a crew investigation pass (2026-09-03): the loader decodes with yaml.Unmarshal into a plain map, which discards line numbers -- today's lint findings are file-granular only. A useful LSP (hover/completion/inline errors) needs real positions, so the yaml.Node decoding upgrade is a practical prerequisite, not a nice-to-have. internal/domain/eda/expr's Compile/Eval already return structured errors that should map cleanly to diagnostics -- confirm this rather than re-deriving error shapes.","design":"Two-part scope, decide whether to split into two tickets or do both together once you've read the code:\n1. yaml.Node decoding upgrade: replace the plain-map yaml.Unmarshal decode path (internal/domain/workflow/routing.go -- three call sites at time of writing, all doing 'var raw map[string]string; yaml.Unmarshal(data, \u0026raw)') with yaml.Node-based decoding that retains line/column info, without changing any existing collision-detection behavior.\n\nVERIFIED FEASIBLE, concrete shape (2026-09-03): gopkg.in/yaml.v3's Node type has Line/Column fields populated directly by the decoder (confirmed in the vendored source). For a mapping node (Kind == MappingNode), Content is a flat []*Node alternating key-node, value-node pairs -- so decoding into *yaml.Node instead of map[string]string gives Content[i].Line for the i-th key's line number directly, no manual line-counting needed. The upgrade is: yaml.Unmarshal(data, \u0026node) into a *yaml.Node instead of the map, then walk node.Content in pairs extracting key.Value/value.Value (same strings as today) plus key.Line (new). This is a pure additive capability -- existing collision error MESSAGES should stay byte-identical where line info isn't yet surfaced in them, add line numbers to the error format once available. Do not change collision-detection LOGIC, only the decode representation.\n\n2. serve/lsp command: add a new entry to cmd/archie-playbooks's existing command table (do not restructure -- t2db.12 built it explicitly to take this addition without restructuring, confirmed by reading cmd/archie-playbooks/main.go's commands map). Scope: a minimal LSP surface (diagnostics at minimum; hover/completion if straightforward) over the same compile/validate path the lint command already uses. Weigh a tiny hand-rolled LSP protocol implementation (fits organisation.md's thin cmd/ rule and the narrow-capability-family principle) against pulling in an LSP library -- vet any new dependency via the vetting-dependencies skill before adding it, same rigor as the CEL decision (docs/prds/eda-playbook-engine.md's resolved open question 1) -- this is a real, undecided choice, not preempted here.","acceptance_criteria":"cmd/archie-playbooks gains a serve (or lsp) subcommand alongside lint, using the same underlying compile/validate calls -- no second validation path. Diagnostics report file:line where the yaml.Node upgrade provides it. Existing lint-mode tests and behavior are unchanged (regression-tested). task check passes.","notes":"LSP dependency investigation, 2026-09-03. Checked 3 candidates directly (not from training memory): sourcegraph/go-lsp is ARCHIVED, not usable. tliron/glsp is active (Apache-2.0, 285 stars, pushed 2025) but pulls in a moderate dependency chain unrelated to a headless diagnostics server -- gorilla/websocket (unneeded for stdio transport), plus several TUI/pretty-printing deps (termenv, go-colorful, runewidth) via its commonlog dependency. Mismatched for organisation.md's thin-cmd/narrow-capability-family principle. sourcegraph/jsonrpc2 (not go-lsp) is the leaner alternative: one dependency (gorilla/websocket, again unneeded for stdio), actively maintained (pushed within the last month, not archived), and it only implements the JSON-RPC 2.0 engine itself (request/response ID correlation, notification vs request routing) -- the genuinely correctness-sensitive part worth depending on rather than reimplementing by hand (same reasoning that favored CEL's type-checker over a bespoke one). The LSP-specific method surface (initialize, textDocument/didOpen, textDocument/didChange, textDocument/publishDiagnostics -- a small subset, not the full protocol) should still be hand-written thin structs against the existing expr/routing schema types, not pulled from a library, since we need only a handful of methods. Recommend: sourcegraph/jsonrpc2 for the transport/framing, hand-rolled LSP method glue on top -- still needs a full vetting-dependencies pass (license, CVE history, dependency footprint measured) before actually adding it, matching the CEL rigor. Not Line truncated
{"_type":"issue","id":"archie-core-t2db.19","title":"eda: scope Channel and Forge action positions (investigation, blocked on execution-time gaps)","description":"Investigation ticket -- decide the typed-contract shape for the two remaining named action positions (Channel, Forge) before implementing either. Blocked on archie-core-t2db.17 (idempotency) since both are naturally side-effecting positions; investigation/scoping can proceed now, implementation cannot land before .17 resolves.\n\nGrounded by a crew investigation pass (2026-09-03): Channel already exists as internal/channels.Channel (embeds gateway.Gateway + ConfigSchema/ValidateConfig, telegram/email/webhook implementations registered at daemon startup). Forge already exists as internal/forge.Forge = IssueForge + PullRequestForge + RepoForge, with New(...) switching on github/gitea/none; the daemon poller currently special-cases forge operations directly rather than through any addressable position.","design":"See docs/prds/channel-forge-positions.md (committed 2026-09-03). Forge is fully scoped and ready to implement once t2db.17 lands: native-Go-by-name (not Module-kind) over the existing internal/forge.Forge interface, close-issue/link-branch as the safe first operations, create-pr deferred. Channel is NOT resolved -- the crew investigation's assumption that channels.Channel has an addressable send capability is FALSE (verified: only Name/Start/Stop + config validation exist, no Send method anywhere in internal/channels or internal/gateway). This is now an open product/architecture decision for Sam: whether 'Channel action' means (1) a new playbook-scoped notification capability distinct from the interactive chat channels, or (2) reusing the interactive channels with some new conversation-scoping mechanism for a non-chat trigger. Do not implement a Channel position until Sam decides which.","acceptance_criteria":"A design-doc addition (new docs/prds/ file or a section in eda-playbook-engine.md, your call which fits better -- state why) resolving: typed-contract shape for each position, Args/Result shapes, and the host-access/resolution mechanism. No implementation in this ticket.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-09-02T18:12:40Z","created_by":"Sam Catlow","updated_at":"2026-09-02T18:15:31Z","dependencies":[{"issue_id":"archie-core-t2db.19","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-09-02T18:12:40Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-t2db.19","depends_on_id":"archie-core-t2db.17","type":"blocks","created_at":"2026-09-02T18:12:40Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-t2db.16","title":"eda: reduce complexity in bootstrap.go loadWorkflows and routing.go LoadPlaybookDirs","description":"task check now runs golangci-lint (Sam's explicit requirement, 2026-09-03 -- catch lint regressions as part of the definitive gate, not just fmt/vet/build/test). First run surfaced two real findings, both accumulated debt from this session's own EDA slices, not pre-existing:\n\n1. internal/app/archied/bootstrap.go:647 loadWorkflows -- cyclomatic complexity 17, max 15 (cyclop). Grew incrementally across t2db.9 (kindWorkflows), t2db.10 (labelWorkflows), t2db.11 (PlaybookDirs merge), t2db.15 (EDAPlaybookDir) -- each addition was small, the function as a whole crossed the threshold.\n2. internal/domain/workflow/routing.go:103 LoadPlaybookDirs -- cognitive complexity 52, max 30 (gocognit), from t2db.11's directory-merge loader (kind-vs-label detection, per-file and cross-file collision checks all inline).\n\nRoot-cause fix required, not suppression: no //nolint. Extract cohesive sub-steps into named helper functions -- this is exactly the kind of case AGENTS.md's Architectural Simplicity rule describes (prefer a clean extraction over papering past a threshold).","design":"For loadWorkflows: extract the four independent load-and-set steps (kind-file load, label-file load, playbook-dirs load+merge, EDAPlaybookDir load) into named helpers the top-level function calls in sequence, each returning its own error for the existing log-and-abort pattern. Do not change the log-and-abort error-handling shape or field names.\n\nFor LoadPlaybookDirs: split the per-file parsing loop's kind-detection-vs-label-detection-vs-collision-check logic into a couple of named helpers (e.g. classifyBinding, checkCollision) called from the main loop, keeping the existing collision error messages and behavior byte-identical -- this is a pure refactor, not a behavior change.","acceptance_criteria":"golangci-lint run ./... reports zero cyclop/gocognit findings on these two functions. All existing tests for workflow.LoadPlaybookDirs, kindWorkflows, labelWorkflows, and bootstrap's loadWorkflows-adjacent behavior pass unchanged (byte-identical collision error messages -- diff the exact strings, do not just check err != nil). task check (now including lint) passes fully.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-09-02T18:10:21Z","created_by":"Sam Catlow","updated_at":"2026-09-02T18:10:21Z","dependencies":[{"issue_id":"archie-core-t2db.16","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-09-02T18:10:21Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-t2db.15","title":"eda: playbook document + event coordinator, single-action workflow-kind dispatch","description":"Seventh slice of docs/prds/eda-playbook-engine.md. Builds the rich playbook document shape (trigger + ordered actions with CEL 'when') and an event coordinator that dispatches it -- the first real consumer of t2db.14's expr package. Scoped tightly to what's already safe per this doc's own gating:\n\n- Exactly ONE action per playbook in this slice, and it MUST be position: workflow. Reject (load failure) a playbook declaring more than one action, or an action whose position is module/channel/forge -- those remain blocked on the unresolved execution-time gaps (mid-run failure semantics, idempotency for non-workflow actions) per the 'Execution-time gaps' section. Do not relax this without Sam's sign-off -- this is the one hard boundary in this ticket, everything else is normal implementation judgment.\n- This is an ADDITIONAL loading path alongside the existing flat kind/label binding files (t2db.9/.10/.11). Do NOT modify workflow.Route(), workflow.workflowForLabels, or remove/change the existing single-file/multi-dir binding loaders. Migrating Route() onto the new mechanism is a separate, later, larger decision -- not in scope here.\n- Idempotency is free for this slice for the same reason it was free for t2db.13's first Module slice: a single workflow-kind action reaches the exact same workflow.Registry dispatch path that already carries TaskEnvelope's idempotency key. Nothing new to design here.","design":"Depends on archie-core-t2db.14 (expr package) -- do not start until it is closed and verified.\n\n1. Playbook document type (new package, likely internal/domain/eda/playbook -- confirm against organisation.md's layout rule, follow the log/logextract split precedent from t2db.13 if a generated component turns out to be needed, though this ticket is pure YAML+CEL, no Yaegi, so likely no extract package is needed here):\n - trigger: reuse existing workintake label/kind matching (do not invent a second label-matching mechanism -- workintake.SplitLabels/KindsForLabels already exist and are the one place this vocabulary lives).\n - actions: a list, validated at load to contain exactly one entry with position: workflow and a workflow registry name.\n - when: optional CEL expression string on the action, compiled via t2db.14's Compile() at load time -- a compile failure is a reported load failure (same collision-handling philosophy as t2db.9-.12), not a silently-skipped playbook.\n2. Event coordinator: loads playbook files from a configured directory (mirror the PlaybookDirs pattern from t2db.11 -- reuse its directory-scanning shape, do not reinvent), compiles every playbook's when expression at load (fail the whole load on any compile error, consistent with the existing reject-at-load rule), and at dispatch time: match trigger against an incoming task's labels/kind, evaluate when (if present) against a context of {event: \u003ctask's label/kind fields, whatever is cheaply available -- do not over-engineer the event shape beyond what a workflow-kind dispatch actually needs\u003e, actions: {} (empty -- no prior actions exist in a single-action playbook)}, and if the condition is true (or absent), dispatch to the named workflow via the existing workflow.Registry -- call the same registry lookup Route() already uses, do not duplicate dispatch logic.\n3. Config: a directory field for these playbook documents (distinct from t2db.11's PlaybookDirs, which holds flat binding files -- naming these two similar-but-different directories clearly is important; suggest something like EDAPlaybookDir or clarify in the field doc comment exactly how it differs from PlaybookDirs so a future reader isn't confused). If you judge the distinction is confusing enough that these should share one directory with two file shapes distinguished by content, flag that as a note in the PRD rather than silently deciding it -- but implement SOMETHING reasonable rather than blocking.\n4. Bootstrap wiring: load-and-abort on failure, matching every other slice's established pattern.\n5. Do NOT wire this into production task intake (daemon.go/pollNATS/publishTask) in this ticket -- prove the coordinator end-to-end with tests that construct a task-like input directly, the same way t2db.13 proved ModuleRegistry with direct Register/Invoke calls rather than full daemon wiring. Production wiring (making a real forge-triggered task actually flow through this coordinator instead of only workflow.Route()) is explicitly a follow-up ticket -- note it as such when you close this one.","acceptance_criteria":"A playbook YAML with trigger + one workflow-kind action + optional when loads successfully and dispatches to the correct registered workflow when trigger+when match. A playbook declaring 2+ actions is a reported load failure. A playbook with a non-workflow action position is a reported load failure. A whLine truncated