Skip to content

fix(shell-ball): listen for runtime task notifications#369

Merged
MeteorsLiu merged 2 commits into
1024XEngineer:mainfrom
gdemonc:issue-327-shell-ball-runtime-subscriptions
Apr 29, 2026
Merged

fix(shell-ball): listen for runtime task notifications#369
MeteorsLiu merged 2 commits into
1024XEngineer:mainfrom
gdemonc:issue-327-shell-ball-runtime-subscriptions

Conversation

@gdemonc

@gdemonc gdemonc commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Part of 任务:前端未完成部分 #327
  • Subscribe shell-ball to active-task runtime notifications so task.steered and selected loop.* events can surface in the floating bubble flow
  • Keep runtime notifications observation-only in shell-ball: formal visual state still follows task.updated, while task.steered, loop.retrying, and loop.failed render as lightweight local status bubbles
  • Update shell-ball contract coverage to reflect the new runtime subscription and message mapping behavior

Changes

  • Add active task runtime subscription in apps/desktop/src/features/shell-ball/useShellBallCoordinator.ts
  • Add lightweight runtime message mapping for:
    • task.steered
    • loop.retrying
    • loop.failed
  • Deduplicate runtime observation bubbles per task/event
  • Extend shell-ball contract tests and subscription stubs for subscribeTaskRuntime(...)

Testing

  • pnpm --dir apps/desktop typecheck
  • pnpm --dir apps/desktop lint
  • node -r ./scripts/registerShellBallTestAliases.cjs --test --test-name-pattern "runtime observation helper|coordinator subscribes to formal task, approval, and runtime updates" .cache/shell-ball-tests/features/shell-ball/shellBall.contract.test.js
  • go test ./services/local-service/internal/rpc -run "HandleStreamConn(EmitsLoopLifecycleNotifications|FiltersRuntimeNotificationsToRequestTask)"
  • go test ./services/local-service/internal/rpc -run "HandleStreamConnStreamsLoopLifecycleNotificationsBeforeResponseForSubmitInput"
  • go test ./services/local-service/internal/runengine -run "(EmitRuntimeNotificationPersistsLoopStopReason|ContinueTaskMergesContinuationStateAndDrainsSteeringMessages)"
  • go test ./services/local-service/internal/orchestrator -run "TaskSteerPersistsFollowUpMessage"

Notes

  • This change does not alter backend or protocol behavior
  • Full pnpm --dir apps/desktop test:shell-ball still has unrelated pre-existing baseline failures, so validation here uses targeted contract coverage plus backend notification tests

@fennoai fennoai 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.

1 finding from the review passes.

Comment thread apps/desktop/src/features/shell-ball/useShellBallCoordinator.ts Outdated
@codecov

codecov Bot commented Apr 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gdemonc

gdemonc commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator Author

@xgopilot 解决你提到的问题

@fennoai

fennoai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Result

Fixed the race I called out in review by changing shell-ball runtime observation handling from per-task late subscription to a global runtime subscription with task-scoped buffering and replay.

What Changed

  • Added subscribeAllTaskRuntime(...) in apps/desktop/src/rpc/subscriptions.ts and kept subscribeTaskRuntime(...) as the filtered wrapper for task-detail consumers.
  • Updated apps/desktop/src/features/shell-ball/useShellBallCoordinator.ts to queue task.steered / loop.* notifications that arrive before the submit response registers the formal task_id, then replay them once the task is bound locally.
  • Extended apps/desktop/src/features/shell-ball/shellBall.contract.test.ts with a runtime-race contract case and updated subscription stubs in apps/desktop/src/features/shell-ball/test-stubs/rpcSubscriptions.ts.

Validation

  • Passed: git diff --check
  • Not run: pnpm --dir apps/desktop typecheck
  • Not run: pnpm --dir apps/desktop lint
  • Not run: shell-ball contract test command from the PR description

The desktop workspace in this runner does not have pnpm/corepack or installed node_modules, and .cache/shell-ball-tests/... had not been generated, so I could not execute the requested local checks here.

Git

View job run

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: gdemonc <146809967+gdemonc@users.noreply.github.com>
@gdemonc

gdemonc commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator Author

@xgopilot 还有什么问题

@fennoai

fennoai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Review

No additional issues found in the updated patch.

I re-checked the change against origin/main...HEAD, including the new subscribeAllTaskRuntime(...) path in apps/desktop/src/rpc/subscriptions.ts and the task-scoped runtime queue/replay flow in apps/desktop/src/features/shell-ball/useShellBallCoordinator.ts. The earlier race around runtime notifications arriving before local task registration is addressed by the global subscription plus per-task_id buffering, and I did not find another behavioral regression in the changed code.

I did not rerun the desktop checks in this runner.

View job run

@gdemonc gdemonc requested review from MeteorsLiu and liche719 April 28, 2026 13:00
@MeteorsLiu MeteorsLiu merged commit 5c20922 into 1024XEngineer:main Apr 29, 2026
3 checks passed
@gdemonc gdemonc deleted the issue-327-shell-ball-runtime-subscriptions branch May 17, 2026 07:23
@gdemonc gdemonc restored the issue-327-shell-ball-runtime-subscriptions branch May 17, 2026 07:24
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.

4 participants