Skip to content

ci(native): run the tests against a UBSan build of the addon - #33

Merged
ThomasK33 merged 3 commits into
mainfrom
ci/ubsan-native-tests
Oct 29, 2026
Merged

ThomasK33 merged 3 commits into
mainfrom
ci/ubsan-native-tests

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Why

CI must fail by itself when the native addon hits undefined behavior again. A normal build of the out-of-range casts that #30 fixed passed every test, so only a sanitizer build catches that kind of bug. This PR adds that build to CI.

What changed

  • mise.toml gets a ci-ubsan task. It builds the addon with -fsanitize=undefined,float-cast-overflow -fno-sanitize-recover=all, then runs npm test and npm run smoke.
  • A guard step after the build fails the task when the addon's object files hold no UBSan checks, so the row cannot pass on a plain build.
  • .github/workflows/ci.yml gives every matrix row a task column and adds a linux-x64-ubsan row that runs ci-ubsan.
  • native/README.md and README.md name the task in their verification sections.

Scope

  • The sanitizer runs on Linux x64 with GCC only. The other rows keep the plain ci task.
  • It instruments the addon's C++ code. Zig builds libghostty-vt as before.
  • AddressSanitizer and other sanitizers are left out.

Tradeoffs

  • A matrix row, not a second job. One job definition stays, and the task column says what each row runs.
  • The flags apply to the build:native step only, so npm ci and the Zig build of libghostty-vt never see them.
  • No LD_PRELOAD. The UBSan handlers that Zig bundles in libghostty-vt.a take every report and abort the process. The addon also links libubsan.so.1 as a fallback.
  • The guard reads the object files, not the final .node. The .node carries Zig's handlers in every build, so it cannot show whether g++ got the flags.

Blast radius

CI gets one more Linux job about as long as the ci row. The published package changes only by one line in each of README.md and native/README.md.

Verification


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

A normal build of the out-of-range casts fixed in #30 passes every
test. Add a ci-ubsan mise task that builds only the addon with
-fsanitize=undefined,float-cast-overflow and no recovery, then runs
the tests and smoke. CI runs it as a linux-x64-ubsan matrix row, and
every row now names its mise task.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `medium`_

Change-Id: Iad93613b401f2b4c82346d12b851dc9dc779dac5
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T21:42:08.160801Z ffecdc2 Manual request
🔒 Security Review ✅ Completed 2026-10-29T21:42:06.447978Z ffecdc2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 46a5afe8ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 46a5afe8ef

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

If the sanitizer flags stop reaching g++, the ubsan row would build a
plain addon and stay green. The new step checks the addon's own object
files for undefined UBSan _abort handlers. The final .node cannot show
this, because libghostty-vt.a always carries Zig's handlers.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `low`_

Change-Id: I5e7cd4b708ad8e7f17356cb9e4da8cecf15c75b9
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: dcb68251f7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcb68251f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread mise.toml Outdated
mise runs each step with pipefail. grep -q exits on its first match,
so nm can die of SIGPIPE and the guard fails a correctly instrumented
build with exit 141. grep -c reads to the end and still exits 1 when
nothing matches.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `low`_

Change-Id: I17c4f080629226f6dfb27d9354923d7a31ac382b
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: ffecdc20f7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: ffecdc20f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33
ThomasK33 merged commit 96fb41b into main Oct 29, 2026
5 checks passed
@ThomasK33

Copy link
Copy Markdown
Member Author

Merge record for this PR.

  • Landed as 96fb41b (squash, linear history). Its tree equals the tested head ffecdc2.
  • CI: all four rows passed on ffecdc2 and on main at 96fb41b, including the new ci (linux-x64-ubsan).
  • Red check: workflow run 40955931001, on a throwaway branch with the pre-fix(native): range-check dimensions before casting them #30 native/terminal.cc, failed the UBSan row with panic: nan is outside the range of representable values of type 'unsigned int'. The branch is deleted.
  • Reviews: 3 Codex rounds of 6. Round 2 found one valid P1: grep -q gets SIGPIPE under mise's pipefail. It was fixed in ffecdc2, and its thread is resolved. Round 3 was clean in both lanes, and a 6-minute grace check stayed clean.
  • Advisor (fresh context, one pass): "ready with tracked follow-ups". Both follow-ups landed in this PR: the object-file guard and the corrected handler claim in the body.
  • Approval: main requires 1 approving review, and the author cannot approve. The owner consented to an admin bypass for this PR.
  • Known limit: the guard proves that -fsanitize and -fno-sanitize-recover reached g++, but not float-cast-overflow itself, because the fixed addon code has no float cast left to check. The red-check run proved that flag once.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

@ThomasK33 ThomasK33 mentioned this pull request Oct 30, 2026
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