Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ env:

jobs:
# Package suites are sharded across runners so the big whiteboard IT suite and
# the real-browser suites stop starving each other on one 4-vCPU runner, with
# every shard fully uncapped (TURBO_CONCURRENCY=100% at the workflow env level
# overrides turbo.json's local 50% default; no VITEST_MAX_WORKERS). The
# planner derives the matrix instead of a hand-maintained package list: it
# the real-browser suites stop starving each other on one 4-vCPU runner. The
# build job below caps TURBO_CONCURRENCY at 50% (overriding this workflow's
# 100% default) for exactly that reason: uncapped, multiple Chromium fleets
# and vite hosts compete on the runner's 4 vCPUs and vitest browser mode has
# no session reconnect (#389). The planner derives the matrix instead of a
# hand-maintained package list: it
# enumerates workspace packages, weighs each by its measured suite duration
# from the ci-test-timings artifact (published by the last main push; unknown
# packages get a small default), and LPT-bin-packs into as many shards as the
Expand Down Expand Up @@ -74,6 +76,10 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
# 4-vCPU runners saturate under uncapped browser suites; vitest browser mode
# cannot survive a starved websocket (#389).
env:
TURBO_CONCURRENCY: '50%'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.plan.outputs.matrix) }}
Expand Down Expand Up @@ -128,9 +134,40 @@ jobs:
if: matrix.chromium && steps.playwright-cache.outputs.cache-hit != 'true'
- run: pnpm exec playwright install-deps chromium
if: matrix.chromium && steps.playwright-cache.outputs.cache-hit == 'true'
# Direct evidence for the shard-4 browser-connection-closed failure (#389):
# samples memory/swap/load/chrome-process-count every 2s for the duration of
# the shard's run. nohup + disown detach the loop from this step's shell so
# it survives past this step and keeps running in the background for the
# rest of the job.
- name: Start runner resource sampler
run: |
nohup bash -c '
while true
do
echo "$(date +%s) mem=$(free -m | awk "/^Mem:/{print \$3\"/\"\$2}") swap=$(free -m | awk "/^Swap:/{print \$3}") load=$(cut -d" " -f1-3 /proc/loadavg) chrom=$(pgrep -c chrom 2>/dev/null || echo 0)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

sample="$(pgrep -c '^__coderabbit_no_such_process__$' 2>/dev/null || echo 0)"
if [[ "$sample" == $'0\n0' ]]; then
  echo "The fallback emits duplicate zero lines."
  exit 1
fi

Repository: conciv-dev/conciv

Length of output: 155


🏁 Script executed:

#!/usr/bin/env bash
set -u

pattern='^__coderabbit_no_such_process_9f3c7b__$'

printf '%s\n' '--- direct pgrep ---'
set +e
direct="$(pgrep -c "$pattern" 2>/tmp/pgrep.err)"
status=$?
set -e
printf 'status=%s\n' "$status"
printf 'stdout=%q\n' "$direct"
printf 'stderr=%q\n' "$(cat /tmp/pgrep.err)"

printf '%s\n' '--- command substitution with fallback ---'
set +e
sample="$(pgrep -c "$pattern" 2>/dev/null || echo 0)"
status=$?
set -e
printf 'status=%s\n' "$status"
printf 'quoted=%q\n' "$sample"
printf 'lines=%s\n' "$(printf '%s\n' "$sample" | wc -l)"

printf '%s\n' '--- workflow expression shape ---'
set +e
line="$(echo "ts=1 chrom=$(pgrep -c "$pattern" 2>/dev/null || echo 0)")"
status=$?
set -e
printf 'status=%s\n' "$status"
printf 'quoted=%q\n' "$line"
printf '%s\n' "$line" | od -An -t x1

Repository: conciv-dev/conciv

Length of output: 423


🌐 Web query:

man7 pgrep -c count exit status no matches outputs 0

💡 Result:

The pgrep command's exit status and output behavior regarding counts are defined as follows: Exit Status: By default and when using the --count (-c) option, pgrep uses the following exit codes [1]: - 0: One or more processes matched the criteria [2][1]. - 1: No processes matched [2][1]. - 2: Syntax error in the command line [2][1]. - 3: Fatal error, such as out of memory [2][1]. Output for --count (-c): When the --count (-c) option is used, pgrep suppresses the list of PIDs and instead prints the total count of matching processes to standard output [1]. If the count is zero (i.e., no processes match), pgrep will output 0 and exit with a non-zero exit status (specifically 1) [1].

Citations:


Prevent duplicate zero counts in the sampler output.

When no Chromium process matches, pgrep -c chrom outputs 0 and returns status 1. The fallback appends another 0, which inserts a newline into the sampler record. Store the count with || true, then use ${chrom_count:-0}.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml at line 147, Update the sampler command around the
Chromium process count to capture pgrep’s output while preventing its nonzero
status from triggering the fallback, then emit ${chrom_count:-0} so no-match
cases produce exactly one zero without a newline.

sleep 2
done
' > /tmp/runner-sampler.log 2>&1 &
disown
- run: pnpm exec conciv-ci-shards run
env:
SHARD_PACKAGES: ${{ matrix.packages }}
# Diagnostic capture for #389: kernel log (OOM killer, cgroup throttling)
# plus the resource sampler's trailing window, regardless of whether the
# shard passed or failed.
- name: Capture runner diagnostics
if: always()
run: |
sudo dmesg 2>/dev/null | tail -200 > /tmp/runner-dmesg.log || true
tail -400 /tmp/runner-sampler.log > /tmp/runner-sampler-tail.log || true
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: runner-diag-${{ matrix.shard }}
path: |
/tmp/runner-dmesg.log
/tmp/runner-sampler-tail.log
if-no-files-found: ignore
# Collapse this shard's per-package results (vitest emits test-results.json
# only in CI; turbo caches them so cache-hit packages still report) into ONE
# file, then upload it by literal name. Never glob packages/** here: the
Expand Down
Loading