fix: work in flight hangs after the app is suspended in the background
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with SSHKeepAlive.ping() in packages/dartssh2/lib/src/ssh_keepalive.dart: add a timeout and close the client on failure so later pings still run. Then bound the cancel paths — collectSshExecOutput in lib/core/utils/ssh_exec.dart (await commandDone) and _terminateAiCommandSession in lib/view/page/ssh/page/ask_ai.dart. In fl_pi_llm's runtime.dart add a stream stall watchdog and a resume check; wrap in-flight iOS runs in beginBackgroundTask. Done when a connection killed during suspension ends within the short wait instead of hanging.
Written by the indexing model from the issue text.
Description
A run or connection that is in flight when the app is suspended in the background can hang after resume, and nothing ends it.
SSH
-
SSHKeepAlive(packages/dartssh2/lib/src/ssh_keepalive.dart):ping()has no timeout and a failure never closes the client. One unanswered ping stops every later keepalive, so a silently dead connection (NAT/server dropped it while suspended) is never detected. - Cancel paths wait on
session.donewith no limit:collectSshExecOutput(lib/core/utils/ssh_exec.dart,await commandDone) and_terminateAiCommandSession(lib/view/page/ssh/page/ask_ai.dart). On a dead connection neither the 5-minute tool timeout nor Stop ends an Agent tool call. Fall back to closing the channel/client after a short wait. -
ServerNotifierkeeps a client whose status read timed out and marks it connected;ensureShellClient/ensureExecreuse it. Nothing checksstate.clienton resume (terminal tabs reconnect, but they own separate clients).
Agent (fl_pi_llm)
- LLM HTTP streams have no stall timeout (
runtime.dart, defaultHttpClient, body read with no watchdog). - No lifecycle handling: a run suspended mid-request or mid-tool is not checked on resume.
iOS
- No
beginBackgroundTaskaround an in-flight transfer.UIBackgroundModesdeclaresfetchwith no handler (removed). - No
beginBackgroundTaskaround an in-flight Agent run: needs fl_pi_llm to say whether any chat is running (InFlightWorkTODO).
Related: a run cut off by the process being killed was left holding its session ("Lane "main" already has an active operation"); fixed in fl_pi_llm. Android Agent runs keep the foreground service up in a separate change.
Done in #1705 (lollipopkit/dartssh2#26). The rest is fl_pi_llm.
- Dominant language
- Dart
- Stars
- 8.9k
- Forks
- 573
- Avg merge
- 2h 11m
- Merged PRs (30d)
- 134
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lollipopkit/flutter_server_box
-
优化建议Openenhancement feature
Difficulty 4/5 3-5 days Newbie friendliness 30/100
lollipopkit/flutter_server_box#1829 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
feature
Difficulty 4/5 3-5 days Newbie friendliness 45/100
lollipopkit/flutter_server_box#1827 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
lollipopkit/flutter_server_box#1808 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 36/100
lollipopkit/flutter_server_box#1798 · 6 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
bug invalid
Difficulty 3/5 1-2 days Newbie friendliness 35/100
lollipopkit/flutter_server_box#1784 · 12 comments · 2 reactions ·
Maintainers usually reply within 1 day
All issues in lollipopkit/flutter_server_box
Similar issues
-
bot-found bug priority: P3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
madenvel/KalinkaPlayer#498 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libnativeapi/nativeapi#21 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
chriskelly/wish-together#102 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
TomBursch/kitchenowl#1188 ·
Maintainers usually reply within 2 days
-
area/adaptivity kind/task priority/p1
Difficulty 2/5 1-3 hours Newbie friendliness 85/100