Skip to content

feat(flows): optional alert steps (if_present) - #136

Merged
leeguooooo merged 2 commits into
mainfrom
feat/optional-alert
Oct 6, 2026
Merged

leeguooooo merged 2 commits into
mainfrom
feat/optional-alert

Conversation

@leeguooooo

@leeguooooo leeguooooo commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Why: The parallel session saved Xiaohongshu post and delete flows (16 s and 23 s in one call, against 37 calls and 5 m 40 s by hand). It could not write the occasional system "Allow Paste" prompt into them, because an alert step with no alert up fails the run.

What:

  • {type: alert, button|action, if_present: true} answers the alert when one is up. When none is, it passes as skipped: "no_alert".
  • This works for both batch and single /agent/input actions.
  • Without the flag, the step still fails as no_alert.
  • MCP and flow alert steps carry if_present.

Registry rule: flows that use if_present must not enter the official registry until a client with this field is the minimum. Older clients reject unknown fields.

Tests: new daemon integration test (optional passes, strict still fails) and MCP encoding test. cargo test -p server and -p iphone-use-mcp pass.

Summary by CodeRabbit

  • New Features
    • Alert actions can now be marked optional. If no alert is present, the action is skipped and the flow continues.
  • Documentation
    • Added guidance on optional alerts and client compatibility.
  • Chores
    • Updated package versions to 0.13.1.

…r only sometimes

Hardware (Xiaohongshu flows): an occasional system 'Allow Paste' prompt
could not be written into a flow — an alert step with no alert up fails the
run. {type: alert, ..., if_present: true} answers the alert when one is up
and passes as skipped: no_alert when none is; without the flag the step
still fails as no_alert. MCP/flow alert steps carry if_present.
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e73974f6-29ff-45c6-93e8-66050d7c022b
📥 Commits

Reviewing files that changed from the base of the PR and between 908aa19 and 38f1924.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • crates/core/Cargo.toml
  • crates/mcp/Cargo.toml
  • crates/mcp/src/server.rs
  • crates/server/Cargo.toml
  • crates/server/src/http.rs
  • crates/server/tests/agent_actions_outcome.rs
  • docs/agent-reference.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Alert actions can now set if_present. When no system alert is present, the server skips an optional alert and reports no_alert. Package versions change from 0.13.0 to 0.13.1.

Changes

Optional alert handling

Layer / File(s) Summary
MCP alert request contract and encoding
crates/mcp/src/server.rs, crates/mcp/Cargo.toml
PhoneStep::Alert gains if_present, which defaults to false. Request encoding includes the field only when it is true. Tests cover true and false values and retain the existing validation cases.
Server outcomes and supporting coverage
crates/server/src/http.rs, crates/server/tests/agent_actions_outcome.rs, docs/agent-reference.md, crates/core/Cargo.toml, crates/server/Cargo.toml
The server validates if_present as a boolean. When an optional alert is absent, batch actions complete with skipped: "no_alert" without increasing applied_actions; single actions return success with skipped: "no_alert" and outcome: "not_sent". Tests and reference documentation cover the behavior. Package versions change to 0.13.1.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant MCPClient
  participant HTTPServer
  participant WDA
  MCPClient->>HTTPServer: Submit alert with if_present true
  HTTPServer->>WDA: Execute alert action
  WDA-->>HTTPServer: HTTP 404, no active alert
  HTTPServer-->>MCPClient: Complete step as skipped no_alert
Loading

Merge Risk: ⚪ Minimal · up to 38f19

This adds optional alert steps without changing behavior for existing flows. Strict alert steps still fail when no alert is present. Flows that use the new field need a client that supports it, which the docs already state.

🚥 Pre-merge checks | ✅ 4 | ❓ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ❓ Inconclusive Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (5 skipped: 4… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: optional alert steps controlled by if_present.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (5 skipped: 4 unsupported, 1 too large.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@leeguooooo
leeguooooo merged commit 68a721e into main Oct 6, 2026
2 checks passed
@leeguooooo
leeguooooo deleted the feat/optional-alert branch October 6, 2026 10:23
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