Skip to content

OpenCode sessions can fail to reopen when session lookup exceeds its 2-second budget #699

Done

Description

@itdove

Bug Description

What happened: A user reports that reopening an existing OpenCode session associated with a managed worktree can stop at Checking for existing OpenCode session... with:

Cannot safely resume OpenCode: OpenCode session query timed out within its time budget. No replacement conversation was launched.

The report followed closing the linked ticket. The failure is consistent with the project-scoped opencode session list --format json query exceeding DAF's current 2-second OpenCode query budget. The budget includes version detection and session listing. The fail-closed behavior correctly avoids replacing the native session ID or launching a different conversation.

Ticket closure or the worktree may be relevant context, but the error alone does not prove either caused the timeout: the session identity check happens before the issue-status transition.

Expected behavior: A valid existing OpenCode session should be resumable when session listing is merely slow, while keeping the query bounded and preserving fail-closed identity checks when ownership cannot be verified.

Steps to reproduce:

  1. Configure OpenCode and create a development session using a managed worktree.
  2. Close the linked ticket.
  3. Later run daf open <session-name>.
  4. If the project-scoped OpenCode session listing takes longer than the current 2-second budget, observe that DAF refuses to resume the session.

Environment: DAF, OpenCode, and OS versions were not included in the report.

Acceptance Criteria

  • Slow but successful OpenCode session lookups can complete within a bounded, appropriate budget (for example, through a retry or configurable timeout).
  • A failed, timed-out, or ambiguous lookup never overwrites a saved native session ID or launches a replacement conversation.
  • Timeout guidance provides a clear recovery path for resuming the verified session in its recorded project/worktree.
  • Regression tests cover a slow existing-session lookup and verify that final failure preserves session identity and metadata.

Activity

  1. self-assigned this
    on Nov 22, 2026
  2. itdove commented on Nov 22, 2026

    @itdove
    OwnerAuthor

    Implemented issue #699. OpenCode fallback capture and saved-ID reopen verification now use a bounded 10-second query budget. Timeout or failed/ambiguous checks preserve the saved identity and metadata and refuse replacement launches; recovery guidance identifies the recorded project/worktree and verified-ID update/reopen steps. Regression coverage includes a >2-second successful reopen and timeout metadata preservation. Validation: 121 focused tests passed, mypy passed, and the isolated integration suite passed 19/19.

  3. itdove commented on Nov 22, 2026

    @itdove
    OwnerAuthor

    Pull request created: #700

  4. itdove commented on Nov 22, 2026

    @itdove
    OwnerAuthor

    ✅ Session Complete

    Project: devaiflow
    Goal: #699: OpenCode sessions can fail to reopen when session lookup exceeds its 2-second budget
    Time Spent:
    1h 25m total

    • itdove: 1h 24m
    • unknown: 0h 0m
      Branch: 699

    No significant activity detected in this session.

    Session Notes:

    Session Notes: itdove-devaiflow-699

    JIRA: #699

    2026-11-22 11:00

    Generated by DevAIFlow

  5. reopened this on Nov 24, 2026
  6. itdove commented on Nov 24, 2026

    @itdove
    OwnerAuthor

    ✅ Session Complete

    Project: devaiflow
    Goal: #699: OpenCode sessions can fail to reopen when session lookup exceeds its 2-second budget
    Time Spent:
    1h 32m total

    • itdove: 1h 32m
    • unknown: 0h 0m
      Branch: 699

    No significant activity detected in this session.

    Session Notes:

    Session Notes: itdove-devaiflow-699

    JIRA: #699

    2026-11-22 11:00

    2026-11-23 19:33

    Generated by DevAIFlow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions