Skip to content

fix(flows): normalize bare-scope jq in condition expressions + prompt guard (B17)#4707

Merged
graycyrus merged 2 commits into
tinyhumansai:mainfrom
graycyrus:fix/flows-jq-condition-normalize
Jul 8, 2026
Merged

fix(flows): normalize bare-scope jq in condition expressions + prompt guard (B17)#4707
graycyrus merged 2 commits into
tinyhumansai:mainfrom
graycyrus:fix/flows-jq-condition-normalize

Conversation

@graycyrus

Copy link
Copy Markdown
Contributor

Fixes B17 — the last hop for condition-based flows. The builder emitted field:"=item.labels | any(.name == \"in progress\") | not" (the simple-path shorthand item.labels piped into jq). expr::run_jq compiled bare item as an undefined jq functionNull → the condition routed all 95 real issues to false → 0 output. (B1→B15→B16 had gotten the real data flowing; this was the final blocker.)

Fix

  • tinyflows (#6, pin → 68590ed): normalize_bare_scope_ref prepends . when a jq program starts with a bare top-level scope key (item/items/run/nodes) followed by ./|/[/ /EOF — so =item.labels | any(…) resolves as jq field access. Leading-dot exprs and jq builtins (any(...) etc., followed by () are untouched; only currently-null-returning hybrids change. 5 expr tests + a condition-node jq test.
  • prompt.md: warn the builder to never mix the shorthand with jq — use a leading dot (=.item.x | …) for any piped/functional expression.

Verification

tinyflows 310 pass · openhuman cargo check clean · flows:: 413 pass.

…gainst mixing (B17)

The builder emitted condition fields like `=item.labels | any(.name == "in progress") | not`
— shorthand bare key (`item`, no leading dot) piped into jq. expr::run_jq compiled bare `item`
as an undefined jq function → Null → condition routed ALL items to false → 0 output (proven
live: 95 real issues all filtered).

- vendor/tinyflows -> 68590ed (tinyflows#6): normalize_bare_scope_ref prepends `.` when a jq
  program starts with a bare top-level scope key (item/items/run/nodes) so `=item.labels | …`
  resolves as field access; leading-dot exprs + jq builtins (`any(...)`) untouched.
- prompt.md: warn the builder to never mix the shorthand with jq — use `=.item.x | …` (leading
  dot) for any piped/functional expression; plain `=item.x` shorthand is fine alone.

tinyflows 310 pass; openhuman cargo check clean; flows:: 413 pass.
@graycyrus
graycyrus requested a review from a team July 8, 2026 13:21
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1f1cdc12-0fa8-4340-8cef-e6430c463c73

📥 Commits

Reviewing files that changed from the base of the PR and between 9830c90 and f50bc2d.

📒 Files selected for processing (2)
  • src/openhuman/flows/agents/workflow_builder/prompt.md
  • vendor/tinyflows

Comment @coderabbitai help to get the list of available commands.

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

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +310 to +312
- **Never mix the shorthand with jq.** If an expression uses `|`, `[`,
functions (`any(...)`, `length`), or any jq beyond a plain dotted path, it
MUST start with `.` (the jq root): write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Narrow the jq-root rule to bare scope refs

In cases where the builder needs a valid jq expression that starts with a literal rather than a root field—such as array/object construction with =[.item.a, .item.b]—this wording says any jq beyond a dotted path must start with ., so following it either forbids supported filters or can lead to invalid rewrites like =.[...]. Please scope the guard to expressions that begin with a bare scope key (item/items/run/nodes) before jq syntax.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in f50bc2d. Scoped the guard explicitly to expressions that begin with a bare scope key (item/items/run/nodes); expressions that already start with valid jq syntax like =[.item.a, .item.b] are called out as not needing the leading dot. The underlying Rust normalizer (normalize_bare_scope_ref in tinyflows) was already scoped this way — it only fires when the program's leading char is alphabetic and the leading identifier matches a scope key — this was purely a prompt-wording precision fix for the builder LLM.

@graycyrus

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…addresses @chatgpt-codex-connector on prompt.md:312)

The prior wording said "any expression that uses |, [, functions... must
start with a dot", which read as applying even to expressions that already
begin with valid jq syntax (e.g. `=[.item.a, .item.b]` for array
construction) — following it literally would prepend a stray leading dot
and change the expression's meaning. Scope the guard explicitly to
expressions that begin with a bare scope key (item/items/run/nodes).
@graycyrus
graycyrus merged commit 2e5eb4f into tinyhumansai:main Jul 8, 2026
12 checks passed
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