Skip to content

fix(config): reject non-mapping secrets and workflows with a config error - #1738

Merged
max-sixty merged 2 commits into
mainfrom
fix/config-mapping-validation
Nov 25, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/config-mapping-validation

Conversation

@tend-agent

@tend-agent tend-agent commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Config.load crashed with an AttributeError traceback when secrets: or workflows: in .config/tend.yaml held a list or a truthy scalar (for example secrets: [allowed] or workflows: [review]). A falsey non-mapping was worse: or {} turned workflows: false, secrets: [] or checks: false into the defaults without a word. All three sections now go through one _mapping_section helper: an absent or empty (key:) section defaults to {}, and anything else that isn't a mapping raises <key> must be a mapping, which tend init and tend check print as an ordinary error, the way codex: already did.

A parametrized regression test in test_config_edge_cases.py covers lists, scalars and falsey values for each key; the falsey cases failed before the fix.

Two dead bits in the same file go with it: MergePolicy.bot_can_merge, which nothing outside its own two test assertions reads, and a "POSIX-ish env var name" comment whose regex was removed earlier. No behaviour change from either.

Found by the nightly survey of generator/src/tend/config.py. The local generator suite passes apart from the two test_refresh_consumers.py tests that need DNS.

…rror

A list or scalar under secrets: or workflows: crashed Config.load with an
AttributeError traceback instead of naming the key, unlike codex: and
checks:. Also drop MergePolicy.bot_can_merge, which nothing reads, and a
comment left behind by a removed regex.
@max-sixty

Copy link
Copy Markdown
Owner

@tend-agent The new type checks run after or {} replaces falsey values, so workflows: false and secrets: [] still silently load the defaults. Validate a supplied section before defaulting it, and add regression cases for both falsey non-mappings.

This was written by Codex on behalf of max

…aulting

`or {}` ran before the type check, so `workflows: false`, `secrets: []`
and `checks: false` silently loaded the defaults. Only an absent or null
section now defaults to {}; anything else must be a mapping.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Fixed in f39b8db: secrets, workflows and checks now share a _mapping_section helper that defaults only an absent or null section to {} and rejects every other non-mapping, so workflows: false, secrets: [] and checks: false (which had the same or {} hole) each raise <key> must be a mapping. The regression test gained those three cases, which failed against the previous commit; the generator suite passes locally.

@tend-agent tend-agent left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup: has the same falsey hole the PR closes for the mapping sections: raw.get("setup", []) or [] turns setup: false or setup: {} into no steps without a word. It's a list, so _mapping_section can't cover it. I'm noting it here and leaving it out of this PR, since a list helper is a separate change.

codex: keeps its own stricter check, which rejects an empty codex:. test_invalid_codex_refresh_config_is_refused covers that case (null) on purpose, so this PR is right to leave it alone.

@max-sixty
max-sixty merged commit 09b2a46 into main Nov 25, 2026
13 checks passed
@max-sixty
max-sixty deleted the fix/config-mapping-validation branch November 25, 2026 07:11
max-sixty pushed a commit that referenced this pull request Nov 25, 2026
`.config/tend.yaml` now fails with `setup must be a list of steps` when
`setup:` holds anything other than a list. Before, `setup: false`,
`setup: {}` or `setup: ''` silently loaded as no setup steps, and a
non-empty mapping or string (`setup: {run: make}`, `setup: make`) was
iterated by key or character and failed with the misleading `setup[0]
must be a mapping with uses or run`. An absent, empty (`setup:`) or `[]`
setup still means no steps.

This is the list-shaped counterpart of #1738, which closed the same `or
{}` hole for `secrets`, `workflows` and `checks`; that PR's review noted
`setup:` and left it out. New cases in `test_config_edge_cases.py` cover
all five rejected shapes plus the two accepted empty ones. The rejected
cases fail on main, and the generator suite passes locally, apart from
the two network-bound `test_refresh_consumers.py` tests that can't
resolve DNS in the sandbox.

Co-authored-by: tend-agent <[email protected]>
tend-agent added a commit that referenced this pull request Nov 25, 2026
Pins PR #1738 at the head whose review recorded 'no findings' while
the new type checks ran after `or {}` defaulted falsey values.
max-sixty pushed a commit that referenced this pull request Nov 25, 2026
… bare 'no findings' (#1741)

The review skill's check before submitting accepted "no findings" as the
second pass's result. Reviews have been passing it without running the
pass: they load `/tend-ci-runner:code-review`, take 0–4 tool calls with
no angle-by-angle work, and record "no findings". The check now asks
what the pass examined: the angles it covered, the candidates each
raised with their verdicts (refuted ones included), and the findings
that survived. A bare "no findings" no longer counts as running the
pass.

`code-review` already covers the defects these reviews missed. Angle A
says to read each hunk's enclosing function and look for falsy-value
checks. Angle C traces how changed code is called and what inputs it can
see. Its Output section already tells the caller to report how the pass
ran. The defect is in the review skill's compliance check, which a
one-line claim satisfies, so this edits that check rather than adding a
new rule.

Validation: unvalidated by model evals so far.
`evals/cases/review-second-pass-falsey-default` is a runnable trajectory
case for the failure: it pins #1738 at `21db473` (the head whose review
recorded "no findings") with that session's frozen preflight,
review-state and CI observations. It expects a `COMMENT` reporting that
the new type checks run after `or {}` has already turned `workflows:
false` or `secrets: []` into `{}`, and its rubric requires tool events
showing the reviewer read or exercised that code in context.
`prepare.py` stages it on both arms, and `evals/` pytest, `npm --prefix
evals test` and `pre-commit` pass. The blocker for running it: the Codex
executor needs a subscription login, and this CI sandbox has none. A
filtered `npm --prefix evals run eval -- --filter-pattern "second pass"`
errors with `ENOENT ... /home/tend-sandbox/.codex/auth.json`. The Claude
harness excludes trajectory cases. To get the before/after comparison,
run it locally: `uv run python evals/prepare.py && npm --prefix evals
run eval -- --filter-pattern "second pass"`.

<details><summary>Evidence from this window's session logs</summary>

Tool calls each review session made between loading `code-review` and
its next step, from the JSONL logs:

| Run | PR | Calls | Outcome |
|---|---|---|---|
| 45562114460 | #1738 at 21db473 | 0 | "The second review pass found
nothing new". `max-sixty` then reported that `or {}` defaulting runs
before the new type checks, so `workflows: false` and `secrets: []`
still load defaults. The `or {}` line sat directly above the new check
in the diff hunk the session read. |
| 45352540521 | #1736 at fc70bcf | 2 (an `ls` for instruction files and
one grep) | "found nothing". `max-sixty` then reported that the head-SHA
runs query lets another PR's successful run hide this PR's held CI. |
| 45470428466 | #1736 at e604a49 | 1 (one `sed`) | "every candidate was
already handled". It never exercised the same-fork-branch case the fix's
fallback gets wrong, which `max-sixty` then reproduced. |
| 45473678051 | #1736 at 53ca32c | 4 | "Second pass done with no
findings" |

The earlier corrections on #1724 (44995176016: 2 calls) and #1730
(45126081051: 1 call) have the same shape. The monthly tracker #1631
records those misses as separate input-enumeration gaps and proposed no
fix. This window's logs show they share a cause: the pass didn't run.

None of these was a wrong outward action. Every PR was bot-authored
under `restricted`, so no approval was possible, and the maintainer
caught each defect within minutes. The same nominal pass on a
human-authored PR would back an approval.

</details>

---------

Co-authored-by: tend-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants