fix(#2732): enhance notification for failed/crashed subagent tasks
- completedTaskSummaries now includes status and error info - notifyParentSession: noReply=false for failed tasks so parent reacts - Batch notification distinguishes successful vs failed/cancelled tasks - notification-template updated to show task errors - task-poller: session-gone tests (85 new lines) - CI: add Bun shim to PATH for legacy plugin migration tests
This commit is contained in:
@@ -10,12 +10,10 @@ describe("autoMigrateLegacyPluginEntry", () => {
|
||||
beforeEach(() => {
|
||||
testConfigDir = join(tmpdir(), `omo-legacy-migrate-${Date.now()}-${Math.random().toString(36).slice(2)}`)
|
||||
mkdirSync(testConfigDir, { recursive: true })
|
||||
process.env.OPENCODE_CONFIG_DIR = testConfigDir
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
rmSync(testConfigDir, { recursive: true, force: true })
|
||||
delete process.env.OPENCODE_CONFIG_DIR
|
||||
})
|
||||
|
||||
describe("#given opencode.json has a bare legacy plugin entry", () => {
|
||||
@@ -27,7 +25,7 @@ describe("autoMigrateLegacyPluginEntry", () => {
|
||||
)
|
||||
|
||||
// when
|
||||
const result = autoMigrateLegacyPluginEntry()
|
||||
const result = autoMigrateLegacyPluginEntry(testConfigDir)
|
||||
|
||||
// then
|
||||
expect(result.migrated).toBe(true)
|
||||
@@ -47,7 +45,7 @@ describe("autoMigrateLegacyPluginEntry", () => {
|
||||
)
|
||||
|
||||
// when
|
||||
const result = autoMigrateLegacyPluginEntry()
|
||||
const result = autoMigrateLegacyPluginEntry(testConfigDir)
|
||||
|
||||
// then
|
||||
expect(result.migrated).toBe(true)
|
||||
@@ -67,7 +65,7 @@ describe("autoMigrateLegacyPluginEntry", () => {
|
||||
)
|
||||
|
||||
// when
|
||||
const result = autoMigrateLegacyPluginEntry()
|
||||
const result = autoMigrateLegacyPluginEntry(testConfigDir)
|
||||
|
||||
// then
|
||||
expect(result.migrated).toBe(true)
|
||||
@@ -81,7 +79,7 @@ describe("autoMigrateLegacyPluginEntry", () => {
|
||||
// given - empty dir
|
||||
|
||||
// when
|
||||
const result = autoMigrateLegacyPluginEntry()
|
||||
const result = autoMigrateLegacyPluginEntry(testConfigDir)
|
||||
|
||||
// then
|
||||
expect(result.migrated).toBe(false)
|
||||
@@ -98,7 +96,7 @@ describe("autoMigrateLegacyPluginEntry", () => {
|
||||
)
|
||||
|
||||
// when
|
||||
const result = autoMigrateLegacyPluginEntry()
|
||||
const result = autoMigrateLegacyPluginEntry(testConfigDir)
|
||||
|
||||
// then
|
||||
expect(result.migrated).toBe(true)
|
||||
@@ -116,7 +114,7 @@ describe("autoMigrateLegacyPluginEntry", () => {
|
||||
writeFileSync(join(testConfigDir, "opencode.json"), original)
|
||||
|
||||
// when
|
||||
const result = autoMigrateLegacyPluginEntry()
|
||||
const result = autoMigrateLegacyPluginEntry(testConfigDir)
|
||||
|
||||
// then
|
||||
expect(result.migrated).toBe(false)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { existsSync, readFileSync, writeFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
|
||||
import { parseJsoncSafe } from "../../shared/jsonc-parser"
|
||||
import { getOpenCodeConfigPaths } from "../../shared/opencode-config-dir"
|
||||
@@ -31,15 +32,23 @@ function toLegacyCanonical(entry: string): string {
|
||||
return entry
|
||||
}
|
||||
|
||||
function detectOpenCodeConfigPath(): string | null {
|
||||
function detectOpenCodeConfigPath(overrideConfigDir?: string): string | null {
|
||||
if (overrideConfigDir) {
|
||||
const jsoncPath = join(overrideConfigDir, "opencode.jsonc")
|
||||
const jsonPath = join(overrideConfigDir, "opencode.json")
|
||||
if (existsSync(jsoncPath)) return jsoncPath
|
||||
if (existsSync(jsonPath)) return jsonPath
|
||||
return null
|
||||
}
|
||||
|
||||
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null })
|
||||
if (existsSync(paths.configJsonc)) return paths.configJsonc
|
||||
if (existsSync(paths.configJson)) return paths.configJson
|
||||
return null
|
||||
}
|
||||
|
||||
export function autoMigrateLegacyPluginEntry(): MigrationResult {
|
||||
const configPath = detectOpenCodeConfigPath()
|
||||
export function autoMigrateLegacyPluginEntry(overrideConfigDir?: string): MigrationResult {
|
||||
const configPath = detectOpenCodeConfigPath(overrideConfigDir)
|
||||
if (!configPath) return { migrated: false, from: null, to: null, configPath: null }
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user