Skip to content

fix(harness): preserve Terminal start through status updates [SAP-3292] - #1041

Closed
ynadge wants to merge 1 commit into
assistant-history-scope-and-focusfrom
terminal-start-acknowledgment
Closed

ynadge wants to merge 1 commit into
assistant-history-scope-and-focusfrom
terminal-start-acknowledgment

Conversation

@ynadge

@ynadge ynadge commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Primary change type

  • Bug fix

Problem and motivation

When Start Terminal emitted a session status update before its HTTP response, the conversation remounted and aborted that request. A real PTY started, but the pane returned to Assistant and attached again.

Summary and scope

Keep one conversation and Studio-keyed Terminal operation owner through dormant, starting, ready and exited states. Settle the explicit request before showing its latest Terminal state. Natural Terminal exit also preserves selected Assistant focus and drafts. Existing account, navigation, lifecycle and End guards still reject stale operations.

Related work

Related issue: https://linear.app/sapiom/issue/SAP-3292

Depends on #1040. Native stack target: main.

Validation

108 browser cases passed: 86 Continue/End/history/portable Terminal, 14 chat/focus/draft/lease and 8 saved Terminal record. The new held starting/ready response, failed startup and End race cases pass; deliberately restoring the remount made the regression fail. Frontend TypeScript, explicit four-file ESLint and diff checks passed. A fresh non-mock full workspace build passed.

The actual built browser → Studio server → corrected native → real PTY flow then passed in 14.60 seconds: one paused continuation/seed, one model request only after Send, same-ID paused Resume, Start HTTP200 with one PTY and zero extra Assistant attachment/history, and selected two-engine End while a sibling survived. All four native processes and the PTY were confirmed absent after cleanup. This is source-built E2 with loopback fixture services, not signed activated production E3.

Tests and documentation

Added three realistic status-before-acknowledgement regressions. Made the End-before-attach fixture deterministic under React StrictMode; retained stale-lease/no-conversation assertions. Updated natural-exit focus/draft expectations and assistant-history.md. Increment: 327 changed lines including tests/docs/changeset. pnpm pr:size is absent in this SDK; measured the incremental Git diff.

Compatibility and release impact

  • Terminal starts still require an explicit action. No authorization or runtime activation change.
  • Changeset: @sapiom/harness patch.
  • Fix-forward: Keep the pending operation owner stable and correct the transition that interrupted its acknowledgement; preserve End and authority fencing.

Security

  • No secrets, credentials, private data, or unsanitized logs included.
  • No suspected vulnerability disclosed publicly.

AI assistance

  • AI assistance used: Codex implemented and reviewed the change with the validation described above.

Checklist

  • CONTRIBUTING.md read; maintainer-authorized issue work.
  • One focused increment, checks, documentation and release impact addressed.
  • I can explain and maintain the submitted changes.

Devin Review

Visual verification

These fixture images show the action states before and after the held Start response. The fixture Terminal is blank; the actual PTY proof follows separately.

Waiting for acknowledgement Terminal after acknowledgement
Starting Terminal remains pending Terminal stays selected

The 14-second actual browser/native/PTY flow uses the built SPA and real Studio server with the corrected candidate, isolated account/model fixtures and a real bash PTY. It covers Continue, explicit Send, End, paused Resume, explicit Start Terminal and final End. This is E2 source verification; production activation and signed installed E3 remain separate.

Continued, paused Resumed, paused Terminal explicitly started
Continued Assistant Resumed Assistant Real PTY

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 25b99da8-e7b7-498e-a533-e2b97fd7a375

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ynadge ynadge closed this Sep 15, 2026
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