Skip to content

Add session summary to agent workflow#14

Merged
kenorb merged 3 commits into
masterfrom
opencode/dispatch-7a9c78-20260506165258
May 6, 2026
Merged

Add session summary to agent workflow#14
kenorb merged 3 commits into
masterfrom
opencode/dispatch-7a9c78-20260506165258

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

I have updated the cogni-ai-agent.yml workflow to include a session summary step, following the pattern specified in the cogni-ai-agent-action repository.

Changes Made:

  1. Added actions: read permission: Updated the cogni-ai-agent job permissions to allow the summary action to retrieve job logs.
  2. Added Generate Session Summary step:
    • Invokes Cogni-AI-OU/cogni-ai-agent-action/ai-inference/summary@main.
    • Uses if: always() to ensure a summary (including failure analysis) is generated even if the agent execution fails.
    • Provides the necessary github_token.

Verification:

  • Validated the modified workflow using actionlint via pre-commit.
  • Verified YAML formatting using yamllint via pre-commit.

The summary action will now automatically generate a human-readable execution summary and visual audit report in the GitHub Actions job summary after each agent run.

Triggered by workflow_dispatch

New%20session%20-%202026-05-06T16%3A52%3A57.165Z
opencode session  |  github run

Co-authored-by: kenorb <kenorb@users.noreply.github.com>
@sourcery-ai

sourcery-ai Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the cogni-ai-agent GitHub Actions workflow to grant read access to Actions data and append a new, always-running session summary step that invokes the shared summary action with the appropriate GitHub token.

File-Level Changes

Change Details Files
Adjust job permissions so the workflow can read Actions data required for generating summaries.
  • Add actions: read to the cogni-ai-agent job permissions block while keeping existing write permissions intact
.github/workflows/cogni-ai-agent.yml
Add a post-run session summary step that always executes and calls the shared summary action with credentials.
  • Append a Generate Session Summary step after the agent execution step
  • Configure the step with if: always() so it runs even when previous steps fail
  • Invoke Cogni-AI-OU/cogni-ai-agent-action/ai-inference/summary@main
  • Pass secrets.GITHUB_TOKEN to the action via the github_token input
.github/workflows/cogni-ai-agent.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@kenorb

kenorb commented May 6, 2026

Copy link
Copy Markdown
Member

/co Add as a separate job as per example.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider pinning Cogni-AI-OU/cogni-ai-agent-action/ai-inference/summary to a specific tag or commit SHA instead of @main to avoid unexpected behavior from upstream changes.
  • You can use the built-in ${{ github.token }} instead of secrets.GITHUB_TOKEN for github_token to align with current GitHub Actions best practices and keep the config slightly clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider pinning `Cogni-AI-OU/cogni-ai-agent-action/ai-inference/summary` to a specific tag or commit SHA instead of `@main` to avoid unexpected behavior from upstream changes.
- You can use the built-in `${{ github.token }}` instead of `secrets.GITHUB_TOKEN` for `github_token` to align with current GitHub Actions best practices and keep the config slightly clearer.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Co-authored-by: kenorb <kenorb@users.noreply.github.com>
@opencode-agent

opencode-agent Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

I have updated the .github/workflows/cogni-ai-agent.yml workflow to move the session summary generation into a dedicated job, following the recommended pattern and addressing recent code review feedback.

Changes Summary:

  1. Isolated Summary Job: Created a new summary job that runs after cogni-ai-agent finishes. This job is configured with if: always() && needs.cogni-ai-agent.result != 'skipped' to ensure summaries are generated even if the agent fails, while avoiding runs when the agent is skipped.
  2. Reduced Agent Permissions: Removed the actions: read permission from the cogni-ai-agent job as it is no longer needed there, adhering to the principle of least privilege.
  3. Best Practices & Security:
    • Switched from secrets.GITHUB_TOKEN to the built-in ${{ github.token }}.
    • Pinned the summary action to a specific commit SHA (d883c78527dba26908459dc3c86e2cdeddf42f0a) to ensure workflow stability and security.
  4. Validation: Verified the modified workflow using actionlint and yamllint via pre-commit. The file was also automatically formatted using yamlfix.

The session summary will now be generated in a separate job, making the workflow more robust and easier to monitor.

New%20session%20-%202026-05-06T17%3A02%3A18.194Z
opencode session  |  github run

@kenorb kenorb merged commit 51c7471 into master May 6, 2026
2 of 8 checks passed
@kenorb kenorb deleted the opencode/dispatch-7a9c78-20260506165258 branch May 6, 2026 17:09
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.

1 participant