chore: replace 607 em-dashes with double hyphens project-wide
Includes MCP crash-after-init test fix (crash moved from handle() to serve() entry point so transport sees immediate subprocess death).
This commit is contained in:
1 parent
16d6cd62b7
commit
f6d51416f0
112 files changed
+587
-582
No files matched your search
@@ -1,7 +1,7 @@
|
||||
// Command archie-agent is a long-running NATS-connected worker. It answers
|
||||
// two request shapes: single-stage archie.agent.> requests over the
|
||||
// ARCHIE_TASKS JetStream stream (the legacy per-stage protocol), and full
|
||||
// task handoffs on archie.taskrun.> (core NATS, queue-grouped) — where it
|
||||
// task handoffs on archie.taskrun.> (core NATS, queue-grouped) -- where it
|
||||
// runs workflow.Route/workflow.Run itself, proxying Store/Forge/worktree
|
||||
// operations back to archied over NATS instead of holding those
|
||||
// credentials directly.
|
||||
@@ -189,7 +189,7 @@ func run() int {
|
||||
// bootTaskID reads the boot-time task.json brief the daemon writes into
|
||||
// the worktree before container acquire (container.WriteTaskJSON) and
|
||||
// returns its ID. Returns (0, false) when the file is absent, unparseable,
|
||||
// or has no ID — any of which mean "shared pool mode, no dedicated task."
|
||||
// or has no ID -- any of which mean "shared pool mode, no dedicated task."
|
||||
func bootTaskID(mountDir string, log *slog.Logger) (int64, bool) {
|
||||
data, err := os.ReadFile(filepath.Join(mountDir, "task.json"))
|
||||
if err != nil {
|
||||
@@ -197,7 +197,7 @@ func bootTaskID(mountDir string, log *slog.Logger) (int64, bool) {
|
||||
}
|
||||
var payload container.TaskPayload
|
||||
if err := json.Unmarshal(data, &payload); err != nil {
|
||||
log.Warn("task.json present but unparseable — falling back to shared queue subscription", "err", err)
|
||||
log.Warn("task.json present but unparseable -- falling back to shared queue subscription", "err", err)
|
||||
return 0, false
|
||||
}
|
||||
if payload.ID <= 0 {
|
||||
|
||||
@@ -13,14 +13,14 @@ import (
|
||||
func TestBootTaskID(t *testing.T) {
|
||||
log := slog.New(slog.DiscardHandler)
|
||||
|
||||
t.Run("no task.json — shared pool mode", func(t *testing.T) {
|
||||
t.Run("no task.json -- shared pool mode", func(t *testing.T) {
|
||||
id, ok := bootTaskID(t.TempDir(), log)
|
||||
if ok || id != 0 {
|
||||
t.Fatalf("bootTaskID() = (%d, %v), want (0, false)", id, ok)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("valid task.json — dedicated per-task mode", func(t *testing.T) {
|
||||
t.Run("valid task.json -- dedicated per-task mode", func(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
data, err := json.Marshal(container.TaskPayload{ID: 42, Owner: "acme", Repo: "widget"})
|
||||
if err != nil {
|
||||
|
||||
@@ -29,7 +29,7 @@ const rpcTimeout = 60 * time.Second
|
||||
// operations run directly against the container's bind-mounted worktree.
|
||||
//
|
||||
// Prepare deliberately discards the RPC response's directory (the
|
||||
// daemon's host-side path) and returns localDir instead — archied and
|
||||
// daemon's host-side path) and returns localDir instead -- archied and
|
||||
// archie-agent see the same files at different paths.
|
||||
type hybridTrees struct {
|
||||
push *worktreerpc.Client
|
||||
@@ -72,7 +72,7 @@ var _ workflow.Trees = (*hybridTrees)(nil)
|
||||
// runTask builds a workflow.Registry from the container's own mounted
|
||||
// worktree, routes and runs req.Task's entire workflow, and reports the
|
||||
// terminal outcome. Store/Forge/worktree-push calls proxy back to archied
|
||||
// over nc; Store is archied's sole authority for task state — the
|
||||
// over nc; Store is archied's sole authority for task state -- the
|
||||
// returned Response.Task is a best-effort snapshot for logging only.
|
||||
func runTask(ctx context.Context, req taskrun.Request, nc *natsio.Conn, newRunner agentexec.RunnerFactory, workDir string, log *slog.Logger) (*taskrun.Response, error) {
|
||||
registry, err := skillbuild.BuildRegistry(workDir)
|
||||
@@ -118,7 +118,7 @@ func runTask(ctx context.Context, req taskrun.Request, nc *natsio.Conn, newRunne
|
||||
|
||||
// handleTaskRun decodes a taskrun.Request from msg, runs it via runTask
|
||||
// against the container's fixed worktree mount, and replies with the
|
||||
// outcome. Errors are reported in the reply, not returned — there's no
|
||||
// outcome. Errors are reported in the reply, not returned -- there's no
|
||||
// caller to return them to; this is a NATS subscription callback.
|
||||
func handleTaskRun(ctx context.Context, msg *natsio.Msg, nc *natsio.Conn, log *slog.Logger) {
|
||||
var req taskrun.Request
|
||||
|
||||
@@ -166,7 +166,7 @@ func TestRunTaskExecutesBootstrapWorkflowEndToEnd(t *testing.T) {
|
||||
BaseURL: "file://" + host,
|
||||
}
|
||||
|
||||
// The daemon always prepares the worktree before container acquire —
|
||||
// The daemon always prepares the worktree before container acquire --
|
||||
// reproduce that here so the container's bind mount has real content.
|
||||
hostDir, _, err := daemonTrees.Prepare(ctx, "acme", "widget", "main", 1, task.Title, "", "bootstrap")
|
||||
if err != nil {
|
||||
|
||||
+4
-4
@@ -122,7 +122,7 @@ func run() int {
|
||||
}()
|
||||
}
|
||||
|
||||
// NATS client (optional — SQLite flow unchanged when [nats] is absent).
|
||||
// NATS client (optional -- SQLite flow unchanged when [nats] is absent).
|
||||
var natsClient *nats.Client
|
||||
if cfg.NATS.URL != "" {
|
||||
natsToken, err := configuredNATSToken(cfg.NATS, os.Getenv)
|
||||
@@ -139,7 +139,7 @@ func run() int {
|
||||
log.Info("nats connected", "url", cfg.NATS.URL)
|
||||
}
|
||||
|
||||
// Container pool (optional — no containers when [containers] is absent).
|
||||
// Container pool (optional -- no containers when [containers] is absent).
|
||||
var containerPool *container.Pool
|
||||
var storeBackend storage.Backend
|
||||
if cfg.Containers.Enabled {
|
||||
@@ -175,7 +175,7 @@ func run() int {
|
||||
storeBackend = storage.NewDockerBackend(dockerCli)
|
||||
}
|
||||
|
||||
// Gateways (optional — absent [chat.telegram] disables). Multi-agent
|
||||
// Gateways (optional -- absent [chat.telegram] disables). Multi-agent
|
||||
// collaboration PRD phase C (docs/prds/multi-agent-collaboration.md).
|
||||
if cfg.Chat.Telegram.TokenEnv != "" {
|
||||
tgToken := os.Getenv(cfg.Chat.Telegram.TokenEnv)
|
||||
@@ -237,7 +237,7 @@ func run() int {
|
||||
log.Info("workflow registry built", "workflows", len(registry))
|
||||
|
||||
// Load daemon plugins from the configured plugin directory (Layer 2).
|
||||
// Failed plugins are skipped — the daemon starts with the remaining set.
|
||||
// Failed plugins are skipped -- the daemon starts with the remaining set.
|
||||
var pluginReg *plugin.Registry
|
||||
if cfg.PluginDir != "" {
|
||||
plugins, err := plugin.LoadDir(cfg.PluginDir, pluginextract.Symbols)
|
||||
|
||||
Reference in new issue
Block a user