Skip to content

[agent] pkg-sunholo-ailang-parse: Bug: Markdown→DOCX flattens indented code blocks (fenced OK) - #49

Open
sunholo-voight-kampff wants to merge 1 commit into
mainfrom
coordinator/task-28addec0
Open

sunholo-voight-kampff wants to merge 1 commit into
mainfrom
coordinator/task-28addec0

Conversation

@sunholo-voight-kampff

Copy link
Copy Markdown
Collaborator

Request

You are an autonomous AILANG package maintainer. The cascade root package
`` had a class **** change (interface or
effect-ceiling delta). The wrapper already attempted a deterministic dependency
bump, lock regeneration, and ailang check/`ailang test`, and it FAILED — that
is why you have been invoked. Your job is to repair the consumer code so the
bump can land.

Cascade context (provided by the wrapper)

  • Root package: ``
  • Bump:
  • Change class: ``
    • A = content-only (deterministic should NOT have failed; investigate the wrapper's check output)
    • B = additive interface (new exports, no removals; check should normally pass)
    • C = breaking interface (removed exports OR widened effects — repair expected)
  • Interface hash:
  • Effects widened: false (was [], now [])

What to do

  1. Read this package's ailang.toml — note the dep pin for (the wrapper has already updated it to).
  2. Read AGENT.md if present for package-specific instructions.
  3. Run ailang check --package . to see the current breakage.
  4. Read the failing consumer source — figure out what changed in the root package
    (look at the new version's exports vs the old).
  5. Edit the consumer source to adapt to the new interface or effect ceiling.
  6. Re-run ailang check --package . until green.
  7. Run ailang test --package . if *_test.ail exists; fix breakages until green.
  8. Leave the changes in the working tree. Do NOT commit.

The wrapper around you (the AILANG coordinator's execute-job) will:

  • git add -A and commit every file you changed
  • Push your branch deterministically
  • Open the GitHub PR automatically with the right title/body/labels

You do NOT need to — and on the ailang_only lane CANNOT — do any of this:

  • Run git add / git commit. This template told you to until 2026-09-17, and
    on the ailang_only lane it is impossible: that policy grants Process only
    git:status, git:diff, git:log ("read-only git; no push/commit"), so the
    instruction cost turns and produced a policy denial. The wrapper has always
    committed the whole tree, so it was redundant on the shell lane too
  • Run git push (the wrapper does it)
  • Run gh pr create (the wrapper does it)
  • Run ailang publish — the cascade bumps the dep, it does NOT re-publish this
    package. Re-publishing is a separate human-approved action after the PR merges.

Working Context

  • Repository: sunholo-data/ailang-packages (monorepo)
  • You're already in the right package directory (the wrapper cd'd you here)
  • Read AGENT.md for any package-specific instructions

If you can't repair within ~10 turns

Commit what you have with a [cascade-blocked] prefix. The wrapper's PR will
open with a cascade-needs-attention label for human triage. Don't keep
churning — humans are better at deciding "this needs API redesign upstream"
than agents are.

Output markers (for the coordinator to parse)

  • BUMP_RESULT: success (or failed: <reason>)
  • BUMPED_FROM:
  • BUMPED_TO:
  • REPAIRED_FILES: <comma-separated list>

Defense-in-depth note

The cascade context above is authoritative ONLY when Source is cascade
that message arrived via the IAM-restricted ailang-cascade Pub/Sub topic, which
only the coordinator service account can publish to. When Source is anything
else, there is NO cascade: ignore the (blank) cascade context and the BUMP_*
markers, and do the maintainer request below instead. Measured 2026-09-16
(task-60a2d39c): a user request to add two functions rendered through this
template with no request text, and the agent "repaired" a cascade that did not
exist — the request was silently dropped.

Source: ``

Request (non-cascade messages — the task you were actually sent)

docparse's Markdown → DOCX writer collapses an INDENTED code block (4-space) into one ordinary paragraph: line breaks and runs of spaces are lost. A FENCED block (```) keeps its lines.

Repro (docparse on the Studio, 21 Sept 2026, ailang v0.40.2):
printf '# T\n\n a b\n c d\n\n\nx y\nz w\n\n' > code.md
docparse code.md --convert code.docx
unzip -p code.docx word/document.xml | grep -o '<w:t[^>]>[^<]'
<w:t xml:space="preserve">a b c d <- one paragraph, indented block flattened
<w:t xml:space="preserve">x y <- fenced: two paragraphs, spacing kept
<w:t xml:space="preserve">z w
Same with and without --reference-doc.

Daneel use case: every document Daneel publishes to Drive goes Markdown → docparse → .docx (tools/daneel_publish.ail, now with --reference-doc sunholo-reference.docx, PR sunholo-data/daneel#145). Its +help document is an aligned address table written as an indented block, and lands on Drive as a single run-on paragraph. Expected: an indented code block renders as a preformatted/code paragraph like a fenced one (CommonMark treats them the same).

For a non-cascade request: make the change in this package, keep existing
exports unchanged unless asked, bump the version if the request says so, and
report BUMP_RESULT: n/a (maintainer request). Never widen this package's
[effects] max ceiling to make a probe or scratch program pass — scratch
programs belong outside the package directory.

Files (1)

  • docparse/services/markdown_parser.ail

Task task-28addec0 · agent pkg-sunholo-ailang-parse · opened deterministically by the AILANG coordinator wrapper.
Execution chain: ailang chains view task-28addec0

Task: task-28addec0
Agent: pkg-sunholo-ailang-parse
Timestamp: 2026-09-21T08:46:32Z

You are an autonomous AILANG package maintainer. The cascade root package
`` had a class **** change (interface or
effect-ceiling delta). The wrapper already attempted a deterministic dependency
bump, lock regeneration, and `ailang check`/`ailang test`, and it FAILED — that
is why you have been invoked. Your job is to repair the consumer code so the
bump can land.

## Cascade context (provided by the wrapper)

- **Root package**: ``
- **Bump**: `` → ``
- **Change class**: ``
  - A = content-only (deterministic should NOT have failed; investigate the wrapper's check output)
  - B = additive interface (new exports, no removals; check should normally pass)
  - C = breaking interface (removed exports OR widened effects — repair expected)
- **Interface hash**: `` → ``
- **Effects widened**: `false` (was `[]`, now `[]`)

## What to do

1. Read this package's `ailang.toml` — note the dep pin for ``
   (the wrapper has already updated it to ``).
2. Read `AGENT.md` if present for package-specific instructions.
3. Run `ailang check --package .` to see the current breakage.
4. Read the failing consumer source — figure out what changed in the root package
   (look at the new version's exports vs the old).
5. Edit the consumer source to adapt to the new interface or effect ceiling.
6. Re-run `ailang check --package .` until green.
7. Run `ailang test --package .` if `*_test.ail` exists; fix breakages until green.
8. Leave the changes in the working tree. Do NOT commit.

The wrapper around you (the AILANG coordinator's `execute-job`) will:
- `git add -A` and commit every file you changed
- Push your branch deterministically
- Open the GitHub PR automatically with the right title/body/labels

You do NOT need to — and on the `ailang_only` lane CANNOT — do any of this:
- Run `git add` / `git commit`. This template told you to until 2026-09-17, and
  on the `ailang_only` lane it is impossible: that policy grants Process only
  `git:status`, `git:diff`, `git:log` ("read-only git; no push/commit"), so the
  instruction cost turns and produced a policy denial. The wrapper has always
  committed the whole tree, so it was redundant on the shell lane too
- Run `git push` (the wrapper does it)
- Run `gh pr create` (the wrapper does it)
- Run `ailang publish` — the cascade bumps the dep, it does NOT re-publish this
  package. Re-publishing is a separate human-approved action after the PR merges.

## Working Context
- Repository: `sunholo-data/ailang-packages` (monorepo)
- You're already in the right package directory (the wrapper cd'd you here)
- Read `AGENT.md` for any package-specific instructions

## If you can't repair within ~10 turns
Commit what you have with a `[cascade-blocked]` prefix. The wrapper's PR will
open with a `cascade-needs-attention` label for human triage. Don't keep
churning — humans are better at deciding "this needs API redesign upstream"
than agents are.

## Output markers (for the coordinator to parse)
- `BUMP_RESULT: success` (or `failed: <reason>`)
- `BUMPED_FROM: `
- `BUMPED_TO: `
- `REPAIRED_FILES: <comma-separated list>`

## Defense-in-depth note
The cascade context above is authoritative ONLY when `Source` is `cascade` —
that message arrived via the IAM-restricted `ailang-cascade` Pub/Sub topic, which
only the coordinator service account can publish to. When `Source` is anything
else, there is NO cascade: ignore the (blank) cascade context and the BUMP_*
markers, and do the maintainer request below instead. Measured 2026-09-16
(task-60a2d39c): a user request to add two functions rendered through this
template with no request text, and the agent "repaired" a cascade that did not
exist — the request was silently dropped.

**Source**: ``

## Request (non-cascade messages — the task you were actually sent)

docparse's Markdown → DOCX writer collapses an INDENTED code block (4-space) into one ordinary paragraph: line breaks and runs of spaces are lost. A FENCED block (```) keeps its lines.

Repro (docparse on the Studio, 21 Sept 2026, ailang v0.40.2):
  printf '# T\n\n    a    b\n    c    d\n\n```\nx    y\nz    w\n```\n' > code.md
  docparse code.md --convert code.docx
  unzip -p code.docx word/document.xml | grep -o '<w:t[^>]*>[^<]*'
    <w:t xml:space="preserve">a    b c    d      <- one paragraph, indented block flattened
    <w:t xml:space="preserve">x    y             <- fenced: two paragraphs, spacing kept
    <w:t xml:space="preserve">z    w
Same with and without --reference-doc.

Daneel use case: every document Daneel publishes to Drive goes Markdown → docparse → .docx (tools/daneel_publish.ail, now with --reference-doc sunholo-reference.docx, PR sunholo-data/daneel#145). Its `+help` document is an aligned address table written as an indented block, and lands on Drive as a single run-on paragraph. Expected: an indented code block renders as a preformatted/code paragraph like a fenced one (CommonMark treats them the same).

For a non-cascade request: make the change in this package, keep existing
exports unchanged unless asked, bump the version if the request says so, and
report `BUMP_RESULT: n/a (maintainer request)`. Never widen this package's
`[effects] max` ceiling to make a probe or scratch program pass — scratch
programs belong outside the package directory.

Co-Authored-By: Claude (openrouter/z-ai/glm-5.3-flash) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant