Skip to content

fix: add polling comparison and close resume/watch gaps - #14

Merged
zhoushoujianwork merged 1 commit into
mainfrom
fix/issue-11-polling-eval
Oct 26, 2026
Merged

zhoushoujianwork merged 1 commit into
mainfrom
fix/issue-11-polling-eval

Conversation

@zhoushoujianwork

Copy link
Copy Markdown
Owner

Fixes #11

Follow-up to #13 (session reuse and watch -t already merged). This PR adds the missing acceptance evidence and fixes defects found while writing it.

Added

  • internal/cli/polling_eval_test.go: reproducible headless comparison of short status polling vs one long watch vs bounded watches for a fake long-running worker. Logs parent turns (one offload CLI call each), elapsed time, exit codes, and whether the outcome was seen. Also checks that failure, timeout and stall stay visible under a long watch. Run: go test ./internal/cli -run TestPollingCoordinationComparison -v
  • Tests for resume keeping profile and directory, resume with a missing directory, a resumed run holding its session from the start, and the live-state exit code.

Defects fixed

  1. Live state recorded exit_code=0 for failed and timed-out runs, because the state was published before the final exit code was set. status and watch therefore printed exit_code=0 for status=error/timeout. It is now published after the exit code is final.
  2. A resumed run did not register its session until the first stream event, so an immediate second offload -r on the same session was not refused. The resumed session is now published at start; later events no longer overwrite it with an empty value.
  3. A worker finishing between two bounded watches (after exit 124) was reported only as no active workers. The next watch now prints it as recently finished with status and exit code.
  4. Resume with a deleted session directory gave a bare not-a-directory error. It now says how to recover (restore the directory, or pass -d) and points to offload show.

Measured (sample run, 3s fake worker, timings scaled down)

  • short poll (status every 400ms): 10 parent turns
  • one long watch: 1 turn
  • bounded watches (-t 1s): 4 turns (124, 124, 124, 0)
    These count parent turns only. Parent and worker tokens (cached and noncached) and cost are not measured and remain unavailable. No token or cost saving is claimed; the fake worker is not a comparable baseline for real sessions.

Checks

gofmt, go vet ./..., go test -race ./... pass locally. Not covered: real Codex/Claude host completion notifications, and real model runs. Nothing here touches the desktop.

Note: the active-session check still relies on advisory live state files, so it narrows the overlap window rather than being a lock.

@zhoushoujianwork
zhoushoujianwork merged commit fda1b78 into main Oct 26, 2026
1 check passed
@zhoushoujianwork
zhoushoujianwork deleted the fix/issue-11-polling-eval branch October 26, 2026 06:07
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.

Reduce parent-model overhead through session reuse and quieter worker coordination

1 participant