Skip to content

Claude instructions to reproduce/troubleshoot CI failures#3778

Open
cataphract wants to merge 5 commits intomasterfrom
glopes/claude-ci
Open

Claude instructions to reproduce/troubleshoot CI failures#3778
cataphract wants to merge 5 commits intomasterfrom
glopes/claude-ci

Conversation

@cataphract
Copy link
Copy Markdown
Contributor

@cataphract cataphract commented Apr 7, 2026

Description

Add instructions so that claude can monitor CI pipelines, download artifacts, reproduce and troubleshoot CI failures locally.

These were mostly generated through several iterations where claude is asked to execute jobs by reading the instructions and suggest changes to the files and then by manually reviewing the suggestions.

In the end, the instructions don't need to be 100% accurate, and claude fails to closely follow the instructions 100% of the time anyway; the point is that the instructions and the helper scripts allow it to mimic the CI jobs locally in a reasonable amount of time, without excessive trial and error.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@cataphract cataphract requested a review from a team as a code owner April 7, 2026 13:52
@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 bot commented Apr 7, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Other Violations

🧪 9 Tests failed

ext/openssl/tests/bug74796.phpt (Bug #74796: TLS encryption fails behind HTTP proxy) from php.ext.openssl.tests   View in Datadog   (Fix with Cursor)
001- string(19) "Hello from server 0"
002- NULL
003- string(19) "Hello from server 1"
004- NULL
005- string(19) "Hello from server 2"
006- NULL
007- cs.php.net
008- uk.php.net
009- us.php.net
002+ error:0A000086:SSL routines::certificate verify failed in /usr/local/src/php/ext/openssl/tests/ServerClientTestCase.inc(191) : eval()'d code on line 15
...
ext/openssl/tests/sni_server_key_cert.phpt (sni_server with separate pk and cert) from php.ext.openssl.tests   View in Datadog   (Fix with Cursor)
001- string(%d) "cs.php.net"
002- string(%d) "uk.php.net"
003- string(%d) "us.php.net"
002+ error:0A000086:SSL routines::certificate verify failed in /usr/local/src/php/ext/openssl/tests/ServerClientTestCase.inc(191) : eval()'d code on line 9
003+ 
005+ 
007+ 
009+ 
010+ Deprecated: openssl_x509_parse(): Passing null to parameter #1 ($certificate) of type OpenSSLCertificate|string is deprecated in /usr/local/src/php/ext/openssl/tests/ServerClientTestCase.inc(191) : eval()'d code on line 11
011+ 
...
ext/openssl/tests/sni_server.phpt (sni_server) from php.ext.openssl.tests   View in Datadog   (Fix with Cursor)
001- string(%d) "cs.php.net"
002- string(%d) "uk.php.net"
003- string(%d) "us.php.net"
002+ error:0A000086:SSL routines::certificate verify failed in /usr/local/src/php/ext/openssl/tests/ServerClientTestCase.inc(191) : eval()'d code on line 9
003+ 
005+ 
007+ 
009+ 
010+ Deprecated: openssl_x509_parse(): Passing null to parameter #1 ($certificate) of type OpenSSLCertificate|string is deprecated in /usr/local/src/php/ext/openssl/tests/ServerClientTestCase.inc(191) : eval()'d code on line 11
011+ 
...
View all

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.64% (-0.05%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 8d0cfcd | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@@ -0,0 +1,305 @@
#!/usr/bin/env -S uv run --script
Copy link
Copy Markdown
Collaborator

@bwoebi bwoebi Apr 8, 2026

Choose a reason for hiding this comment

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

This is essentially doing the same than tooling/bin/build-debug-artifact?
Only that it seemingly doesn't take care of caching the build, i.e. full rebuild every time? - I see, dockerh does that. Odd.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just looked at it, and if we want to use tooling/bin/build-debug-artifactinstead, it needs to be updated to use the centos build. Because otherwise the bookworm images are too recent for system-tests

Copy link
Copy Markdown
Collaborator

@bwoebi bwoebi Apr 8, 2026

Choose a reason for hiding this comment

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

Well, I've been using tooling/bin/build-debug-artifact all the time successfully for system tests. Did you actually try it? (./tooling/bin/build-debug-artifact gnu-aarch64-8.2-nts /Users/bob.weinand/system-tests/binaries is what I've been using mostly)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll try, but the images for apache-mod-... are the appsec-ci images, which are based on bullseye

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, fails:

[08-Apr-2026 15:02:37 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'ddtrace.so'
(tried: .../ddtrace.so (/lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found
(required by .../ddtrace.so)), ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wasn't aware that we were using different base images for system tests :-(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see, I was working with php-fpm-* images.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We really ought to unify images between appsec and tracer. (Ideally by just putting everything missing into bookworm images)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've changed it to build on centos, like on ci.

variant. Empty stub files satisfy this for versions you don't build.
Profiling can also be fully stubbed. See
[section 1c](#1c-slim-build--one-php-version-only) for all stub
commands.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this talking about generate-final-atrifact at all? seems like noise, you always want a local build?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this has leftovers from a previous strategy. I'll clean that up

@@ -0,0 +1,390 @@
#!/usr/bin/env -S uv run --script
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two questions:
a) Can we move this under tooling/bin ?
b) Would it be reasonable to have it as PHP script instead of python?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure

Output: `target/debug/libdatadog_php_profiling.so` (~144 MB vs ~20 MB for profiler-release).
Use the same `php -d extension=...` command, just point to the debug path.

## ZTS tests -- parallel PECL extension
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, once it moved to use the ci bookworm images this no longer became necessary. I'll reword.

```
logs/docker/weblog/logs/php_error.log
logs/docker/weblog/logs/tracer.log
```
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Something I noticed is that it sometimes adds debug info, and then becomes frustrated because it doesn't show up.
fprintf(stderr), php_log_err(E_NOTICE) etc.

Basically, it has the tracer logs, so it should simply use LOG(ERROR, <printf compatible args>) in tracer code or error!() in profiler code, and it'll definitely show up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've tested this and added a section explainging debug methods. Interestinglt, error! doesn't print anything either with the current config in system-tests.

- Move download-artifacts from .claude/ci/ to tooling/bin/ and update
  all references in documentation.
- Rewrite download-artifacts into PHP and use curl multi handles. Time
  to find the datadog-setup.php from a commit drops from ~35 s to ~10 s.
- Delete build-slim-package.py; its functionality is now more or less
  covered by build-debug-artifact, the difference being in that
  build-debug-artifacts builds, well, debug artifacts, unlike CI.
- Switch build-debug-artifact from bookworm to centos-7 images for GLIBC
  2.17 compatibility with all weblog base images.
- Use debug build profiles (CFLAGS=-O0, cargo dev profile, cmake Debug)
  instead of release/RelWithDebInfo.
- Add Rust appsec helper build support to build-debug-artifact.
- Resolve libddwaf commit on the host to avoid git failures in
  worktrees; pass LIBDDWAF_GIT_COMMIT to cmake in
  build-appsec-helper.sh.
- Suppress git safe.directory errors in build-appsec-helper-rust.sh.
- Simplify system-tests.md: remove stub file instructions, point to
  "Slim package with debug binaries" section in building-locally.md.
- Simplify github-actions-profiler.md: note that bookworm images already
  include the parallel PECL extension.
- Add "Slim package with debug binaries" section to building-locally.md
  documenting build-debug-artifact usage.
@cataphract cataphract requested a review from bwoebi April 8, 2026 17:00
Comment on lines +22 to +26
Matrix: PHP 7.2--8.5 (versions where `version_compare($v, "7.2", ">=")`)

## What It Tests

`windows test_c` starts `httpbin-windows` and `php-request-replayer-2.0-windows`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we try avoiding info which becomes trivially stale, e.g. say Matrix: PHP 7.2+, php-request-replayer-*-windows etc.? (also in the other files)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 9c628cb

@cataphract cataphract requested a review from bwoebi April 9, 2026 11:24
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 9, 2026

Benchmarks [ tracer ]

Benchmark execution time: 2026-04-09 14:38:49

Comparing candidate commit 8d0cfcd in PR branch glopes/claude-ci with baseline commit 42c7c25 in branch master.

Found 5 performance improvements and 3 performance regressions! Performance is the same for 186 metrics, 0 unstable metrics.

scenario:ContextPropagationBench/benchInject64Bit-opcache

  • 🟩 execution_time [-1.723µs; -1.405µs] or [-11.946%; -9.740%]

scenario:EmptyFileBench/benchEmptyFileOverhead

  • 🟥 execution_time [+137.585µs; +343.675µs] or [+4.206%; +10.506%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟥 execution_time [+3.048µs; +5.172µs] or [+2.966%; +5.034%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache

  • 🟥 execution_time [+4.467µs; +6.733µs] or [+4.461%; +6.724%]

scenario:PDOBench/benchPDOOverhead

  • 🟩 execution_time [-9.200µs; -6.990µs] or [-3.729%; -2.833%]

scenario:PDOBench/benchPDOOverheadWithDBM

  • 🟩 execution_time [-8.669µs; -6.135µs] or [-3.513%; -2.486%]

scenario:PHPRedisBench/benchRedisOverhead

  • 🟩 execution_time [-48.600µs; -33.113µs] or [-4.927%; -3.357%]

scenario:SamplingRuleMatchingBench/benchRegexMatching4-opcache

  • 🟩 execution_time [-11.918µs; -11.671µs] or [-89.259%; -87.413%]

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.

2 participants