fix(web): stamp explicit incomplete/stop_reason instead of UI prose matching #96

Open
salmaelsoly wants to merge 1 commit from development_structured_incomplete_field into integration
Member

Summary

Replaces the UI's brittle prose-matching (isIncompleteReply() over ~8 hardcoded phrases) with an explicit incomplete (boolean) / stop_reason (string) field stamped by the server on every turn/job reply. The UI keys its Continue/Retry affordance off that field and falls back to the prose heuristic only when the field is absent (older daemon). Detection reuses existing server-side signals — no new prose matcher.

Closes #40

Changes

  • Server (proof_run.rs): new turn_incomplete_signal() — the single server-owned text fallback, reusing reply_indicates_incomplete_run() (no new phrases).
  • Server (session.rs): stamp incomplete/stop_reason on the synchronous message.send response and the chat.complete SSE event.
  • Engine (core.rs): stamp incomplete/stop_reason on the turn:end SSE event, matched against the engine-owned STEP_LIMIT_REPLY_MARKER; Err arm reports stop_reason: "error".
  • Server (contract.rs): stamp_incomplete_signal_into_details() derives the signal from the structured step-limit flag, then failure_kind, then the reply fallback; called at the proof/autonomy job-details persistence point and during subagent reconciliation (before failure_kind is cleared).
  • UI (store.ts): prefer the server field at all 3 call sites (trackJobUntilDone terminal, sync message.send return, turn:end SSE); isIncompleteReply() demoted to a documented legacy fallback. Regenerated production bundle.
  • Tests: 4 new unit tests covering turn_incomplete_signal() and stamp_incomplete_signal_into_details() (structured flag, failure_kind, clean run).

Test Results

cargo test -p hero_shrimp_server — 301 passed, 0 failed. cargo check -p hero_shrimp_engine -p hero_shrimp_server clean. vite build succeeded; tsc shows only pre-existing unrelated errors.

## Summary Replaces the UI's brittle prose-matching (`isIncompleteReply()` over ~8 hardcoded phrases) with an explicit `incomplete` (boolean) / `stop_reason` (string) field stamped by the server on every turn/job reply. The UI keys its Continue/Retry affordance off that field and falls back to the prose heuristic only when the field is absent (older daemon). Detection reuses existing server-side signals — no new prose matcher. ## Related Issue Closes https://forge.ourworld.tf/lhumina_code/hero_shrimp/issues/40 ## Changes - **Server (`proof_run.rs`)**: new `turn_incomplete_signal()` — the single server-owned text fallback, reusing `reply_indicates_incomplete_run()` (no new phrases). - **Server (`session.rs`)**: stamp `incomplete`/`stop_reason` on the synchronous `message.send` response and the `chat.complete` SSE event. - **Engine (`core.rs`)**: stamp `incomplete`/`stop_reason` on the `turn:end` SSE event, matched against the engine-owned `STEP_LIMIT_REPLY_MARKER`; `Err` arm reports `stop_reason: "error"`. - **Server (`contract.rs`)**: `stamp_incomplete_signal_into_details()` derives the signal from the structured step-limit flag, then `failure_kind`, then the reply fallback; called at the proof/autonomy job-details persistence point and during subagent reconciliation (before `failure_kind` is cleared). - **UI (`store.ts`)**: prefer the server field at all 3 call sites (`trackJobUntilDone` terminal, sync `message.send` return, `turn:end` SSE); `isIncompleteReply()` demoted to a documented legacy fallback. Regenerated production bundle. - **Tests**: 4 new unit tests covering `turn_incomplete_signal()` and `stamp_incomplete_signal_into_details()` (structured flag, `failure_kind`, clean run). ## Test Results `cargo test -p hero_shrimp_server` — 301 passed, 0 failed. `cargo check -p hero_shrimp_engine -p hero_shrimp_server` clean. `vite build` succeeded; `tsc` shows only pre-existing unrelated errors.
fix(web): stamp explicit incomplete/stop_reason instead of UI prose matching
Some checks failed
Verify / verify (push) Failing after 19s
Verify / verify (pull_request) Failing after 38s
3482b99ccc
Replace the UI's brittle prose-matching (isIncompleteReply over ~8 hardcoded
phrases) with an explicit incomplete/stop_reason field stamped by the server on
every turn/job reply. The UI keys its Continue/Retry affordance off that field
and falls back to the prose heuristic only when the field is absent (older
daemon). Detection reuses existing server signals — the structured step-limit
event, failure_kind, and a single server-owned reply_indicates_incomplete_run
fallback — so there is no new prose matcher.

#40
salmaelsoly force-pushed development_structured_incomplete_field from 3482b99ccc
Some checks failed
Verify / verify (push) Failing after 19s
Verify / verify (pull_request) Failing after 38s
to f6c9572a2d
All checks were successful
Verify / verify (pull_request) Successful in 12m47s
Verify / verify (push) Successful in 32m54s
2026-06-08 14:25:56 +00:00
Compare
All checks were successful
Verify / verify (pull_request) Successful in 12m47s
Verify / verify (push) Successful in 32m54s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin development_structured_incomplete_field:development_structured_incomplete_field
git switch development_structured_incomplete_field

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch integration
git merge --no-ff development_structured_incomplete_field
git switch development_structured_incomplete_field
git rebase integration
git switch integration
git merge --ff-only development_structured_incomplete_field
git switch development_structured_incomplete_field
git rebase integration
git switch integration
git merge --no-ff development_structured_incomplete_field
git switch integration
git merge --squash development_structured_incomplete_field
git switch integration
git merge --ff-only development_structured_incomplete_field
git switch integration
git merge development_structured_incomplete_field
git push origin integration
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_shrimp!96
No description provided.