You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(core): tool-execute callable-namespace test expects pretty JSON, Code Mode results are intentionally compact #65
But Code Mode result formatting is deliberately compact:
// packages/core/src/codemode/tool.ts:325-328// Compact like native tool results: indentation costs context on every call and models read compact JSON as well.functionformatValue(value: CodeMode.DataValue){if(typeofvalue==="string")returnvaluereturnJSON.stringify(value)??String(value)}
That compact choice matches the native tool path (packages/core/src/tool/runtime.ts:270stringify also uses plain JSON.stringify(value)) and the sibling test in the same file, "canonical execution distinguishes declared, model-only, and raw schema outputs", which expects compact '{"value":"encoded"}'.
The pretty-printed expectation at :155 is the sole outlier — both it and formatValue landed in the same commit (1fc489d878), contradicting each other from the start. The callable-namespace behaviour itself (metadata toolCalls for slack.admin + slack.admin.create) passes; only the text formatting assertion fails.
Reproduction (verified this run, unmodified main)
cd packages/core && bun test test/tool-execute.test.ts
# 5 pass / 1 fail
# (fail) execute supports callable namespace tools
# expected text: '[\n "admin",\n "created"\n]'
# received text: '["admin","created"]'
# at tool-execute.test.ts:155:26
This failure was first noted as an unnamed pre-existing cluster in #52's CI notes ("tool-execute 'execute supports callable namespace tools' — verified failing identically on unmodified main locally, 5 pass/1 fail"); it had no issue of its own until now.
Why it matters
A permanently red test in @opencode/core trains everyone to ignore unit (linux) failures and masks real regressions in the Code Mode callable-namespace path — the exact feature this test exists to pin (a namespace that is itself callable and also has child tools).
Acceptance criteria
bun test test/tool-execute.test.ts in packages/core passes 6/6 on main.
The fix aligns the outlier expectation with the intentional compact formatting (test fix), OR — if maintainers instead want pretty-printed Code Mode results — changes formatValue deliberately, updates its comment, and justifies the extra context cost against the native-tool precedent. Do not leave the two sides contradicting each other.
No production behaviour changes unless the second route is explicitly chosen; the toolCalls metadata assertion stays as-is.
Activity