Skip to content

fix(desktop): skip archived session queries - #4431

Open
Phoenix500526 wants to merge 3 commits into
apache:mainfrom
Phoenix500526:fix/skip-archived-session-queries
Open

fix(desktop): skip archived session queries#4431
Phoenix500526 wants to merge 3 commits into
apache:mainfrom
Phoenix500526:fix/skip-archived-session-queries

Conversation

@Phoenix500526

Copy link
Copy Markdown
Contributor

Summary

Prevent archived sessions from remaining automatic query targets by:

  • excluding archived sessions from bootstrap selection
  • pausing automatic Skills and Plan refreshes while archive or delete actions are pending

This reuses the existing pending row-action state, so renderer cleanup still happens only after the Runtime Host confirms the operation.

Fixes #4430

Verification

  • npm --workspace @maka/desktop run build:main — passed
  • npm --workspace @maka/desktop run typecheck — passed
  • npm run check:app-shell-hooks — passed
  • npm --workspace @maka/desktop run check:architecture — passed (60 tests)
  • Biome check on the changed TypeScript files — passed
  • Relevant Desktop regression suites — passed (16 tests)

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope:

OpenAI Codex assisted with diagnosis, implementation, regression tests, and code review.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/M Under 500 readable lines label Sep 1, 2026
@Phoenix500526

Copy link
Copy Markdown
Contributor Author

@Astro-Han This PR fixes a concrete bug, and AppShell is currently the only composition point that holds both the authoritative archived state and the pending Archive/Delete state, so keeping the small query gate there is the simplest owner-correct fix. The monotonic token ratchet blocks even this composition-only change; moving it into a new helper or controller would add indirection and could make ownership worse, so what path did you intend for legitimate bug fixes that need small AppShell wiring without gaming the metric?

@Phoenix500526
Phoenix500526 force-pushed the fix/skip-archived-session-queries branch from 8f1760f to 2dbcff1 Compare September 1, 2026 05:56
@Phoenix500526

Phoenix500526 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Hi, @chihumyum This PR currently fails the AppShell architecture ratchet because a narrow bug fix adds query-gate wiring at the composition point. Given the migration tracked in #3439 and the guardrail introduced by #4088, should we hold this fix until the Conversation/AppShell ownership work provides its intended home, or is there an accepted way to land this small wiring now without mechanically moving it elsewhere just to satisfy the ledger?

@chihumyum

Copy link
Copy Markdown
Contributor

Hi, @chihumyum This PR currently fails the AppShell architecture ratchet because a narrow bug fix adds query-gate wiring at the composition point. Given the migration tracked in #3439 and the guardrail introduced by #4088, should we hold this fix until the Conversation/AppShell ownership work provides its intended home, or is there an accepted way to land this small wiring now without mechanically moving it elsewhere just to satisfy the ledger?

Thanks for raising this. Please do not hold the bug fix until the full Conversation/AppShell migration, and please do not raise the AppShell token baseline.
The ratchet failure is intentional here: deriving archived || pending archive/delete in AppShell introduces automatic-query eligibility policy, rather than composition-only wiring. AppShell being the current rendezvous point for both facts reflects the existing integration knot; it does not make AppShell their final owner.
The bounded path I intended is to put this behind the existing Session catalog/lifecycle authority (session-catalog-state.ts, eventually application/session). That authority should own the archived catalog fact plus scoped Archive/Delete query-block leases. Session Navigation should acquire a lease for the full revision family around the actual Host mutation, while Skills and Plan consume a narrow stable isAutomaticQueryBlocked contract. AppShell should only forward that contract and should lose its pending Set/predicate, so its recorded debt does not grow.
Please also cover revision-family IDs, release on failure/cancellation, refresh after unblocking, and requests already in flight. The bootstrap archived-session filtering can remain as-is.
You are right that the guardrail documentation should state this bug-fix path explicitly; I’ll clarify that separately.

@Phoenix500526
Phoenix500526 force-pushed the fix/skip-archived-session-queries branch from 2dbcff1 to e1f0530 Compare September 1, 2026 09:55
@Phoenix500526

Copy link
Copy Markdown
Contributor Author

Hi, @chihumyum This PR currently fails the AppShell architecture ratchet because a narrow bug fix adds query-gate wiring at the composition point. Given the migration tracked in #3439 and the guardrail introduced by #4088, should we hold this fix until the Conversation/AppShell ownership work provides its intended home, or is there an accepted way to land this small wiring now without mechanically moving it elsewhere just to satisfy the ledger?

Thanks for raising this. Please do not hold the bug fix until the full Conversation/AppShell migration, and please do not raise the AppShell token baseline. The ratchet failure is intentional here: deriving archived || pending archive/delete in AppShell introduces automatic-query eligibility policy, rather than composition-only wiring. AppShell being the current rendezvous point for both facts reflects the existing integration knot; it does not make AppShell their final owner. The bounded path I intended is to put this behind the existing Session catalog/lifecycle authority (session-catalog-state.ts, eventually application/session). That authority should own the archived catalog fact plus scoped Archive/Delete query-block leases. Session Navigation should acquire a lease for the full revision family around the actual Host mutation, while Skills and Plan consume a narrow stable isAutomaticQueryBlocked contract. AppShell should only forward that contract and should lose its pending Set/predicate, so its recorded debt does not grow. Please also cover revision-family IDs, release on failure/cancellation, refresh after unblocking, and requests already in flight. The bootstrap archived-session filtering can remain as-is. You are right that the guardrail documentation should state this bug-fix path explicitly; I’ll clarify that separately.

Done

Automatic Skills and Plan refreshes could reach the Runtime Host after a
session entered archival, producing avoidable session errors.

CLOSES apache#4430

Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
Generated-by: OpenAI Codex
@Phoenix500526
Phoenix500526 force-pushed the fix/skip-archived-session-queries branch from e1f0530 to ff532da Compare September 3, 2026 01:39
The E2E could leave the viewport before anchoring a text
selection, so scrolling succeeded while the selection stayed empty.
Wait for the composer and anchor within the rendered line first.

Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
Generated-by: OpenAI Codex
The scroll E2E recurred because moving to zero was treated as the
request even though a settled scroller cannot move farther. Dispatching
the upward wheel matches the production trigger and removes timing
dependence on a scroll event.

Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
Generated-by: OpenAI Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(desktop): archived sessions can remain selected and trigger Skills and Plan queries

2 participants