devagentic-canvas: distinguish auth/404/network failures in slash commands#16
Merged
Conversation
…mands _request previously collapsed every failure mode into a single opaque None. Slash commands then printed "Couldn't reach devagentic" even when the real cause was a missing API key, an unresolved user_id, or a 5xx — wrong four-of-six ways. Add a module-level last_error_text() helper. _request populates it with a short kind on failure (auth, not_found, unreachable, parse, no user_id) and clears it on entry. Slash commands append the Reason. Hook intentionally ignores the slot — its loss-tolerant contract is correct for ephemeral context injection. Backward-compatible: existing return signatures unchanged; the helper is purely additive. Closes #15.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #15. Previously
_requestcollapsed six distinct failure modes into a single opaque None, and slash commands printed the generic "Couldn't reach devagentic" string for all of them — wrong four-of-six ways.Changes
plugins/devagentic-canvas/client.py: new module-levellast_error_text()helper._requestrecords a short kind on every failure path (auth, 404, generic HTTP, unreachable, parse, no user_id) and clears it on entry to the next call.plugins/devagentic-canvas/commands.py: new_failure_detail()helper that appendsReason: <text>.to the existing user-facing strings in/canvas list,/canvas open,/canvas show,/canvas new.pre_llm_callhook inpreamble.pyis intentionally unchanged — its loss-tolerant silent-None contract is correct for ephemeral context injection.Why this matters across the boundary
This is exactly the diagnostic gap that ate iterations during #8 / #9 / #13 triage. An operator who sets
DEVAGENTIC_BASE_URL=\$DUPLEX_SERVICE_URL(or who forgetsDEVAGENTIC_API_KEY) will now see, e.g.:Instead of having to grep hermes DEBUG logs to find that out.
Test plan
tests/test_devagentic_canvas_plugin.py:test_last_error_unresolved_user_idtest_last_error_auth_failed(401)test_last_error_not_found(404)test_last_error_unreachable(URLError)test_last_error_cleared_on_success— proves we don't leak stale Reason text across callstest_handle_list_appends_failure_detail— covers the commands.py integrationpytest tests/test_devagentic_canvas_plugin.py→ 42 passed (36 previous + 6 new).Filed by hermes-maintainer (PowerCreek).