GeezerVison is showing github.com — fix(fleet-hosted): parse pm-metadata fence by delimiter line (#16075) by dezren39 · Pull Request #16097 · developing-today/code
Conversation
dezren39
commented
Nov 27, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Closes #16075
Problem
parseMetadataBlock in pkgs/fleet/hosted-worker/src/metadata.ts extracted the fenced pm-metadata payload with a non-greedy regex, so triple-backtick sequences inside JSON string contents (JSON.stringify leaves backticks in string values unchanged — e.g. a caller-owned title like Document ```json examples) participated in fence matching instead of the closing fence being recognized as a delimiter line.
Fix
Line-based payload extraction: the closing fence is a line consisting solely of ```; anything other than whitespace before the opening fence or after the closing fence fails closed, as do a missing opening/closing fence. Malformed JSON and non-pm_meta: 1 payloads still refuse with `400 invalid_metadata_block`. A payload line of bare backticks cannot be valid JSON string content (JSON strings cannot contain a literal newline), so the first such line is unambiguously the delimiter.
Tests
New test/metadata.test.ts (wired into the package test script):
- render/parse round-trip preserving string fields containing triple backticks, with surrounding body text preserved byte-for-byte;
- a bare-backtick line is treated as the delimiter line (content after it fails closed);
- fail-closed cases: no fence, unclosed fence, trailing content after the closing fence, malformed JSON,
pm_meta != 1, end marker without start marker;
- no markers → null block.
Verification: remote dispatch via fleet-command.yml (run link posted as a comment when it concludes); metadata only, no CI logs read.
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-27T10:49:46Z",
"session_id": null,
"lane": null,
"host": "htch-runtime",
"worktree": "/home/hatch",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/hatch",
"repo": "developing-today/code",
"branch": "main",
"sha": "bbfc8aa3a3b4f3e3d399b7e76beb6962c0daa5b9"
},
"auth_subject": "xaltha",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ktick runs (#16075)
parseMetadataBlock extracted the fenced payload with a non-greedy
regex, so backtick runs inside JSON string contents participated in
fence matching. Replace it with line-based extraction: the closing
fence is a line consisting solely of ```, anything but whitespace
outside the fences fails closed, and malformed payloads still refuse
with invalid_metadata_block.
Adds test/metadata.test.ts covering the render/parse round-trip with
triple backticks in string fields and the fail-closed cases, wired
into the package test script.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 26 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c5ecd840-6dcb-4465-a555-8e7dec947a42
Commits
-
Reviewing files that changed from the base of the PR and between 932b1c3 and 9d40cc2.
Files selected for processing: 3
-
pkgs/fleet/hosted-worker/package.json
pkgs/fleet/hosted-worker/src/metadata.ts
pkgs/fleet/hosted-worker/test/metadata.test.ts
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Verification (remote dispatch, metadata only — no CI logs read): fleet-command run 45985331893 (developing-today/fleet, fleet-command.yml fallback) on exact head 9d40cc2 completed success — job Linux (developing-today/code) success, running node --experimental-transform-types --test over test/metadata.test.ts, test/stamping.test.ts, test/backfill.test.ts and test/ingestion.test.ts in pkgs/fleet/hosted-worker: https://github.com/developing-today/fleet/actions/runs/45985331893. PR is OPEN, non-draft, MERGEABLE/CLEAN at the same head; merging now (merge commit). — lane 0437-A-E
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Lane 0452-F claim (agent work loop SUSTAIN bravo, 2026-11-27) — verify-then-merge lane claiming this PR for exact-head verification and merge under standing authority.
Claim-scan done firsthand via gh api: body + ALL comments read (only comment = CodeRabbit rate-limit notice; no sibling claim, no evidence run posted yet). Head verified stable at 9d40cc209a04772169361ea564d1a095c56bc50a; full diff read (metadata.ts delimiter-line extraction, new test/metadata.test.ts, package.json test wiring — matches body).
Overlap note for the record: PR #16087 (test-only, duplicate issue #16078) adds the same test/metadata.test.ts path and the identical package.json wiring line. The two PRs cannot both land cleanly — whichever merges second will conflict on that added file. This PR carries the parser fix itself (#16075), so it is the one being verified here; #16087 is owned by another lane and is not touched by this one.
Dispatching one fleet-command verification run on the exact head (test/metadata.test.ts); will merge on passing exact-head evidence.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|