Skip to content

fix(agent-harness): escalate user-actionable blockers to the user with a concrete ask (#4092)#4482

Merged
senamakel merged 4 commits into
tinyhumansai:mainfrom
senamakel:fix/GH-4092-escalate-to-user
Jul 4, 2026
Merged

fix(agent-harness): escalate user-actionable blockers to the user with a concrete ask (#4092)#4482
senamakel merged 4 commits into
tinyhumansai:mainfrom
senamakel:fix/GH-4092-escalate-to-user

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

  • When the no-progress ladder halts on a user-actionable blocker (a missing service connection — the issue's canonical case), replace the crate's generic "unreachable environment, report this back" summary with a direct ask + concrete next step ("… needs a service that isn't connected. Connect it (Settings → Connections), then tell me to retry — or tell me how you'd like to proceed").
  • The run still pauses so the ask surfaces; non-user-actionable failures keep the crate summary.
  • (CI) Also adds config_*_privacy_mode to a stale schema-catalog golden — see ## Related.

Problem

Issue #4092: when an agent is stuck on something only the user can unblock (missing connection, ambiguous request, required confirmation), it should pause and ask the user a specific question instead of looping silently. The canonical example: acting on a service that isn't connected — the agent retries and never says "Service X isn't connected — connect it in Settings, or tell me how to proceed".

On the current base:

  • Interactive turns already surface clarifying questions inline (the agent asks in its reply — graph.rs), so the pure "ask the user" path is covered there.
  • Repeated failures are capped by the crate's no-progress ladder (nudge → halt), which surfaces a halt summary to the caller/user.

The gap: the halt summary is framed as "the goal looks unreachable in this environment; report this back" — wrong for a missing connection, which is not an unreachable environment but a blocker the user can clear. The agent reports a generic dead-end instead of asking the user to connect the service.

Solution

In RepeatedToolFailureMiddleware's Halt arm, detect a user-actionable blocker via user_actionable_escalation(tool, error) — today a missing service connection, matched on the same not-connected signal the composio error mapping already uses (not connected / connect … in Settings), which the tools themselves emit. When detected, replace the generic halt summary with a user-directed ask that relays the tool's own message and gives a concrete next step (connect in Settings → Connections, then retry, or say how to proceed). The run still Pauses so the ask surfaces. Non-user-actionable failures (a missing file, a segfault) return None and keep the crate's summary untouched.

This escalates after the same-strategy retries are exhausted (the "after N unproductive iterations" the issue asks for), turning a generic "I give up" into a specific, actionable ask.

Submission Checklist

  • Tests added or updated (happy path + failure/edge) — user_actionable_escalation_detects_missing_connection (missing-connection → ask; plain failures → None) and halt_on_missing_connection_asks_the_user_instead_of_reporting_back (a repeated not-connected failure halts with the ask, not the generic report-back, and still pauses).
  • Diff coverage ≥ 80% — the helper and the halt-arm branch are exercised by the two tests.
  • Coverage matrix updated — N/A: behaviour change to existing no-progress handling.
  • All affected feature IDs listed under ## Related — N/A.
  • No new external network dependencies introduced.
  • Manual smoke checklist updated if this touches release-cut surfaces — N/A: internal escalation wording.
  • Linked issue closed via Closes #NNN.

Impact

  • Agent harness. When a run repeatedly fails because a service isn't connected, the user now gets a specific ask (connect it / tell me how to proceed) instead of a generic environment-unreachable report. No change to non-user-actionable halts or to the nudge/pause mechanics.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/GH-4092-escalate-to-user
  • Commit SHA: see head

Validation Run

  • pnpm --filter openhuman-app format:check — N/A (no frontend changes)
  • pnpm typecheck — N/A (no TS changes)
  • Focused tests: openhuman::tinyagents::middleware::tests::{user_actionable_escalation_detects_missing_connection, halt_on_missing_connection_asks_the_user_instead_of_reporting_back} — execution deferred to CI (shared build host)
  • Rust fmt/check (if changed): rustfmt --edition 2021 --check clean; cargo check --bin openhuman-core passed (Finished dev)
  • Tauri fmt/check (if changed): N/A

Validation Blocked

  • command: cargo test --lib -- user_actionable_escalation halt_on_missing_connection
  • error: none — shared build host saturated
  • impact: cargo check compiled clean; deterministic tests validated by CI

Behavior Changes

  • Intended behavior change: a repeated user-actionable blocker (missing connection) halts with a direct user ask instead of a generic report-back.
  • User-visible effect: the user is told exactly what to connect (and how) or asked how to proceed, instead of receiving a generic failure report.

Parity Contract

  • Legacy behavior preserved: non-user-actionable halts keep the crate's summary; the nudge, thresholds, and Pause path are unchanged.
  • Guard/fallback/dispatch parity checks: user_actionable_escalation returns None for anything but a recognised missing-connection signal, so only that case is reworded.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this one

senamakel added 2 commits July 4, 2026 00:22
…h a concrete ask (tinyhumansai#4092)

When an agent is stuck on something only the user can unblock — the issue's
canonical case is acting on a service that isn't connected — the no-progress
ladder halts with the crate's generic "the goal looks unreachable in this
environment; report this back" summary. That's the wrong framing for a
missing connection: it's not an unreachable environment, it's a blocker the
user can clear, and the agent should say so with a concrete next step.

In `RepeatedToolFailureMiddleware`'s halt path, detect a user-actionable
blocker (a missing service connection — the same not-connected signal the
composio error mapping already keys on, and which the tools surface as
"connect … in Settings → Connections") and replace the generic halt summary
with a direct ask: "I can't continue without your input: <tool> needs a
service that isn't connected. <relayed tool message> Connect it (Settings →
Connections), then tell me to retry — or tell me how you'd like to proceed."
The run still pauses so the ask surfaces; non-user-actionable failures keep
the crate's summary unchanged.

Tests: `user_actionable_escalation` detects a missing connection and phrases
the ask (and returns None for plain environment failures); a repeated
not-connected failure halts with the user-directed ask (not the generic
report-back) and still pauses.

Closes tinyhumansai#4092.

Claude-Session: https://claude.ai/code/session_01KcmdqJVpjmnH31HqTHRLwG
@senamakel senamakel requested a review from a team July 4, 2026 00:23
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

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: 1 minute

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: 47f6f777-ef82-4f5e-8f19-a22a98f1f18f

📥 Commits

Reviewing files that changed from the base of the PR and between 3791f30 and 72ecf82.

📒 Files selected for processing (1)
  • src/openhuman/tinyagents/middleware.rs

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: f20fe17edf

ℹ️ 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 src/openhuman/tinyagents/middleware.rs Outdated
let missing_connection = lower.contains("not connected")
|| lower.contains("isn't connected")
|| lower.contains("is not connected")
|| (lower.contains("connect") && lower.contains("settings"));

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 Restrict reconnect guidance to true disconnections

When a repeated Composio insufficient-scope or trigger-permission failure reaches this halt path, its existing error text contains guidance like Reconnect ... in Settings → Connections while explicitly saying the connected account is missing permissions (src/openhuman/composio/error_mapping.rs:155-174). This broad (connect && settings) match rewrites that into “needs a service that isn't connected,” which contradicts the real cause and sends users down the wrong recovery path; please narrow the predicate to true not-connected/platform errors or preserve the original scope/permission wording.

Useful? React with 👍 / 👎.

@senamakel senamakel self-assigned this Jul 4, 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: 72ecf82d02

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

// Keep this narrow: some scope/permission failures legitimately tell the
// user to reconnect in Settings, but they are not missing connections.
let missing_connection = lower.contains("[composio:error:composio_platform]")
|| lower.contains("not connected")

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 not-connected escalation to user-owned integrations

This broad substring also matches agent-actionable MCP errors: mcp_clients_list_tools returns server_id=... is not connected; connect it first via mcp_clients_connect (src/openhuman/mcp_registry/ops.rs), and the tinyagents adapter turns that into a failed tool result. After repeated calls, this new branch replaces that recovery hint with “Connect it (Settings → Connections)”, even though the correct next step is for the agent to call the MCP connect tool, not for the user to reconnect a service in Settings. Please anchor this escalation to true integration/platform connection failures (or preserve errors that already name a recovery tool).

Useful? React with 👍 / 👎.

@senamakel senamakel merged commit c4701a9 into tinyhumansai:main Jul 4, 2026
13 of 15 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.

[Harness] Escalate to the user after N unproductive iterations

1 participant