feat: graph content hash, trail-off heuristics, nested compat test (from OpenHuman) - #97
Conversation
Introduce a new `graph_hash` module that computes a deterministic hash over a graph's structure and node content. This enables the catalog to detect and skip duplicate graph registrations, preventing redundant storage and ensuring idempotent publish operations. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…sh_tests.rs Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…,crates/tinyflows-copilot/src/l Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a new `trail_off` module to the copilot crate that provides text heuristics for detecting whether a builder turn ends with a question, along with the corresponding changelog entries documenting this addition and other recent changes. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Tiny Sweeper review
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 714c960899
ℹ️ 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".
There was a problem hiding this comment.
tinysweeper found nothing blocking, but could not review everything, so this is not an approval: CHANGELOG.md, crates/tinyflows-catalog/Cargo.toml, crates/tinyflows-catalog/src/graph_hash.rs, crates/tinyflows-catalog/src/graph_hash_tests.rs, crates/tinyflows-catalog/src/lib.rs, crates/tinyflows-copilot/src/lib.rs, crates/tinyflows-copilot/src/trail_off.rs, crates/tinyflows-copilot/src/trail_off_tests.rs and 1 more.
$0.0079 · 96,112 in / 12,217 out · 12,800 cached (13%) · ladder/vectors, deepseek/deepseek-v4-flash · 1,078 embedded
tests: $0.0027 · 25,013 in / 2,526 out · 0 cached (0%) · deepseek/deepseek-v4-flash
description: $0.0013 · 16,143 in / 92 out · 0 cached (0%) · deepseek/deepseek-v4-flash
e2e: $0.0029 · 29,138 in / 1,363 out · 0 cached (0%) · deepseek/deepseek-v4-flash
Fixed a bug where the schedule gap detection logic incorrectly identified overlapping time windows as gaps. The issue occurred when adjacent windows shared a boundary time, causing the gap checker to treat them as non-contiguous. This change ensures that windows with matching start and end times are properly recognized as overlapping rather than gapped. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new `tinyflows-schedule` crate that provides cron expression parsing and timezone-aware scheduling, replacing the previous gate-based test infrastructure. The old gate tests have been removed as the scheduling logic has been reimplemented using the `cron` and `chrono-tz` crates, which offer more robust and standard-compliant time handling. The schedule tests have been updated to accommodate the new implementation's error message formatting. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The `text_looks_like_question` function now passes the code-span state from the text preceding the last paragraph into the question-mark scan, so that a backtick opened before the final paragraph is correctly recognised as still open. The old fallback that checked the last non-blank line for a trailing `?` has been removed because the paragraph-based scan already covers that case. The compatibility tests for router fan-in detection have been moved to a separate file. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add validation in `validate_schedule` to reject `Every` intervals whose conversion to milliseconds would overflow or fail to advance the clock, matching the same arithmetic used when computing the next run. This prevents persisted schedules from becoming stuck. Also add `skip_serializing_if` to `CronJobPatch::agent_id` so absent fields are omitted from JSON output while explicitly cleared fields remain as `null`. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…blocks The previous calculation of `paragraph_start` using `trimmed.len() - paragraph.len()` failed when the trimmed text contained leading whitespace or blank lines before a code block, causing incorrect identification of question marks. The fix uses `rfind` to reliably locate the paragraph within the trimmed text, and adds test cases for empty code fences and code blocks without a closing fence. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The function `question_mark_outside_code_with_state` redeclared `open_run_len` as a local variable, shadowing the parameter of the same name. Removing the shadowing lets the function use the parameter value directly, fixing a logic error where the initial state was always overwritten to `None`. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ff7e67a2a
ℹ️ 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".
The `ACTIVE_WINDOW_CANDIDATE_LIMIT` and `RUN_GAP_SCAN_OCCURRENCES` constants were too low to reliably detect one-minute gaps caused by annual daylight saving time transitions. A full leap year at the minimum five-minute cadence produces up to 105,408 runs, so the scan limit is raised to 105,500 and the active window candidate limit is increased to 600,000 to ensure the gap detection works regardless of where the scan starts. A new test verifies that the scan finds the spring-forward gap across a full year. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The `last_paragraph` function previously searched for the paragraph string within the original text using `rfind`, which could fail when the paragraph contained CRLF line endings that were normalized to LF during extraction. The function now returns a slice of the original text by tracking byte offsets, eliminating the need for a search and preventing the panic. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b6fd126cc
ℹ️ 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".
feat(schedule): tinyflows-schedule crate (schedule model + next-run logic)
The question-mark detection logic now skips question marks inside tilde-fenced code blocks, matching the existing behaviour for backtick-fenced blocks. This prevents false positives when a question mark appears inside a code block delimited by three or more tildes. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted several if and while blocks in `trail_off.rs` to use braces consistently, placing the opening brace on the same line as the control flow keyword and the body on a new line. This improves code readability and aligns with the project's style conventions. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…eparate files Moved the router compatibility tests from `compat_tests.rs` into a new `compat_router_tests.rs` module, and the prompt-related gate tests from `gates_tests.rs` into a new `gates_prompt_tests.rs` module, to keep each test file focused on a single concern and reduce the size of the main test files. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a collection like `nodes` is not an array and a member of a different collection is also malformed, the error message now reports the collection-level problem first. This makes the diagnostic more useful because a broken collection shape is typically the root cause, and the fix avoids depending on JSON map key ordering. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d65a2885a
ℹ️ 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".
| question_mark_outside_code_with_state( | ||
| paragraph, | ||
| code_span_state(prefix), | ||
| tilde_fence_state(prefix), | ||
| ) |
There was a problem hiding this comment.
Unify prefix state across both fence syntaxes
When a completed tilde-fenced block in the prefix contains an unmatched backtick (for example, ~~~text\nUse \literal\n~~~\n\nWhich channel?), code_span_state(prefix)reports an open backtick span even though that backtick is literal fenced content, whiletilde_fence_state(prefix)` independently reports the tilde fence as closed. The final question is consequently suppressed and the host adds an unnecessary generic fallback despite an explicit question; scan the prefix with one combined state machine so delimiters inside either fence cannot affect the other state.
Useful? React with 👍 / 👎.
Stacked on #96 (
move-openhuman-flow-logic): OpenHuman's tinyflows pin is that branch's tip, so this is based on it rather thanmain. Retarget tomainonce #96 lands.What moves out of OpenHuman
tinyflows_catalog::graph_hash::compute_graph_hash(graph, require_approval)(+ privatecanonicalize_json): the stale-approval pin recorded when a run parks and re-checked on resume. The digest is a persisted format, so it is byte-identical to the host's old implementation: a fixed-vector test pins two SHA-256 values, and a second test compares against a verbatim copy of the pre-extraction code across several graphs (unicode, floats, nesting, empty). Key-order stability,require_approvalcoverage and array-order sensitivity tests moved with it. New deps on the catalog:sha2(workspace),hex.tinyflows_copilot::trail_off:text_looks_like_question(public) with its code-span / URL-query / CRLF-paragraph heuristics, and the 9 tests that pin them. The host'sbuild_trail_off_fallback(needs its ownConversationMessage/tool names) stays in OpenHuman.compat_tests: adds the nested-inline-sub_workflowrecursion case that only the host suite had (the other host cases were already ported here).migrate::deserialize_graphfrom #96 is what replaces the host'smigrate_and_deserialize_graph; nothing new needed for it.Verification
cargo fmt --all --check;cargo clippy --all-targets -D warningson tinyflows, tinyflows-catalog, tinyflows-copilot; tests: catalog 74 (5 new), copilot 31 (9 new), tinyflowscompat15 (1 new).