Agent tasks

Authorized reviews and code changes that Synaxis owns and an execution host performs. Off by default. The feature is proposed and being delivered in slices; this page says what exists, what it needs, and what it refuses.

What a task is

A task is one durable responsibility: a request, its acceptance criteria, who authorized it, and the evidence it produced. It is not a chat session, a job or a pull request. A task can have several attempts, a pull request it owns, findings, questions, artifacts and a timeline; its state (queued, running, waiting_input, waiting_external, ready, reconciling, ended) is separate from the pull request's own state.

Two kinds exist:

Kind Does Delivers
review Inspects a pinned revision against its base and reports findings. Never edits or publishes on its own. A report in Synaxis; publishing it upstream is a separate confirmed command
generate Changes code in a task branch under a grant. A patch artifact or a draft pull request

What is required

  1. An administrator turns the feature on (Agent:Enabled) and chooses the kinds and effects (Agent:Kinds, Agent:Effects; publication is publish, execution is execute). The same settings can be applied as the agent section of a configuration document (configuration as code), including the engine, review and publication settings; an executor host's own settings stay out of that document because its token is a secret and its placement is a deployment property.
  2. An execution engine is qualified:
    • the native engine (Agent:Engines:Native): an enrolled executor host composes the native CodeWrightAI Harness kernel — the only scheduler;
    • or the direct engine (Agent:Engines:DirectModel): a schema-validated, single model call per review. It is explicitly not native: no tools, no shell, no repository execution. Use it to try reviews; it is refused for generation.
  3. A model route exists for what the engine asks: Models:Routes:agent.review (and agent.generate when it lands). Each output to a pull-request conversation is recorded in the task timeline with its causal position and a disposition — delivery.sent, delivery.superseded when a newer publication replaces it, or delivery.undeliverable with the reason. An undeliverable destination is evidence on that task, not a blocker for other tasks.

A pull request whose webhook was missed is recovered by a bounded poll: each subscription keeps a provider cursor, and the reconciliation loop reads the pull request's current state, updates its binding, and ends the task on merge or close. Only pull-request state is polled; comments, reviews and CI results still need their delivery.

A generation attempt runs three ordered activities — plan, implement and review — each as its own Harness run with an independent conversation; a review attempt runs one review activity, and validation stays a separate approved-command step. The native scheduler owns their admission, joins and completion, and each activity's events are recorded with its label.

The CodeWrightAI desktop plugin contributes a read-only Agent tasks panel while the connection is ready; it lists the tasks you may read, the selected task's detail and its review findings, and lets you dismiss a finding with a reason, and sends pause, resume, stop and retry with the task's current revision. Answering questions, publication and merge are not in the panel yet.

build/Evaluate-AgentTasks.ps1 runs the deterministic evaluation scenarios against PostgreSQL and the fake providers and checks perf/agent/baseline.json; TestResults/agent-evaluation.json records each scenario's outcome, state, attention and duration. Model-quality numbers need a fleet and a real model and are not claimed.

A review publishes its findings with a location as inline review comments pinned to the reviewed head, each carrying a fingerprint marker; when the provider refuses the positions, the summary comment is used instead. On Azure DevOps the findings become threads on the pull request's iteration at the reviewed commit (none are placed once newer commits were pushed), then a summary thread; a draft pull request is opened there too, after one push that moves the task branch only from the commit the task expects. Both are made as the requester, so their Azure DevOps account must be linked. An attempt's validation result is published as a status by the task's authorizer: on GitHub a check run made by the App where its installation grants Checks write access, else a commit status, and on Azure DevOps a status on the pull request iteration of the evaluated commit. synaxis agent capabilities (or GET /api/v1/agent/capabilities) lists what each connection's provider supports and why the rest is absent. When newer commits were pushed since, nothing is published, so a status never describes code that was not checked. A generation task cannot become ready until the kernel reports evidence for every acceptance criterion; missing evidence blocks the task with criterion.missing.

A generation task created without acceptance criteria starts in waiting_input with one question and no attempt; answer it and the task queues, with the answer delivered as a decision input. Configure usage ceilings with SYNTAXIS_Agent__Limits__MaxModelTokens / SYNTAXIS_Agent__Limits__MaxCostUsd (0 = unlimited); the kernel reports tokens, tool calls and cost, and a ceiling fails the attempt closed (budget.exceeded), even when the reported usage is unknown.

The metrics carry synaxis_agent_tasks, synaxis_agent_operations, synaxis_agent_findings and synaxis_agent_checks, the active-task/attention/uncertain-operation/executor gauges, histograms of attempt duration, queue age and correction rounds, and synaxis_agent_review_coverage_total, which counts each review as complete, partial (the diff or file list was cut, or the executor said it left something out) or unreported. A rising share of partial reviews means the review bounds (agent.review) are too tight for the changes coming in.

Concurrency is bounded per installation, per repository and per authorizer (Agent:MaxActivePerPrincipal); two tasks cannot run on the same ref at once — the later one waits and records why. Each attempt records a budget reservation (minutes, correction rounds) and a consumption fact (wall clock; model and tool usage are unknown), and an input may cite another task the caller can read as its source.

A repository policy may carry trigger rules as JSON, e.g. {"rules":[{"id":"ci","event":"check_run","conclusions":["failure"],"mode":"observe","enabled":true}]}. A matching verified delivery records one candidate with its rule assessment (observe runs nothing). An auto rule starts a review task only when it names the principal it acts as, e.g. "authorizer":{"kind":"service_account","id":"<id>"} (or "kind":"user"): the task is created as that principal through every normal check (its repository access, the policy, the limits), once per candidate however often the delivery arrives. Without an authorizer, from a fork, carrying Synaxis's own output, or when the head cannot be proved to be the repository itself, the candidate is recorded as eligible with the reason and nothing runs; an authorizer that is disabled, expired or refused records refused. Rules use one set of events for every provider: pull_request, pull_request_review, issue_comment, check_run and workflow_run (an Azure DevOps pull request created or updated is pull_request with opened or synchronize, and a completed build is workflow_run with success, failure or cancelled), work_item (a GitHub issue), suggestion (one the repository review records or a curator releases) and schedule, which carries its own "every" and "at" in the schedule settings' syntax, e.g. {"id":"nightly","event":"schedule","every":"daily","at":"03:00","mode":"auto","authorizer":{...}}. A scheduled review targets the default branch, once per slot; saving the policy skips the slot already past. An issue or a suggestion proposes a code change, which only a person starts, so even an auto rule records it as eligible. Implementing a suggestion is a normal generate request whose origin names the suggestion; the suggestion's repository and state are checked and the task is linked.

A follow-up from a pull request — a comment, a submitted review asking for changes, or a failed CI check — is routed to the task as context (with its provider identity) and starts a bounded correction round; a follow-up that arrives after the task ended is recorded as a refusal. A pull request closed without merge and then reopened brings its task back as a new correction round, but only while the task's grant is valid, its requester still has access to the repository, nothing upstream is unsettled and rounds remain; otherwise the reopen is recorded on the timeline and a new task is needed. A merged or stopped task is never reopened. On Azure DevOps the same holds: comments, failed builds and the pull request being completed, abandoned or reactivated reach the task once, whether a service hook announced them or the five-minute poll found them; the connection subscribes the comment and pull-request hooks in each selected project.

  1. Each repository is turned on with its own policy: synaxis agent policy --repo owner/name --enable --kinds review --effects review,publish. A policy change names the version it saw and is kept as a revision; synaxis agent revisions --repo owner/name lists them and synaxis agent rollback --repo owner/name --version <n> restores one as a new revision (the REST routes are GET /api/v1/agent/repositories/{id}/policy/revisions and POST .../policy/rollback).
  2. For the native engine, an executor is enrolled and deployed (below).

Creating a task

synaxis agent review --repo owner/name --request "Review the order reservation path." --pr "#42"
synaxis agent implement --repo owner/name --request "Reject a negative quantity before reserving stock." \
  --criteria "Negative quantities are rejected|Valid orders still pass" --delivery draft_pr
synaxis agent tasks --repo owner/name
synaxis agent show <task-id>

The same create is POST /api/v1/agent/tasks and the MCP tools org_agent_task_create, org_agent_task_get, org_agent_tasks, org_agent_task_input, org_agent_task_control, org_agent_task_answer, org_agent_task_findings, org_agent_finding_disposition, org_agent_task_publish, org_agent_operation and org_agent_operation_reconcile, with the reads org_agent_task_timeline, org_agent_task_attempts, org_agent_task_questions, org_agent_task_inputs, org_agent_task_artifacts, org_agent_policy and org_agent_capabilities, and org_agent_task_merge (confirmed first, like publication). The agent tools are offered only while Agent:Enabled is on. Every mutation carries an idempotency key; a repeat with the same key and payload returns the original receipt, and a different payload under that key is refused.

Task reads and downloads are filtered by the caller's current upstream access, not by who created the task. Control (pause, resume, stop, retry, answer, publish) belongs to the requester and administrators.

Controls and evidence

synaxis agent pause <task-id> --reason "waiting for the release"
synaxis agent resume <task-id>
synaxis agent stop <task-id> --reason "not needed"
synaxis agent timeline <task-id>
synaxis agent findings <task-id>
synaxis agent disposition <task-id> --finding <id> --disposition fixed|dismissed|accepted_risk --reason "…"
synaxis agent input <task-id> --kind context|request|decision --body "…"
synaxis agent inputs <task-id>
synaxis agent readmit <task-id> --input <id> [--kind review|generate] [--request "…"]
synaxis agent artifacts <task-id>
synaxis agent merge <task-id> [--method squash] [--confirmation <token>]
  • Stop revokes the task's grant and requests cancellation. If an activity is still running, the task enters reconciling until the writer is quiescent; a stopped task cannot be revived by a retry — create a new task for a fresh grant.
  • Retry starts a new attempt only after the prior one ended, and only for a failed or still-open task whose last attempt and upstream operations are settled; otherwise it answers uncertain-ownership or uncertain-operation.
  • Reads check your current access to the repository every time; requesting a task does not keep it readable after that access is gone. Content past its retention answers content-expired; the task's record and hashes remain.
  • Publication is its own confirmed command: synaxis agent publish <task-id> --mode report|patch|draft_pr. Without the confirmation token, the answer carries the exact change and a single-use token; with it, the change is recorded as a recoverable operation and sent once. An operation whose outcome is uncertain is reconciled by provider evidence, never retried blindly (synaxis agent operation <id>, synaxis agent reconcile <id>).
  • Handed-back requests: an executor that is asked for more than the task may do (a comment asking it to deploy, say) returns that input with its reason instead of acting on it. The task page lists it under Handed back; Admit as a new task (or synaxis agent readmit) creates a separate task authorized by you, checked against the repository policy and limits like any task you create. The original task's authority never grows.
  • A review is ready when its snapshot is current, no critical or high finding is open and validation passed. A new push makes old evidence stale; old results never satisfy the new head.

Deploying an executor

An executor is an enrolled workload identity — separate from task authorizers and from users' provider tokens. It has no database credential and no publication credential.

synaxis agent executors enroll --name executor-1 --placement process --profiles static_review
# prints the token once

Write the token to a file the executor reads (Agent:Executor:TokenFile) and deploy the executor role:

docker compose --profile agent up -d executor

The Compose service mounts the ingestion mirrors read-only and gives the executor a work volume of its own. On Kubernetes there is no chart template for the executor yet: run the role as a separate Deployment with a token secret, a read-only mirror volume and a work volume, and no service account token unless the native kernel needs one.

Settings (Agent:Executor:*):

Setting Meaning
Enabled, Name, Placement The role's identity and backend (process or docker; Kubernetes and connected hosts are not qualified)
Profiles What it is qualified for (static_review; validation, generation; hostile is refused)
TokenFile The enrolled token (printed once)
MirrorRoot, WorkRoot Where mirrors are mounted read-only and where per-attempt checkouts are made
KernelCommand The native kernel command ({workspace}, {request}, {profile} placeholders). Empty refuses native execution
ImageDigest The approved container image, required for docker placement
Commands The approved validation command templates (each a name, executable, arguments, timeout and Required)

The executor polls the API, prepares a separate checkout per attempt from the read-only mirror (hooks disabled), runs the configured kernel or validation commands under a bounded run, and reports authenticated callbacks. A callback from a stale owner generation changes nothing and is retained as rejected evidence. When isolation is missing (no image for docker, no mirror, no kernel) the command is refused, never run unisolated.

Execution pool

Attempts are placed on the enrolled executors apart from task admission: an executor never runs more than its capacity, the least loaded one is chosen, and a task that finds no free slot waits (its timeline says why once) and is tried again. The agent.pool section of the configuration sets this:

Setting Meaning
maxActiveAttempts The most attempts in flight across every executor (0, the default: their capacities added up)
reserveContinuation true (default) keeps the last free slot for a task already under way (a correction round), so new work cannot starve it
waitSeconds How long a waiting task waits before placement is tried again (default 60, 5 to 3600)

Administrators see the pool on the Tasks page, with synaxis agent pool, or at GET /api/v1/agent/pool: each executor's attempts against its capacity, its unclaimed commands and when it last called, and the queued, running and waiting tasks. The same view states the retention period and what retention cannot erase: pull requests, comments and check runs a task published stay on the provider (with a count of those whose task content was erased), backups keep erased content until their own retention ends, and task rows, hashes and the audit log are kept.

An attempt's reported model tokens and cost are recorded as usage of its kind's model route (agent.review or agent.generate), so they appear on the usage page and count against that route's budget; the task's timeline names the usage record.

Draining and switching off

Three switches take work out of service without hiding or losing what is under way:

Switch Effect
Agent:Paused = true No new task starts, whether a person, a readmission or a rule asks (503, agent-paused). Existing tasks stay readable and controllable; their publications, merges and reconciliation go on.
Agent:DisabledProviders (github, ado) No new publication, status or merge is prepared for that provider (409, provider-off), and synaxis agent capabilities lists it with everything off and the reason. Follow-up polling and the reconciliation of what was already sent go on.
synaxis agent executors drain <executor> The executor finishes what it holds and takes no new attempt and no unassigned command; resume <executor> returns it to service.

Agent:Enabled = false switches the feature off entirely, reads included, so use the switches above while work is under way. To drain an installation, for example before an upgrade:

  1. Set Agent:Paused to true and restart the API, so no new task starts.
  2. Drain each executor with synaxis agent executors drain <executor>, then watch synaxis agent pool until its attempts reach zero.
  3. Check synaxis agent tasks --state reconciling and each task's operations: settle every unknown operation with synaxis agent reconcile <operation> or on the provider before you stop the executors.
  4. Upgrade, start the executors, resume them, and set Agent:Paused back to false.

Native execution (the kernel adapter)

The executor launches one kernel process per attempt. For the native engine that process is BWTECH.CodeWrightAI.Synaxis.AgentKernel (a .NET tool in this repository), which attaches to a CodeWrightAI Harness coordinator for a profile, starts one pinned workflow revision, streams the run's durable events as the executor's NDJSON events, and writes the final answer as a report artifact. It never reports completion the run did not confirm: a stream that ends without a terminal event is reported uncertain, and a missing profile or workflow fails honestly.

Agent:Executor:KernelCommand = "synaxis-agent-kernel --request {request}"
SYNAXIS_HARNESS_PROFILE       = /var/lib/synaxis/harness-profile
SYNAXIS_HARNESS_WORKFLOW_ID   = synaxis.review        # a workflow revision registered in that profile
SYNAXIS_HARNESS_WORKFLOW_VERSION = 1
SYNAXIS_HARNESS_KEY_DIRECTORY = /var/run/secrets/codewright-providers   # optional: a folder of provider keys

A Helm deployment can run an executor as an optional agentExecutor Deployment (process placement inside the pod) when a shared ReadWriteMany mirror claim and the enrolled token Secret are provided; it is unqualified and refused by the code as kubernetes placement.

The Harness profile owns the provider configuration: its harness.json names where a provider's key is, so no credential is in the profile file and none is passed through the executor. By default that is an environment variable of the Worker's start. With SYNAXIS_HARNESS_KEY_DIRECTORY (in Helm, agentExecutor.harness.keys.existingSecret), each key is the file named by its variable in that folder, a mounted Secret: before each attempt the kernel writes the server's model settings and has the Worker reload its profile, which reads every key file again, so a model, provider or key changed in Synaxis applies to the next attempt without restarting the executor or its Worker. A Worker that does not let the kernel reload (the kernel's user is not one of its decision actors) keeps its settings, and the kernel says so. Build the Harness packages the adapter needs from the sibling checkout with build/Pack-HarnessKernel.ps1 (they are pinned by HarnessVersion in Directory.Packages.props, never project-referenced).

The adapter's protocol is covered by unit tests with a scripted gateway (order, report artifact and hash, failure, uncertainty, a refused start and the attempt limit). A local run against a Harness Worker with the stub runtime attached to the profile, started a run and streamed its acceptance; the stub executes nothing, so nothing completed, which is the honest outcome. It has not been exercised against a real provider: that run, and the fleet qualification it needs, is outstanding.

What is not available

  • Native Harness composition is wired through the configured KernelCommand; an adapter executable that speaks the kernel protocol (NDJSON events) is deployment work that has not been shipped or qualified here. Without it, native tasks wait or fail visibly.
  • Generating code needs a native executor whose kernel adapter is not shipped yet, so a generation task waits or fails visibly until one is deployed (task T-SRV-99 of the product backlog). Once a task has generated files, publishing them as a draft pull request, routing the pull request's comments, reviews and failed checks back as correction rounds, and the validation status all work on GitHub and Azure DevOps.
  • What each connection's provider supports, and why the rest is absent, is in synaxis agent capabilities. A merge you confirm works on both providers: GitHub merges at the confirmed head, and Azure DevOps completes the pull request at the confirmed source commit with its branch policies enforced, never bypassed. Neither provider has merge-queue support.
  • Kubernetes and connected-machine executors, automatic merge, and hostile-code (fork) execution are not implemented or qualified, and the product refuses them rather than pretending.
  • The direct engine is not a sandbox and does not execute repository code; it is only for static review.
  • The console has a task list and a task detail page (request, authority, questions, findings, timeline, artifacts, recoverable operations with a reconcile action, and pause/resume/stop/retry/publish). Publish shows the exact change the server will make and sends it only after you confirm it there.

Troubleshooting

Symptom Cause and fix
agent-off Agent:Enabled is false
agent-kind-off The kind is off on the installation or the repository
unsupported-capability No qualified engine for that kind; configure Agent:Engines and, for generation, a native executor
model-route-missing Models:Routes:agent.review (or .generate) is not configured, or its provider fails
A native task waits No enrolled executor for its profile; synaxis agent executors list, then enroll and deploy one
task.pool.waiting on the timeline Every qualified executor is at its capacity, the pool is at maxActiveAttempts, or the last slot is reserved; see synaxis agent pool
missing-capability in the task's error The executor has no KernelCommand (or no image/mirror): it refused rather than running unisolated
confirmation-required Publication is asking the person to confirm the exact change; send the token back
not-indexed The task's refs are not fetched into the mirror yet; the task waits for the fetch
reconciling An executor or provider outcome is uncertain; reconcile it (synaxis agent reconcile <operation-id>), do not retry blindly