Added # issue context completion to the web chat composer alongside / slash commands, backed by a pluggable trigger completion model and a daemon-backed GET /api/issues endpoint.
What Changed
Backend Open Issues API:
internal/infrastructure/daemonrpc/client.go & internal/app/archied/harness.go: Added daemon.v1.IssueService/ListIssues RPC client and server registration forwarding caller identity (rpcidentity.Outgoing(ctx, presence.UI)).
internal/app/archied/repository_check.go & internal/app/archied/repository_access_test.go: Implemented ListIssues on repositoryServer, enforcing caller authentication (codes.Unauthenticated), access.ActionRead on access.KindTask (codes.PermissionDenied), and querying open issues across the caller organisation's configured repositories via IssuesWithLabel(ctx, owner, name, "") (capped at 200 issues).
internal/webui/api_repository_check.go, internal/webui/server.go, internal/webui/authorize.go, internal/webui/authorization_surfaces_test.go, internal/app/archieui/run.go: Exposed GET /api/issues mapped to access.KindTask and wired srv.Issues to the daemon RPC client.
Frontend Composer Completion & # Issue Dropdown:
ui/src/lib/api.ts: Added api.issues().
ui/src/chat/commands.ts: Generalized slash-only completion into a pluggable trigger model (detectTrigger, completionsFor, commandCompletionSource, issueCompletionSource, matchesFor, applyCompletion, moveSelection, resolveCompletionKey) supporting /, #, and future triggers.
ui/src/chat/state.ts: Added issueSpecs, activeTrigger, activeCompletionLabel, composerCaret, and lazy open-issue loading (refreshIssues) triggered when # is typed.
ui/src/chat/ChatSlashPalette.vue & ui/src/chat/ChatComposer.vue: Updated the completion listbox to display CompletionItem entries with dynamic aria-label ("Issues" for #, "Commands" for /), ArrowUp/ArrowDown navigation, Enter/Tab acceptance, click insertion, and Escape dismissal.
Tests:
ui/test/chat-composer-completion.test.ts: Added unit tests covering trigger detection (#, /, and custom triggers), issue/command filtering, mid-draft and multi-line token replacement (applyCompletion), and keyboard navigation (ArrowUp, ArrowDown, Enter, Tab, Escape, and exact slash command submission).
internal/app/archied/repository_access_test.go & internal/webui/authorization_surfaces_test.go: Added tests for ListIssues and HTTP authorization coverage on GET /api/issues.
e2e/checks/chat-composer.cjs: Extended the browser composer check to cover # issue dropdown filtering, Escape dismissal, and Tab insertion.
Verification
task check passed (UI build, vue-tsc typecheck, 108 UI unit tests, proto:check, proto:lint, db:check, golangci-lint, Go builds, and Go test suite).
internal/app/archieui/run.go:146: Run calls wireDaemon(opts, srv, &cleanups) and aborts startup if it returns an error. wireDaemon unconditionally delegates to wireHarness, which calls harnessrpc.Dial(opts.Daemon.Target, opts.identity).
However, harnessrpc.Dial explicitly rejects a nil TLS identity (if id == nil { return nil, nil, errors.New("harness sessions need [tls] ca_file and cert_dir") }), whereas rpctls.Load returns nil, nil in plaintext loopback mode and every other RPC client (staterpc, gatewayrpc, messagingrpc, daemonrpc) as well as the daemon's own listener (setupDaemonRPC in internal/app/archied/harness.go, which states "Without certificates it binds only loopback and does not serve terminals") supports plaintext loopback without TLS certificates. Because wireHarness treats opts.identity == nil as a fatal error instead of leaving srv.HarnessTerminal and srv.SandboxViewnil (which the HTTP handlers already answer with 503 Service Unavailable), archieui.Run cannot start at all in plaintext loopback mode.
In addition, if opts.Daemon.Target is empty (for example in a flags-only invocation without a config file, since withDefaults in internal/app/archieui/config.go does not default Daemon.Target and Options.validate() does not require it), wireDaemon still calls daemonrpc.Dial("", opts.identity) and harnessrpc.Dial("", opts.identity), failing startup instead of either skipping daemon wiring or defaulting Daemon.Target.
e2e/checks/chat-composer.cjs:7: ChatComposer.vue sets an explicit role="combobox" on <Textarea> (aria-label="Message Archie"), which Vue passes through to the underlying <textarea> root element (ui/src/chat/ChatComposer.vue:211-220). In ARIA and Playwright's role selector engine, an explicit role="combobox" overrides <textarea>'s implicit textbox role. Querying page.getByRole('textbox', { name: 'Message Archie', exact: true }) will therefore match 0 elements and time out at await composer.waitFor().
internal/app/servicekit/runtimeconfig.go:27: cp.RuntimeConfig (controlplanestore.runtimeConfigFrom at internal/infrastructure/controlplanestore/runtime_config.go:97-105) layers ForgeConnectionsKind by clearing out.Forge.Type, out.Forge.Host, out.Forge.Token = "", "", config.SecretRef{} when no "default" root connection is present in the stored forge-connections document (tested in TestForgeLayeringReadsTheConnection as "a document with no root connection disables the forge").
However, servicekit.RuntimeConfig immediately passes the layered config to configuration.Validate(&cfg) (line 41), which calls validateSingleIdentity (internal/infrastructure/configuration/validate.go:211-219) whenever len(cfg.Identities) == 0:
if!forgeTypePattern.MatchString(cfg.Forge.Type){returnfmt.Errorf("%w: forge.type %q (want none or the name of an installed forge package)",ErrInvalidInput,cfg.Forge.Type)}
Because forgeTypePattern (^[a-z0-9][a-z0-9-]*$) rejects "" (expecting "none", "off", or "disabled" per configuration.ForgeDisabled), servicekit.RuntimeConfig fails with validate database settings: invalid configuration: forge.type "" (want none or the name of an installed forge package):
In archied, removing the "default" forge connection is rejected on live watch updates, and report(wrapped) records that validation error across every layered control-plane kind in versions.
In archie-gateway, relayer calls servicekit.RuntimeConfig on provider-settings, model-aliases, and tool-settings updates; because cp.RuntimeConfig layers forge-connections into cfg before configuration.Validate(&cfg) runs, a forge-connections document without "default" causes unrelated gateway setting updates to fail validation.
On subsequent boots or SIGHUP reloads, both archied (loadRuntimeConfig) and archie-gateway (openState) fail to start.
internal/app/archieui/config.go:129: When Resolve runs without a configuration file (o.Config == "" or the path at o.Config does not exist, which readProjection explicitly allows so "the process is fully drivable by flags"), project and merge are skipped and withDefaults is responsible for filling service targets that are not required via CLI flags. withDefaults populates o.Messaging.Target from config.LookupService(config.ServiceNameMessaging), and validate checks o.Gateway.Target and o.State.Target, but o.Daemon.Target is neither defaulted in withDefaults nor validated in validate (and cmd/archie-ui/main.go defines no -daemon-target flag).
As a result, any flags-only run (or Resolve call without an on-disk config file) returns Options with Daemon.Target == "", which then fails at startup in Run -> wireDaemon (internal/app/archieui/run.go:102,147,160) when daemonrpc.Dial and harnessrpc.Dial attempt to dial an empty target.
internal/app/archieui/run.go:113: In Run, liveCtx, stopLive := context.WithCancel(ctx) is created and passed only to go srv.RunLive(liveCtx), while go pumpEvents(ctx, srv, opts.EventPollInterval, log) and go presence.Run(ctx, presence.UI, servicekit.Build(), tasks, srv.Health, log) (as well as compose(ctx, ...) which starts a background servicekit.RunningVersions poller) are started with the caller's ctx before Listen is called.
If Listen fails (lines 118-121) or serve returns a listener error while ctx is still active, Run returns and its deferred cleanups close the staterpc and gatewayrpc clients, but pumpEvents, presence.Run, and RunningVersions continue running in leaked goroutines against the closed tasks client until the caller's ctx is eventually cancelled.
Findings outside the diff:
- `internal/app/archieui/run.go:146`: `Run` calls `wireDaemon(opts, srv, &cleanups)` and aborts startup if it returns an error. `wireDaemon` unconditionally delegates to `wireHarness`, which calls `harnessrpc.Dial(opts.Daemon.Target, opts.identity)`.
However, `harnessrpc.Dial` explicitly rejects a `nil` TLS identity (`if id == nil { return nil, nil, errors.New("harness sessions need [tls] ca_file and cert_dir") }`), whereas `rpctls.Load` returns `nil, nil` in plaintext loopback mode and every other RPC client (`staterpc`, `gatewayrpc`, `messagingrpc`, `daemonrpc`) as well as the daemon's own listener (`setupDaemonRPC` in `internal/app/archied/harness.go`, which states `"Without certificates it binds only loopback and does not serve terminals"`) supports plaintext loopback without TLS certificates. Because `wireHarness` treats `opts.identity == nil` as a fatal error instead of leaving `srv.HarnessTerminal` and `srv.SandboxView` `nil` (which the HTTP handlers already answer with `503 Service Unavailable`), `archieui.Run` cannot start at all in plaintext loopback mode.
In addition, if `opts.Daemon.Target` is empty (for example in a flags-only invocation without a config file, since `withDefaults` in `internal/app/archieui/config.go` does not default `Daemon.Target` and `Options.validate()` does not require it), `wireDaemon` still calls `daemonrpc.Dial("", opts.identity)` and `harnessrpc.Dial("", opts.identity)`, failing startup instead of either skipping daemon wiring or defaulting `Daemon.Target`.
- `e2e/checks/chat-composer.cjs:7`: `ChatComposer.vue` sets an explicit `role="combobox"` on `<Textarea>` (`aria-label="Message Archie"`), which Vue passes through to the underlying `<textarea>` root element (`ui/src/chat/ChatComposer.vue:211-220`). In ARIA and Playwright's role selector engine, an explicit `role="combobox"` overrides `<textarea>`'s implicit `textbox` role. Querying `page.getByRole('textbox', { name: 'Message Archie', exact: true })` will therefore match 0 elements and time out at `await composer.waitFor()`.
- `internal/app/servicekit/runtimeconfig.go:27`: `cp.RuntimeConfig` (`controlplanestore.runtimeConfigFrom` at `internal/infrastructure/controlplanestore/runtime_config.go:97-105`) layers `ForgeConnectionsKind` by clearing `out.Forge.Type, out.Forge.Host, out.Forge.Token = "", "", config.SecretRef{}` when no `"default"` root connection is present in the stored `forge-connections` document (tested in `TestForgeLayeringReadsTheConnection` as `"a document with no root connection disables the forge"`).
However, `servicekit.RuntimeConfig` immediately passes the layered config to `configuration.Validate(&cfg)` (line 41), which calls `validateSingleIdentity` (`internal/infrastructure/configuration/validate.go:211-219`) whenever `len(cfg.Identities) == 0`:
```go
if !forgeTypePattern.MatchString(cfg.Forge.Type) {
return fmt.Errorf("%w: forge.type %q (want none or the name of an installed forge package)", ErrInvalidInput, cfg.Forge.Type)
}
```
Because `forgeTypePattern` (`^[a-z0-9][a-z0-9-]*$`) rejects `""` (expecting `"none"`, `"off"`, or `"disabled"` per `configuration.ForgeDisabled`), `servicekit.RuntimeConfig` fails with `validate database settings: invalid configuration: forge.type "" (want none or the name of an installed forge package)`:
1. In `archied`, removing the `"default"` forge connection is rejected on live watch updates, and `report(wrapped)` records that validation error across every layered control-plane kind in `versions`.
2. In `archie-gateway`, `relayer` calls `servicekit.RuntimeConfig` on `provider-settings`, `model-aliases`, and `tool-settings` updates; because `cp.RuntimeConfig` layers `forge-connections` into `cfg` before `configuration.Validate(&cfg)` runs, a `forge-connections` document without `"default"` causes unrelated gateway setting updates to fail validation.
3. On subsequent boots or `SIGHUP` reloads, both `archied` (`loadRuntimeConfig`) and `archie-gateway` (`openState`) fail to start.
- `internal/app/archieui/config.go:129`: When `Resolve` runs without a configuration file (`o.Config == ""` or the path at `o.Config` does not exist, which `readProjection` explicitly allows so "the process is fully drivable by flags"), `project` and `merge` are skipped and `withDefaults` is responsible for filling service targets that are not required via CLI flags. `withDefaults` populates `o.Messaging.Target` from `config.LookupService(config.ServiceNameMessaging)`, and `validate` checks `o.Gateway.Target` and `o.State.Target`, but `o.Daemon.Target` is neither defaulted in `withDefaults` nor validated in `validate` (and `cmd/archie-ui/main.go` defines no `-daemon-target` flag).
As a result, any flags-only run (or `Resolve` call without an on-disk config file) returns `Options` with `Daemon.Target == ""`, which then fails at startup in `Run` -> `wireDaemon` (`internal/app/archieui/run.go:102,147,160`) when `daemonrpc.Dial` and `harnessrpc.Dial` attempt to dial an empty target.
- `internal/app/archieui/run.go:113`: In `Run`, `liveCtx, stopLive := context.WithCancel(ctx)` is created and passed only to `go srv.RunLive(liveCtx)`, while `go pumpEvents(ctx, srv, opts.EventPollInterval, log)` and `go presence.Run(ctx, presence.UI, servicekit.Build(), tasks, srv.Health, log)` (as well as `compose(ctx, ...)` which starts a background `servicekit.RunningVersions` poller) are started with the caller's `ctx` before `Listen` is called.
If `Listen` fails (lines 118-121) or `serve` returns a listener error while `ctx` is still active, `Run` returns and its deferred `cleanups` close the `staterpc` and `gatewayrpc` clients, but `pumpEvents`, `presence.Run`, and `RunningVersions` continue running in leaked goroutines against the closed `tasks` client until the caller's `ctx` is eventually cancelled.
When completing a trigger token in the middle of a sentence that is already followed by whitespace ("Implement #186 now" at caret 14), applyCompletion unconditionally appends a trailing space before after (" now"), producing two consecutive spaces ("Implement #1861 now"), and this test codifies the double space as expected output. If after already starts with whitespace, avoiding a duplicate space (or advancing the cursor past the existing space) and asserting "Implement #1861 now" would prevent double spaces on mid-sentence completions.
When completing a trigger token in the middle of a sentence that is already followed by whitespace (`"Implement #186 now"` at caret 14), `applyCompletion` unconditionally appends a trailing space before `after` (`" now"`), producing two consecutive spaces (`"Implement #1861 now"`), and this test codifies the double space as expected output. If `after` already starts with whitespace, avoiding a duplicate space (or advancing the cursor past the existing space) and asserting `"Implement #1861 now"` would prevent double spaces on mid-sentence completions.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Added
#issue context completion to the web chat composer alongside/slash commands, backed by a pluggable trigger completion model and a daemon-backedGET /api/issuesendpoint.What Changed
internal/infrastructure/daemonrpc/client.go&internal/app/archied/harness.go: Addeddaemon.v1.IssueService/ListIssuesRPC client and server registration forwarding caller identity (rpcidentity.Outgoing(ctx, presence.UI)).internal/app/archied/repository_check.go&internal/app/archied/repository_access_test.go: ImplementedListIssuesonrepositoryServer, enforcing caller authentication (codes.Unauthenticated),access.ActionReadonaccess.KindTask(codes.PermissionDenied), and querying open issues across the caller organisation's configured repositories viaIssuesWithLabel(ctx, owner, name, "")(capped at 200 issues).internal/webui/api_repository_check.go,internal/webui/server.go,internal/webui/authorize.go,internal/webui/authorization_surfaces_test.go,internal/app/archieui/run.go: ExposedGET /api/issuesmapped toaccess.KindTaskand wiredsrv.Issuesto the daemon RPC client.#Issue Dropdown:ui/src/lib/api.ts: Addedapi.issues().ui/src/chat/commands.ts: Generalized slash-only completion into a pluggable trigger model (detectTrigger,completionsFor,commandCompletionSource,issueCompletionSource,matchesFor,applyCompletion,moveSelection,resolveCompletionKey) supporting/,#, and future triggers.ui/src/chat/state.ts: AddedissueSpecs,activeTrigger,activeCompletionLabel,composerCaret, and lazy open-issue loading (refreshIssues) triggered when#is typed.ui/src/chat/ChatSlashPalette.vue&ui/src/chat/ChatComposer.vue: Updated the completion listbox to displayCompletionItementries with dynamicaria-label("Issues"for#,"Commands"for/),ArrowUp/ArrowDownnavigation,Enter/Tabacceptance, click insertion, andEscapedismissal.ui/test/chat-composer-completion.test.ts: Added unit tests covering trigger detection (#,/, and custom triggers), issue/command filtering, mid-draft and multi-line token replacement (applyCompletion), and keyboard navigation (ArrowUp,ArrowDown,Enter,Tab,Escape, and exact slash command submission).internal/app/archied/repository_access_test.go&internal/webui/authorization_surfaces_test.go: Added tests forListIssuesand HTTP authorization coverage onGET /api/issues.e2e/checks/chat-composer.cjs: Extended the browser composer check to cover#issue dropdown filtering,Escapedismissal, andTabinsertion.Verification
task checkpassed (UI build,vue-tsctypecheck, 108 UI unit tests,proto:check,proto:lint,db:check,golangci-lint, Go builds, and Go test suite).workflow: implement · 80 iterations · 8795217 tokens (449849 fresh + 8345368 cached)
Findings outside the diff:
internal/app/archieui/run.go:146:RuncallswireDaemon(opts, srv, &cleanups)and aborts startup if it returns an error.wireDaemonunconditionally delegates towireHarness, which callsharnessrpc.Dial(opts.Daemon.Target, opts.identity).However,
harnessrpc.Dialexplicitly rejects anilTLS identity (if id == nil { return nil, nil, errors.New("harness sessions need [tls] ca_file and cert_dir") }), whereasrpctls.Loadreturnsnil, nilin plaintext loopback mode and every other RPC client (staterpc,gatewayrpc,messagingrpc,daemonrpc) as well as the daemon's own listener (setupDaemonRPCininternal/app/archied/harness.go, which states"Without certificates it binds only loopback and does not serve terminals") supports plaintext loopback without TLS certificates. BecausewireHarnesstreatsopts.identity == nilas a fatal error instead of leavingsrv.HarnessTerminalandsrv.SandboxViewnil(which the HTTP handlers already answer with503 Service Unavailable),archieui.Runcannot start at all in plaintext loopback mode.In addition, if
opts.Daemon.Targetis empty (for example in a flags-only invocation without a config file, sincewithDefaultsininternal/app/archieui/config.godoes not defaultDaemon.TargetandOptions.validate()does not require it),wireDaemonstill callsdaemonrpc.Dial("", opts.identity)andharnessrpc.Dial("", opts.identity), failing startup instead of either skipping daemon wiring or defaultingDaemon.Target.e2e/checks/chat-composer.cjs:7:ChatComposer.vuesets an explicitrole="combobox"on<Textarea>(aria-label="Message Archie"), which Vue passes through to the underlying<textarea>root element (ui/src/chat/ChatComposer.vue:211-220). In ARIA and Playwright's role selector engine, an explicitrole="combobox"overrides<textarea>'s implicittextboxrole. Queryingpage.getByRole('textbox', { name: 'Message Archie', exact: true })will therefore match 0 elements and time out atawait composer.waitFor().internal/app/servicekit/runtimeconfig.go:27:cp.RuntimeConfig(controlplanestore.runtimeConfigFromatinternal/infrastructure/controlplanestore/runtime_config.go:97-105) layersForgeConnectionsKindby clearingout.Forge.Type, out.Forge.Host, out.Forge.Token = "", "", config.SecretRef{}when no"default"root connection is present in the storedforge-connectionsdocument (tested inTestForgeLayeringReadsTheConnectionas"a document with no root connection disables the forge").However,
servicekit.RuntimeConfigimmediately passes the layered config toconfiguration.Validate(&cfg)(line 41), which callsvalidateSingleIdentity(internal/infrastructure/configuration/validate.go:211-219) wheneverlen(cfg.Identities) == 0:Because
forgeTypePattern(^[a-z0-9][a-z0-9-]*$) rejects""(expecting"none","off", or"disabled"perconfiguration.ForgeDisabled),servicekit.RuntimeConfigfails withvalidate database settings: invalid configuration: forge.type "" (want none or the name of an installed forge package):archied, removing the"default"forge connection is rejected on live watch updates, andreport(wrapped)records that validation error across every layered control-plane kind inversions.archie-gateway,relayercallsservicekit.RuntimeConfigonprovider-settings,model-aliases, andtool-settingsupdates; becausecp.RuntimeConfiglayersforge-connectionsintocfgbeforeconfiguration.Validate(&cfg)runs, aforge-connectionsdocument without"default"causes unrelated gateway setting updates to fail validation.SIGHUPreloads, botharchied(loadRuntimeConfig) andarchie-gateway(openState) fail to start.internal/app/archieui/config.go:129: WhenResolveruns without a configuration file (o.Config == ""or the path ato.Configdoes not exist, whichreadProjectionexplicitly allows so "the process is fully drivable by flags"),projectandmergeare skipped andwithDefaultsis responsible for filling service targets that are not required via CLI flags.withDefaultspopulateso.Messaging.Targetfromconfig.LookupService(config.ServiceNameMessaging), andvalidatecheckso.Gateway.Targetando.State.Target, buto.Daemon.Targetis neither defaulted inwithDefaultsnor validated invalidate(andcmd/archie-ui/main.godefines no-daemon-targetflag).As a result, any flags-only run (or
Resolvecall without an on-disk config file) returnsOptionswithDaemon.Target == "", which then fails at startup inRun->wireDaemon(internal/app/archieui/run.go:102,147,160) whendaemonrpc.Dialandharnessrpc.Dialattempt to dial an empty target.internal/app/archieui/run.go:113: InRun,liveCtx, stopLive := context.WithCancel(ctx)is created and passed only togo srv.RunLive(liveCtx), whilego pumpEvents(ctx, srv, opts.EventPollInterval, log)andgo presence.Run(ctx, presence.UI, servicekit.Build(), tasks, srv.Health, log)(as well ascompose(ctx, ...)which starts a backgroundservicekit.RunningVersionspoller) are started with the caller'sctxbeforeListenis called.If
Listenfails (lines 118-121) orservereturns a listener error whilectxis still active,Runreturns and its deferredcleanupsclose thestaterpcandgatewayrpcclients, butpumpEvents,presence.Run, andRunningVersionscontinue running in leaked goroutines against the closedtasksclient until the caller'sctxis eventually cancelled.@@ -0,0 +188,4 @@assert.deepEqual(applyCompletion("#18", 3, "#1861"), {text: "#1861 ",cursor: 6,});When completing a trigger token in the middle of a sentence that is already followed by whitespace (
"Implement #186 now"at caret 14),applyCompletionunconditionally appends a trailing space beforeafter(" now"), producing two consecutive spaces ("Implement #1861 now"), and this test codifies the double space as expected output. Ifafteralready starts with whitespace, avoiding a duplicate space (or advancing the cursor past the existing space) and asserting"Implement #1861 now"would prevent double spaces on mid-sentence completions.Closed and will be implemented with #1882
Pull request closed