nsmcp::QuestionService method continue (public)
<instance of nsmcp::QuestionService> continue context handle \ turn [ peerAddress ] [ automatic ]
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.
- automatic (optional, defaults to
"false")- Whether this is a server-guarded automatic continuation. Automatic and manual continuations have distinct public labels.
- 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" } if {![string is boolean -strict $automatic]} {error "Invalid automatic continuation flag"} if {$automatic} { if {![dict get [:jobWatch $record] ready]} { error "Retained results are not ready for automatic continuation" } # Claim each completed batch once under the question mutex. Two # tabs cannot queue the same automatic model round. send also # checks the expected turn, preventing a stale callback race. foreach job $jobs {dict set record automaticJobs $job 1} if {[string bytelength $record]>${:maxBytes}} {error "Conversation size limit reached"} nsv_set ${:store} $handle $record } 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 source [:originTurn $record $previous] set original [dict get $source question] set sourceTurn [dict get $source 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 original request. Retrieve these existing background jobs first with log_results. If they remain pending, report their retained handles promptly rather than repeatedly polling. Once they complete, perform any remaining analysis needed for the original request. A totals-only result is context, not a completed origins analysis. If origins were requested and not yet returned, start at most one bounded evidence job using the same exact status filters and timezone and explicit from/to within the original frozen window. Reuse an existing origin-evidence job instead of duplicating it. Keep full-period totals separate from evidence-window origin counts and qualify the evidence scope. Do not restart completed work, start duplicate scans or reinterpret relative times. If an existing job expired or failed, report that rather than silently replacing it.\nJob handles: [join $jobs {, }].\nOriginal request to finish: $excerpt" set label [expr {$automatic ? "Auto-continue the previous analysis." : "Continue the previous analysis."}] return [:send $context $label $handle {} {} $peerAddress $turn $question $sourceTurn]XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)