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
Addresses four PR review items focused on operator UX when things go
sideways:
- isWebhookSecretConfigured (review high). The bare
`catch { return false }` swallowed AccessDeniedException and
DecryptionFailureException, making setup re-prompt for a webhook
secret when the real problem was IAM. Now: only
ResourceNotFoundException returns false; everything else throws a
CliError pointing the operator at the IAM gap. Test updated to
assert both paths.
- admin invite-user half-create (review medium). If
AdminCreateUser succeeds but AdminSetUserPassword fails (stricter
password policy than generator, partial IAM grant on the Set verb),
the user was left in FORCE_CHANGE_PASSWORD with no diagnostic. Wrap
the second call in try/catch and throw a CliError that names the
user, explains the broken state, and gives both a delete-user CLI
and a manual-fix path.
- PAK migration runbook (review non-blocking #1). Expanded the
"Migration from 2.0a (PAK) to 2.0b (OAuth)" section in
LINEAR_SETUP_GUIDE.md with: a pre-deploy checklist, what survives
the migration vs what doesn't, an explicit rollback note (fix
forward; the original PAK secret is gone with the CFN resource),
and the per-step difference between 2.0a-with-Identity (skipped) vs
2.0a-with-PAK (migrate) deploys.
- Vestigial AgentCore Identity dep (review non-blocking #2).
bedrock-agentcore==1.9.1 is kept in agent/pyproject.toml because
the workload-token bridge in server.py still calls it (now wrapped
in try/except per review batch 1). Add an inline comment
explaining why it's pinned even though Phase 2.0b-O2 reads
Secrets Manager directly — it's the seam for resuming the
AgentCore Identity path in 2.0c.
CLI tests: 13/13 pass.
Copy file name to clipboardExpand all lines: docs/guides/LINEAR_SETUP_GUIDE.md
+41-8Lines changed: 41 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,16 +226,49 @@ The signing secret in Secrets Manager doesn't match the webhook. Re-run `bgagent
226
226
227
227
## Migration from 2.0a (PAK) to 2.0b (OAuth)
228
228
229
-
If your deployment is on Phase 2.0a (personal API key), 2.0b is a **hard cutover** — there is no `--use-pak` fallback flag. Plan for a maintenance window:
229
+
If your deployment is on Phase 2.0a (personal API key), 2.0b is a **hard cutover** — there is no `--use-pak` fallback flag. Plan for a short maintenance window (typically <30 min for a single workspace).
230
230
231
-
1.**Drain the queue.** Wait for in-flight tasks to finish. In-flight tasks at upgrade time will fail their final Linear comment because the OAuth token isn't yet authorized when the agent looks for it.
232
-
2.**Deploy 2.0b.**`mise //cdk:deploy`. This adds `LinearWorkspaceRegistryTable`, removes `LinearApiTokenSecret` IAM grants from the agent runtime + Lambdas, and removes the `linear-api-key` AgentCore credential provider's role in the runtime.
233
-
3.**For each Linear workspace, run Steps 1–4 above.** Each workspace needs a new Linear OAuth app, a new AgentCore credential provider (`linear-oauth-<slug>`), and a fresh OAuth authorize via `bgagent linear setup`.
234
-
4.**Verify with a test issue.** Apply the `bgagent` label in each onboarded workspace and confirm the agent posts as `bgagent[bot]` (not as the previous PAK owner's Linear identity).
235
-
5.**Decommission the PAK.** Once 2.0b is verified working, revoke the personal API key in Linear settings ([Linear Settings → Security](https://linear.app/settings/account/security) → Personal API keys → revoke). The PAK is no longer used by any code path; revoking it is a clean break.
236
-
6.**Clean up the old api-key credential provider:**`aws bedrock-agentcore-control delete-api-key-credential-provider --name linear-api-key`.
231
+
> **What changes under the hood.** 2.0a stored a single `LinearApiTokenSecret` (one PAK shared by all teammates) and granted the agent runtime `secretsmanager:GetSecretValue` on that one ARN. 2.0b stores a per-workspace `bgagent-linear-oauth-<slug>` secret containing `{access_token, refresh_token, expires_at, client_id, client_secret, …}`, and replaces the single-ARN grant with a `bgagent-linear-oauth-*` prefix grant. The CDK stack drops the `LinearApiTokenSecret` resource entirely, so there's no automated rollback once 2.0b is deployed.
237
232
238
-
User mappings in `LinearUserMappingTable` survive the migration — they're keyed on Linear identity, which is unchanged. Project mappings in `LinearProjectMappingTable` likewise survive.
233
+
### Pre-deploy checklist
234
+
235
+
Run these BEFORE deploying 2.0b so you have everything ready when the maintenance window starts:
236
+
237
+
1.**List your in-flight tasks.**`bgagent list --status RUNNING --status PENDING` — the migration will not corrupt these, but their final Linear comment may fail because the OAuth token isn't yet authorized when the agent runs.
238
+
2.**Pick one Linear workspace to migrate first.** Multi-workspace orgs should rehearse on the lowest-traffic workspace before doing the rest.
239
+
3.**Note the workspace's `urlKey`** (the `<slug>` in `linear.app/<slug>/...`). You'll need it for `bgagent linear setup <slug>`.
240
+
4.**Confirm CLI admin access.** You need an AWS principal with `secretsmanager:CreateSecret` on `bgagent-linear-oauth-*` AND `dynamodb:PutItem` on `LinearWorkspaceRegistryTable`. Without these, `bgagent linear setup` aborts mid-way (the OAuth dance succeeds, the secret write fails — your Linear OAuth app gets stuck with no usable token).
241
+
242
+
### Migration steps
243
+
244
+
1.**Drain the queue.** Wait for in-flight tasks to finish. In-flight tasks at deploy time will fail their final Linear comment because their token resolver short-circuits when neither `LinearApiTokenSecret` (gone) nor `bgagent-linear-oauth-<slug>` (not yet created) is present.
245
+
2.**Deploy 2.0b.**`mise //cdk:deploy`. This adds `LinearWorkspaceRegistryTable`, removes the `LinearApiTokenSecret` resource and IAM grants, and adds the `bgagent-linear-oauth-*` prefix grant on the agent runtime + webhook processor + orchestrator.
246
+
3.**For each Linear workspace, run [Steps 1–4 above](#step-by-step-setup).** Each workspace needs:
247
+
- A new Linear OAuth app (Settings → API → Applications → Create new app, scopes `read,write,app:assignable,app:mentionable`)
248
+
-`bgagent linear setup <slug>` to run the OAuth dance and write the per-workspace secret
249
+
- The webhook signing secret pasted into the Secrets Manager `LinearWebhookSecret` resource
250
+
4.**Re-onboard projects.** If 2.0a had `LinearProjectMappingTable` rows, they survive — but verify with `bgagent linear list-projects` that the listed projects still match what's mapped. The mapping rows are keyed on `linear_project_id` UUID which is stable across the migration.
251
+
5.**Verify with a test issue.** Apply the trigger label in each onboarded workspace and confirm the agent posts as `bgagent[bot]` (not as the previous PAK owner's Linear identity). The author byline change is the cleanest signal that OAuth — not the PAK — is on the wire.
252
+
6.**Decommission the PAK.** Once 2.0b is verified working, revoke the personal API key in Linear settings ([Linear Settings → Security](https://linear.app/settings/account/security) → Personal API keys → revoke). The PAK is no longer used by any code path; revoking is a clean break with no rollback.
253
+
254
+
### Rollback
255
+
256
+
If 2.0b fails verification and you need to revert before doing the OAuth setup:
257
+
258
+
- The `LinearApiTokenSecret` CFN resource has been deleted, so a `cdk deploy` of the previous commit will recreate it but **the secret value will be empty**. You'd need to re-paste the PAK value manually.
259
+
- Recommend instead: **fix-forward**. The 2.0b OAuth dance is a 5-minute step per workspace; rolling back is rarely worth the time.
260
+
261
+
### What survives the migration
262
+
263
+
-**`LinearUserMappingTable`** — keyed on Linear identity (organization + user UUID), which is unchanged across PAK→OAuth.
264
+
-**`LinearProjectMappingTable`** — keyed on `linear_project_id` UUID, also stable.
265
+
-**`LinearWebhookDedupTable`** — TTL-bounded; rows from the maintenance window will TTL out within 8h.
266
+
-**GitHub PR comments and Linear-issue mappings** in any in-flight task records.
267
+
268
+
### What does NOT survive
269
+
270
+
-`LinearApiTokenSecret` Secrets Manager value — gone with the CDK resource.
271
+
- The 2.0a `linear-api-key` AgentCore credential provider (if 2.0a-with-Identity was deployed mid-Phase) — clean it up after with: `aws bedrock-agentcore-control delete-api-key-credential-provider --name linear-api-key`. Phase 2.0b-O2 does not use AgentCore Identity at all, so there's nothing to clean up if you skipped the parked 2.0a-Identity branch.
Copy file name to clipboardExpand all lines: docs/src/content/docs/using/Linear-setup-guide.md
+41-8Lines changed: 41 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,16 +230,49 @@ The signing secret in Secrets Manager doesn't match the webhook. Re-run `bgagent
230
230
231
231
## Migration from 2.0a (PAK) to 2.0b (OAuth)
232
232
233
-
If your deployment is on Phase 2.0a (personal API key), 2.0b is a **hard cutover** — there is no `--use-pak` fallback flag. Plan for a maintenance window:
233
+
If your deployment is on Phase 2.0a (personal API key), 2.0b is a **hard cutover** — there is no `--use-pak` fallback flag. Plan for a short maintenance window (typically <30 min for a single workspace).
234
234
235
-
1.**Drain the queue.** Wait for in-flight tasks to finish. In-flight tasks at upgrade time will fail their final Linear comment because the OAuth token isn't yet authorized when the agent looks for it.
236
-
2.**Deploy 2.0b.**`mise //cdk:deploy`. This adds `LinearWorkspaceRegistryTable`, removes `LinearApiTokenSecret` IAM grants from the agent runtime + Lambdas, and removes the `linear-api-key` AgentCore credential provider's role in the runtime.
237
-
3.**For each Linear workspace, run Steps 1–4 above.** Each workspace needs a new Linear OAuth app, a new AgentCore credential provider (`linear-oauth-<slug>`), and a fresh OAuth authorize via `bgagent linear setup`.
238
-
4.**Verify with a test issue.** Apply the `bgagent` label in each onboarded workspace and confirm the agent posts as `bgagent[bot]` (not as the previous PAK owner's Linear identity).
239
-
5.**Decommission the PAK.** Once 2.0b is verified working, revoke the personal API key in Linear settings ([Linear Settings → Security](https://linear.app/settings/account/security) → Personal API keys → revoke). The PAK is no longer used by any code path; revoking it is a clean break.
240
-
6.**Clean up the old api-key credential provider:**`aws bedrock-agentcore-control delete-api-key-credential-provider --name linear-api-key`.
235
+
> **What changes under the hood.** 2.0a stored a single `LinearApiTokenSecret` (one PAK shared by all teammates) and granted the agent runtime `secretsmanager:GetSecretValue` on that one ARN. 2.0b stores a per-workspace `bgagent-linear-oauth-<slug>` secret containing `{access_token, refresh_token, expires_at, client_id, client_secret, …}`, and replaces the single-ARN grant with a `bgagent-linear-oauth-*` prefix grant. The CDK stack drops the `LinearApiTokenSecret` resource entirely, so there's no automated rollback once 2.0b is deployed.
241
236
242
-
User mappings in `LinearUserMappingTable` survive the migration — they're keyed on Linear identity, which is unchanged. Project mappings in `LinearProjectMappingTable` likewise survive.
237
+
### Pre-deploy checklist
238
+
239
+
Run these BEFORE deploying 2.0b so you have everything ready when the maintenance window starts:
240
+
241
+
1.**List your in-flight tasks.**`bgagent list --status RUNNING --status PENDING` — the migration will not corrupt these, but their final Linear comment may fail because the OAuth token isn't yet authorized when the agent runs.
242
+
2.**Pick one Linear workspace to migrate first.** Multi-workspace orgs should rehearse on the lowest-traffic workspace before doing the rest.
243
+
3.**Note the workspace's `urlKey`** (the `<slug>` in `linear.app/<slug>/...`). You'll need it for `bgagent linear setup <slug>`.
244
+
4.**Confirm CLI admin access.** You need an AWS principal with `secretsmanager:CreateSecret` on `bgagent-linear-oauth-*` AND `dynamodb:PutItem` on `LinearWorkspaceRegistryTable`. Without these, `bgagent linear setup` aborts mid-way (the OAuth dance succeeds, the secret write fails — your Linear OAuth app gets stuck with no usable token).
245
+
246
+
### Migration steps
247
+
248
+
1.**Drain the queue.** Wait for in-flight tasks to finish. In-flight tasks at deploy time will fail their final Linear comment because their token resolver short-circuits when neither `LinearApiTokenSecret` (gone) nor `bgagent-linear-oauth-<slug>` (not yet created) is present.
249
+
2.**Deploy 2.0b.**`mise //cdk:deploy`. This adds `LinearWorkspaceRegistryTable`, removes the `LinearApiTokenSecret` resource and IAM grants, and adds the `bgagent-linear-oauth-*` prefix grant on the agent runtime + webhook processor + orchestrator.
250
+
3.**For each Linear workspace, run [Steps 1–4 above](#step-by-step-setup).** Each workspace needs:
251
+
- A new Linear OAuth app (Settings → API → Applications → Create new app, scopes `read,write,app:assignable,app:mentionable`)
252
+
-`bgagent linear setup <slug>` to run the OAuth dance and write the per-workspace secret
253
+
- The webhook signing secret pasted into the Secrets Manager `LinearWebhookSecret` resource
254
+
4.**Re-onboard projects.** If 2.0a had `LinearProjectMappingTable` rows, they survive — but verify with `bgagent linear list-projects` that the listed projects still match what's mapped. The mapping rows are keyed on `linear_project_id` UUID which is stable across the migration.
255
+
5.**Verify with a test issue.** Apply the trigger label in each onboarded workspace and confirm the agent posts as `bgagent[bot]` (not as the previous PAK owner's Linear identity). The author byline change is the cleanest signal that OAuth — not the PAK — is on the wire.
256
+
6.**Decommission the PAK.** Once 2.0b is verified working, revoke the personal API key in Linear settings ([Linear Settings → Security](https://linear.app/settings/account/security) → Personal API keys → revoke). The PAK is no longer used by any code path; revoking is a clean break with no rollback.
257
+
258
+
### Rollback
259
+
260
+
If 2.0b fails verification and you need to revert before doing the OAuth setup:
261
+
262
+
- The `LinearApiTokenSecret` CFN resource has been deleted, so a `cdk deploy` of the previous commit will recreate it but **the secret value will be empty**. You'd need to re-paste the PAK value manually.
263
+
- Recommend instead: **fix-forward**. The 2.0b OAuth dance is a 5-minute step per workspace; rolling back is rarely worth the time.
264
+
265
+
### What survives the migration
266
+
267
+
-**`LinearUserMappingTable`** — keyed on Linear identity (organization + user UUID), which is unchanged across PAK→OAuth.
268
+
-**`LinearProjectMappingTable`** — keyed on `linear_project_id` UUID, also stable.
269
+
-**`LinearWebhookDedupTable`** — TTL-bounded; rows from the maintenance window will TTL out within 8h.
270
+
-**GitHub PR comments and Linear-issue mappings** in any in-flight task records.
271
+
272
+
### What does NOT survive
273
+
274
+
-`LinearApiTokenSecret` Secrets Manager value — gone with the CDK resource.
275
+
- The 2.0a `linear-api-key` AgentCore credential provider (if 2.0a-with-Identity was deployed mid-Phase) — clean it up after with: `aws bedrock-agentcore-control delete-api-key-credential-provider --name linear-api-key`. Phase 2.0b-O2 does not use AgentCore Identity at all, so there's nothing to clean up if you skipped the parked 2.0a-Identity branch.
0 commit comments