Repository navigation
Conversation
5 tasks done
A Linear agent session showed only the start and the end of a task. It now
shows what the agent is doing while it works, where the task stands, and
whether the reader has to act:
- each tool call as an ephemeral action ("Reading `src/app.ts`"), replaced by
the next one
- the agent's messages as thoughts, clipped to 600 characters
- setup steps: issue context gathered, repository cloned, attachments read,
nudge picked up
- "Queued" and "Still queued (N min so far)" while waiting on the
concurrency limit; the admission reconciler re-emits admission_queued
every 15 minutes so a long wait does not go stale
- the session checklist (Linear's plan): understand the ticket, set up the
repository, write the code, open the pull request, ready for your review.
The stage is kept on the task record with a forward-only conditional
write; the terminal event completes it or cancels what was left
- a closing line on the final activity saying whether the reader needs to do
anything (review the PR, answer the question, try again)
- a task that ends with a pull request moves its issue to In Review, which
the setup guide already promised for session tasks
Persistent activities are capped at 30 per task with a conditional counter
on the task record, so a long run cannot flood the session. Ephemeral tool
calls do not count, and only the newest tool call per task in a stream batch
is sent. Progress events have their own per-invocation cap, so they cannot
crowd out the lifecycle events. Activity ids are derived from the event id,
so a stream retry does not post twice.
Progress and the checklist are best effort: a failed write is logged, never
retried, and nothing is posted after the session's final response or a
terminal status. Progress events only route when
LINEAR_AGENT_SESSIONS_ENABLED is set, and the comment path ignores them, so
comment-path tasks see no change.
isadeks
force-pushed
the
feat/1066-linear-session-progress
branch
from
November 24, 2026 22:58
a314fb1 to
3bf3205
Compare
…y picker - When `bgagent linear setup` moves a workspace onto the Identity vault it keeps the existing Secrets Manager token. If that token's access token has already expired, setup now says the fallback is unverified (refresh tokens expire when unused and cannot be checked without rotating) instead of printing "Kept the existing Secrets Manager token as a fallback". Seen live: a token dead since 2026-08-27 was reported as a working fallback. - The self-link and teammate pickers re-ask on an empty or invalid answer (up to 3 times). A pasted session id that ends in a newline, followed by Enter, left a stray empty line that silently skipped the self-link. (cherry picked from commit 1fbfad4)
(cherry picked from commit dd6ff85)
…loyed A Secrets Manager workspace that ABCA did not use for a while let its Linear refresh token expire, so every Linear trigger failed silently until someone re-consented through the CLI's localhost callback. The vault refreshes the grant itself and ships a hosted consent page. - enableLinearIdentityVault now defaults to whether AgentCore is deployed (which proves the region has AgentCore); deployments without AgentCore keep Secrets Manager. true|false still overrides, and any other value fails synth. - Existing vault deployments keep their resources and logical IDs; a Secrets Manager workspace keeps working until `bgagent linear setup` moves it (the resolver picks per workspace via provider_name). - Census: all 112 supported profiles pass with the vault on; the all-backends inline-network profile was already an expected rejection. - CLI hints and the setup guide / ADR-016 describe the new default. (cherry picked from commit 60bacdb)
With the vault on by default wherever AgentCore is deployed, the explicit opt-in only matters for deployments without AgentCore. (cherry picked from commit b188f5c)
…e (knip) (cherry picked from commit 844b65c)
main now rejects enableLinearIdentityVault without the linear feature, so a default derived from AgentCore alone failed every stack synthesized without Linear. An explicit true without Linear still fails. (cherry picked from commit 524af34)
…ive (#1004) Revocation detection (#812) only runs when a Linear event needs a token, so an idle workspace or a dead webhook never re-detects a dead grant, and an unused refresh token simply expires: observed live, a workspace sat with an expired refresh token for months with one ERROR log line. - The concurrency reconciler (already every 15 min) async-invokes the Linear webhook processor with {grant_health_probe: true} on exactly one tick per 12 h (isProbeTick). Best-effort: a failed invoke never affects reconciliation. - In probe mode the processor resolves a token for every active registry workspace. That refreshes expiring tokens (keeping idle grants alive) and sends a rejected grant down the existing latch-and-announce path to OperationalAlerts. Its summary logs any workspace without a usable token. - Zero new CloudFormation resources (an invoke IAM statement and two env vars): the root stack is at its 490-resource budget in some census profiles, so a rule of its own did not fit. - LINEAR_SETUP_GUIDE troubleshooting documents the probe, the alert topic (which ships without subscribers) and the recovery command. (cherry picked from commit d78a4fa)
…ts own file (knip) (cherry picked from commit 702cdbe)
…es (#1001) Post an approval-request notice on the task's Linear issue when a Cedar gate opens, and one outcome comment when it resolves (approved, denied, timed out, stranded). Notices go through the existing fan-out Linear dispatcher and workspace token resolver, are rendered from the saved approval row, and are idempotent per request via delivery markers and deterministic comment IDs. The linked task owner can reply `approve` or `deny [reason]` to the notice. The processor re-reads the comment from Linear (bot actors, the app's own identity, and issue/parent/body mismatches are ignored), checks the replier maps to the task owner, and records the decision through the same approve/deny code path as the API, tagged with a Linear decision_source. Non-owner, stale and duplicate replies get a same-thread explanation. API and CLI behaviour is unchanged; webhook signature verification is untouched. No new CloudFormation resources. (cherry picked from commit 4567ba6)
- approval-notifications: render the notice text in two helpers, so loadApprovalNotification is under the complexity ceiling of 40 (was 46) - fanout: move the Linear approval notice and the ended-task thread close out of dispatchToLinear (was 42) - pin cdk's jest moduleNameMapper in contracts/coverage-thresholds.json. The decision handlers are imported lazily with a .js extension (they validate their environment at load, and nodenext needs the extension on a dynamic import), so jest maps "./x.js" to "./x". The mapper resolves file names only: it changes no floor, no measured file and no test command. It needs a maintainer's agreement. The moved code is unchanged. (cherry picked from commit 5c2a97e)
…onto main The Linear changes of #996, #998, #1001 and #1004 were written before main's MicroVM approval lifecycle (#904), the nested maintenance stack, the shared Linear user lookup and the stricter lint. This adapts them: - approve/deny: recordApprovalForUser / recordDenialForUser keep main's post-commit step (audit and MicroVM wake) and add decision_source to its audit metadata; the API handler passes its invocation start and context - the grant health probe runs before the webhook processor's existing handler, which keeps its complexity record; the reconciler that triggers it stays in the maintenance nested stack, and the trigger sits inside main's `if (linearIntegration)` guard - the vault default resolves to on only with both Linear and AgentCore, and keeps main's guard for an explicit true without Linear - the shared Linear user lookup reads consistently, since approval replies and a session stop are authorized from it - the approval-reply check in handleCommentTrigger moves to a helper (the function was past the complexity ceiling); the control-character regexes that strip terminal escapes from untrusted text are marked as intended - stack tests count the vault's three functions and its consent-page stack
… goes out Approval requests in a Linear agent session (#1066): - a pending Cedar request is posted as an elicitation with Approve / Deny buttons (signal: select) and the time by which it is denied unanswered, from the same notice loader as the comment channel, so a delayed request that is no longer open is never shown and the text gets the same redaction - a reply in the session decides the task's open request (awaiting_approval_request_id) through recordApprovalForUser / recordDenialForUser with a linear_session decision source; only the task owner can decide, and any other reply posts the choice again so the session keeps waiting for input - a decision made elsewhere, a timeout or a stranded wait is a note; a decision made in the session is not echoed - an approve / deny when nothing is waiting is answered and starts nothing, so a late answer after a timeout cannot start new work Outbound redaction: every Linear GraphQL call's variables and every GitHub comment body the platform posts pass through the secret scanner, so agent-originated text the platform relays cannot carry a credential out. Linear API keys and OAuth tokens (lin_api_, lin_oauth_) join the scanner's patterns in the CDK and the agent, with a shared vector.
This was referenced Nov 25, 2026
An approval request on a Linear task gave a person five minutes: the effective window is the minimum of the matching rules' @approval_timeout_s and the task's approval_timeout_s, and the task default was 300 s. Someone away from the session for a meeting missed it, and the request was denied. - contracts/constants.json: approval_timeout_s.default 300 -> 1800 (the CDK, CLI and agent read it; min 30 and max 3600 are unchanged) - the built-in soft-deny rules (force pushes, protected-branch pushes, .env and credentials files) allow 3600 s, so the task's window decides instead of the rule clipping it; a team's stricter rule still clips its own window - Blueprint security.approvalTimeoutSeconds (30..3600, validated at synth) sets a repo's default. It is resolved at submit time onto the TaskRecord, like approvalGateCap, so a blueprint edit never changes a running task's window; a request's own approval_timeout_s wins. An out-of-range value in a hand-edited row is logged and ignored rather than refusing the task. - a MicroVM waiting on a default gate now sleeps up to 1740 s instead of 240 s - docs: user guide, constants, Cedar design doc, compute design, submit --help
When an issue is delegated, the session's comment is the one Linear writes
itself ("This thread is for an agent session with <app>."). It was read as
the person's directive, so it led the task description and named every
delegated task's branch (bgagent/<task>/this-thread-is-for-an-agent-session-
with-...). Seen live on three delegated issues. The placeholder alone now
reads as no directive; a person's comment that starts the same way is kept.
Seen live: a repo rule gating the test command asked twice in one task, because a session approval covered that one call only. - A request that matched exactly one rule gets a third button, Approve for this task (value "approve for this task", also accepted typed). It approves with scope rule:<id>, the scope bgagent approve --scope takes, so the agent does not ask again for that rule during the task. - The rule is read consistently from the approval request row, never from the reply. A request that matched several rules keeps Approve / Deny: the agent treats a rule approval as covering any later request that rule is among, so approving one of several would also pass requests the others raise. A whole-task answer there approves the one call and says so. - The setup guide names the button and the 30-minute default.
…ex built per key The SAST range scan flagged inputField: it built a RegExp from each key at call time. One literal pattern now matches every 'key': 'value' pair of the preview, and the caller's key order picks the value.
…stray answer With no approval request open, only a bare answer (approve, deny, approve for this task) is refused as an answer to nothing. "Deny anonymous access to /admin" as a new session's request, or "deny-list the tracker domains" to a running task, was refused instead of starting the task or reaching the agent.
bgagent repo onboard rewrites the whole RepoTable row and carries forward the Blueprint-only settings. approval_timeout_s was not among them, so re-onboarding a repo silently put its tasks back on the platform default window.
… the old window The update path only SET approval_timeout_s when it was configured, so dropping security.approvalTimeoutSeconds from a Blueprint left the earlier value on the RepoTable row and its tasks kept that window. Only the Blueprint writes the field, so the update now REMOVEs it when unset.
…estating comments checklistMoveForEvent no longer parses the PR number itself: the dispatcher already labels every checklist write from the task's PR. progressActivityId builds its version-4 UUID like the approval comment id, without the variant table. The claim helpers drop a TASK_TABLE_NAME guard the dispatcher already needs, the checklist stage drops a coercion for a writer that never existed, and two doc comments that ended up above the wrong function are back on theirs.
… recorded Session approve / deny replies were decided from the webhook's fields alone. The comment path (#1001) reads each reply back from Linear because legacy worker credentials can read the OAuth bundle that holds the webhook signing key, so a worker could otherwise sign its own approval in the owner's name. The session path now does the same: fetchSessionPromptActivity reads the prompt activity by id and the decision is recorded only when it is a human's prompt (not an app, not the token's own identity) in this session, by the same person, with the same answer. A lookup failure throws, so the delivery retries instead of trusting the webhook.
… are spaced The heartbeat fired when age % 900 < 60, which holds only when pickup runs are exactly 60 s apart: runs at 898 s and 961 s skipped the mark. Each mark (whole 15-minute periods queued) is now claimed with a conditional write of queue_heartbeat_mark on the still-QUEUED task, and only the run that claims it emits the event.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One pull request for the Linear channel. It folds in four open pull requests that conflicted with main and adds the session features they led to. Each piece has its own commits.
Area
cdkagent(one scanner pattern)clidocstoolingRelated
Fixes #1066. Closes #996, #998, #1001, #1004. Supersedes #1006, #1008, #1012 and #1014: their commits are here unchanged, then adapted to main in one commit. Changes the platform's default approval window.
Changes
1. Progress in the agent session. Tool calls show as one ephemeral line ("Running
npm test"). The agent's messages and setup steps show as activities, and a queued task says "Still queued (N min so far)" every 15 minutes. Linear'splanshows a checklist that only moves forward, through a conditional write on the task record. The final activity says whether the reader has to act, and a task that ends with a pull request moves its issue to In Review. A task posts at most 30 persistent activities and only the newest tool call per batch. Activity ids come from event ids, so a retry does not post twice, and nothing is posted after the final response. All of it needsenableLinearAgentSessions.2. Approval requests in the session. A pending Cedar request is posted with Approve and Deny buttons and its deadline. It uses the notice loader from #1001, so a request that is no longer open is never shown. A reply from the task owner decides the open request through
recordApprovalForUserorrecordDenialForUser, with alinear_sessiondecision source. Any other reply posts the choice again. A bare "approve" or "deny" with nothing waiting starts nothing. A request that matched exactly one rule also gets "Approve for this task", which approves withrule:<id>. Several matched rules keep two buttons, because the agent treats a rule approval as covering any later request that rule is among.Approval window. The agent uses the smallest of the matching rules'
@approval_timeout_sand the task'sapproval_timeout_s, so the old 300 s task default gave a person five minutes.approval_timeout_s.defaultincontracts/constants.jsongoes from 300 to 1800, and the built-in soft-deny rules allow 3600 s. The new Blueprint settingsecurity.approvalTimeoutSeconds(30 to 3600) sets a repo's default at submit time. A request's own value wins. A MicroVM waiting on a default gate now sleeps up to 1740 s instead of 240 s.Session answers are read back from Linear. Before an approve or deny is recorded, the prompt is read back from Linear by its activity id. It must be a human's prompt (not an app, not the token's own identity) in this session, by the same person, with the same answer. The comment path from #1001 does the same, because legacy worker credentials can read the OAuth bundle that holds the webhook signing key. A lookup failure throws, so the delivery retries instead of trusting the webhook.
Queue heartbeat marks. Each 15-minute mark is claimed with a conditional write of
queue_heartbeat_markon the still-QUEUED task, so it fires once even when pickup runs drift.Delegation placeholder. Linear's own "This thread is for an agent session with ..." comment was read as the task's instruction and named every delegated branch after it. It is now ignored.
3. Outbound redaction. The secret scanner runs over the variables of every Linear GraphQL call and every GitHub comment body the platform posts. Linear tokens (
lin_api_,lin_oauth_) join the scanner in the CDK and the agent, with a shared test vector.4. Folded-in pull requests
bgagent linear setupreports the vault fallback correctly, and its identity pickers ask again.5. Adapting them to main
decision_sourceto it.handleCommentTriggermoves to a helper, because that function was past the complexity ceiling.Validation
mise run lint,mise run drift-prevention, the CDK suite (9743 passed, 42 skipped), the CLI suite (1644 passed), the agent suite (3276 passed, 11 skipped) and the CI semgrep range and masking scans.redactValue, and the Blueprint andbgagent repo onboardhandling of the approval window.Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.