mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 12:03:27 +00:00
fix: address review issues and add processes documentation
- Fix unstable onExit callback in ProcessesTab (useCallback) - Fix SSE follow stream race condition (subscribe before history read) - Update inspector.mdx with new process management features - Change observability icon to avoid conflict with processes - Add docs/processes.mdx covering the full process management API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6dbc871db9
commit
be32cf04a2
6 changed files with 296 additions and 9 deletions
|
|
@ -1494,12 +1494,15 @@ async fn get_v1_process_logs(
|
|||
since,
|
||||
};
|
||||
|
||||
let entries = runtime.logs(&id, filter).await?;
|
||||
let response_entries: Vec<ProcessLogEntry> =
|
||||
entries.iter().cloned().map(map_process_log_line).collect();
|
||||
|
||||
if query.follow.unwrap_or(false) {
|
||||
// Subscribe before reading history to avoid losing entries between the
|
||||
// two operations. Entries are deduplicated by sequence number below.
|
||||
let rx = runtime.subscribe_logs(&id).await?;
|
||||
let entries = runtime.logs(&id, filter).await?;
|
||||
let response_entries: Vec<ProcessLogEntry> =
|
||||
entries.iter().cloned().map(map_process_log_line).collect();
|
||||
let last_replay_seq = response_entries.last().map(|e| e.sequence).unwrap_or(0);
|
||||
|
||||
let replay_stream = stream::iter(response_entries.into_iter().map(|entry| {
|
||||
Ok::<axum::response::sse::Event, Infallible>(
|
||||
axum::response::sse::Event::default()
|
||||
|
|
@ -1515,6 +1518,9 @@ async fn get_v1_process_logs(
|
|||
async move {
|
||||
match item {
|
||||
Ok(line) => {
|
||||
if line.sequence <= last_replay_seq {
|
||||
return None;
|
||||
}
|
||||
let entry = map_process_log_line(line);
|
||||
if process_log_matches(&entry, requested_stream_copy) {
|
||||
Some(Ok(axum::response::sse::Event::default()
|
||||
|
|
@ -1539,6 +1545,10 @@ async fn get_v1_process_logs(
|
|||
return Ok(response.into_response());
|
||||
}
|
||||
|
||||
let entries = runtime.logs(&id, filter).await?;
|
||||
let response_entries: Vec<ProcessLogEntry> =
|
||||
entries.iter().cloned().map(map_process_log_line).collect();
|
||||
|
||||
Ok(Json(ProcessLogsResponse {
|
||||
process_id: id,
|
||||
stream: requested_stream,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue