Skip to content

fix: Allow ibazel notifications to pass when not running tests#52

Merged
dzbarsky merged 5 commits into
hermeticbuild:masterfrom
jaqx0r:notify-blocked
Oct 24, 2025
Merged

fix: Allow ibazel notifications to pass when not running tests#52
dzbarsky merged 5 commits into
hermeticbuild:masterfrom
jaqx0r:notify-blocked

Conversation

@jaqx0r

@jaqx0r jaqx0r commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

This change merges two selects so that context cancellation and ibazel notifications are also checked when waiting for tests to run or for services to fail.

This helps in non-test situations like when using ibazel to shorten the edit/test cycle.

Fixes: #51

James-Wilkinson1_cba added 3 commits October 23, 2025 19:28
If `ibazel` notifies of a change or the context is cancelled, then deal
with it when we are waiting for service errors or test completions.
This avoids a deadlock in interactive modes.

Fixes: hermeticbuild#51
This is a workaround that avoids the deadlock from the previous
implementation, as that would not exit the drain loop until the channel
was closed.

Here we just read if we can in a best effort fashion.

A better solution would be to let the writing goroutine close the
channel on exit and for us to notify on close with a context.
Comment thread cmd/svcinit/main.go
testStartTime := time.Now()

testCmd = exec.CommandContext(ctx, testPath, testArgs...)
testCmd = exec.CommandContext(testCtx, testPath, testArgs...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@codex will this testCmd also get stopped/cancelled when the parent ctx is cancelled?

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.

When one context is derived from an outer context, as queryCtx is derived from ctx in this example, if the outer context is canceled, then the derived context is automatically canceled as well.

https://go.dev/doc/database/cancel-operations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah perfect, I suspected as much but was curious if I could get Codex to explain it. Guess not :)

@dzbarsky

Copy link
Copy Markdown
Member

@codex will the testCmd also get stopped/cancelled when the parent ctx is cancelled? please review

@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.

ℹ️ 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 cmd/svcinit/main.go
@jaqx0r

jaqx0r commented Oct 23, 2025

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dzbarsky

Copy link
Copy Markdown
Member

Thanks for fixing this!

@dzbarsky dzbarsky merged commit 5dbb063 into hermeticbuild:master Oct 24, 2025
2 checks passed
@jaqx0r

jaqx0r commented Oct 24, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the speedy review!

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.

ibazel_notify is not propagated into svcinit when no tests are running

2 participants