Skip to content

feat: wake a chat on matching output lines of a watched process - #269

Merged
ibetitsmike merged 2 commits into
mainfrom
mike/chat-process-wakeups-2-output
Nov 13, 2026
Merged

ibetitsmike merged 2 commits into
mainfrom
mike/chat-process-wakeups-2-output

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Part of #248

wait_for_events takes process_output_pattern, an RE2 regular expression for the output lines of its process_ids. While a watched process runs, the chat gets a message with the new complete lines that match. The exit message still follows.

  • process_output_cooldown_seconds (0 to 86400, default 60): a message for matching lines waits at least this long after the wake-up's last message, and collects the lines printed meanwhile.
  • process_output_max_events (1 to 100, default 10): at most this many line messages per process. The last one says so, and the exit still wakes the chat.
  • The tool refuses a pattern without process_ids, an invalid or longer than 1 KB pattern, out-of-range values, and the cool-down or maximum without a pattern. The resolved values are stored on each process_exit event, so they survive a coderd restart.
  • Each line message records a run keyed process_output:<process id>:<position>, where the position is the byte offset in the process's whole output after the last line it covered. The next poll reads only complete lines after that position. Once the agent truncates the output (first and last 16 KiB, agentproc.HeadTailBuffer), only lines after its omission marker count, minus the first one, which may have lost its start. Lines that the agent dropped between two polls are missed.
  • The final poll of an expired watch reports exits only, no lines.
  • No API or schema change. ARCHITECTURE.md gets one TODO for Mike.

The UI follows in a later PR.

Xum opened this PR on behalf of @ibetitsmike.

…ed process

wait_for_events takes process_output_pattern, a regular expression for the
output lines of its process_ids, with process_output_cooldown_seconds
(default 60) and process_output_max_events (default 10). While a watched
process runs, each poll matches the complete lines printed after the last
line message and sends one message with them, at most once per cool-down
after the wake-up's last message and up to the maximum per process. The
exit message still follows. The final poll reports exits only.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T09:01:12.093361Z 413c4bb 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.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of @ibetitsmike.

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

ℹ️ 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 coderd/x/chatd/ARCHITECTURE.md Resolved
Comment thread coderd/x/chatd/fork_process_events.go Resolved
Comment thread coderd/x/chatd/fork_process_events.go Resolved
Comment thread coderd/x/chatd/fork_process_events.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum posted this on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 413c4bbf76

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

@ibetitsmike
ibetitsmike merged commit 72d8af0 into main Nov 13, 2026
9 checks passed
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merge evidence for head 413c4bbf76:

  • fork-ci run 43395764626 succeeded on this head, and all 9 check runs succeeded.
  • Codex reviewed 413c4bbf76 and found no major issues. The earlier review on b7ccfe11ce was answered and resolved:
    • P1: the intentional ARCHITECTURE.md TODO for the author.
    • Three P2s, recorded as follow-ups.
    • No review threads are unresolved.
  • W15 ran the tests in the Fork ops Go lane. The clean run passed, and each of 8 deliberate bugs (K to R) failed the tests on their assertions.
  • UAT on this head, with a real chat on the oMLX model, passed:
    • U1: a matching line wakes the chat, then the exit wakes it.
    • U4: with no match, only the exit wakes it.
    • U2b: matches during the cool-down are batched into the next message.
    • U3b: after the message limit, no more wakes until the exit.
  • Fork ops checked the UAT summary and the teardown. The throwaway oMLX key gets 401, and all 18 evidence files match their checksums.

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