Skip to content

Lookout: subscriptions filter their sources' events with an event pattern; agents see each source's shape - #532

Merged
lydakis merged 2 commits into
mainfrom
claude/project-thread-j9pfup
Oct 31, 2026
Merged

lydakis merged 2 commits into
mainfrom
claude/project-thread-j9pfup

Conversation

@lydakis

@lydakis lydakis commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

What

George's idea: an agent should see what a programmatic lookout source emits and subscribe with a filter on that data, so only matching events wake it (e.g. a CR source filtered to the paths its work touches).

  • Sources keep their data. sources::Event keeps every field the line printed (fields, shared via Arc); before, anything beyond text/id/from/url/urgent was dropped. The note quotes the other fields as compact JSON after the text, cut at 2,000 chars.
  • Filter on a subscription. Sub.filter is an event pattern in AWS EventBridge / SNS filter-policy syntax (sonny/src/lookout/pattern.rs): fields AND, values OR, list fields match on any item, nested objects, prefix, suffix, wildcard, equals-ignore-case, anything-but, numeric, exists, $or. Checked at add (4 KiB, 256 values, 6 deep; unknown matchers refused with the supported list). A filter needs sources. A hand-edited file with a bad filter hears nothing, not everything.
  • Evaluated in the lookout in hearing, as each event arrives, before it is held for a note: a non-match never wakes anyone.
  • Agents learn the shape by looking. Each source's runner keeps its shape (fields of the last 200 events, dotted for nested objects, their kinds, a recent example) in STORE.sources/.shapes/NAME.json, written when fields change, at most once a minute otherwise, and as each run ends. Every subscriptions answer lists sources as {name, events, fields}; a filter naming a field no recent event had is added with an unseen warning.
  • Tool description, docs/LOOKOUT.md (Filters section), FEATURES.md row.

Security

A filter is plain data matched against data, size-bounded, and only ever narrows what a subscriber hears. Agents still cannot define commands. Shape examples are source text that any subscriber could already read.

Coordination

The commons thread is changing the same files (topics, digest, the commons as a built-in source). Its patches are not on main yet. I resolved this change on top of them; the resolved commit is in the project's files (lookout-filters/0004-filters-on-commons-stack.patch), where Sub::hears matches NAME or NAME:TOPIC and then the filter. Whichever lands second takes that resolution.

Tests

  • pattern.rs unit tests for every matcher, $or, nesting, list fields and the limits.
  • subs.rs: filter add/refuse/round-trip, unseen warning, listed shapes, bad hand-edited filter hears nothing.
  • sources.rs: events keep other fields, the note quotes them, shape kinds/examples/expiry/flush.
  • mod.rs: a filtered subscription hears only matching events; rehear keeps the filter.
  • Live tests/test_lookout.py: a CR poller prints two changes, a filtered subscriber is woken with only the billing one, and the shape file records both.

cargo test -p sonny, cargo clippy -p sonny --all-targets, and AGENT_TEST_RUNTIME=1 python3 -m unittest tests.test_lookout pass locally.

…tern; sources keep their fields and the lookout keeps each source's shape

A source's event keeps every field its line printed, and a subscription's
filter (an EventBridge-style event pattern: prefix, suffix, wildcard,
equals-ignore-case, anything-but, numeric, exists, $or) hears only the
events it matches, checked as each event comes. The lookout keeps each
source's shape (recent fields, kinds, an example) beside the sources'
folders, and every subscriptions answer lists it, so an agent knows what
it may filter on; a filter naming a field no recent event had is added
with an unseen warning. The note quotes an event's other fields.

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

chatgpt-codex-connector Bot commented Oct 31, 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-31T17:06:30.470969Z f9c2498 Manual request
🔒 Security Review ⚠️ Failed 2026-10-31T16:53:35.948543Z
We couldn’t complete this review. Comment @codex security review to try again.
f9c2498 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

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@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: 54ed429696

ℹ️ 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/pattern.rs Resolved
Comment thread sonny/src/lookout/subs.rs Resolved
…ames only fields that keep a filter from matching

Codex review on #532: equal() turned both sides into f64, so integer IDs
past 2^53 compared equal; whole numbers now compare as i64/u64. The unseen
warning named every field a filter mentioned, even under exists:false or
in one $or branch while another could match; pattern::missing now names
only fields that keep the pattern from matching an event with the fields
a source lately had.

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

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

lydakis commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

@codex security review

This PR's one automatic security review failed on the usage limit. Tracked in #531 as riskier: event patterns over outside sources' events, which then reach agents' turns (see #348).


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: f9c2498202

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

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