You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ai workflow runs on Vercel and uses OIDC for Sandbox authentication. Link the project first:
96
-
97
-
```bash
98
-
vercel link
99
-
```
100
-
101
-
Follow the prompts to connect to your Vercel team and project.
102
-
103
-
### 3. Configure environment variables
104
-
105
-
Copy the example file and fill in your credentials:
106
-
107
-
```bash
108
-
cp .env.example .env
109
-
```
110
-
111
-
Walk through each section:
112
-
113
-
**Jira** — Your Atlassian instance and API credentials:
114
-
```bash
115
-
JIRA_BASE_URL=https://your-domain.atlassian.net
116
-
JIRA_EMAIL=your-email@example.com
117
-
JIRA_API_TOKEN=your-jira-api-token # Generate at https://id.atlassian.com/manage-profile/security/api-tokens
118
-
JIRA_PROJECT_KEY=PROJ # Your Jira project key (e.g., AWT)
119
-
JIRA_WEBHOOK_SECRET= # Optional: openssl rand -hex 32. Without it, dispatch falls back to 1-min cron polling.
120
-
```
121
-
122
-
> The Jira webhook is registered separately (see [SETUP.md § 8](./SETUP.md#8-register-the-jira-webhook)). The handler at `/webhooks/jira` verifies an `X-Hub-Signature` HMAC-SHA256 header.
123
-
124
-
**Jira columns** — The board column names ai workflow watches and moves tickets between:
125
-
```bash
126
-
COLUMN_AI=AI # Column where tickets are assigned to the agent
127
-
COLUMN_AI_REVIEW=AI Review # Column where completed tickets go for human review
128
-
COLUMN_BACKLOG=Backlog # Column where tickets go when clarification is needed
129
-
```
130
-
131
-
**VCS** — Choose `github` or `gitlab`. Only fill the block matching your provider.
132
-
133
-
```bash
134
-
VCS_KIND=github
135
-
136
-
# GitHub (active when VCS_KIND=github)
137
-
GITHUB_TOKEN=ghp_xxxxxxxxxxxx # Personal access token with repo scope
138
-
GITHUB_OWNER=your-org # GitHub org or username
139
-
GITHUB_REPO=your-repo # Target repository name
140
-
GITHUB_BASE_BRANCH=main # Branch PRs will target
141
-
```
142
-
143
-
```bash
144
-
VCS_KIND=gitlab
145
-
146
-
# GitLab (active when VCS_KIND=gitlab)
147
-
GITLAB_TOKEN=glpat-xxxxxxxxxxxx # PAT with api, read_repository, write_repository scopes
148
-
GITLAB_PROJECT_ID=group/repo # Project ID or full path
149
-
GITLAB_BASE_BRANCH=main # Branch PRs will target
150
-
GITLAB_HOST=https://gitlab.com # Override for self-hosted
Operators can drive workflows directly from Slack with `/ai-workflow list | status <KEY> | cancel <KEY>` once `SLACK_SIGNING_SECRET` is set and the slash command is registered (Request URL: `https://<your-domain>/webhooks/slack`). See `.claude/skills/init-slack/references/slash-commands.md` for the full setup walkthrough.
163
-
164
-
**Agent** — AI model configuration:
165
-
```bash
166
-
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxx # Anthropic API key
167
-
CLAUDE_MODEL=claude-opus-4-6 # Model to use (default: claude-opus-4-6)
168
-
# COMMIT_AUTHOR= # Optional override (set with COMMIT_EMAIL).
169
-
# COMMIT_EMAIL= # On GitHub, leave unset to author commits as the App's bot.
170
-
```
171
-
172
-
**GitHub App bot identity** — when `VCS_KIND=github` and both `COMMIT_AUTHOR` / `COMMIT_EMAIL` are unset, the workflow derives the identity from the configured GitHub App (`<app-slug>[bot]` + the `<id>+<slug>[bot]@users.noreply.github.com` noreply address). GitHub then renders commits with the App's avatar and the `[bot]` badge in the UI.
173
-
174
-
**Switching agents** — ai workflow supports two CLI runtimes. Set `AGENT_KIND` once per deployment:
175
-
176
-
```bash
177
-
AGENT_KIND=claude # default — Anthropic Claude Code
178
-
# or
179
-
AGENT_KIND=codex # OpenAI Codex CLI
180
-
```
181
-
182
-
When `AGENT_KIND=codex`:
183
-
184
-
```bash
185
-
CODEX_API_KEY=sk-codex-xxxxxxxxxxxx # or CODEX_CHATGPT_OAUTH_TOKEN
186
-
CODEX_MODEL=gpt-5-codex # default
187
-
```
188
-
189
-
Pricing is fetched from [LiteLLM's community-maintained JSON](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) on each cold start (1h TTL by default). Override `CODEX_PRICING_URL` in air-gapped environments. When pricing is unavailable, Slack reports show tokens-only with `cost unknown`.
190
-
191
-
**Sandbox** — Concurrency and timeout limits:
192
-
```bash
193
-
MAX_CONCURRENT_AGENTS=3 # Max parallel sandboxes (default: 3)
194
-
JOB_TIMEOUT_MS=1800000 # Agent timeout in ms (default: 30 minutes)
195
-
```
196
-
197
-
**Run Registry** — Upstash Redis for tracking active runs:
If your Vercel project already has environment variables configured:
219
-
220
-
```bash
221
-
vercel env pull .env.local
222
-
```
223
-
224
-
This provisions OIDC tokens for Sandbox authentication automatically — no need to set `VERCEL_TOKEN`, `VERCEL_TEAM_ID`, or `VERCEL_PROJECT_ID` manually.
|`CRON_SECRET`| No | — | Cron endpoint auth token (Vercel sets this automatically when defined) |
312
-
313
-
† Required only for the matching `VCS_KIND`. `env.ts` cross-validates at startup.
314
-
‡ Required only for the matching `AGENT_KIND` (the OAuth token alternative also satisfies this).
315
-
\* On Vercel, OIDC authenticates the sandbox automatically. These are only needed for local development if `vercel env pull` doesn't cover your setup.
316
-
317
-
## Deploying to Vercel
318
-
319
-
### 1. Push to GitHub
320
-
321
-
ai workflow deploys automatically when connected to Vercel via Git integration.
322
-
323
-
### 2. Import project
324
-
325
-
In the [Vercel Dashboard](https://vercel.com/new), import your repository. Vercel auto-detects Nitropack and configures the build.
326
-
327
-
### 3. Set environment variables
328
-
329
-
Add all required environment variables in your Vercel project settings under **Settings → Environment Variables**. You can also use the CLI:
330
-
331
-
```bash
332
-
vercel env add JIRA_BASE_URL
333
-
vercel env add JIRA_API_TOKEN
334
-
# ... repeat for each variable
335
-
```
336
-
337
-
### 4. Cron job
338
-
339
-
The cron schedule is configured in `vercel.json` and activates automatically on deploy:
340
-
341
-
```json
342
-
{
343
-
"crons": [
344
-
{
345
-
"path": "/cron/poll",
346
-
"schedule": "* * * * *"
347
-
}
348
-
]
349
-
}
350
-
```
351
-
352
-
This hits `/cron/poll` every minute. Vercel injects the `CRON_SECRET` header automatically.
353
-
354
-
### 5. CI/CD
355
-
356
-
Two GitHub Actions workflows are included:
71
+
## Setup
357
72
358
-
-**CI** (`ci.yml`) — Runs on pull requests targeting `main`/`dev` and on `merge_group` events. Runs typecheck and unit tests; gates the merge queue on `e2e-orchestration → e2e-capacity → e2e-agent`.
359
-
-**E2E** (`e2e.yml`) — Manual `workflow_dispatch` with tier selection (`orchestration`, `capacity`, `agent`, `all`) and an `agent` choice (`claude` | `codex`):
-**capacity** — concurrency, claim/release, reconciler (30 min timeout, runs after orchestration)
362
-
-**agent** — full ticket → PR run against real Jira + GitHub (120 min timeout, runs after capacity)
73
+
For installation, environment variables, and deployment instructions, see [SETUP.md](./SETUP.md).
363
74
364
75
## Workflow Deep-dive
365
76
@@ -389,7 +100,7 @@ There is a single durable workflow — `agentWorkflow` in [`src/workflows/agent.
389
100
390
101
If either phase returns `clarification_needed`, the workflow posts numbered questions as a Jira comment, moves the ticket to Backlog, and emits a `needs_clarification` Slack event. If a phase fails or times out, the ticket is moved to Backlog with a `failed` event.
391
102
392
-
> A third "Review" phase exists as commented-out scaffolding in `agent.ts`. It's intentionally disabled today.
103
+
> A third "Review" phase is implemented in `agent.ts` but gated behind `ENABLE_REVIEW_PHASE` (default `false`). When enabled, it runs after Phase 2 — the agent self-reviews its diff and fixes issues before push (15 min poll cap, `REVIEW_SCHEMA` for structured output).
0 commit comments