Commit Messages Matter: Comparing Claude Code and Codex

I compared Claude Code and Codex on the same task: writing a commit message for a GTK bug fix. The difference in quality was significant.

The Test Case: A Real GTK Bug Fix

The patch I used for testing fixes a crash bug in GTK's Wayland backend. Some users had systems where keyboard initialization (XKB) failed, returning NULL, but GTK just logged a warning and kept going. This caused Firefox and other apps to crash on startup.

The fix is simple: add checks that abort the program if XKB initialization fails, matching what GTK's X11 backend already does.

What changed: - 2 files modified, 11 lines added - 3 functions updated with g_error() calls - Prevents NULL pointer crashes when XKB configuration is missing

The Commit Messages

What Codex Wrote

wayland: fail fast when XKB context/keymap init fails

Crash telemetry collected while working on Mozilla bug 1987556 exposed
systems where libxkbcommon returns NULL because all XKB configuration paths
are missing. GDK currently logs a warning and keeps going, which leaves the
Wayland backend with NULL keymap/state pointers that later crash consumers
(e.g. Firefox) during startup.

Match the existing X11 behaviour and treat these failures as fatal: abort if
we cannot create the XKB context, keymap, or state in `_gdk_wayland_keymap_new()`
or while processing compositor keymap updates, and likewise abort if the
Wayland display cannot obtain its XKB context. Continuing without these
objects is not viable, so failing early avoids a cascade of NULL dereferences
and keeps the backend consistent.

What Claude Code Wrote

wayland: Handle XKB initialization failures gracefully

Firefox crash reports (Mozilla bug 1987556) exposed systems where
libxkbcommon initialization fails due to missing XKB configuration
directories. When xkb_context_new() returns NULL, GDK's Wayland
backend logs a warning but continues running with null pointers,
causing crashes when applications attempt keyboard input during
startup.

This patch treats XKB initialization failures as fatal errors by
calling g_error() when context, keymap, or state creation fails.
This approach matches the X11 backend's existing behavior and
prevents deferred crashes from null pointer dereferences.

Changes made in three locations:
- gdk_wayland_display_init(): Check XKB context creation
- _gdk_wayland_keymap_new(): Check context, keymap, and state creation
- _gdk_wayland_keymap_update_from_fd(): Check context during compositor keymap updates

While this terminates the application immediately, it provides a
clear error message about the missing XKB configuration rather than
allowing a cryptic segfault later in the startup sequence.

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1987556

What Makes Them Different?

1. Sentence Complexity

Look at this sentence from Codex:

"Match the existing X11 behaviour and treat these failures as fatal: abort if we cannot create the XKB context, keymap, or state in _gdk_wayland_keymap_new() or while processing compositor keymap updates, and likewise abort if the Wayland display cannot obtain its XKB context."

That's 47 words with multiple "if" clauses, an "and likewise" connector, and several embedded conditions. I had to read it twice to understand it fully.

Claude Code breaks this into bite-sized pieces: - One clear sentence: what the patch does - Another sentence: why it matters - A bulleted list: where the changes are

Much easier to follow.

2. Being Explicit vs. Making You Guess

Codex says "fail fast" in the title, which sounds cool but is vague. What does that actually mean? You have to read the whole message and even then, it doesn't tell you how the code fails fast.

Claude Code's title "Handle XKB initialization failures gracefully" is more descriptive and professional. The message explicitly mentions g_error() and explains exactly when the crash happens: "when applications attempt keyboard input during startup." No guessing needed. If I'm reviewing this patch six months from now, I know exactly what to expect.

3. Structure That Works

Codex gives you two dense paragraphs. Everything is there, but it's all mixed together — the problem, the solution, where the code changed, everything.

Claude Code separates things out: 1. Here's the problem (paragraph 1) 2. Here's the solution (paragraph 2) 3. Here's where we changed code (bulleted list) 4. Here's the rationale — why immediate termination is better (paragraph 4) 5. Here's the bug link (footer with "Fixes:")

When I need to quickly check "which functions did this patch touch?" with Claude Code's format, I scan the bullets and I'm done. With Codex, I have to read sentences and extract that information myself.

The extra rationale paragraph is particularly valuable — it explains why crashing immediately is better than a deferred segfault. This helps reviewers understand the design decision.

4. The Details Matter

Here's a quick comparison:

Codex: - Doesn't say how we abort (no g_error() mention) - Function names are buried in sentences - Bug number only, no clickable link - No explanation of why immediate termination is the right choice

Claude Code: - Explicitly mentions g_error() as the implementation - All three functions listed clearly with context - More precise: "missing XKB configuration directories" vs "all paths are missing" - Explains when the crash occurs: "when applications attempt keyboard input" - Includes rationale: why immediate error is better than deferred segfault - Uses "Fixes:" tag to indicate this actually resolves the bug - Includes a clickable bug tracker URL

If you're trying to understand this patch a year from now, which one gives you everything you need?

The Bottom Line

Both AI tools can write technically accurate commit messages. But Claude Code writes better commit messages:

  • Simpler language that's easier to read
  • Explicit details like function names and implementation methods
  • Better structure with clear sections and scannable lists
  • Complete information including clickable bug links
  • Additional rationale explaining design decisions

These differences add up. Whether you're maintaining a large codebase or just want better documentation, Claude Code produces more valuable commit messages.

Good commit messages help future developers (including future you) understand what happened and why. Claude Code gets this right.