Skip to content

Post ambient session results back to GitHub issues#14

Merged
jeremyeder merged 3 commits intomainfrom
ambient-post-results
Mar 26, 2026
Merged

Post ambient session results back to GitHub issues#14
jeremyeder merged 3 commits intomainfrom
ambient-post-results

Conversation

@jeremyeder
Copy link
Copy Markdown
Contributor

Summary

  • Switches from fire-and-forget to wait mode (wait: 'true', 30min timeout)
  • Posts session result as a comment on the triggering issue
  • Adds issues: write permission for the GITHUB_TOKEN
  • Result shown in a collapsible <details> block
  • Status emoji: ✅ Completed, ⚠️ Error/Timeout/Stopped, ❌ CreateFailed

Test plan

  • Merge to main
  • Comment @ambient describe what this repo does on an issue
  • Verify session result is posted back as a comment

🤖 Generated with Claude Code

- Wait for ACP session to complete before exiting
- Post session phase and result as a comment on the issue
- Add issues: write permission for commenting
- Show result in a collapsible details block

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3feb1298-eba2-475e-a980-811badd2f617

📥 Commits

Reviewing files that changed from the base of the PR and between b150388 and 2ac37a4.

📒 Files selected for processing (1)
  • .github/workflows/ambient.yml

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


Walkthrough

Workflow permissions now include issues: write. The ambient action invocation was given id: session, wait: 'true', and timeout: '300'. A new if: always() post-step formats a comment from session-* outputs and posts it to the triggering issue via gh issue comment.

Changes

Cohort / File(s) Summary
Workflow Configuration
.github/workflows/ambient.yml
Added issues: write permission. Updated ambient-code/ambient-action@v0.0.2 step with id: session, wait: 'true', and timeout: '300'. Added a final if: always() step that reads session-name, session-phase, session-result from the session step outputs, maps phase → emoji/status (Completed→✅, empty→set CreateFailed & ❌, else →⚠️), conditionally includes a <details> block when session-result is non-empty, writes the markdown to a temp file, and posts it to the issue using gh issue comment authenticated with GH_TOKEN: github.token.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as GitHub Actions Workflow
    participant Action as ambient-action (session)
    participant Post as Post-result step
    participant GH as GitHub Issues (gh CLI)

    Workflow->>Action: invoke ambient-action (wait: 'true', timeout: '300')\n(id: session)
    Action-->>Workflow: session outputs (session-name, session-phase, session-result)
    Workflow->>Post: always() step reads session outputs
    Post->>Post: map phase to emoji/status\nformat comment body (optional <details>)
    Post->>GH: gh issue comment (GH_TOKEN: github.token)
    GH-->>Post: comment created
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Post ambient session results back to GitHub issues' directly and clearly summarizes the main change: adding functionality to post session results as comments on GitHub issues.
Description check ✅ Passed The description is directly related to the changeset, providing a clear summary of the workflow modifications including wait mode, result posting, permissions, and status emoji mapping.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ambient-post-results

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ambient.yml:
- Around line 48-58: SESSION_RESULT is being interpolated directly into BODY
which can cause shell injection or syntax breaks; instead stop expanding it
inside the double-quoted string and write the message body safely — either build
the BODY using a quoted heredoc (e.g., <<'EOF') to prevent expansion or write
SESSION_RESULT to a temporary file and pass that file via --body-file; update
the places that set BODY and the caller that uses SESSION_RESULT (references:
SESSION_RESULT, BODY, and the consumer using --body-file) to use one of these
safe methods.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b2390acd-3f66-43c0-95d9-50b9a2feab71

📥 Commits

Reviewing files that changed from the base of the PR and between 0d8ecb5 and 2e77360.

📒 Files selected for processing (1)
  • .github/workflows/ambient.yml

Use --body-file instead of interpolating SESSION_RESULT into a
shell string, which could break on backticks or $() in output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeremyeder jeremyeder merged commit 1a71b35 into main Mar 26, 2026
5 of 7 checks passed
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