Skip to content

Background work: scripts and job-owned subagents from background jobs - #196

Merged
jlongster merged 4 commits into
devfrom
background-jobs-pill
Nov 20, 2026
Merged

jlongster merged 4 commits into
devfrom
background-jobs-pill

Conversation

@jlongster

Copy link
Copy Markdown
Contributor

Ports the desktop activity pill's background-job behavior (anomalyco/opencode#64790) to the background-work capsule.

  • One GET /api/experimental/job?sessionID&descendants=true&status=running on open/switch, resume and reconnect; then experimental.job.updated events. No polling.
  • The session's own running codemode jobs show as "N scripts" with a row (first line of the script or the job id, elapsed) and Stop → POST /api/experimental/job/:id/cancel.
  • A subagent stays listed while its session runs or any running job is owned in its subtree (a subagent job counts for its childSessionID). Its new Stop interrupts it if running and cancels every running job in its tree.
  • Image/video jobs only keep their subagent listed.

Draft: not built or run on a device here (no JDK/Android SDK on the box); CI runs scripts/check.sh. Strings translated with scripts/translate.py.

jlongster and others added 4 commits November 19, 2026 18:53
… jobs

User decisions:
- Port the desktop activity pill's background-job behavior to Android
User decisions:
- Fix the failing Android unit tests on the pill port
Always report the jobs list, reapply job updates that race it, cancel the
read on leave, stop rows concurrently with feedback, scope job updates to the
screen's family, seed pushed subagents, desktop section order, TalkBack Stop
on script rows, parity notes and tests. Not built locally; CI runs check.

User decisions:
- Fix the review findings on the Android pill port
From anomalyco/opencode-ios#355 (dec2b938, e1518739, 4fcdc9cb, f9beb70c):
- With only scripts running the capsule shows the plain busy orb, as the
  desktop's chip does; script rows keep </>.
- A script's first line truncates at its end; shells keep middle truncation.
- Move to Background lists jobs too, so a moved script shows at once.
- A job is kept when its owner or the session that started it is in the tree.
- Switch snapshots keep their tree's jobs through job.updated and restore them.
- A family pick clears pending Stops; an empty jobID never names a script.
- Tests: a settle missed while the stream was down is gone after the
  reconnect's re-list; events during that list win over its stale answer.

Verified: :feature:session and :feature:drawer JVM unit tests pass (1383),
except 9 Robolectric native tests that can't load on this musl box.
@jlongster
jlongster marked this pull request as ready for review November 20, 2026 18:11
@jlongster
jlongster merged commit 4c1e005 into dev Nov 20, 2026
2 checks passed
@jlongster
jlongster deleted the background-jobs-pill branch November 20, 2026 20:04
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