Skip to content

Instance routes fail for percent-encoded names like 'Opencode Go' #74

@vernonstinebaker

Description

@vernonstinebaker

Summary

Instance routes currently fail when the instance name contains spaces or other percent-encoded characters in the URL path.

Example: an instance named Opencode Go appears in /api/instances, but direct instance routes return 404 when addressed as /api/instances/nullclaw/Opencode%20Go.

Reproduction

Observed against a local NullHub instance with a real instance named Opencode Go:

  • GET /api/instances/nullclaw/Opencode%20Go -> 404
  • DELETE /api/instances/nullclaw/Opencode%20Go -> 404
  • POST /api/instances/nullclaw/Opencode%20Go/stop -> 404

But /api/instances still lists Opencode Go under nullclaw.

Root Cause

src/api/instances.zig route parsing does not percent-decode the {name} path segment before state lookup.

So the backend looks up Opencode%20Go instead of Opencode Go.

This appears to affect all instance routes that rely on parsePath(...), not just delete.

Proposed Fix

Small follow-up PR:

  1. Add regression tests first for percent-encoded instance names.
  2. Decode path segments before instance lookup in src/api/instances.zig.
  3. Cover at least delete and get routes, and confirm stop/restart if they share the same parser.
  4. Keep the fix tightly scoped; no broad routing refactor.

Validation

Expected validation once implemented:

  • zig build test --summary all
  • zig build
  • npm run build only if UI changes are needed

Scheduling Note

This should wait until PR #73 is merged, because PR #73 already changes src/api/instances.zig substantially for local standalone NullClaw import support.

Waiting avoids file conflicts and keeps this bug fix as a clean second PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions