Repository navigation
fix(core): take a leading-dash Apify reference as the positional value (#3689) - #4027
Merged
Merged
Conversation
#3689) About one in 4,096 random base64url Apify consent references and run handles starts with --, and brain apify read it as an unknown flag. That intermittently failed apify-front-doors on main (incident #4026). The apify command now moves a 43-character dashed reference behind a bare -- before the shared parser runs. Shape, entropy, stored values and the general parser are unchanged. Closes #3689 Refs #4026 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schlessera
marked this pull request as draft
November 15, 2026 17:36
schlessera
marked this pull request as ready for review
November 15, 2026 17:36
schlessera
marked this pull request as draft
November 15, 2026 17:42
schlessera
marked this pull request as ready for review
November 15, 2026 17:42
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.
Declared fix for red-main incident #4026. Closes #3689.
Cause
Apify consent references and run handles are 32 random bytes in base64url (
reference,packages/common/src/apify/consent.ts:412;packages/common/src/apify/ledger.ts:390). About one in 4,096 of them starts with--, andbrain apifypassed its arguments straight to the sharedparseArgs, which refused such a value asUnknown flag. Main run 43738678603 failed inpackages/ui-server/tests/apify-front-doors.test.ts:184(cli(["run", prepared.proposal])) withUnknown flag: --dqYdZ-o38E…. #4023, the first bad SHA, touches only Claude transcript archive restore and does not reach this code. The decision and its rationale are recorded on #4026.Change
packages/core/src/cli/commands/apify.ts: before parsing,brain apifymoves a 43-character reference that starts with--behind a bare--, where the shared parser keeps it positional verbatim. No flag has that shape. Other arguments keep their order, and anything already after a separator is untouched. The general parser, reference shape and entropy, stored records, and the MCP and hosted-bridge doors are unchanged. Both new and existing stored dashed values now work in the documented direct form, and the separator form still works.packages/ui-server/tests/apify-front-doors.test.ts: a deterministic test spies onnode:crypto'srandomBytesso that every 32-byte draw encodes to a distinct---leading value. It asserts that the consent reference, the proposal and the ledger run handle all start with--, then drivesinspect(direct and through--),prepare,run,status,resultsandabortthrough the CLI.@schlessera/brain.Contract: the CLI input shapes in
docs/integration-contract/cli.mdare unchanged, and the documented positional form now holds for every value.Proof
referencesAsPositionalcall reverted inapify.ts,bun run test packages/ui-server/tests/apify-front-doors.test.tsgives 14 pass and 1 fail. The new test fails withUnknown flag: --odysseus4AAAA…atparseArgs(packages/core/src/cli/io.ts:115), the same failure seen on main. With the change restored: 15 pass, 0 fail.tsc --noEmitis clean.bun run check:pr --base origin/mainpassed:{"version":1,"kind":"brain-check-pr-receipt","head":"ac762543f8dff4e5c2dcea0e56088817115c68ab","base":"origin/main","mode":"focused","startedAt":"2026-11-15T17:33:18.399Z","finishedAt":"2026-11-15T17:34:23.198Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12865.474023},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":107.07278099999894},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":86.08370699999796},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":21.451927000001888},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":51702.845315000006}]}🤖 Generated with Claude Code