Skip to content

Triggers: show skipped checks, fire prints its turn handle, add --replace keeps history; memory up to 16 KiB - #241

Merged
lydakis merged 17 commits into
mainfrom
claude/project-thread-51pp6w
Oct 28, 2026
Merged

lydakis merged 17 commits into
mainfrom
claude/project-thread-51pp6w

Conversation

@lydakis

@lydakis lydakis commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Trigger and memory gaps that a day of monitors ran into.

Changes

  • A skipped run shows on the trigger. When a repeating trigger's --if said no, nothing was written, so trigger ls showed no sign that the gate ran. One monitor polled for 19 minutes waiting for a fire its own gate had suppressed. Each row now has checked: when the gate last ran (checked_ms), what it said (go, no or failed), and its detail. The last result of the last real fire is kept.

  • trigger fire NAME prints the turn to wait on. It used to queue an ask for launchd and return, so callers slept and polled. It now waits for the run, up to 90 s (the gate's 60 s plus the send). It prints the outcome with the turn and its handle (turn:BOT/N), or why nothing went (declined with the gate's detail, skipped, failed), or pending if the run hasn't reported in time. Each ask gets its own receipt beside the trigger's files, so the result survives a trigger that ends with this send, and another fire's result can't hide it.

  • trigger add --replace changes a trigger in place. Changing a rule meant rm and a new add, which lost the trigger's last result. With --replace, a different definition under the same name replaces the old one and keeps:

    • its last result and gate check,
    • the agent a --start trigger made, when the target and the store are the same (the id goes on the row as soon as the agent is made),
    • the commit a --commit trigger has seen, when the repository is the same.

    Its count of sends starts again, for the new --runs. If the new row can't be written, the old plist goes back. Without --replace, the refusal now names the flag.

  • A fire run again for its ask sends the same request. Before an ask's turn is submitted, the full request is written (synced) into the ask, along with the store, generation and --reply-to that sent it. A fire cut short, or the trigger that replaced it, resends it as it was, so the daemon takes it once and its answer is passed on under the same id. It skips the time, commit and --if checks, because it already passed them. It doesn't count a send that already settled again. This also fixes a refire after a minute boundary, which used to rebuild its timestamped prompt and fail with idempotency_conflict.

  • Memory facts and indexes go up to 16 KiB, from 4 KiB. Leads and tasks in five or more bots hit memory_full and spent turns trimming. The index is still bounded, so every task can read it whole.

  • Automation skill: documents --replace, what fire prints, the checked field, and a weekday example: --cron '*/10 8-18 * * 1-5' in place of an all-hours --every 10m.

Two crash-window findings are declined and logged in #96.

Testing

  • cargo test -p sonny --bin sonny: 217 passed. agent-client tests pass. cargo clippy -p sonny -p agent-client --all-targets and cargo fmt --check are clean.
  • tests/test_trigger.py against a release daemon (AGENT_TEST_RUNTIME=1): 23 tests, OK (the real-launchd one is skipped off macOS).
  • New tests:
    • Unit fire_says_what_came_of_its_own_ask: pending; a receipt that outlives its trigger; each of two fires settled before the first fire looked finds its own outcome; a declined gate.
    • Unit a_gate_that_says_no_shows_on_the_row_and_keeps_the_last_result.
    • Unit replace_keeps_what_the_trigger_did: last result kept, sends counted again, the commit seen kept for the same repository and reset for another, and the started agent kept on the same store, cleared on another, and kept when it was made while the first answer was still pending.
    • Unit a_replace_whose_row_cannot_be_written_puts_the_old_trigger_back.
    • Runtime test_an_ask_sends_the_request_it_sent_before_also_for_the_trigger_that_replaced_it: a --reply-to fire's ask, replayed by a replacement whose --if says no, returns the same turn and passes no second answer. One already settled isn't counted again. One saved for another store sends the replacement's own message.
    • Runtime test_a_gate_that_says_no_costs_no_turn now checks the row's checked. test_real_launchd_fires_and_removes checks the handle fire prints.
  • Not run on macOS: launchd isn't in this container.

No visible UI change, so no screenshots.

🤖 Generated with Claude Code

…y after a tool call, keep the answer a steer came after

- An overload or rate limit that Anthropic sends after the stream began is
  the 529 or 429 it would have been before it, and is retried as one; it
  failed the turn with provider_error and no retry.
- Retries after an overload or a stall start at 2 s instead of 250 ms: a
  stall resent at once with the same context stalls again.
- An empty reply once the model has replied in the turn, as after a
  reaction with nothing to add, ends the turn; an empty reply to a prompt
  or an empty summary still fails as empty_completion.
- A turn handle's result carries before_steer, the last text the turn
  wrote before its last steer, when it then ended on a reply to the steer.
- read refuses an image or other binary file with file_not_text, naming
  its kind, instead of putting its bytes in context.
- A command whose output reader stops reading (| head) exits quietly
  instead of panicking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHW3CCrgg5qbk2KQVA
…s reply on resume

An overloaded_error inside the stream now closes the model's pool as an
HTTP 529 does, and its retry waits on the pool like a rate limit; only a
stalled stream keeps its own seconds-long backoff. A turn that parked on a
call the model made, or on its pool after one, still counts as having
replied when it resumes, so an empty reply then ends it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHW3CCrgg5qbk2KQVA
@lydakis lydakis self-assigned this Oct 28, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T00:59:15.070713Z 7fc7d6f New commits
🔒 Security Review ✅ Completed 2026-10-28T00:59:13.962918Z 7fc7d6f New commits
ℹ️ 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: e70ab4ec85

ℹ️ 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 sonny/src/trigger.rs Resolved
Comment thread sonny/src/trigger.rs Resolved
Comment thread sonny/src/trigger.rs Resolved

lydakis commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@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: 2a71c92e04

ℹ️ 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 sonny/src/trigger.rs Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 2a71c92e04

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: d440b89078

ℹ️ 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 sonny/src/trigger.rs Resolved

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

ℹ️ 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 sonny/src/trigger.rs Resolved

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

ℹ️ 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 sonny/src/trigger.rs Resolved

@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: 1abaf77058

ℹ️ 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 sonny/src/trigger.rs Resolved

@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: 6dcbeef53b

ℹ️ 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 sonny/src/trigger.rs Resolved

@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: 34261a30a1

ℹ️ 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 sonny/src/trigger.rs Resolved
Comment thread sonny/src/trigger.rs Resolved

@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: 241a564d39

ℹ️ 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 sonny/src/trigger.rs Resolved
Comment thread sonny/src/trigger.rs Resolved

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

ℹ️ 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 sonny/src/trigger.rs Resolved
@lydakis
lydakis merged commit 4eb40d8 into main Oct 28, 2026
2 of 3 checks passed
@lydakis lydakis mentioned this pull request Oct 28, 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.

2 participants