MCPcopy Index your code
hub / github.com/coder/coder / TouchStep

Method TouchStep

coderd/x/chatd/chatdebug/service.go:508–523  ·  view source on GitHub ↗

TouchStep bumps the step's and its parent run's updated_at timestamps without changing any other fields. This prevents long-running operations (e.g. streaming) from being prematurely swept by FinalizeStale, which first marks runs stale by chat_debug_runs.updated_at and then cascades to steps whose r

(
	ctx context.Context,
	stepID uuid.UUID,
	runID uuid.UUID,
	chatID uuid.UUID,
)

Source from the content-addressed store, hash-verified

506// first marks runs stale by chat_debug_runs.updated_at and then cascades
507// to steps whose run_id was just finalized.
508func (s *Service) TouchStep(
509 ctx context.Context,
510 stepID uuid.UUID,
511 runID uuid.UUID,
512 chatID uuid.UUID,
513) error {
514 // Atomically bump both the step and its parent run so
515 // FinalizeStale cannot interleave between the two touches.
516 return s.db.TouchChatDebugStepAndRun(chatdContext(ctx),
517 database.TouchChatDebugStepAndRunParams{
518 Now: s.clock.Now(),
519 StepID: stepID,
520 RunID: runID,
521 ChatID: chatID,
522 })
523}
524
525// DeleteByChatID deletes debug data for a chat and emits a delete event.
526// The startedBefore bound scopes deletion to runs created before that

Callers 1

launchHeartbeatFunction · 0.80

Calls 2

chatdContextFunction · 0.85

Tested by

no test coverage detected