|
Entropic 2.14.3
Local-first agentic inference engine
|
gh#158: the cancel token of the run executing on THIS thread. More...


Go to the source code of this file.
Classes | |
| class | entropic::RunCancelScope |
| RAII publication of one run's cancel token to its own thread. More... | |
| class | entropic::RunSessionScope |
| RAII publication of one run's session key to its own thread. More... | |
| class | entropic::RunStreamScope |
| RAII: publish a streaming run's sink to its own thread (gh#208). More... | |
Namespaces | |
| namespace | entropic |
| Activate model on GPU (WARM → ACTIVE). | |
Typedefs | |
| using | entropic::RunStreamFn = void(*)(const char *chunk, size_t len, void *user_data) |
| Signature of a run's stream-chunk sink (gh#208, v2.14.2). | |
Functions | |
| ENTROPIC_EXPORT const std::atomic< bool > * | entropic::current_run_cancel () |
| The cancel token of the run executing on this thread, if any. | |
| ENTROPIC_EXPORT bool | entropic::current_run_cancelled () |
| Whether THIS thread's run has been cancelled. | |
| ENTROPIC_EXPORT bool | entropic::cancel_current_run () |
| Cancel the run executing on this thread (gh#158). | |
| ENTROPIC_EXPORT std::string | entropic::current_run_session () |
| The session key of the run executing on this thread (gh#166). | |
| ENTROPIC_EXPORT bool | entropic::emit_to_current_run_stream (const char *chunk, size_t len) |
| Deliver a chunk to the stream sink published on THIS thread. | |
gh#158: the cancel token of the run executing on THIS thread.
cancel_flag_ that ServerManager::interrupt_external_tools() trips on EVERY transport at once. That is correct while a handle runs one turn at a time — the only in-flight tool call belongs to the only run. Once runs are keyed per session (gh#158) it stops being correct: interrupting session A would abort session B's in-flight filesystem.read too, and B would see an empty result it cannot distinguish from a legitimate one (the exact failure mode gh#150 was filed for).The honest fix is a cancel token carried by the REQUEST. Threading one through would change ToolExecutionInterface (a C function-pointer struct on the core↔facade seam), ServerManager::call_tool, ExternalClient and Transport::send_request — four signatures, three .so boundaries, for a value that is already unambiguous from context: a run is a BLOCKING call on the caller's thread, and every tool call it makes happens on that same thread. So the token is published per thread instead of per parameter.
This is the same mechanism entropic::log::HandleLogScope already uses to route a log line to the right session without threading a handle id through every logging call, and it is deliberately modelled on it.
Definition in file run_scope.h.