SEZ9 opened a new issue, #13151:
URL: https://github.com/apache/seatunnel/issues/13151

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   ### What happened
   
   A clarifying question can repeat without limit, and since #13000 each 
repetition grows the text sent to the model.
   
   `Orchestrator.process_user_input` has two exits that return a question:
   
   ```python
   if plan_result["type"] == "question":
       self.pending_question = plan_result.get("content")
       return plan_result
   ...
   if missing:
       question = ("I need a few more details to generate the config:\n" + ...)
       self.pending_question = question
       return {"type": "question", ...}
   ```
   
   Neither counts rounds. A planner that keeps emitting text without both a 
source and a sink, together with a caller that keeps answering, loops 
indefinitely.
   
   #13000 made a reply accumulate onto the requirement instead of replacing it, 
which is correct — the requirement has to survive the question — but it means 
an unbounded loop is also unbounded growth:
   
   ```python
   self._original_request = (
       f"{self._original_request}\n\n"
       f"Additional details, in reply to a clarifying question:\n"
       f"{user_input}"
   )
   ```
   
   Every round appends. An automated caller that answers each question, such as 
a benchmark harness or any script wrapping the Orchestrator, will keep 
enlarging the prompt until something else fails.
   
   ### SeaTunnel Version
   
   dev (`9f741b9c6`)
   
   ### SeaTunnel Config
   
   n/a — the defect is in the CLI's orchestration, not in a job config.
   
   ### Running Command
   
   ```shell
   seatunnel ai run    # interactive: the user can stop, so the growth is 
bounded by patience
   # or any programmatic caller:
   Orchestrator(client).process_user_input(reply)   # loops while the planner 
keeps asking
   ```
   
   ### Error Exception
   
   No exception. That is the problem — the exchange simply never terminates.
   
   ### Zeta or Flink or Spark Version
   
   n/a
   
   ### Java or Scala Version
   
   n/a
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   
   ---
   
   ### Why a bound rather than a better planner prompt
   
   The planner may be unable to resolve a pipeline for a reason no prompt 
fixes: the user genuinely has not said where the data lives. The question is 
the right response the first time. What is missing is a decision about when to 
stop asking.
   
   Two options were considered:
   
   1. **Give up with an error** naming what is still needed.
   2. **Generate anyway** with a documented warning.
   
   Option 2 is worse than it looks. A config invented without a source and a 
destination still parses, still loads its plugins and still runs, so every 
later gate — static check, dry-run, real execution — passes it. The CLI would 
deliver a job that moves the wrong data and report success. That is the class 
of error the gates cannot see, so the engineering has to stop it earlier.
   
   This was raised as a non-blocking follow-up during review of #13001, where I 
noted that what happens when the counter trips is a behaviour decision worth 
its own issue rather than a number picked in passing.
   
   ### Proposed fix
   
   Route both question exits through one helper that counts, so the count 
cannot be forgotten by one exit and a future third exit inherits the bound. 
After three rounds — the same budget the validate/fix loop already uses — 
return an error naming the source and the destination, and clear the exchange.
   
   Related: #12999 (the orchestration error-propagation chain), #13000, #13001.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to