OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Python SDK rejects long inline skill Markdown before sending a request

Open loading2332 opened this issue 1 month ago • 0 comments

Issue Origin

Observed or reproduced in a real environment

Bug Description

The Python HTTP SDK's add_skill() and update_skill() fail on ordinary inline SKILL.md content longer than the local filesystem's filename limit. Both AsyncHTTPClient and SyncHTTPClient raise OSError: [Errno 63] File name too long on macOS before sending an HTTP request.

Steps to Reproduce

  1. Install the standalone SDK from current main (7c12d3062fecd5a37cebc61087d1a4eb01826108) on Python 3.12.
  2. Pass the 793-character Markdown below to add_skill() or update_skill("demo", source).
  3. Observe ENAMETOOLONG and zero outgoing HTTP requests.

Expected Behavior

Send the original Markdown in the request's data field. Inline skill content is already supported by the HTTP routes and SkillProcessor; filesystem filename limits should not limit its size.

Actual Behavior

Both SDK methods call Path(data).exists() to detect a local upload before treating the string as inline content. On the tested Python versions, this raises ENAMETOOLONG instead of returning false. The call therefore never reaches the existing inline-content branch.

Minimal Reproducible Example

import asyncio
import errno

from openviking_sdk import AsyncHTTPClient

source = (
    "---\nname: demo\ndescription: A valid inline skill\n---\n"
    + "Follow these instructions carefully.\n" * 20
)
requests = []

async def record_request(request):
    requests.append(request)

async def main():
    client = AsyncHTTPClient(
        url="http://127.0.0.1:1933",
        event_hooks={"request": [record_request]},
    )
    await client.initialize()
    try:
        for method, args in [
            ("add_skill", (source,)),
            ("update_skill", ("demo", source)),
        ]:
            try:
                await getattr(client, method)(*args)
            except OSError as exc:
                print(method, errno.errorcode[exc.errno], len(requests))
    finally:
        await client.close()

asyncio.run(main())

The failure occurs before network access, so reproducing it does not require a running OpenViking server.

Error Logs

add_skill ENAMETOOLONG 0
update_skill ENAMETOOLONG 0

OpenViking Version

Upstream main at 7c12d3062fecd5a37cebc61087d1a4eb01826108; editable standalone openviking-sdk reports 0.1.15.dev167.

Python Version

3.12.14 (also confirmed the underlying Path.exists() failure on 3.9.6).

Operating System

macOS

Model Backend

Not applicable; no model calls.

Additional Context

I reproduced all four public entrypoints (sync/async, add/update) against a local loopback HTTP recording server using real filesystem probing: each raised ENAMETOOLONG with zero received requests. The existing standalone SDK suite passes on the same base: 187 tests, with three pre-existing unawaited-mock warnings. This establishes an SDK failure before transport, not a live OpenViking/model integration result.

The TypeScript-specific equivalent was fixed in #5308 for #5307. Those changes do not cover the Python SDK; searches for inline skills, filename limits, and ENAMETOOLONG found no Python-specific report or fix.

Proposed scope: handle ENAMETOOLONG only in the optional path probe used by the two Python skill methods, then use the existing inline data handling. Keep real local file/directory uploads, other filesystem errors, resource imports, and OVPack operations unchanged. No new public option or server change is needed.

This report was investigated and reproduced by an AI coding agent.

loading2332 avatar Oct 20 '26 09:10 loading2332