Skip to content

fix: split snapshot handler helpers and preserve wait cleanup semantics - #249

Merged
thymikee merged 3 commits into
mainfrom
codex/issue-158-snapshot-helpers
Mar 22, 2026
Merged

thymikee merged 3 commits into
mainfrom
codex/issue-158-snapshot-helpers

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

Refactor the snapshot handler into focused helper modules for capture, wait, session, alert, and settings flows.
Preserve sessionless wait <duration> behavior by bypassing runner cleanup on the sleep path and add regression coverage for it.
Reuse shared snapshot normalization and session construction helpers to reduce duplicated logic while keeping command behavior unchanged.

Closes #158.

Validation

  • node --test src/daemon/handlers/__tests__/snapshot.test.ts src/daemon/handlers/__tests__/snapshot-handler.test.ts
  • Attempted but blocked in this worktree because dependencies are not installed: pnpm format, pnpm typecheck, pnpm test:unit, pnpm test:smoke

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1ca5eeac6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

},
};
}
const { session, device } = await resolveSessionDevice(sessionStore, sessionName, req.flags);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate settings args before resolving target device

Calling resolveSessionDevice before handleSettingsCommand changes the settings error path: when the user passes invalid/missing args without an existing session, the command now tries device discovery first and can fail with DEVICE_NOT_FOUND instead of returning the expected INVALID_ARGS usage message. This is a regression from prior behavior and is reproducible in environments without connected simulators/devices (it also breaks the existing settings usage hint test).

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-249/

Built to branch gh-pages at 2026-03-22 19:00 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@thymikee
thymikee merged commit f90eea2 into main Mar 22, 2026
6 of 7 checks passed
@thymikee
thymikee deleted the codex/issue-158-snapshot-helpers branch March 22, 2026 19:17
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.

Refactor snapshot handler into capture/wait/session helpers

1 participant