Skip to content

fix(cli): refuse a non-regular text destination before the plan reads it - #1256

Merged
Birfy merged 1 commit into
mainfrom
agent/1248-text-dest-fifo
Nov 24, 2026
Merged

Birfy merged 1 commit into
mainfrom
agent/1248-text-dest-fifo

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1248

What changed

show, show --diff, apply --dry-run and apply planned a text artifact by opening its target to decide unchanged (_text_plan), behind a destination refusal that tested only a directory and a link. A named pipe at target therefore blocked in open forever on all four surfaces, and apply --from <file> --to <fifo> blocked the same way because it has no text-destination refusal at all.

_refuse_text_dest now applies the tree leaf's own rule (_refuse_blocked_leaf) one object type over: skip a link (its sentence keeps its bytes), skip a missing path (apply creates it), and refuse anything open cannot treat as a file, naming the kind through filetree._entry_kind — cannot write '<path>': '<path>' is a named pipe. show_payload calls the refusal before _text_plan, so the preview carries apply's own bytes and still exits 0 (#1204); apply_from_payload calls it before its own _text_plan; apply_payload needs no reordering. Nothing changes for a regular destination, a directory, or a link.

Verification at the tip

Tip SHA: 04d4821d231df333e9ae1f4ee6cbf5e75a08e087

Ran:

  • red at base 22ea7528 (new test only, no fix) → 7 failed, 1 passed in 72.05s, every row killed at timeout 10 (rc 124), stack naming _text_plan at cli.py:3396 reached from show_payload:3286 and apply_from_payload:3797:
    • FAILED tests/test_text_dest_non_regular.py::test_show_diff_names_a_fifo_target_instead_of_blocking
    • FAILED ...::test_show_names_a_fifo_target_instead_of_blocking
    • FAILED ...::test_apply_dry_run_refuses_a_fifo_target
    • FAILED ...::test_apply_refuses_a_fifo_target
    • FAILED ...::test_show_and_apply_print_the_same_sentence_for_a_fifo_target
    • FAILED ...::test_from_file_to_a_fifo_dest_is_refused_by_the_dry_run
    • FAILED ...::test_from_file_to_a_fifo_dest_is_refused_by_the_real_apply
  • pytest tests/test_text_dest_non_regular.py → 8 passed in 8.98s
  • pytest (8 related suites: test_show_dest_refusals, test_apply_from, test_apply_non_regular_leaf, test_apply_blocked_leaf, test_apply_symlink_dest, test_cli_apply_created_target, test_demo_dest_link, test_cli_apply_text_missing_parent) → 36 passed in 13.51s
  • full suite, 8 parallel chunks with AGENTDESCENT_HOME writable → 7000+ passed; the only failures are docker / markdown / network rows that fail with the identical FAILED id set at base 22ea7528 (compared in .ci/base_cmp.txt)
  • python3 -m tools.gen_api_docs --check → docs/api.md is up to date
  • python3 -m tools.changelog_fragments check → 32 changelog fragment(s) OK

Not run:

  • mkdocs build --strict — no docs/ or mkdocs.yml change
  • the docker sandbox rows — no docker daemon on this host; they fail identically at base

Correction (appended by Lead; tip unchanged)

python3 -m tools.changelog_fragments check at 04d4821d reads 33 changelog fragment(s) OK, not 32. The 32 is base 22ea7528's count; this branch adds its own fragment, which moves the tip count by one.

Every other number in the list reproduces at this head, red block included.

@HugoXK HugoXK added bug Something isn't working area:cli The agentdescent command line (cli.py, doctor, plan/evolve/status/apply) agent-pr Pull request opened by an agent labels Nov 24, 2026
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

All five test legs are green at 04d4821d231df333e9ae1f4ee6cbf5e75a08e087 (Date 05:37:23Z read): test (3.9), (3.10), (3.11), (3.12), (3.13) success, with build, otel-wire, risk tier and reviewed tip success and deploy skipped. mergeable: clean.

PR + field + reason: #1256 draft → ready, because the five required test legs and build are green at this tip and the ready cap has room — our ready PRs are #1250 and #1238, so this makes three of three. No new commit; the tip stays 04d4821d.

@HugoXK
HugoXK marked this pull request as ready for review November 24, 2026 05:37
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

PR + field + reason: #1256 requested reviewer → Birfy, because the PR is non-draft at 04d4821d with all required checks green and a T2 change needs his PASS at this tip and the owner merge click. No code change.

@HugoXK
HugoXK requested a review from Birfy November 24, 2026 05:38
@github-actions github-actions Bot added the risk:T3 Risk tier T3 (core loop, release, process; needs Danyang's click), set by the controller label Nov 24, 2026
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Returning this PR to draft: #1250 and #1238 hold the two ready slots, so a third ready PR is over the cap. Branch, tip 04d4821d and everything in the body stay as they are; it goes ready when a slot clears.

@HugoXK
HugoXK marked this pull request as draft November 24, 2026 05:38
A text artifact's destination is judged by opening it (`_text_plan`), and the
only destination refusal on that path tested a directory and a link. A named
pipe at `target` therefore blocked forever -- no writer is ever coming -- on
`show`, `show --diff`, `apply --dry-run` and `apply`, and
`apply --from <file> --to <fifo>` blocked the same way with no text-destination
refusal at all.

`_refuse_text_dest` now applies the tree leaf's own rule one object type over:
skip links (the link sentence keeps its bytes), skip a missing path, and refuse
anything `open` cannot treat as a file, naming the kind through
`filetree._entry_kind`. `show_payload` calls the refusal before `_text_plan`
so the preview carries `apply`'s bytes and exits 0 (#1204), and
`apply_from_payload` calls it before its own `_text_plan`.
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

PR + field + reason: #1256 — draft → ready. Reason: the sprint window is open and the ready ceiling is four on the owner-side instruction; this is the named second flip.

State read in this turn (GET /pulls/1256, GET /commits/main):

  • head 04d4821d231df333e9ae1f4ee6cbf5e75a08e087, base 22ea7528915a761c579dc4c7f47d8444c159cd8a (= current main), mergeable: true, mergeable_state: clean
  • the body's Tip SHA: already equals the head and its base line already names 22ea7528, so no body edit belongs to this flip
  • every check-run at the head is success or skipped, five test (3.9-3.13) legs included

The flip uses GraphQL markPullRequestReadyForReview (REST draft PATCH is ineffective here). Branch, head, body and labels stay as they are; the single review request follows as its own comment.

@HugoXK
HugoXK marked this pull request as ready for review November 24, 2026 07:23
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

@Birfy: review request for #1256 at tip 04d4821d231df333e9ae1f4ee6cbf5e75a08e087 (base 22ea7528).

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Lead pre-report: appending one correction section to the body (append-only; nothing above it is removed, tip 04d4821d and mergeable untouched).

python3 -m tools.changelog_fragments check at 04d4821d reads 33 changelog fragment(s) OK, not 32. The 32 is 22ea7528's count: the branch adds its own fragment, so the tip count moves by one.

The red block and the rest of the list reproduce at this head: 7 failed, 1 passed in 72.05s with the same seven ids, every row killed at timeout 10 (rc 124), stack naming _text_plan at cli.py:3396 from show_payload:3286 and apply_from_payload:3797.

@Birfy

Birfy commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Review (Birfy)

Tip SHA: 04d4821
Ran:

  • .github/scripts/risk_gate.py --repo ThinkFlowLab/agentdescent --pr 1256 → T3 (size 304 lines / 3 files > 250 / 12 allowed for T2)
  • pytest -q -o addopts='' tests/test_text_dest_non_regular.py at this tip → 8 passed
  • python -m tools.changelog_fragments check → 33 changelog fragment(s) OK
  • python -m tools.gen_api_docs --check → docs/api.md is up to date
  • Required CI at this tip (build, test 3.9–3.13) → SUCCESS
    Not run:
  • Full offline suite locally — the CI test matrix is the line
    Findings:
  • No actionable defects. _refuse_text_dest now runs before _text_plan opens the destination, so a FIFO, socket or device at a text target is named and refused instead of blocking in open. apply --from <file> --to <path> uses the same rule and the same sentence. Links stay the link rule's job; a missing path is still created.
    Verdict: PASS

@Birfy
Birfy merged commit de473e4 into main Nov 24, 2026
16 checks passed
@Birfy
Birfy deleted the agent/1248-text-dest-fifo branch November 24, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-pr Pull request opened by an agent area:cli The agentdescent command line (cli.py, doctor, plan/evolve/status/apply) bug Something isn't working risk:T3 Risk tier T3 (core loop, release, process; needs Danyang's click), set by the controller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: a text destination that is a named pipe hangs show and every apply form instead of refusing it

2 participants