Skip to content

[Task] Consolidate abort action diagnostics helper #557

@Astro-Han

Description

@Astro-Han

Goal

Consolidate repeated session.action.abort diagnostic emission into a small shared helper without changing abort behavior or losing caller-specific session ID semantics.

When this is done, abort diagnostics should still record the same payload shape (source, mode, result, plus route / visible / timeline session IDs), but the shared construction / emission code should live in one place so future diagnostic field changes do not need to be repeated across multiple callers.

Scope

In scope:

  • Add a shared helper for session.action.abort diagnostic payload construction / emission.
  • Update the existing abort diagnostic call sites to use the helper:
    • packages/app/src/components/prompt-input/submit.ts
    • packages/app/src/pages/session.tsx
    • packages/app/src/pages/session/use-session-commands.tsx
  • Preserve each caller's existing session ID semantics. The helper should accept explicit route / visible / timeline IDs; it should not guess or fall back silently.
  • Preserve the existing diagnostic data fields: source, mode, and result.
  • Preserve PR fix(server, app): split abort into soft/hard modes; preserve pending question on soft (closes #553) #556 soft / hard abort behavior exactly.

Out of scope:

  • Do not change which user actions are soft or hard aborts.
  • Do not change question lifecycle, question continuation, blocker cleanup, or server abort semantics.
  • Do not change undo / revert / auto-heal product behavior.
  • Do not add UI copy or render fallbacks.
  • Do not broaden this into a general diagnostics refactor.

Relevant files or context

Follow-up from PR #556 Gemini review thread:

Current caller-specific ID semantics to preserve:

  • submit.ts emits for the active visible session used by prompt submission / stop actions.
  • session.tsx can distinguish route session from timeline session for revert and auto-heal paths.
  • use-session-commands.tsx undo currently operates on params.id; if this behavior is changed, it should be justified separately rather than hidden inside the helper extraction.

Gemini's point is valid tech debt: the diagnostic emission shape is duplicated, and a helper would reduce drift risk. It was deferred from #556 because #556 was a user-facing abort semantics fix, while this is observability cleanup.

Verification

  • Run bun --cwd packages/app typecheck.
  • Run targeted app tests that cover prompt submit / abort behavior, at minimum:
    • bun --cwd packages/app test src/components/prompt-input/submit.test.ts --preload ./happydom.ts
  • Run or update any targeted tests for the extracted helper if it is placed behind a testable utility boundary.
  • Run git diff --check.
  • Confirm diagnostics still emit session.action.abort with source, mode, and result from all migrated call sites.
  • Confirm no behavior change to PR fix(server, app): split abort into soft/hard modes; preserve pending question on soft (closes #553) #556's soft/hard abort mapping.

Execution mode

Agent can implement directly

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priorityappApplication behavior and product flowstaskNarrow execution, audit, spike, migration, tracking, or upstream follow-up worktech-debtSupplemental cleanup, maintainability, architecture, test, or quality debt context

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions