Skip to content

Lookout sources: restart on a watched file, say when one is down, list topics (U6, U7, U8) - #779

Merged
lydakis merged 17 commits into
mainfrom
claude/project-thread-y8hnke
Nov 7, 2026
Merged

lydakis merged 17 commits into
mainfrom
claude/project-thread-y8hnke

Conversation

@lydakis

@lydakis lydakis commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR adds three lookout wishes George approved on 11-07 (U6, U7, U8). It is the second PR in the agreed order, after #768.

  • U7: restart on script change. Work agents restarted sources by hand about 12 times in 4 days after editing their scripts. A source can now list the files it runs in watch = ["~/bin/slack-poll"], each one starting with / or ~/. When a listed file changes, appears or disappears, the lookout restarts the source on the new code within the 15 s settings reread, and logs source_stopped with the reason "its command changed". Only listed files are watched (George, 11-07), so a cursor the command writes isn't a reason to restart. A source keeps its health and its recently seen IDs across the restart, so an edit never resends an event.
  • U6: source-down notice. Each source used to carry its own "reads failed" code, and one auth failure went 33 minutes unseen. After 3 failed runs in a row (an exit other than 0, or a failure to start), every subscription to the source gets a note from the lookout itself: "The source NAME is down: its last N runs failed, since WHEN, so nothing from it reaches you until it works again, which you will hear. Tell the person, who set it up." The note includes why it failed and the last 5 stderr lines, read to the end. It repeats at most once a day while the source stays down, and a "works again" note follows when it recovers, including after a fix by edit. These notices reach every subscription that names the source, whatever its topic or filter (Event.lookout).
  • U8: topic values. Subscriptions mixed topic and id filters because agents couldn't see the topics. A source's shape now keeps the topics its last 200 events named, newest first, at most 32, and that order survives a restart. The subscriptions listing shows them under topics, so an agent knows what to put after NAME:.

Changes

  • client/src/config.rs: adds Source.watch (a list of files, each starting with / or ~/). The commons source refuses it.
  • sonny/src/lookout/sources.rs:
    • Stamp holds the watched files and their mtimes. Runner.set restarts a source when its stamp changes.
    • Lasting holds Health and Seen per source, and is kept across restarts.
    • emit() records an ID only once the event is sent.
    • Health sends the down and back notices. once() waits up to 1 s for stderr to end.
    • Event::of_lookout and Event.lookout are new and serialized.
    • Shape.topics keeps recency on read and is shown in listed().
  • sonny/src/lookout/subs.rs: in hears(), the lookout's own word on a source reaches every subscription to it.
  • sonny/src/stamp.rs: when is now pub.
  • docs/LOOKOUT.md, SECURITY.md: describe the watch list and say that a source's command and watched files must be somewhere no agent can write. Also the down paragraph and the topics listing.
  • sonny/FEATURES.md: the sources row gets a U6-U8 entry.

No daemon, protocol or schema change. No tool text changes.

Testing

  • cargo test -p sonny and the agent-client config tests pass. New tests:
    • a_source_starts_again_when_its_command_file_changes (an ID seen before the edit isn't sent again)
    • a_source_down_then_fixed_by_an_edit_is_heard_to_work_again
    • a_source_watches_only_the_files_its_settings_list
    • a_source_failing_runs_in_a_row_is_down_once_a_day_then_back
    • a_shape_keeps_the_topics_named_lately_newest_first
    • the_lookout_s_word_on_a_source_reaches_every_subscription_to_it
  • cargo clippy --workspace --all-targets -- -D warnings and cargo fmt are clean.

🤖 Generated with Claude Code

claude added 10 commits November 7, 2026 03:05
A 10-minute digest reached a task about 21 hours late: news that does not
steer waited for its subscriber to rest, and a subscriber kept busy by
messages from elsewhere (busy counts queued and ready turns) never did.

News now waits for rest at most its window: its digest (the
subscription's, else its source's), else `sonny.lookout_rest_minutes`
(15 by default; 0 waits however long, as before). Then it goes as a
steer, joining the running turn, and the note says why. A subscriber that
rests hears everything as before; the person's words and steers go at
once as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHC3i5tCSya5Hav3ZG
The cap on how long news waits for a busy subscriber to rest
(lookout_rest_minutes) is superseded: George wants every delivery to be
steer, queue or attach, with nothing held for the subscriber to rest, so
the next commit makes every lookout note steer. This merge takes main as
it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHC3i5tCSya5Hav3ZG
The lookout held task and source news until the subscriber rested, so a
subscriber others kept busy never heard it: a 10-minute digest arrived
21 hours late (M12). Sonny delivers only by steer, queue or attach, steer
first, so every note now goes as a steer once its news settles: it joins
the running turn at its next round, or starts one. The person's words and
what a `steer` pattern marks still go at once, past any digest.

A note joining a running turn ends with a line saying to act where it
changes the work and carry on; one that starts a turn ends as before.
lead.md says the note joins the running turn or starts one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHC3i5tCSya5Hav3ZG
The tool still said the rest of the news waits until the turn ends, and
that a steer cuts into the running turn: every note now joins the running
turn or starts one, and what `steer` matches goes at once, past any digest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHC3i5tCSya5Hav3ZG
…list topics

A source whose command's files changed since it started starts again on
them within the 15 s settings reread (every word that is a path to a
file, and the first word as PATH finds it), as a service manager
restarts a unit on its new binary (U7).

After 3 failed runs in a row, every subscription to the source hears from
the lookout itself that it is down, with why and stderr's last 5 lines,
again each day while it stays down, and that it works again once a run
does, whatever its topic or filter (U6).

A source's shape keeps the topics its last 200 events named, at most 32,
newest first, and the subscriptions listing shows them under `topics`
(U8).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHC3i5tCSya5Hav3ZG
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 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-07T05:39:01.229605Z 2a24cf8 New commits
🔒 Security Review ✅ Completed 2026-11-07T05:10:33.948611Z e5a13d0 PR opened

Security findings

Advisory findings (1)

ℹ️ 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: e5a13d0051

ℹ️ 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/lookout/sources.rs Resolved
Comment thread sonny/src/lookout/sources.rs Resolved
Comment thread sonny/src/lookout/sources.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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: e5a13d0051

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

Comment thread sonny/src/lookout/sources.rs Resolved
…ealth across restarts

A run's stderr reader is awaited (up to a second) before the run is
judged, so a down notice quotes what the command printed last. A
command word that names a file from where the lookout runs, as
`sh poll.sh`, is stamped too. A source's health is the runner's, kept
across a restart, so one fixed by an edit is heard to work again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHC3i5tCSya5Hav3ZG

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

ℹ️ 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/lookout/sources.rs Resolved
Comment thread sonny/src/lookout/sources.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: 55ce6b19f4

ℹ️ 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/lookout/sources.rs Resolved
Comment thread sonny/src/lookout/sources.rs Resolved
Comment thread sonny/src/lookout/sources.rs Resolved
@lydakis lydakis changed the title Lookout sources: restart on a changed command, say when one is down, list topics (U6, U7, U8) Lookout sources: restart on a watched file, say when one is down, list topics (U6, U7, U8) Nov 7, 2026

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

ℹ️ 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/lookout/sources.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: 50495c3bb6

ℹ️ 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/lookout/sources.rs Resolved
@lydakis
lydakis merged commit a123857 into main Nov 7, 2026
5 checks passed
@lydakis
lydakis deleted the claude/project-thread-y8hnke branch November 7, 2026 06:05
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