Accept inline artifact-ignore patterns via message protocol#39
Merged
jackcbrown89 merged 2 commits intomainfrom Apr 30, 2026
Merged
Accept inline artifact-ignore patterns via message protocol#39jackcbrown89 merged 2 commits intomainfrom
jackcbrown89 merged 2 commits intomainfrom
Conversation
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.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
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.
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
artifacts_ignore_content?: stringtoInvocationMessageandCommandExecutionMessageso consumers can carry gitignore-format ignore patterns through the wire instead of relying on a.artifactignorefile at the watched directory.ArtifactManager.addDirectory(dir, options?)now resolves patterns in this order:options.ignoreContentif provided (pinned — runtime file events for.artifactignoreno longer overwrite it).<dir>/.artifactignoreon disk (existing behavior, kept for back-compat).DEFAULT_ARTIFACT_IGNORE, with alogger.warnso the fallback is visible in operator logs instead of silently masking a misconfig.artifacts_ignore_contentfield onQueryOptionsandExecuteCommandsOptions, plumbed through both invocation and command-execution message builders.Why
Consumers whose watched directory is created (or wiped) by the runtime environment after image build time can't ship a
.artifactignorereliably — 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 awarnmakes 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 newwarnon the default fallback, and session forwarding ofartifacts_ignore_contentto everyaddDirectorycall (invocation + command-execution).uv run pytest test/test_client.py— 61/61 pass, including new round-trip tests forartifacts_ignore_contenton bothqueryandexecute_commands.artifacts_dirs(noartifacts_ignore_content) and a.artifactignoreat 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
.artifactignoresetups behave if edge cases were missed.Overview
Adds optional
artifacts_ignore_contentto 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
ArtifactManagerto accept per-directoryignoreContent, pinning in-memory patterns so.artifactignorefile events don’t overwrite them, and emits awarnwhen falling back to the built-in default ignore rules. The session layer now forwardsartifacts_ignore_content(treatingnullas omitted) to everyaddDirectorycall, and the Python client plumbs the new option throughQueryOptions/ExecuteCommandsOptionswith added tests.Bumps
runtimeuseandruntimeuse-clientversions to0.15.0.Reviewed by Cursor Bugbot for commit e818706. Bugbot is set up for automated code reviews on this repo. Configure here.