Make agent suspend tests release on the suspend signal
The single- and multi-level suspend/restore tests gated their slow leaf tool on a manual release channel closed 50ms after cancel(). That sleep was a guess at how long the suspend signal takes to reach the running sub-agent, so the post-tool turn boundary could observe the release before cancellation and complete the run instead of checkpointing, making the assertions timing-dependent. Expose the per-run suspend signal through SuspendSignalFrom in an export_test shim and have the leaf tools block on it directly. The tool now returns only once the graceful-suspend signal has actually propagated to its agent, so suspension is observed deterministically without sleeps or release channels. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -109,9 +109,12 @@ func withSuspendableToolContext(ctx context.Context, tool Tool) (context.Context
|
||||
}
|
||||
|
||||
execCtx, cancel := context.WithCancelCause(ctx)
|
||||
stop := context.AfterFunc(signal, func() {
|
||||
cancel(context.Cause(signal))
|
||||
})
|
||||
stop := context.AfterFunc(
|
||||
signal,
|
||||
func() {
|
||||
cancel(context.Cause(signal))
|
||||
},
|
||||
)
|
||||
|
||||
return execCtx, func() {
|
||||
stop()
|
||||
|
||||
Reference in New Issue
Block a user