Skip to content

Simplify suspend/resume examples#140

Merged
myzie merged 1 commit intomainfrom
simplify-suspend-examples
Apr 12, 2026
Merged

Simplify suspend/resume examples#140
myzie merged 1 commit intomainfrom
simplify-suspend-examples

Conversation

@myzie
Copy link
Copy Markdown
Collaborator

@myzie myzie commented Apr 12, 2026

Summary

  • Rewrite human_approval and async_webhook examples to use the suspend/resume API directly, without the shared dialogspec abstraction
  • Remove stateless and partial_resume examples that overlapped with async_webhook
  • Delete the dialogspec package (no longer needed)
  • Net result: ~470 lines removed, ~170 lines remain across two focused examples

Test plan

  • Both examples compile (go build ./suspend/human_approval, go build ./suspend/async_webhook)
  • Run human_approval end-to-end and confirm terminal dialog appears
  • Run async_webhook suspend then resume and confirm session persistence works

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Simplified suspend/resume example implementations by removing the dialog specification abstraction pattern and using direct prompt strings instead.
    • Removed partial resumption and stateless session examples to focus on core suspend/resume workflows.

Remove dialogspec package and stateless/partial_resume examples that
added indirection and overlap. Rewrite human_approval and async_webhook
to use the suspend/resume API directly, cutting ~470 lines down to ~170.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c50f7dab-600e-483c-ad42-33116b3f797d

📥 Commits

Reviewing files that changed from the base of the PR and between 8c3f3b2 and 961838d.

📒 Files selected for processing (5)
  • examples/suspend/async_webhook/main.go
  • examples/suspend/dialogspec/dialogspec.go
  • examples/suspend/human_approval/main.go
  • examples/suspend/partial_resume/main.go
  • examples/suspend/stateless/main.go
💤 Files with no reviewable changes (3)
  • examples/suspend/partial_resume/main.go
  • examples/suspend/stateless/main.go
  • examples/suspend/dialogspec/dialogspec.go

📝 Walkthrough

Walkthrough

The pull request removes the dialogspec module and two example programs (partial_resume, stateless) that demonstrated suspend/resume patterns, while updating remaining examples to use simplified direct prompt strings instead of structured dialog specifications. This eliminates the serialized dialog spec convention and reduces example complexity.

Changes

Cohort / File(s) Summary
Dialogspec Module Removal
examples/suspend/dialogspec/dialogspec.go
Deleted entire package containing exported types (Kind, Spec, Option), constants (KindConfirm, KindSelect, etc.), and functions (NewSuspend, FromPending, ToDialogInput) that previously managed structured dialog metadata in suspend results.
Example Updates
examples/suspend/async_webhook/main.go, examples/suspend/human_approval/main.go
Removed dialogspec dependency and replaced structured dialog specifications with direct prompt strings. Updated suspend tool implementations to use simplified pending messages and removed webhook notifier hook logic; streamlined tool-result text and error messages.
Example Removals
examples/suspend/partial_resume/main.go, examples/suspend/stateless/main.go
Deleted two complete example programs: partial_resume (demonstrated iterative resumption of multiple pending tool calls with dialog-based acknowledgment) and stateless (demonstrated suspend/resume without using a Session, with caller-managed JSON state persistence).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 The dialogspec hops away,
Examples fade to simpler days,
Suspend flows clean, no schemas deep—
Just prompts and dreams for agents to keep! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: simplifying suspend/resume examples by removing shared abstractions (dialogspec) and consolidating overlapping examples.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch simplify-suspend-examples

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

@myzie myzie merged commit 7c0cdd2 into main Apr 12, 2026
2 checks passed
@myzie myzie deleted the simplify-suspend-examples branch April 12, 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.

1 participant