Skip to content

fix(id): bound directory mail command runtime (#1788) - #4031

Merged
dezren39 merged 5 commits into
mainfrom
queue/5039-1788-command-timeout
Nov 1, 2026
Merged

dezren39 merged 5 commits into
mainfrom
queue/5039-1788-command-timeout

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

CommandSink::send
  spawn configured mail program
  poll until the 10-second deadline
  on expiry: kill/reap child and return a timeout error

The production deadline matches the existing SMTP timeout budget. A private deadline seam lets tests exercise timeout and finite-success paths quickly.

Evidence

  • Before: CommandSink::send used an unbounded child.wait(); id(directory_mail): CommandSink has no timeout — a mail program that never exits hangs the directory request forever #1788's /bin/sh -c 'sleep 30' probe remained blocked after 3 seconds.
  • After: cargo check --manifest-path pkgs/id/Cargo.toml --lib passes; rustfmt --edition 2024 --check pkgs/id/src/directory_mail.rs and git diff --check pass. Adds timeout/kill/reap and slow-finite tests; keeps the existing non-zero exit test.
  • Test limitation: cargo test --manifest-path pkgs/id/Cargo.toml --lib directory_mail::tests cannot reach test execution because compilation fails at unmodified pkgs/id/src/idset.rs:755 (ChainExt missing note). The same E0063 reproduces on clean main 2f8ab7850. Workspace-wide cargo fmt --check also reports unrelated existing formatting drift; the changed file passes focused rustfmt.

Merge Danger

Door: two-way

Blast Radius: directory-mail

Only CommandSink changes; SMTP and outbox behavior are untouched.

Fixes #1788


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 22:24
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ddb5971-994e-4b77-8bb0-36c7d0760a11
Commits

Reviewing files that changed from the base of the PR and between 8766023 and 86f21f9.

Files selected for processing: 1
  • pkgs/id/src/directory_mail.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-11-01T23:19:45.960272Z 86f21f9 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 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: 1e47e202c3

ℹ️ 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 pkgs/id/src/directory_mail.rs Resolved
Comment thread pkgs/id/src/directory_mail.rs Resolved
…wins (#1788)

Codex P2 (PR #4031): child.kill() terminated only a wrapper script, leaving descendants such as the shipped cloudflare-mail.sh curl running after a reported timeout. The command now spawns as a process-group leader (unix) and the timeout path SIGKILLs the whole group via kill_child_tree, falling back to child.kill(). New regression test: a wrapper that backgrounds sleep 30 and waits - after the timeout error the descendant is gone.

Codex P2 (PR #4031): the poll loop replaced an observed successful exit with a timeout when the finish was first seen after the deadline. The elapsed check on an observed status is deleted: try_wait success now always breaks with the real status, and the deadline applies only while the child is still running.

Also merges current main, which brings the #4044 idset test-compile fix - directory_mail tests now run: 11 passed, 0 failed on the laptop.
@dezren39

dezren39 commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

@codex review — both P2 findings addressed in db70193 (process-group kill on timeout + observed-exit-wins), threads replied and resolved, directory_mail tests 11/11 on the laptop.

@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: db70193b23

ℹ️ 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 pkgs/id/src/directory_mail.rs Resolved
)

Codex P2 (PR #4031 re-review): signal 0 succeeds for a zombie, so in a container whose PID 1 does not reap orphans the descendant check would fail after 2s even though the group kill worked. The probe now treats a Linux /proc state of Z as terminated.
@dezren39

dezren39 commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

@codex review — zombie-probe finding addressed in 86f21f9, thread replied and resolved, directory_mail tests still 11/11.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 86f21f9f45

ℹ️ 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".

@dezren39
dezren39 merged commit 20087ab into main Nov 1, 2026
1 check passed
@dezren39
dezren39 deleted the queue/5039-1788-command-timeout branch November 1, 2026 23:22
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.

id(directory_mail): CommandSink has no timeout — a mail program that never exits hangs the directory request forever

1 participant