Skip to content

Promote dev to main: session-finish credential scope fix#1276

Merged
zbigniewsobiecki merged 5 commits into
mainfrom
dev
May 9, 2026
Merged

Promote dev to main: session-finish credential scope fix#1276
zbigniewsobiecki merged 5 commits into
mainfrom
dev

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Promotes the current dev tip to main. Includes 5 commits ahead of main, headlined by:

Test plan

  • All commits in this range had green CI on dev individually
  • dev's CI for the latest commit (6d80fd0d) is fully green: CI, Build and Deploy (Dev), Push on dev — all passed
  • Wait for main-side CI on the merge commit to pass before considering this fully shipped

🤖 Generated with Claude Code

aaight and others added 5 commits May 8, 2026 16:53
Co-authored-by: Cascade Bot <bot@cascade.dev>
* refactor(triggers): extract agent execution lifecycle

* fix(ci): resolve production audit failure

---------

Co-authored-by: Cascade Bot <bot@cascade.dev>
* test(triggers): pin trigger contract regressions

* fix(triggers): replace mocked uniqueness check with real-implementation test

Move the built-in trigger handler name uniqueness regression out of
builtins.test.ts (which mocks listPMProviders() and every trigger module,
making it incapable of catching real production duplicates) into a new
builtins-uniqueness.test.ts that side-effect-imports the real Trello, JIRA,
and Linear manifests and calls registerBuiltInTriggers with real handler
instances. A duplicate name in any src/triggers/ handler or PM manifest will
now fail CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Cascade Bot <bot@cascade.dev>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(triggers): add canonical events and result builders

* fix(triggers): mirror prNumber into agentInput in buildGitHubPRDispatchResult

The builder required `prNumber` but only wrote it to the top-level
TriggerResult. The worker runs agents from `executionContext.agentInput`,
and the existing safety net only mirrors `workItemId`, not `prNumber`.
A migrated handler relying on the required option could therefore enqueue
a PR agent with no `input.prNumber`, breaking PR context assembly and
refs/pull checkout.

Extend `buildAgentInput` to accept an optional `prNumber` and pass the
option through so it is set in `agentInput` with the option value winning
over any stale caller-supplied value (matching the work-item mirroring
behaviour). Add tests covering both the injection-when-absent and the
stale-value-override cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Cascade Bot <bot@cascade.dev>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…1275)

The cascade-tools session finish CLI extended raw oclif Command instead
of CredentialScopedCommand, so the withGitHubToken AsyncLocalStorage
scope was never established. When the primary PR sidecar was missing
for any reason, validateFinish's secondary fallback findPRForCurrentBranch
would call getClient() against an empty scope, throw "No GitHub client
in scope", get silently swallowed by the catch in finish.ts, and the run
would fail with "Cannot finish session without creating a PR" even when
the PR existed on GitHub. Caught live on cascade run 06ec8a0a (PR #1274
was created but the run was marked failed).

Switch Finish to extend CredentialScopedCommand so it inherits the same
credential-scope wiring every other agent-facing CLI command uses.

Add a regression test that exercises the real src/github/client.js module
(only mocking the @octokit/rest constructor) so any future regression of
the credential scope re-surfaces. The existing finish.test.ts gets the PM
and GitHub credential scopes mocked as no-ops since the now-active
credential chain would otherwise need the manifest registry bootstrapped.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 667566c into main May 9, 2026
15 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

❌ Patch coverage is 97.58713% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/triggers/shared/result-builders.ts 91.30% 8 Missing ⚠️
src/triggers/shared/agent-work-items.ts 99.16% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants