Skip to content

test(core): cover handle_message slash commands and agent dispatch - #51

Closed
cursor[bot] wants to merge 4 commits into
developmentfrom
cursor/test-coverage-automation-f24b
Closed

test(core): cover handle_message slash commands and agent dispatch#51
cursor[bot] wants to merge 4 commits into
developmentfrom
cursor/test-coverage-automation-f24b

Conversation

@cursor

@cursor cursor Bot commented Jul 14, 2026

Copy link
Copy Markdown

Risky behavior now covered

  • handle_message (src/core/dispatch.c): central channel entry for /reset, /status, and agent forwarding — previously had zero unit coverage on main (excluded from the coverage gate).
  • Agent failure fallback: when agent_run fails with an empty response buffer, users get Error: agent failed (code …) instead of a silent empty reply.
  • NULL message text: empty-string coercion path so photo-only / missing-text messages still reach the agent.

Test files added/updated

  • tests/test_dispatch.c/reset clears session, /status returns version, provider success/failure, NULL text
  • tests/stubs/bootstrap_dispatch_stub.c — minimal bootstrap surface so dispatch can be tested without full subsystem init
  • Makefiletest_dispatch target wired into make test and coverage builds

Why these tests materially reduce regression risk

dispatch.c is the user-facing message router for every channel. Regressions in slash commands or agent wiring would reach production without a crash and without failing the coverage gate. These tests prove the happy path and the failure messaging path with a mock channel + spy/fail providers.

Validation

make GATEWAY=0 test_dispatch && ./build/test_dispatch

Passed locally (test_dispatch: all tests passed).

Open in Web View Automation 

adriannoes and others added 4 commits June 19, 2026 00:18
Assert undersized caller buffers get a clear error after snapshot priming,
and openai_compat serializes assistant tool_calls plus tool results.
test: cover get_context buffer guard and OpenAI tool-call JSON
Cover on_hup, stale_enqueue, and stale_free_all in reload.c which
participates in the 80% coverage gate but lacked dedicated tests.
Add unit tests for /reset, /status, provider forwarding, null text,
and agent-failure fallback messaging — the central channel entry point
previously had zero coverage on main.
@adriannoes
adriannoes changed the base branch from main to development July 16, 2026 20:01
@adriannoes

Copy link
Copy Markdown
Collaborator

Duplicate: development already has dispatch coverage in 25b6327 (test_dispatch.c + bootstrap_dispatch_stub.c). Closing in favor of existing integration.

@adriannoes adriannoes closed this Jul 16, 2026
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