Skip to content

fix(mobile): keep idle agent conversations available - #22646

Closed
vesanieminen wants to merge 2 commits into
stablyai:mainfrom
vesanieminen:vesanieminen/Fix-idle-session-with-mobile-chat-view
Closed

vesanieminen wants to merge 2 commits into
stablyai:mainfrom
vesanieminen:vesanieminen/Fix-idle-session-with-mobile-chat-view

Conversation

@vesanieminen

Copy link
Copy Markdown

ELI5

Mobile chat can go blank when Codex finishes a reply, and the Chat option can disappear for an idle session. Keep the saved conversation address available while the agent is idle.

What Changed

The host's mobile status builder no longer discards a known provider session solely because the terminal has a non-agent title. Its identity-only fallback also includes the saved provider name when no launch or live ownership hint remains, so mobile can still recognize a supported chat session. Existing activity and permission checks remain in place.

Why

Conversation identity lasts longer than an active turn. Reusing the execution host's retained identity avoids mobile-side caching, title guessing, or a Linux-only process scan. This also covers restored rows that already contain an identity; it does not recover identities that were never saved.

Linked Issue

Related to #20408.

Visual Proof

Pending before/after mobile capture; kept as a draft. The reporter confirmed that idle chat works with a local 1.4.210 bundle patch addressing these publication failures. That patch also had additional recovery logic, so this is not a claim of device validation for this exact source change.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Linux, Node 24: five targeted suites pass (46 tests), covering idle publication, restored identity, pane isolation, identity removal, existing hook status, title truthfulness, and pending permissions. The new regression suite fails six of eight cases against the original builder and passes all eight with the fix.

pnpm tc:node and pnpm run check:code-quality:changed pass. Full build, full suite, macOS, Windows, and live SSH/device validation remain for CI or follow-up testing.

AI Disclosure

Prepared with OpenAI Codex (GPT-6).

Review

The publication retains the existing agentStatus.agentType and providerSession fields; there are no new wire fields, opcodes, or client requirements. Older mobile clients already consume these fields while an agent is active. The execution host remains the identity authority, and folder workspaces use the same path.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No platform-specific process access or filesystem lookup is added. The running local patched installation was not modified.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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

Important

The transcript-retention bypass is wider than the guard it sits next to: it also lets a pane whose PTY status is still working/permission skip the early return, and the final projection then republishes that non-idle state under a non-agent title. That re-enables the stuck-spinner class (#1437) the nonAgentTitle branch exists to clear. Reproduced through the real projection path (details inline). The new test passes with the fix but only because it uses null for the PTY status.

Reviewed changes

  • Idle transcript retention — buildRuntimeMobileAgentStatus no longer returns an empty status under a non-agent title when a providerSession is known, so headless serve keeps the saved conversation addressable after the turn ends.
  • Agent-type fallback — the identity-only final projection fills agentType from the saved provider-session row (hookRow.providerSessionAgentType) when no launch hint or live owner remains, which is what resolveMobileNativeChat needs.
  • Regression tests — new runtime-mobile-idle-chat.test.ts pins idle publication, restored identity, pane isolation, identity removal, hook status, title truthfulness, and pending permissions.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 717c0e97-a900-4dfa-b3f5-900dc9e6c061

📥 Commits

Reviewing files that changed from the base of the PR and between ad85e55 and 89bb44e.

📒 Files selected for processing (2)
  • src/main/runtime/runtime-mobile-agent-status-builder.ts
  • src/main/runtime/runtime-mobile-idle-chat.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/runtime/runtime-mobile-agent-status-builder.ts
  • src/main/runtime/runtime-mobile-idle-chat.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The fallback agent-status builder now sets the state to done for non-agent titles. For agent titles, it continues to derive the fallback state from the PTY status. When no owner agent is available, it uses the hook row’s provider-session agent type. New tests cover idle chat identity persistence, restoration, shell reclaim, and conditions that prevent or remove published identity.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 89bb4

Idle conversations remain identifiable without showing stale activity. No actionable merge-blocking issue was established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the mobile behavior fix: keeping idle agent conversations available.
Description check ✅ Passed The description covers the user impact, implementation, rationale, linked issue, testing, compatibility, and scope. Visual proof and full validation remain pending, but the description explains these …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 69390c25-a931-4bd7-a174-751e11e07310

📥 Commits

Reviewing files that changed from the base of the PR and between 122b8c2 and ad85e55.

📒 Files selected for processing (2)
  • src/main/runtime/runtime-mobile-agent-status-builder.ts
  • src/main/runtime/runtime-mobile-idle-chat.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

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

✅ No new issues found.

Reviewed changes

This run re-reviewed the delta since the prior pullfrog review (ad85e55): one follow-up commit (89bb44e) tightening the idle-transcript publication.

  • Non-agent title now publishes done — the identity-only final projection forces state: 'done' under a non-agent title before deriving state from pty.lastAgentStatus, closing the hole where the new bypass could republish working/blocked and revive the #1437 stuck spinner.
  • Regression test widened — the shell-pane case parameterizes over null | 'working' | 'permission' and asserts done for each, so the guard is actually pinned.
  • Rename case added — renaming a working terminal to a non-agent title now asserts the activity retires while the transcript address survives.

Both prior pullfrog threads (the builder bypass and the test case) were addressed and resolved. src/main/runtime/runtime-mobile-idle-chat.test.ts passes 12/12 locally.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@vesanieminen

Copy link
Copy Markdown
Author

Possibly related: #22505

@nwparker

Copy link
Copy Markdown
Contributor

Closing as superseded on main by #31460, #31428, #33302, and #33306, which preserve idle Claude/Codex mobile chat rows across neutral titles, manual renames, cold restores (restoredUnconfirmed), and hook clocks in runtime-mobile-agent-status-builder.ts without marking cold-restored plain shells as active chats. Thank you @vesanieminen!

@nwparker nwparker closed this Nov 11, 2026
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.

2 participants