nsmcp::QuestionService method continue (public)

 <instance of nsmcp::QuestionService[i]> continue context handle \
    turn [ peerAddress ]

Defined in /usr/local/ns/tcl/nsmcp/question-service.tcl

Resume an owned conversation from its retained continuation state. Derive the job and window from server-owned state and recheck ownership and turn validity before queuing work.

Parameters:
context (required)
Authenticated request context carrying the principal, grants and selected server.
handle (required)
Retained job or conversation handle; ownership and expiry checks still apply.
turn (required)
Retained turn identifier, used to reject superseded callbacks.
peerAddress (optional)
Direct connection peer supplied by the authenticated HTTP adapter.
Returns:
The rooted JSON conversation status returned by send.

Testcases:
No testcase defined.
Source code:
# Derive handles from owned server state; the browser cannot substitute
# another job or change its original time window. send rechecks the turn
# under its queue lock, so a stale button cannot resume an older turn.
ns_mutex lock ${:mutex}
try {
    set record [:owned $context $handle]
    if {$turn eq "" || [dict get $record current] ne $turn} {
        error "The conversation has moved on; refresh its status before continuing"
    }
    set jobs [:continuationJobs $record]
    if {$jobs eq {}} {
        error "No retained background jobs are available to continue"
    }
    set original [dict get [lindex [dict get $record turns] end] question]
    set sourceTurn $turn
    foreach previous [dict get $record turns] {
        set found false
        foreach job $jobs {
            if {[dict exists $previous jobs $job]} {
                set found true
                break
            }
        }
        if {$found} {
            set original [dict get $previous question]
            set sourceTurn [dict get $previous id]
            break
        }
    }
} finally {
    ns_mutex unlock ${:mutex}
}
set excerpt [string range $original 0 1023]
if {[string length $original]>1024} {
    append excerpt " (original question excerpt)"
}
set question "Continue the retained analysis and finish the answer. Retrieve only these existing background jobs with log_results; keep polling them if needed. Do not start duplicate scans or reinterpret relative times: use the jobs' original fixed time windows. If a job has expired or failed, report that rather than starting a replacement.\nJob handles: [join $jobs {, }].\nOriginal request (context only): $excerpt"
return [:send $context {Continue the previous analysis.} $handle {} {} $peerAddress $turn $question $sourceTurn]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: