Skip to content

fix(agent-core-v2): tolerate unresolvable bound model in media registrar refresh - #19

Merged
zicochaos merged 1 commit into
mainfrom
fix/media-registrar-unresolvable-model
Jul 29, 2026
Merged

fix(agent-core-v2): tolerate unresolvable bound model in media registrar refresh#19
zicochaos merged 1 commit into
mainfrom
fix/media-registrar-unresolvable-model

Conversation

@zicochaos

Copy link
Copy Markdown
Owner

Problem

Issue #18 — left over from #16: Agent tool description > renders global tool restrictions in subagent type descriptions (and any session where the bound model alias stops resolving) produced:

[unexpected] Error2: Model "mock-model" is not configured in config.toml.
    at ConfigBackedModelCatalog.getRequester (kosong/model/catalogService.ts:161)
    at AgentMediaToolsRegistrar.refresh (agent/media/mediaToolsRegistrar.ts:102)

AgentMediaToolsRegistrar.refresh runs inside the agent.status.updated listener and called modelCatalog.getRequester(alias) unconditionally. When the bound alias fails to resolve — config edited mid-session, or a stub catalog in tests — the throw happened inside an Emitter listener and was reported as [unexpected]. Tests still passed, so it was pure noise masking real regressions.

What changed

  • mediaToolsRegistrar.ts: refresh() now mirrors profileService.tryResolveRawModel — on resolution failure it falls back to no requester (media tools still register, just without a video uploader) instead of throwing inside the listener.
  • read-media.test.ts: new case pinning the behavior — binding an unresolvable alias reports no unexpected error and still registers ReadMediaFile. Verified it fails without the fix and passes with it.

Verification

  • agent-core-v2: 4231 passed (incl. the new regression test); tool.test.ts 94/94 with zero stderr noise
  • oxlint clean on touched files, lint:domain OK, tsc --noEmit clean

Closes #18.

…rar refresh

AgentMediaToolsRegistrar.refresh ran inside the agent.status.updated
listener and called modelCatalog.getRequester unconditionally, so a
bound alias that no longer resolves (config edited mid-session, stub
catalogs in tests) threw inside the listener and surfaced as an
[unexpected] stderr trace. Mirror profileService.tryResolveRawModel:
fall back to no requester — media tools still register, without an
uploader — instead of crashing the listener.

Closes #18
@zicochaos
zicochaos merged commit 928413e into main Jul 29, 2026
13 of 14 checks passed
@zicochaos
zicochaos deleted the fix/media-registrar-unresolvable-model branch July 30, 2026 12:40
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.

agent-core-v2 tool.test.ts: stray stderr from requester resolution with unconfigured model

1 participant