Skip to content

fix: report site/adapter-source command errors cleanly instead of crashing - #327

Open
ayushsingh82 wants to merge 1 commit into
agentrhq:mainfrom
ayushsingh82:fix/311-site-adapter-error-handling
Open

fix: report site/adapter-source command errors cleanly instead of crashing#327
ayushsingh82 wants to merge 1 commit into
agentrhq:mainfrom
ayushsingh82:fix/311-site-adapter-error-handling

Conversation

@ayushsingh82

Copy link
Copy Markdown
Contributor

Summary

Working through the local-mode portion of the manual QA checklist in #311, I found that every webcmd site * subcommand (notes, endpoints, field-maps, fixtures, samples) and webcmd adapter source get/put / adapter path had no error handling in their commander actions. Any failure — a missing fixture, an invalid site name, a duplicate field-map key, an unsupported local write — surfaced as a raw unhandled-rejection stack trace instead of the CLI's normal Error: ... output, and always exited 1 regardless of the error's intended exit code (e.g. SITE_MEMORY_NOT_FOUND should exit 66, an ArgumentError should exit 2).

  • src/site-memory/commands.ts (shared by local and hosted mode via registerSiteCommands) — added a wrapAction helper so every action reports errors and exit codes consistently.
  • src/cli.ts — same fix for adapter source get, adapter source put, and adapter path.
  • src/cli.test.ts — updated 3 pre-existing unit tests that had encoded the old crash-and-reject behavior as expected, to instead assert the clean error message + correct process.exitCode.
  • tests/e2e/adapter-authoring-parity.test.ts (new, registered in vitest.config.ts) — e2e coverage for the local-mode-testable sections of test: validate adapter authoring and override parity in local and hosted modes #311: mode boundaries, override/source/reset workflow, site memory + fixtures + samples, browser init/verify and its flags, and mutable input-output files via a private test adapter.

Sections of #311 requiring a live hosted Cloud deployment (workspace/user isolation, marketplace metadata) are out of scope here — this addresses the local-mode reliability gap surfaced while working through the checklist.

Test plan

  • npm run typecheck
  • npm test (unit + plugin, 5589 passed)
  • npx vitest run --project e2e tests/e2e/adapter-authoring-parity.test.ts (28 passed)
  • Manually verified before/after CLI output for site fixture get (missing → clean error, exit 66), site note add ../evil (clean error, exit 1), adapter source get --output (clean error, exit 2)

…shing

webcmd site * (notes, endpoints, field-maps, fixtures, samples) and
adapter source get/put/path had no error handling, so any failure
surfaced as a raw unhandled-rejection stack trace and always exited 1,
discarding the intended CliError exit code (e.g. a missing fixture
should exit 66, a bad flag 2). Wrap these actions the same way the
rest of the CLI reports errors.

Also adds e2e coverage for the local-mode portion of the manual QA
checklist in agentrhq#311 (override/source workflow, site memory, browser
init/verify flags, mutable input-output files).
@ayushsingh82

ayushsingh82 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@beubax mind taking a look? Quick summary of what's here:

Working through the local-mode checklist in #311, every webcmd site * subcommand (notes, endpoints, field-maps, fixtures, samples) and webcmd adapter source get/put/adapter path turned out to have no error handling — any failure surfaced as a raw unhandled-rejection stack trace and always exited 1, discarding the intended CliError exit code (e.g. a missing fixture should exit 66, a bad flag 2). This PR fixes that in site-memory/commands.ts (shared by local and hosted mode) and the adapter-source actions in cli.ts, updates the 3 unit tests that had encoded the old crash as expected behavior, and adds e2e coverage (tests/e2e/adapter-authoring-parity.test.ts) for the local-mode-testable portion of #311's checklist.

Full details and test plan are in the PR description above. Happy to adjust scope if you'd rather this land as smaller pieces.

@github-actions

Copy link
Copy Markdown
Contributor

🟠 Maintainer review suggested — low confidence

The automated review could not reach a fully supported conclusion.

Limitations

  • The automated review returned an invalid structured result.

This review is advisory and does not block merging.

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.

1 participant