Skip to content

refactor(agents): Refine agent loading and skill processing logic - #698

Merged
haiphucnguyen merged 3 commits into
mainfrom
feature/update-agents-exeucution
Sep 6, 2026
Merged

haiphucnguyen merged 3 commits into
mainfrom
feature/update-agents-exeucution

Conversation

@haiphucnguyen

Copy link
Copy Markdown
Collaborator
  • Deprecates and removes Cursor agent support.
  • Introduces dedicated parser and testing for Codex stream JSON events.
  • Enhances agent streaming to prevent content loss by checking multiple event types.
  • Improves skill repository by adding folder name sanitization and limits.
  • Updates internal logging and test coverage across agents.

- Deprecates and removes Cursor agent support.
- Introduces dedicated parser and testing for Codex stream JSON events.
- Enhances agent streaming to prevent content loss by checking multiple event types.
- Improves skill repository by adding folder name sanitization and limits.
- Updates internal logging and test coverage across agents.
Copilot AI lite review requested due to automatic review settings September 5, 2026 20:05

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

There are confirmed correctness issues in the new skill rename-on-save logic (frontmatter name: detection and an unsafe edge case that could rename the skills root directory).

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

Pull request overview

This PR refactors external-agent integration by removing Cursor support, adding a dedicated Codex JSONL event parser + tests, and improving streaming/materialization behavior so agent output and tool activity are less likely to be dropped or silently ignored.

Changes:

  • Removed the Cursor external agent implementation and its stream-json parser.
  • Added CodexStreamJsonEventParser plus real-fixture tests, and updated CodexAgent to consume structured --json events (thread/turn/item lifecycle).
  • Improved skill folder handling and agent streaming: rename-on-save for skill.md folders, stronger materialization diagnostics, and more robust Antigravity streaming/tool-call surfacing.
File summaries
File Description
shared/src/test/kotlin/io/askimo/core/skills/CodexStreamJsonEventParserTest.kt Adds fixture-based tests for Codex --json JSONL event parsing.
shared/src/main/kotlin/io/askimo/core/agent/repository/SkillRepository.kt Adds rename-on-save logic to keep skill folder names aligned with frontmatter name: (with collision handling).
shared/src/main/kotlin/io/askimo/core/agent/ExternalAgentTemplate.kt Improves skill materialization logging/diagnostics and adds entrypoint presence warning.
shared/src/main/kotlin/io/askimo/core/agent/ExternalAgentLoader.kt Removes CursorAgent from the registered external agents list.
shared/src/main/kotlin/io/askimo/core/agent/CursorStreamJsonEventParser.kt Removes Cursor stream-json event parser (Cursor support deprecated).
shared/src/main/kotlin/io/askimo/core/agent/CursorAgent.kt Removes Cursor external agent implementation.
shared/src/main/kotlin/io/askimo/core/agent/CodexStreamJsonEventParser.kt Introduces a dedicated parser for Codex codex exec --json JSONL events.
shared/src/main/kotlin/io/askimo/core/agent/CodexAgent.kt Switches Codex execution to --json, updates arg ordering, and parses structured events for output/tool calls/usage/errors.
shared/src/main/kotlin/io/askimo/core/agent/AntigravityAgent.kt Avoids content loss by checking multiple response fields and routes tool-ish steps through onToolCall.
cli/src/test/kotlin/io/askimo/core/skills/SkillRepositoryTest.kt Adds/updates tests for the new rename-on-save folder behavior and updates delete test accordingly.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 3
  • 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 +435 to +437
if (targetFolderName != null && targetFolderName != currentFolderName) {
val resolvedName = resolveAvailableFolderName(currentFolder.parent, targetFolderName, currentFolderName)
if (resolvedName != null) {
Comment on lines +425 to +430
val hasExplicitName = content.contains(Regex("^name\\s*:", RegexOption.MULTILINE))
val parsedName = if (hasExplicitName) {
runCatching { SkillMarkdownParser.parse(content, normalizedRelativePath, absolute).name }.getOrNull()
} else {
null
}

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

The new rename-on-save logic in SkillRepository has edge cases that can trigger incorrect renames/collisions (blank name: and case-insensitive filesystem behavior).

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

Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Lite


// Never rename when the entry file sits directly under skillsDir() itself — there's
// no containing skill folder to rename, and currentFolder would be the skills root.
if (targetFolderName != null && targetFolderName != currentFolderName && currentFolder != root) {
Comment on lines +509 to +512
return lines.subList(1, closingIndex + 1).any { line ->
val colonIndex = line.indexOf(':')
colonIndex > 0 && line.substring(0, colonIndex).trim() == "name"
}

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.

🔵 Needs a closer look

The new rename-on-save collision suffix logic can violate the stated folder-name length cap when appending -2, -3, etc., which should be corrected before merging.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

shared/src/main/kotlin/io/askimo/core/agent/repository/SkillRepository.kt:481

  • MAX_FOLDER_NAME_LENGTH is enforced in sanitizeFolderName(), but resolveAvailableFolderName() appends -2, -3, ... without re-checking the length, so the final folder name can exceed the stated cap. Truncate the base name to leave room for the suffix before checking existence/returning the candidate.
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@haiphucnguyen
haiphucnguyen merged commit 10f03ec into main Sep 6, 2026
10 of 13 checks passed
@haiphucnguyen
haiphucnguyen deleted the feature/update-agents-exeucution branch September 6, 2026 00:09
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