Skip to content

Agent-emitted HUMAN_QUESTION is garbled (PTY whitespace stripped) unless task uses the '...this exact question:' marker #18

Description

@khaliqgant

Summary

An agent-emitted HUMAN_QUESTION: marker gets posted to Slack with all whitespace stripped when the interactive CLI (e.g. claude) renders the marker line inside its TUI box:

Whichrate-limiterstrategyshouldweuse

The intended text was: "Which rate-limiter strategy should we use — token-bucket or fixed-window?"

Root cause

observeHumanAssistanceOutput in runner.js scrapes the question from the agent PTY output via extractHumanQuestionCandidates. When Claude's boxed TUI reflows the line, spaces are already gone before extraction (replace(/\s+/g, ' ') can't restore spaces that the terminal render dropped).

There is a mitigation — shouldPreferDeclaredHumanQuestion / humanQuestionLooksCompacted will prefer a declared question lifted from the task text — but extractDeclaredHumanQuestionFromTask only fires when the task literally contains the phrase:

/(?:followed by|with)\s+this\s+exact\s+question\s*:/i

If the workflow author writes a natural HUMAN_QUESTION: instruction without that exact marker phrase, declaredQuestion is undefined and the garbled PTY scrape is posted verbatim.

Impact

  • The default/naive way to author an agent-driven Slack question produces garbled output.
  • The fix (relayflows#16) is present in 1.0.4 but is effectively opt-in and undiscoverable — nothing warns the author that their question will be PTY-scraped unless they use the magic phrase.

Suggested fixes (any of)

  1. Make humanQuestionLooksCompacted output route to a fallback that reconstructs the question from the raw marker in the agent's stdout/log (not PTY render) rather than posting the compacted string.
  2. When renderedQuestion looks compacted and no declared question exists, hold and warn ([ask-human] question looks garbled; add "...this exact question:" to the task) instead of silently posting the mangled text.
  3. Document the ...this exact question: convention prominently in the writing-agent-relay-workflows skill's human-assistance section (it currently isn't mentioned).

Repro

Task that reproduces (no marker phrase):

Print exactly one line: HUMAN_QUESTION: Which rate-limiter strategy should we use — token-bucket or fixed-window?

Task that works (marker phrase):

Print one line beginning with HUMAN_QUESTION: followed by this exact question:
Which rate-limiter strategy should we use — token-bucket or fixed-window?

Environment

  • @relayflows/core 1.0.4, local relayflows run, claude interactive agent
  • Previously reported/fixed at the platform level in relayflows#16; this is about the remaining opt-in gap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions