Skip to content

fix(harness): validate selected Assistant workspaces [SAP-3292] - #1044

Closed
ynadge wants to merge 1 commit into
assistant-history-workspace-aliasesfrom
assistant-workspace-action-preflight
Closed

ynadge wants to merge 1 commit into
assistant-history-workspace-aliasesfrom
assistant-workspace-action-preflight

Conversation

@ynadge

@ynadge ynadge commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Primary change type

  • Bug fix

Problem and motivation

An Assistant history selection can become stale before an action request. The server previously checked its current workspace, then the browser rejected a returned workspace that differed from the selected record. Inspection, Resume or Continue could already have started before that rejection.

Summary and scope

Send the selected launch/canonical workspace pair with all three actions and validate it against current history and the live Studio row before invoking native work. A distinct workspace_changed response tells the user to reopen Past sessions and select the refreshed entry. It preserves uncertain operations and does not offer a new Continue operation from stale metadata.

After explicit re-selection, Resume can refresh only its transport workspace proof when the Studio ID, canonical workspace and verified retry scope match. Its cached UUID and original revision remain fixed. Continue receives only its original UUID/revision triple; workspace metadata never enters its receipt fingerprint or persisted browser tuple.

Related work

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

Depends on #1043. Native stack target: main.
Addresses #1043 (comment).

Validation

50 focused tests passed (28 route, 19 client, 3 shared-error tests). An HTTP probe using the prior route/client invoked each native callback once before browser rejection; the corrected code returns workspace_changed with zero callbacks for Inspect, Resume and Continue. This reproduces stale selected metadata at the transport boundary; ordinary Studio UI has no hot-cwd setter.

History/Continue browser coverage passed all 76 cases across the full run and targeted rerun: the initial run passed 75, and one old exact request-body assertion needed the new workspace field. The corrected case and both new workspace conflict/reselection cases passed on rerun. The new cases verify retained Continue storage with no replacement control and same-UUID/original-revision Resume after a lost acknowledgement and explicit re-selection.

Non-mock workspace build, final Harness server rebuild and root typecheck passed. Scoped core and explicit browser lint passed without errors or warnings. Independent review found no additional actionable issue.

Final integrated checks passed: pnpm --filter @sapiom/harness test ran 4,862 unit tests (two skips) and 10 performance tests. Root pnpm typecheck and pnpm lint passed; the latter reports two existing test warnings. The unrelated unchanged agent-core unreadable-directory fixture prevents claiming an all-repository test pass in this VM.

Final source-built browser → Studio server → corrected native → real PTY verification passed through a real filesystem symlink in 16.41 seconds. All 20 captured source hashes match 1b758499, and the actual Inspect/Resume/Continue POSTs carry the verified workspace pair. Continue creates one paused child and one seed; only explicit Send calls the loopback model. Resume retains the same Studio/native IDs. Explicit Terminal Start returns HTTP200 with one PTY and zero extra Assistant reads. End stops both selected engines while the sibling survives, and all five processes are absent after cleanup.

The final source was repackaged into the unsigned Linux desktop bundle; its smoke test passed 17 checks with one Windows-only agent-shim skip. This uses the default activation path separately from the corrected-candidate browser flow with loopback account/model fixtures. Production owner publication/activation, Windows accepted-source-store durability and signed installed E3 remain external gates. Exact-head Devin review reported no issues.

Browser evidence

Stale selection retains the Resume request Same operation paused after explicit re-selection
Workspace conflict preserves Retry Resume Saved Resume succeeds paused after history refresh

Continue preserves its saved request without a fresh-operation control. These are inspected disposable browser-fixture action states at 1b758499, with served bytes verified against the local SHA-256 manifest.

Tests and documentation

Added route/client/browser regressions and documented the workspace precondition and retry boundary in assistant-history.md. Increment: 441 changed lines including tests, docs and changeset. pnpm pr:size is absent in the SDK; measured the incremental Git diff.

Compatibility and release impact

  • Optional additive request metadata; legacy bodies remain accepted. Durable operation IDs, receipt fingerprints and source ownership are unchanged.
  • Changeset: @sapiom/harness patch.
  • Fix-forward: Preserve exact identity and saved-operation checks while correcting preflight or refreshed-selection handling; keep stale selection unavailable until it is refreshed.

Security

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

AI assistance

  • AI assistance used: Codex implemented and independently 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

@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: a2c7ce2a-a70d-451e-8f29-ccfdb49553de

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

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