From bc99dfba1898123ea824de98a2d5a06e996ed667 Mon Sep 17 00:00:00 2001 From: Agando Date: Fri, 23 Oct 2026 20:59:29 +0200 Subject: fix(newos4): outboxResult scoped, markdown mime, old reply path retired (v4.6.81) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit delegateTask declared `const outboxResult` inside the AI branch and returned it outside, so a delegation with the AI module missing threw 'outboxResult is not defined'. The catch turned that into _handleAgentFailure: the worker stayed idle with no result while spawn_agent reported ok — the reported symptom exactly. Now function-scoped, and the no-module path returns 'queued — AI module not loaded, nothing executed' rather than claiming 'completed'. Also: nginx served _docs/*.md as application/octet-stream (no .md type) — now text/markdown + nosniff; agent-replies.php returns 410 for GET as well as POST, so there is one reply path. Verified: with the AI module deleted at runtime, delegateTask returns the queued string and throws nothing. --- api/debug/agent-replies.php | 59 +++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 40 deletions(-) (limited to 'api/debug') diff --git a/api/debug/agent-replies.php b/api/debug/agent-replies.php index 2d2e2b2..b996a29 100644 --- a/api/debug/agent-replies.php +++ b/api/debug/agent-replies.php @@ -1,45 +1,24 @@ ($r['created_at'] ?? '') > $since)); - } - json_response(['success' => true, 'replies' => array_slice($all, -100)]); -} - -if ($method !== 'POST') { - error_response('Method not allowed', 405); -} - -// v4.6.71: retired. Two write paths meant two truths — messages written here never -// reached the chat thread, so they looked like a conversation nobody answered. -// One write path now: /api/chat/post.php (contract: _docs/chat-contract.md). http_response_code(410); -header('Content-Type: application/json'); +header('Content-Type: application/json; charset=utf-8'); echo json_encode([ - 'success' => false, - 'code' => 'gone', - 'error' => 'POST /api/debug/agent-replies.php is retired', - 'use' => '/spaces/newos4/api/chat/post.php', - 'contract'=> '/spaces/newos4/_docs/chat-contract.md', - 'read' => '/spaces/newos4/api/chat/poll.php', -]); -exit; + 'success' => false, + 'code' => 'gone', + 'error' => 'agent-replies.php is retired — the chat channel replaced it', + 'use' => '/spaces/newos4/api/chat/post.php and /api/chat/poll.php', + 'contract' => '/spaces/newos4/_docs/chat-contract.md', + 'host' => 'python3 /var/www/webx11.duckdns.org/spaces/newos4/scripts/chat.py list', +], JSON_UNESCAPED_SLASHES); -- cgit v1.2.3