Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/opencode/src/altimate/observability/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ export class Tracer {
this.snapshotPromise = fs.mkdir(this.snapshotDir, { recursive: true })
.then(() => fs.writeFile(tmpPath, JSON.stringify(trace, null, 2)))
.then(() => fs.rename(tmpPath, filePath))
.catch(() => {
.catch((err) => {
console.debug(`[tracing] failed to write trace snapshot: ${err}`)
fs.unlink(tmpPath).catch(() => {})
})
.finally(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/src/altimate/observability/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ tagsHtml += '<span class="tag">Provider: <strong>' + e(t.metadata.providerId ||
tagsHtml += '<span class="tag">Model: <strong>' + e(model) + '</strong></span>';
tagsHtml += '<span class="tag">Agent: <strong>' + e(t.metadata.agent || 'default') + '</strong></span>';
var stColor = t.summary.status === 'error' || t.summary.status === 'crashed' ? 'var(--red)' : t.summary.status === 'running' ? 'var(--orange)' : 'var(--green)';
tagsHtml += '<span class="tag" style="border-color:' + stColor + '">Status: <strong style="color:' + stColor + '">' + (t.summary.status || 'unknown') + '</strong></span>';
tagsHtml += '<span class="tag" style="border-color:' + stColor + '">Status: <strong style="color:' + stColor + '">' + e(t.summary.status || 'unknown') + '</strong></span>';
${live ? "tagsHtml += '<span class=\"live-badge\"><span class=\"live-dot\"></span>LIVE</span>';" : ""}
document.getElementById('tags').innerHTML = tagsHtml;

Expand Down
8 changes: 8 additions & 0 deletions packages/opencode/src/cli/cmd/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ export const TraceCommand = cmd({
// User can open manually
}

// Graceful shutdown on interrupt
const shutdown = () => {
server.stop()
process.exit(0)
}
process.on("SIGINT", shutdown)
process.on("SIGTERM", shutdown)

// Keep server alive until interrupted
await new Promise(() => {})
}
Expand Down
Loading