Repository navigation
refactor(core): Enhance stability and refactor core logic and database access - #702
Merged
Merged
Conversation
…e access - Improve database concurrency by enabling WAL mode and setting busy timeouts. - Correct agent timeline rendering to properly handle streaming and tool retry loops. - Refactor ViewModel lifecycle management to consistently use `viewModelScope`. - Update agent classes to handle detailed errors and status markers more gracefully. - Apply various UI and style refinements across chat and desktop views.
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness issues affecting concurrency/finalization in agent run streaming state, and a .gitignore pattern that breaks ignore-glob parsers (e.g. ripgrep).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors core streaming/timeline logic and database access to improve stability under concurrency, while also tightening ViewModel lifecycle cancellation and refining several desktop UI interactions.
Changes:
- Enable SQLite WAL + busy timeout via JDBC properties to reduce
SQLITE_BUSYunder concurrent writers. - Fix/strengthen timeline rendering for streaming + tool retry loops, including stable Compose keys and improved tool-group behavior.
- Refactor desktop ViewModel coroutine ownership to ensure cached/evicted ViewModels cancel all of their work deterministically; plus assorted UI polish (selection, styling, history readability).
File summaries
| File | Description |
|---|---|
| shared/src/main/kotlin/io/askimo/core/db/SQLiteDataSourceFactory.kt | Removes the standalone SQLite DataSource factory (consolidating creation elsewhere). |
| shared/src/main/kotlin/io/askimo/core/db/DatabaseManager.kt | Adds WAL/busy-timeout/synchronous settings via SQLite JDBC config properties. |
| shared/src/main/kotlin/io/askimo/core/db/AbstractSQLiteRepository.kt | Reuses a lazily connected Exposed Database instance for transactions. |
| shared/src/main/kotlin/io/askimo/core/chat/dto/TurnTimelineEntry.kt | Refines “effective tool call” collapsing to keep successful calls and preserve final failures. |
| shared/src/main/kotlin/io/askimo/core/agent/CodexAgent.kt | Stops emitting lifecycle-only status rows to the user. |
| shared/src/main/kotlin/io/askimo/core/agent/ClaudeAgent.kt | Stops emitting lifecycle-only init/result status rows; keeps usage extraction. |
| shared/src/main/kotlin/io/askimo/core/agent/AntigravityAgent.kt | Improves tool-call parsing and error propagation from result events. |
| desktop/src/main/kotlin/io/askimo/desktop/settings/VoiceSettingsSection.kt | Uses theme surface color for selector cards. |
| desktop/src/main/kotlin/io/askimo/desktop/project/ProjectView.kt | Makes project title/identifiers selectable for easier copying. |
| desktop-shared/src/test/kotlin/io/askimo/ui/chat/TurnTimelineGroupRenderKeyTest.kt | Adds regression tests for stable render keys during streaming. |
| desktop-shared/src/main/kotlin/io/askimo/ui/shell/EventLogPanel.kt | Refactors compact event rows (selection + surface styling). |
| desktop-shared/src/main/kotlin/io/askimo/ui/common/theme/AppColors.kt | Adjusts outlined text-field container color behavior. |
| desktop-shared/src/main/kotlin/io/askimo/ui/chat/MessageComponents.kt | Improves tool timeline rendering (stable keys, auto-collapse, capped scrolling list). |
| desktop-shared/src/main/kotlin/io/askimo/ui/chat/ChatViewModel.kt | Introduces a ViewModel-owned scope and cancels it in cleanup to prevent leaks. |
| desktop-shared/src/main/kotlin/io/askimo/ui/chat/ChatView.kt | Makes session title selectable in the header. |
| desktop-shared/src/main/kotlin/io/askimo/ui/chat/ChatMessageList.kt | Updates day separator label to include time. |
| desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentRunViewModel.kt | Adds mutex + turn-id invalidation to prevent concurrent/stale timeline writes during streaming/cancel. |
| desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentRunArea.kt | Passes isStreaming=true for live agent timeline; improves history list readability. |
| desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentHistoryPanel.kt | Displays agent name in run history rows/tooltips. |
| cli/src/test/kotlin/io/askimo/core/chat/dto/TurnTimelineEntryCollapsedEffectiveToolsTest.kt | Expands regression coverage for the new “effective tool” collapse behavior. |
| .gitignore | Adds .agents ignore entry. |
Review details
- Files reviewed: 20/21 changed files
- Comments generated: 1
- 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
541
to
+545
| onToken = { token -> | ||
| currentTurnResponse += token | ||
| scope.launch { | ||
| isWaitingForFirstEvent = false | ||
| timeline = timeline + TurnTimelineEntry.Token(token) | ||
| appendTimelineEntry(turnId, TurnTimelineEntry.Token(token)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
viewModelScope.