Skip to content

Commit 044ef82

Browse files
Propagate context.abort to SDK calls in lifecycle tools
read_session_messages and post_session_message make network calls to the SDK but were not forwarding the abort signal. Without this, requests continue running after the invoking session is aborted, causing wasted work. Pipeline code already follows this pattern (signal: entry.abort.signal).
1 parent 5b59399 commit 044ef82

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/opentower/src/tools/lifecycle.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,11 @@ Updated: ${entity.updated_at}`
182182
.optional()
183183
.describe("Maximum number of messages to return. Defaults to 20"),
184184
},
185-
async execute(args) {
185+
async execute(args, context) {
186186
const result = await client.session.messages({
187187
path: { id: args.session_id },
188188
query: { limit: args.limit ?? 20 },
189+
signal: context.abort,
189190
})
190191

191192
if (result.error) {
@@ -243,13 +244,14 @@ IMPORTANT: Before calling this tool, you MUST:
243244
.optional()
244245
.describe("Override the agent handling the message"),
245246
},
246-
async execute(args) {
247+
async execute(args, context) {
247248
const result = await client.session.prompt({
248249
path: { id: args.session_id },
249250
body: {
250251
parts: [{ type: "text", text: args.message }],
251252
...(args.agent ? { agent: args.agent } : {}),
252253
},
254+
signal: context.abort,
253255
})
254256

255257
if (result.error) {

0 commit comments

Comments
 (0)