Skip to content

fix: v0.5.4 — defer process.exit until postSuggestions async chain resolves#14

Merged
omrdev1 merged 1 commit into
mainfrom
fix/v0.5.4-async-exit
Mar 28, 2026
Merged

fix: v0.5.4 — defer process.exit until postSuggestions async chain resolves#14
omrdev1 merged 1 commit into
mainfrom
fix/v0.5.4-async-exit

Conversation

@omrdev1
Copy link
Copy Markdown
Owner

@omrdev1 omrdev1 commented Mar 28, 2026

Summary

Fixes a race condition where process.exit(policyExitCode) was called synchronously at the bottom of cli.ts before the async postSuggestions HTTP chain to the GitHub API had resolved.

Impact: On any build with --post-suggestions enabled and a policy violation (fail_on_violation: true), the process would exit code 1 before suggestion comments were posted to the PR. The build would fail with no inline remediation visible to the developer.

Fix: process.exit is now deferred into the .finally() block of the postSuggestions Promise chain, ensuring the GitHub API calls complete before the process terminates — regardless of whether suggestions succeeded, failed, or timed out.

Type of change

  • Bug fix

Checklist

  • npm test passes (86/86)
  • npx tsc --noEmit passes (zero type errors)
  • npm run build produces clean dist
  • No behaviour change when --post-suggestions is not used

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 28, 2026

🌱 GreenOps Infrastructure Impact

Metric Monthly Total
🔋 Scope 2 — Operational CO2e 3.84kg
🏭 Scope 3 — Embodied CO2e 1.88kg
🌍 Total Lifecycle CO2e 5.71kg
💧 Water Consumption 4.7L
💰 Infrastructure Cost $132.86/month

Potential Scope 2 Savings: -3.52kg CO2e/month (91.6%) | -$8.03/month
💡 Found 1 optimization recommendation.

Resource Breakdown

Resource Type Region Scope 2 CO2e Scope 3 CO2e Water Cost/mo Action
google_compute_instance.api n2-standard-2 us-central1 3.71kg 1.04kg 4.0L 70.81 💡 View Recommendation
google_compute_instance.worker t2a-standard-2 europe-north1 0.13kg 0.83kg 0.8L 62.05 ✅ Optimal

Recommendations

google_compute_instance.api

  • Current: n2-standard-2 in us-central1
  • Suggested: n2-standard-2 in europe-north1
  • Scope 2 Impact: -3.52kg CO2e/month | +$8.03/month
  • Rationale: Moving n2-standard-2 from us-central1 to Finland (europe-north1) reduces grid carbon intensity from 340g to 18g CO2e/kWh, saving 3516g CO2e/month (note: cost increases by $8.03/month). Water consumption also decreases by 2.8L/month.

Emissions calculated using the Open GreenOps Methodology Ledger v2.0.0. Scope 2 (operational) and Scope 3 (embodied) emissions tracked. Water consumption estimated from provider sustainability reports (AWS 2023, Microsoft 2023, Google 2023). Math is MIT-licensed and auditable. Analysed at 2026-03-28T16:21:33.498Z.

🏢 GreenOps Dashboard — aggregate carbon data across all your repositories, set team budgets, and export ESG reports. Join the waitlist · Coming soon.

@omrdev1 omrdev1 merged commit 4526dad into main Mar 28, 2026
2 checks passed
@omrdev1 omrdev1 deleted the fix/v0.5.4-async-exit branch March 28, 2026 16:23
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