Skip to content

Accept inline artifact-ignore patterns via message protocol#39

Merged
jackcbrown89 merged 2 commits intomainfrom
worktree-jb-accept-inline-artifact-ignore
Apr 30, 2026
Merged

Accept inline artifact-ignore patterns via message protocol#39
jackcbrown89 merged 2 commits intomainfrom
worktree-jb-accept-inline-artifact-ignore

Conversation

@jackcbrown89
Copy link
Copy Markdown
Contributor

@jackcbrown89 jackcbrown89 commented Apr 30, 2026

Summary

  • Add optional artifacts_ignore_content?: string to InvocationMessage and CommandExecutionMessage so consumers can carry gitignore-format ignore patterns through the wire instead of relying on a .artifactignore file at the watched directory.
  • ArtifactManager.addDirectory(dir, options?) now resolves patterns in this order:
    1. options.ignoreContent if provided (pinned — runtime file events for .artifactignore no longer overwrite it).
    2. <dir>/.artifactignore on disk (existing behavior, kept for back-compat).
    3. DEFAULT_ARTIFACT_IGNORE, with a logger.warn so the fallback is visible in operator logs instead of silently masking a misconfig.
  • Python client: new artifacts_ignore_content field on QueryOptions and ExecuteCommandsOptions, plumbed through both invocation and command-execution message builders.
  • Bump both packages to 0.15.0.

Why

Consumers whose watched directory is created (or wiped) by the runtime environment after image build time can't ship a .artifactignore reliably — by the time the runtime starts watching the directory, any file copied at build time may be gone. Routing the patterns through the message protocol removes that filesystem-coupling. Promoting the previously-silent default fallback to a warn makes future regressions of this kind visible immediately.

Test plan

  • npm run typecheck (clean)
  • npm test — 159/159 vitest tests pass, including new coverage for: inline-blob match/skip, blob-vs-file precedence, file events not overwriting the inline blob, the new warn on the default fallback, and session forwarding of artifacts_ignore_content to every addDirectory call (invocation + command-execution).
  • uv run pytest test/test_client.py — 61/61 pass, including new round-trip tests for artifacts_ignore_content on both query and execute_commands.
  • Existing-consumer back-compat: a message with only artifacts_dirs (no artifacts_ignore_content) and a .artifactignore at the watched dir continues to load the file (covered by existing tests, which still pass).

Note

Medium Risk
Changes the artifact-watching/ignore-path behavior and message schema, which could impact which files are uploaded and how existing .artifactignore setups behave if edge cases were missed.

Overview
Adds optional artifacts_ignore_content to invocation and command-execution messages so clients can supply gitignore-style artifact ignore rules over the wire instead of relying on an on-disk .artifactignore.

Updates the runtime ArtifactManager to accept per-directory ignoreContent, pinning in-memory patterns so .artifactignore file events don’t overwrite them, and emits a warn when falling back to the built-in default ignore rules. The session layer now forwards artifacts_ignore_content (treating null as omitted) to every addDirectory call, and the Python client plumbs the new option through QueryOptions/ExecuteCommandsOptions with added tests.

Bumps runtimeuse and runtimeuse-client versions to 0.15.0.

Reviewed by Cursor Bugbot for commit e818706. Bugbot is set up for automated code reviews on this repo. Configure here.

Add an optional `artifacts_ignore_content` field on `InvocationMessage`
and `CommandExecutionMessage`. When set, the runtime applies that blob
as the gitignore-format ignore patterns for every directory in
`artifacts_dirs` for that message, in preference to any
`<dir>/.artifactignore` file on disk.

This lets consumers carry ignore patterns through the wire when the
watched directory may be created (or wiped) by the runtime environment
after image build time, where a file copied into the image at build
time would not be visible at watch time.

Resolution order in `ArtifactManager.addDirectory`:
  1. `options.ignoreContent` if provided (pinned — runtime file events
     for the watched dir's `.artifactignore` no longer overwrite it).
  2. `<dir>/.artifactignore` on disk if present (existing behavior).
  3. `DEFAULT_ARTIFACT_IGNORE`, with a `logger.warn` so the fallback is
     visible in operator logs instead of silently masking misconfig.

Plumbed through the Python client as `QueryOptions.artifacts_ignore_content`
and `ExecuteCommandsOptions.artifacts_ignore_content`.

Bumps both packages to 0.15.0.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 265bcc9. Configure here.

Comment thread packages/runtimeuse/src/session.ts Outdated
Pydantic's `model_dump(mode="json")` serializes an unset Optional
field as JSON null rather than dropping the key, so cross-language
clients send `"artifacts_ignore_content": null` whenever the field
is not set. The TypeScript runtime previously checked only against
`undefined`, so null was passed through to `ig.add(null)`, which
crashed the ignore parser with `Cannot read properties of null
(reading 'pattern')` and surfaced as an error_message terminal —
breaking every existing artifact-related e2e test.

Switch both `Session.collectArtifactDirSpecs` and
`ArtifactManager.addDirectory` to a `!= null` check so undefined
and null are handled identically, and add regression tests at both
layers.
@jackcbrown89 jackcbrown89 merged commit e53e1e4 into main Apr 30, 2026
6 checks passed
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