fix(config): resolve the forge from the working context, not a stale global default #406

Merged
hexajon merged 2 commits from issue-390-forge-resolution into main 2026-08-17 11:03:53 +00:00
Owner

Summary

Three forge-resolution bugs shared one root: writes and MCP repo ops must follow the working context (origin-first, ADR 0025), never a stale or global madtea.url. All three are bug fixes that restore origin-first intent; none forks a recorded decision (the clean-greenfield global fallback in ADR 0025 rung 4 is preserved).

  • #391: a dir= API-write now resolves the forge base URL from the same source as the repo slug (the dir's repo-local madtea.url, else its origin), so a cross-forge write no longer sends forge-A's slug to forge-B and 404s. The error's source label now names the true source.
  • #390: the MCP repo tools (list/search/create/fork/topics) and init resolve the forge at call time from the session/working context and fail closed on an ambiguous or unresolvable forge (ADR 0027), returning a named-hosts error instead of a silent global-default 404.
  • #379: interactive auth login treats MADTEA_URL as a configured forge, so an env-only forge that disagrees with origin is warned.

Adversarial verify caught and the fix round repaired a real regression: the #390 reroute initially broke the ADR 0013 --insecure-storage plaintext credential path; restored and machine-verified with the built binary. Hermetic tests (ADR 0022) pin each path. Gate green including parity and mcp-conformance.

Closes #390, #391, #379.

Closes #391
Closes #379
Closes #390

## Summary Three forge-resolution bugs shared one root: writes and MCP repo ops must follow the working context (origin-first, ADR 0025), never a stale or global madtea.url. All three are bug fixes that restore origin-first intent; none forks a recorded decision (the clean-greenfield global fallback in ADR 0025 rung 4 is preserved). - #391: a dir= API-write now resolves the forge base URL from the same source as the repo slug (the dir's repo-local madtea.url, else its origin), so a cross-forge write no longer sends forge-A's slug to forge-B and 404s. The error's source label now names the true source. - #390: the MCP repo tools (list/search/create/fork/topics) and init resolve the forge at call time from the session/working context and fail closed on an ambiguous or unresolvable forge (ADR 0027), returning a named-hosts error instead of a silent global-default 404. - #379: interactive auth login treats MADTEA_URL as a configured forge, so an env-only forge that disagrees with origin is warned. Adversarial verify caught and the fix round repaired a real regression: the #390 reroute initially broke the ADR 0013 --insecure-storage plaintext credential path; restored and machine-verified with the built binary. Hermetic tests (ADR 0022) pin each path. Gate green including parity and mcp-conformance. Closes #390, #391, #379. Closes #391 Closes #379 Closes #390
Three forge-resolution bugs shared one root: writes and MCP repo ops
must follow the working context (origin-first, ADR 0025), never a stale
or global madtea.url.

- #391: a dir= API-write now resolves the forge base URL from the same
  source as the repo slug (the dir's repo-local madtea.url, else its
  origin), so a cross-forge write no longer sends forge-A's slug to
  forge-B. The 404 error's source label names the true source.
- #390: the MCP repo tools (list/search/create/fork/topics) and init
  resolve the forge at call time from the session/working context and
  fail closed on an ambiguous or unresolvable forge (ADR 0027), with a
  named-hosts error instead of a silent global-default 404. The clean
  greenfield global fallback (ADR 0025 rung 4) is preserved.
- #379: interactive auth login now treats MADTEA_URL as a configured
  forge, so an env-only forge that disagrees with origin is warned.

Hermetic tests (ADR 0022) pin each path.
test(setup): swap the #379 sample host codeberg.org to example.org
All checks were successful
ci / mcp-conformance (pull_request) Successful in 2m7s
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (pull_request) Successful in 1m28s
drift / forgejo-smoke (pull_request) Has been skipped
drift / govulncheck (push) Has been skipped
drift / surface-diff (push) Successful in 15s
drift / forgejo-smoke (push) Has been skipped
ci / gate (pull_request) Successful in 25m6s
ci / mcp-conformance (push) Successful in 25s
ci / gate (push) Successful in 7m22s
5f3bb63d0c
The #379 mismatch tests were written before the #384 Codeberg purge and
used codeberg.org as the origin sample host. Repoint it to example.org
(distinct from the forgejo.example.com env host, and not a substring of
it) so the purge stays complete after the merge.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea!406
No description provided.