Skip to content

fix(gateway): keep engine threads out of chat sidebar - #2751

Merged
serrrfirat merged 3 commits into
stagingfrom
fix/chat-hide-engine-rows
Apr 20, 2026
Merged

serrrfirat merged 3 commits into
stagingfrom
fix/chat-hide-engine-rows

Conversation

@serrrfirat

Copy link
Copy Markdown
Collaborator

Summary

  • stop merging engine v2 threads into /api/chat/threads
  • keep the chat sidebar scoped to persisted chat conversations so normal prompts no longer show up as ENGINE rows
  • preserve explicit engine-thread history access and update regression coverage accordingly

Testing

  • CARGO_TARGET_DIR=/Users/firatsertgoz/Documents/ironclaw/target cargo test --lib test_chat_threads_handler_hides_engine_threads_from_sidebar --features libsql
  • CARGO_TARGET_DIR=/Users/firatsertgoz/Documents/ironclaw/target cargo test --lib test_chat_history_returns_engine_v2_messages_for_owner --features libsql
  • python3 -m py_compile tests/e2e/scenarios/test_v2_thread_visibility.py

Notes

  • I attempted to run the updated E2E scenario, but the local env is missing aiohttp, so I left the scenario updated and syntax-checked only.

@github-actions github-actions Bot added scope: channel/web Web gateway channel size: M 50-199 changed lines risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels Apr 20, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request removes the logic that merged engine v2 threads into the chat sidebar, ensuring that internal execution threads are not surfaced as standalone conversations. The changes include updated unit and E2E tests to verify that engine threads are hidden from the sidebar while remaining accessible via direct history lookups. A review comment suggests optimizing session lock handling by capturing the active_thread during an earlier lock period to avoid redundant acquisition.

// ordinary prompts look like standalone `engine` threads.
// Explicit engine-thread history still works via
// `chat_history_handler` when the caller already has a thread id.
let active_thread = session.lock().await.active_thread;

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.

medium

The session lock is acquired here to retrieve active_thread, but it was already locked and then dropped earlier in the same function (lines 657-663). While the drop was necessary to avoid holding the lock across the asynchronous database call at line 679, you could capture active_thread during the first lock period to avoid the redundant second lock acquisition.

@serrrfirat
serrrfirat merged commit 904e378 into staging Apr 20, 2026
17 checks passed
@serrrfirat
serrrfirat deleted the fix/chat-hide-engine-rows branch April 20, 2026 18:38
ilblackdragon added a commit that referenced this pull request Apr 23, 2026
Two pre-existing staging-merge regressions in the coding-flow e2e suite:

1. Assistant thread now intentionally returns `project: None` (#2751),
   so after `project_set_active` the chrome still showed "No project".
   `refreshCurrentThread` now mirrors the backend `resolve_thread_project`
   precedence — per-thread override → active pointer → none — and fetches
   the active-project pointer when the thread has no override. Makes the
   home/assistant thread surface the user's currently-selected coding
   project instead of appearing disconnected.

2. `currentThreadId` was module-scoped and not reachable from Playwright.
   Expose a read-only `window.currentThreadId` getter so scenarios can
   observe thread binding without postMessage wiring.

3. `test_shell_mode_rejects_when_no_project` asserted a 409 contract
   that was deliberately retired in 0323ead (shell mode now falls back
   to the per-user `default` project). Renamed to
   `test_shell_mode_falls_back_to_default_project` and flipped the
   assertion to 202 so the new contract is pinned; the security
   invariant (shell runs against a project cwd, not the gateway's)
   is still covered by `test_shell_mode_roundtrip_persists_across_reload`.

All 7 scenarios in `test_coding_project_flow.py` pass; `test_project_detail`
still passes alongside.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
theredspoon pushed a commit to theredspoon/ironclaw that referenced this pull request Jun 21, 2026
* fix(gateway): keep engine threads out of chat sidebar

* fix: address review findings (iteration 1)

* fix: address review findings (iteration 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: channel/web Web gateway channel size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant