Skip to content

refactor: add agent run title and agent id to history - #696

Merged
haiphucnguyen merged 2 commits into
mainfrom
feature/improvements
Sep 5, 2026
Merged

haiphucnguyen merged 2 commits into
mainfrom
feature/improvements

Conversation

@haiphucnguyen

Copy link
Copy Markdown
Collaborator
  • Persist a human‑readable title with each new agent run and allow updating it later.
  • Add a non‑null agent_id column to the agent_run_history table for tracking which agent executed the run.
  • Update AgentRunRecord and repository to include the new fields.
  • Adjust chat session title generation to use TitleGenerator.fallbackTitle and normalize AI titles.
  • Introduce new UI components, styling helpers, and voice settings changes; add skill exporter logic.

Copilot AI lite review requested due to automatic review settings September 5, 2026 02:05
- Persist a human‑readable title with each new agent run and allow updating it later.
- Add a non‑null `agent_id` column to the `agent_run_history` table for tracking which agent executed the run.
- Update `AgentRunRecord` and repository to include the new fields.
- Adjust chat session title generation to use `TitleGenerator.fallbackTitle` and normalize AI titles.
- Introduce new UI components, styling helpers, and voice settings changes; add skill exporter logic.

BREAKING CHANGE: The `agent_run_history` table now has a required `agent_id` column and `AgentRunRecord` has been extended; existing data and migrations must be updated accordingly.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

It introduces upgrade/migration and data-handling issues (missing title migration/backfill) plus a new sensitive logging path that can leak prompts/user input into logs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR expands agent-run history tracking (persisting a per-conversation title and the executing agent id) and refactors related UI/state management so agentic runs can update titles in-place and restore the correct agent when reopening history. It also adds skill export, improves voice settings (auto-send/auto-play + OpenAI voice dropdown), and introduces a set of shared UI “surface tier” helpers to standardize styling across screens.

Changes:

  • Persist and live-update agent-run conversation titles; add agent readiness model and lock agent selection per conversation.
  • Add skill export-to-ZIP support and improve external agent skill materialization (copy/symlink) with collision-safe slugs + tests.
  • Enhance voice UX (auto-send transcript, auto-play responses, OpenAI voice dropdown) and unify UI surface styling via new theme helpers.
File summaries
File Description
shared/src/main/kotlin/io/askimo/core/event/internal/AgentRunTitleUpdatedEvent.kt New internal event to broadcast agent-run title changes to UI.
shared/src/main/kotlin/io/askimo/core/db/DatabaseManager.kt Adds title to agent_run_history schema and extends migrations.
shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt Adds voice settings flags + configurable OpenAI TTS voice list with parsing.
shared/src/main/kotlin/io/askimo/core/chat/TitleGenerator.kt New shared deterministic fallback title generator.
shared/src/main/kotlin/io/askimo/core/chat/service/ChatSessionService.kt Normalizes/caps AI-generated chat session titles before persisting.
shared/src/main/kotlin/io/askimo/core/chat/repository/ChatSessionRepository.kt Reuses shared TitleGenerator fallback title logic.
shared/src/main/kotlin/io/askimo/core/agent/SkillExporter.kt New ZIP exporter for skills directory.
shared/src/main/kotlin/io/askimo/core/agent/repository/AgentRunHistoryRepository.kt Persists/reads new title + agent_id and adds bulk title update helper.
shared/src/main/kotlin/io/askimo/core/agent/ExternalAgentTemplate.kt Adds reusable skill materialization helpers and improves diagnostics.
shared/src/main/kotlin/io/askimo/core/agent/ExternalAgentLoader.kt Uses agent readiness instead of boolean availability.
shared/src/main/kotlin/io/askimo/core/agent/ExternalAgent.kt Introduces AgentReadiness and native skill discovery capability flag.
shared/src/main/kotlin/io/askimo/core/agent/domain/SkillDefinition.kt Adds collision-safe, sanitized slug for materialization targets.
shared/src/main/kotlin/io/askimo/core/agent/domain/AgentRunRecord.kt Adds title + agentId fields and table columns.
shared/src/main/kotlin/io/askimo/core/agent/CodexAgent.kt Implements native skill materialization for Codex and marks discovery support.
shared/src/main/kotlin/io/askimo/core/agent/ClaudeAgent.kt Switches to shared folder-materialization helper and marks discovery support.
shared/src/main/kotlin/io/askimo/core/agent/AntigravityAgent.kt Adds skill materialization via symlink and adjusts resume flag handling.
desktop/src/main/kotlin/io/askimo/desktop/settings/VoiceSettingsSection.kt Adds voice toggles, OpenAI voice dropdown, and section grouping in settings UI.
desktop-shared/src/main/resources/i18n/messages.properties Adds strings for skill export, voice toggles, history UI, and agent lock messaging.
desktop-shared/src/main/resources/i18n/messages_zh_TW.properties Localizes new agent/voice/export strings (zh_TW).
desktop-shared/src/main/resources/i18n/messages_zh_CN.properties Localizes new agent/voice/export strings (zh_CN).
desktop-shared/src/main/resources/i18n/messages_vi_VN.properties Localizes new agent/voice/export strings (vi_VN).
desktop-shared/src/main/resources/i18n/messages_pt_BR.properties Localizes new agent/voice/export strings (pt_BR).
desktop-shared/src/main/resources/i18n/messages_ko_KR.properties Localizes new agent/voice/export strings (ko_KR).
desktop-shared/src/main/resources/i18n/messages_ja_JP.properties Localizes new agent/voice/export strings (ja_JP).
desktop-shared/src/main/resources/i18n/messages_fr.properties Localizes new agent/voice/export strings (fr).
desktop-shared/src/main/resources/i18n/messages_es.properties Localizes new agent/voice/export strings (es).
desktop-shared/src/main/resources/i18n/messages_de.properties Localizes new agent/voice/export strings (de).
desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/PiperTextToSpeechService.kt Routes Piper TTS through shared JDK HTTP client builder.
desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/OpenAiTextToSpeechService.kt New OpenAI TTS implementation using shared HTTP client builder.
desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/OpenAiSpeechToTextService.kt New OpenAI Whisper STT implementation using shared HTTP client builder.
desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/LocalWhisperSpeechToTextService.kt Routes local whisper STT through shared JDK HTTP client builder.
desktop-shared/src/main/kotlin/io/askimo/ui/shell/NavigationSidebar.kt Uses contrast-safe sidebar header colors and surface tier helpers.
desktop-shared/src/main/kotlin/io/askimo/ui/shell/GlobalSearchDialog.kt Updates card styling to use standard surface tier.
desktop-shared/src/main/kotlin/io/askimo/ui/settings/AppearanceSettingsSection.kt Adjusts selected accent preset colors.
desktop-shared/src/main/kotlin/io/askimo/ui/settings/AgentsSettingsSection.kt Adds “export all skills” UI + uses surface tier styling.
desktop-shared/src/main/kotlin/io/askimo/ui/session/SessionsView.kt Uses surface tiers for header/hover styling.
desktop-shared/src/main/kotlin/io/askimo/ui/plan/PlanDetailView.kt Uses surface tiers for panels and emphasis sections.
desktop-shared/src/main/kotlin/io/askimo/ui/onboarding/OnboardingWizardDialog.kt Updates onboarding card backgrounds to surface tiers.
desktop-shared/src/main/kotlin/io/askimo/ui/mcp/McpToolsDialog.kt Updates banner card colors.
desktop-shared/src/main/kotlin/io/askimo/ui/mcp/AddMcpInstanceDialog.kt Uses surface tiers for inline cards.
desktop-shared/src/main/kotlin/io/askimo/ui/discover/DiscoverView.kt Uses surface tiers and transparent backgrounds for hover states.
desktop-shared/src/main/kotlin/io/askimo/ui/common/theme/AppComponents.kt Introduces standardized “surface tiers” and sidebar tint/content helpers.
desktop-shared/src/main/kotlin/io/askimo/ui/chat/OutdatedMessageComponents.kt Uses surface tier helpers for branch notice background.
desktop-shared/src/main/kotlin/io/askimo/ui/chat/MessageComponents.kt Adds auto-play voice responses when a streamed AI message completes.
desktop-shared/src/main/kotlin/io/askimo/ui/chat/ChatInputField.kt Adds auto-send transcript option + improves waveform sampling behavior and UI.
desktop-shared/src/main/kotlin/io/askimo/ui/agent/WorkspaceFilesPanel.kt Improves workspace switcher tooltips + uses surface tiers for selection/emphasis.
desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentView.kt Refactors agent view to use a ViewModel and simplifies side panel behavior.
desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentsViewModel.kt New view model for workspace + run history loading + title event patching.
desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentRunViewModel.kt New view model owning agentic run execution, history persistence, and title generation.
desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentRunArea.kt Refactors agentic run UI to use view model + shows history list in empty state.
desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentHistoryPanel.kt Updates history list presentation and adds “Show all” behavior.
cli/src/test/kotlin/io/askimo/core/skills/SkillDefinitionSlugTest.kt Adds unit tests for slug generation rules.
cli/src/test/kotlin/io/askimo/core/skills/ExternalAgentTemplateMaterializeSkillTest.kt Adds tests for folder/symlink materialization correctness and cleanup.
cli/src/test/kotlin/io/askimo/core/agent/repository/AgentRunHistoryRepositoryIT.kt Updates integration tests for new title field + title bulk update behavior.
Review details

Suppressed comments (1)

desktop/src/main/kotlin/io/askimo/desktop/settings/VoiceSettingsSection.kt:572

  • contentDescription is hardcoded as "Change voice" which is not localized and may be redundant for screen readers (the selected value + label already convey the control). Prefer null for a purely decorative icon, or use a localized string resource.
                    Icon(
                        Icons.Default.Edit,
                        contentDescription = "Change voice",
                        tint = AppTextStyles.primaryContent,
                    )
  • Files reviewed: 41/41 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 333 to 335
val cmd = buildCommand(agentPath, systemPrompt, userInput, effectiveWorkDir, resumeSessionId)
log.debug("{} command: {}", name, cmd.joinToString(" "))
val processBuilder = ProcessBuilderExt(*cmd.toTypedArray()).apply {
Comment on lines 756 to 760
try {
stmt.executeUpdate("ALTER TABLE agent_run_history ADD COLUMN content_json TEXT")
} catch (_: Exception) {
// Column already exists — safe to ignore.
}
Comment on lines +598 to +601
Text(
text = viewModel.selectedAgent?.name ?: stringResource("agents.view.no.agent"),
style = AppTextStyles.hint,
)
Comment on lines 90 to 93
val response = text("response").default("")
val error = text("error").nullable()
val agentId = varchar("agent_id", 64).nullable()
val agentSessionId = text("agent_session_id").nullable()
@haiphucnguyen
haiphucnguyen merged commit 436e996 into main Sep 5, 2026
8 of 10 checks passed
@haiphucnguyen
haiphucnguyen deleted the feature/improvements branch September 5, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants