feat: ITT-150 add agent run context#2949
Conversation
|
@get6 is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
…text # Conflicts: # server/internal/service/task.go
|
Superseded by clean ITT-150 PR: #2950 |
There was a problem hiding this comment.
Pull request overview
This PR adds a shared “agent run context” concept that is captured at task enqueue time, persisted on the task row, and then injected into daemon-spawned agent runs as both environment variables and a machine-readable .multica/run/context.json file. It also introduces a CLI command to inspect that context and tightens CLI behavior in agent execution contexts (no fallback to member config/identity).
Changes:
- Persist an issue snapshot JSON on
agent_task_queue.contextfor issue-bound tasks and surface it through the daemon claim response. - Write
.multica/run/context.jsonat execenv preparation time and injectMULTICA_RUN_CONTEXT+ task/issue env vars for agent runs. - Add
multica issue context --output jsonplus regression tests across daemon/handler/execenv/CLI paths.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/pkg/db/queries/agent.sql | Adds context to CreateAgentTask insert to persist the issue snapshot at enqueue time. |
| server/pkg/db/generated/agent.sql.go | Regenerates sqlc bindings to include the new Context parameter. |
| server/internal/service/task.go | Builds and stores an IssueSnapshot JSON payload when enqueueing issue/mention tasks. |
| server/internal/runcontext/runcontext.go | Introduces shared run-context models + helpers (normalize/parse/build). |
| server/internal/handler/daemon.go | Reads stored snapshot from task context, falls back explicitly when missing/corrupt, and returns issue/parent/properties in claim response. |
| server/internal/handler/daemon_test.go | Adds regression test ensuring snapshot round-trips through claim response. |
| server/internal/handler/agent.go | Extends task API response shape to include issue, parent, and properties. |
| server/internal/daemon/types.go | Extends daemon task model to carry run-context fields from the claim response. |
| server/internal/daemon/execenv/runtime_config.go | Documents the new multica issue context --output json command and run-context env vars. |
| server/internal/daemon/execenv/execenv.go | Tracks RunContextPath on the prepared environment for injection. |
| server/internal/daemon/execenv/execenv_test.go | Verifies .multica/run/context.json is written and contains expected content. |
| server/internal/daemon/execenv/context.go | Writes .multica/run/context.json alongside the existing issue context file. |
| server/internal/daemon/daemon.go | Injects run-context env vars and includes run-context fields in execenv context creation. |
| server/internal/daemon/daemon_test.go | Adds unit test coverage for run-context env var injection. |
| server/cmd/multica/help.go | Documents MULTICA_RUN_CONTEXT in CLI help output. |
| server/cmd/multica/cmd_issue_test.go | Adds tests for agent headers and multiline preservation while expanding issue command coverage. |
| server/cmd/multica/cmd_issue_context.go | Adds multica issue context command to print current run context JSON. |
| server/cmd/multica/cmd_issue_context_test.go | Adds coverage for successful printing and explicit missing/orphaned context errors. |
| server/cmd/multica/cmd_auth.go | Avoids token fallback in agent execution context; enriches auth status output with token source + mutation identity. |
| server/cmd/multica/cmd_auth_test.go | Adds tests for auth status output behavior in agent contexts. |
| server/cmd/multica/cmd_agent.go | Introduces stricter agent-execution identity parsing/validation and requires MULTICA_TOKEN in agent context. |
| server/cmd/multica/cmd_agent_test.go | Adds tests ensuring agent-context token behavior and identity guards are enforced. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // CR/LF and other whitespace control bytes collapse to a single space; other | ||
| // C0 controls and DEL are dropped; markdown structural characters that have | ||
| // meaning in inline context (`*`, `_`, `` ` ``, `\`, `[`, `]`, `<`) are | ||
| // meaning in inline context (`*`, `_`, “ ` “, `\`, `[`, `]`, `<`) are |
Summary
.multica/run/context.jsonat task spawn time.runcontextmodel andmultica issue context --output jsonfor current run context inspection.Closes ITT-150
Test