Skip to content

[codex] replace background-action with repo-owned helper#1976

Merged
riderx merged 5 commits into
mainfrom
codex/replace-background-action
Apr 28, 2026
Merged

[codex] replace background-action with repo-owned helper#1976
riderx merged 5 commits into
mainfrom
codex/replace-background-action

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented Apr 28, 2026

Summary (AI generated)

  • replace both JarvusInnovations/background-action usages in .github/workflows/tests.yml with a repo-owned background-service helper
  • start each background process with nohup, wait on pinned bunx wait-on@8.0.1 health checks, and emit grouped startup diagnostics when readiness fails
  • dump background service logs after backend or Cloudflare test failures, upload the captured logs as a workflow artifact, and stop the background processes explicitly at the end of the job

Motivation (AI generated)

JarvusInnovations/background-action is not actively maintained, and it hides too much of the failure context when a background service never becomes healthy or when later tests fail. Owning the startup logic in-repo removes the stale wrapper dependency and gives us clearer, version-pinned diagnostics around the exact services this workflow depends on.

Business Impact (AI generated)

This lowers CI maintenance risk and shortens investigation time when local test infrastructure flakes in GitHub Actions. Faster root-cause visibility means less engineering time spent re-running jobs blindly and more confidence in the backend test signal that protects releases.

Test Plan (AI generated)

  • validate .github/scripts/start-background-service.sh with bash -n
  • run a local helper self-test that starts a temporary HTTP server, waits for readiness through bunx wait-on, and captures the emitted outputs
  • verify .github/workflows/tests.yml formatting with bunx prettier --check --parser yaml
  • confirm the GitHub Actions Run tests workflow passes on this branch

Generated with AI

Summary by CodeRabbit

  • New Features

    • Unified, environment-driven CI background service starter with per-service readiness checks, PID and log outputs.
    • Playwright test runner switched to the bundled runner; individual test services (including frontend) can be skipped.
  • Chores

    • Enhanced logging and failure-conditioned log tailing with automatic log artifact uploads.
    • Always-run cleanup step to terminate background services after jobs.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ad9be3f8-2a65-4327-b533-bedc20733df9

📥 Commits

Reviewing files that changed from the base of the PR and between 5d0a374 and 6e46229.

📒 Files selected for processing (2)
  • .github/scripts/start-background-service.sh
  • playwright.config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • playwright.config.ts
  • .github/scripts/start-background-service.sh

📝 Walkthrough

Walkthrough

Adds a new Bash script to start/verify background services, replaces prior background-action usage in GitHub Actions with scripted service startup and PID/log outputs and cleanup, and makes Playwright optionally skip starting the frontend when SKIP_FRONTEND_START is set.

Changes

Cohort / File(s) Summary
Background Service Script
.github/scripts/start-background-service.sh
New script that validates required BACKGROUND_* env vars, prepares/truncates logs, launches the service via nohup bash -lc ..., captures PID, optionally writes GITHUB_OUTPUT, verifies the process stays alive, and waits for readiness using bunx wait-on with configurable timeout/interval.
Workflow Integration
.github/workflows/tests.yml
Replaces JarvusInnovations/background-action@v1 calls with the new script for Edge, Cloudflare Workers, and Playwright services; captures each service’s pid/log_path as step outputs, tails logs on failure, uploads logs as an artifact on failure, and adds always-run PID cleanup steps.
Playwright Config
playwright.config.ts
Condtionally omits adding the frontend webServer when env.SKIP_FRONTEND_START is truthy and logs a skip message; minor reformatting of imports/constants only.

Sequence Diagram

sequenceDiagram
    participant GHA as GitHub Actions
    participant Script as start-background-service.sh
    participant Service as Background Service
    participant WaitOn as bunx wait-on
    participant Log as Log File

    GHA->>Script: invoke with BACKGROUND_* env vars
    Script->>Script: validate vars & parse BACKGROUND_WAIT_ON
    Script->>Log: ensure dir & truncate `BACKGROUND_LOG_PATH`
    Script->>Service: start command with `nohup bash -lc ...` (stdout/stderr → Log)
    Script->>Script: capture PID and optionally write `GITHUB_OUTPUT`

    alt service stays running
        Script->>Service: verify PID alive
        Script->>WaitOn: run wait-on with targets, timeout, interval, --log --verbose
        WaitOn->>WaitOn: poll targets
        alt targets ready
            WaitOn-->>Script: success
            Script->>GHA: emit ready notice + PID
        else timeout/failure
            WaitOn-->>Script: failure
            Script->>Log: tail configured log lines
            Script->>GHA: emit error
        end
    else service exited early
        Script->>Log: tail configured log lines
        Script->>GHA: emit error
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I dug a script beneath the root,
Launched PIDs snug and logs reboot,
I waited on targets, ears on the line,
If things went wrong I showed the last sign,
Now workflows hop and tests run fine.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing JarvusInnovations/background-action with a repository-owned helper script, which is the primary objective of the changeset.
Description check ✅ Passed The description provides a comprehensive AI-generated summary with motivation and business impact, and includes a test plan with progress indicators. However, it deviates from the repository's template structure and lacks manual author commentary.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/replace-background-action

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

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented Apr 28, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing codex/replace-background-action (6e46229) with main (f6797e4)

Open in CodSpeed

@riderx riderx marked this pull request as ready for review April 28, 2026 09:47
@riderx
Copy link
Copy Markdown
Member Author

riderx commented Apr 28, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@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/scripts/start-background-service.sh:
- Line 16: The script currently prints error markers like echo
"::error::BACKGROUND_SERVICE_NAME, BACKGROUND_RUN_COMMAND, BACKGROUND_WAIT_ON,
and BACKGROUND_LOG_PATH are required." to stdout; change these error echos (the
lines that print strings beginning with "::error::") to write to stderr instead
(for example, replace echo ":::error::..." with echo "::error::..." >&2 or use
printf "%s\n" "::error::..." >&2) and apply the same change for the other error
echo occurrences (the other "::error::..." messages in this file).
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: fb094107-3580-48a8-8bea-5f3fb11fe78d

📥 Commits

Reviewing files that changed from the base of the PR and between 730b168 and 6434a61.

📒 Files selected for processing (2)
  • .github/scripts/start-background-service.sh
  • .github/workflows/tests.yml

Comment thread .github/scripts/start-background-service.sh Outdated
@sonarqubecloud
Copy link
Copy Markdown

@riderx riderx merged commit 7514a15 into main Apr 28, 2026
17 of 18 checks passed
@riderx riderx deleted the codex/replace-background-action branch April 28, 2026 16:05
@coderabbitai coderabbitai Bot mentioned this pull request Apr 29, 2026
5 tasks
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