Skip to content

test(sdk): make daemon-restart activity E2E wait for lease release #1386

Closed

Description

@jbeda

Bug description

The TypeScript SDK offline E2E test a daemon restart mid-watch resumes from the cursor across a new run is timing-sensitive at teardown. After restarting mecated, its cleanup calls Session.delete(), but the server sometimes rejects that call because the session lease is still owned by the earlier daemon:

server: session is leased by another process: "<session-id>"

The test therefore fails after its substantive restart/watch assertions, during cleanup.

Evidence

  • PR feat(mecatui): enable readline prompt navigation #1336 CI run 34554180036
  • Failing test: sdk/typescript/e2e/activity.e2e.test.ts — a daemon restart mid-watch resumes from the cursor across a new run
  • Failure path: SessionImpl.delete → e2e/activity.e2e.test.ts:96 → withDaemon teardown
  • The job's generated-contract freshness check, SDK build, and 28 other SDK E2E tests passed.

Expected behavior

The restart scenario should not attempt teardown until the old daemon's lease has been released, or until the restarted daemon has safely taken/reconciled lease ownership. The test must be deterministic rather than depending on process/lease timing.

Actual behavior

Teardown races lease release and gets FAILED_PRECONDITION / session_leased_elsewhere.

Scope

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions