Skip to content

fix: name the two colliding lists when a contract contradicts itself (#173) - #177

Open
Tonited wants to merge 1 commit into
NanmiCoder:mainfrom
Tonited:fix/repair-scope-conflict
Open

Tonited wants to merge 1 commit into
NanmiCoder:mainfrom
Tonited:fix/repair-scope-conflict

Conversation

@Tonited

@Tonited Tonited commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What this carries now

Rebased onto 6cc84f6 (v0.1.19). The generator half of #173 — a generated repair inheriting an outOfScope that swallows its own inScope, plus deduplication of the derived list — landed in that commit, and it also adopted the three tdd.scope.generated-repair-* checks verbatim. This PR was rewritten on top of it and now carries only the half main does not have.

The remaining defect

evaluateQualityCompletion classifies every changed path against the task contract, and classifyChangedPath consults outOfScope before inScope. A path listed in both is therefore rejected as:

repair cannot complete: deploy/compose/postfix/master.cf.inc is out_of_scope

That verdict blames the path. But a hand-written contract can contradict itself exactly the way the generator used to, and the member cannot act on out_of_scope for a path that is also an in-scope target it was told to change — it goes hunting for a scope violation that is really a contract defect. The rejection now names both colliding lists:

repair cannot complete: <path> is listed in inScope but also matches outOfScope — the two lists contradict each other; narrow one of them before resubmitting

Tests

scripts/quality-gates-tdd.mjs gains section I. contradictory contract (#173) with one check:

  • tdd.scope.contradictory-contract-rejection-explains-itself

Mutation-checked: disabling the new branch flips that check from PASS to FAIL with the old bare ... is out_of_scope message.

Verified locally

  • npx tsc -p tsconfig.json --noEmit — pass
  • npx tsc -p tsconfig.client.json --noEmit — pass
  • npx tsc -p tsconfig.json (build) — pass
  • node scripts/quality-gates-tdd.mjs — all checks pass, including the inherited H section
  • pnpm verify:quality-gates — pass

Refs #173.

TSOFTP-afk added a commit to TSOFTP-afk/dsh-agent-teams that referenced this pull request Sep 16, 2026
… covers

repairScopeFromFindings now skips a candidate that the source task's inherited
outOfScope already matches. classifyChangedPath consults outOfScope before
inScope (tdd.scope.out-of-scope-wins), so declaring such a path widened the
generated repair contract with an entry the member can never register: the
dead-lock from issue NanmiCoder#173, reached by a different route than the
finding.file/requiredFix mismatch this branch already fixes.

Widening the scope must not manufacture that contradiction. Resolving the
inherited patterns themselves stays with NanmiCoder#177's generator-level conflict fix
(drop the intersecting inherited patterns, name both lists in the rejection),
so the two changes remain complementary and this filter is a no-op once NanmiCoder#177
lands. The fallback path is unchanged.

Tests: scripts/quality-gates-repair-scope.test.mjs gains the covered-candidate
case, the all-candidates-covered fallback, and an end-to-end
planQualityFollowUp case asserting no declared path is covered by the
inherited outOfScope.
NanmiCoder added a commit that referenced this pull request Sep 17, 2026
Keep requiredFix targets before removing conflicting previous-round exclusions.
Preserve handwritten contract precedence and unrelated exclusions. Cover the
real F_DOC failure, directory collisions, fallback deduplication and completion.

Adapt the generated-contract helper and regression from PR #177 (ebb3641).
Refs #173, #155.

Co-authored-by: Ashley Lin <44889191+Tonited@users.noreply.github.com>
…r#173)

A hand-written contract can put one path in both `inScope` and `outOfScope`.
`classifyChangedPath` consults `outOfScope` first, so the path is rejected as
`out_of_scope` — a verdict that blames the path and sends the member hunting
for a scope violation that is really a contract defect. The rejection now names
both colliding lists.

Scope note: the generator half of NanmiCoder#173 (a generated repair inheriting an
`outOfScope` that swallows its own `inScope`, plus the dedup of the derived
list) is already in main as 6cc84f6, which also adopted the three
`tdd.scope.generated-repair-*` checks verbatim. This PR is rebased onto that
commit and carries only what main does not have.

Mutation-checked: disabling the new branch turns
`tdd.scope.contradictory-contract-rejection-explains-itself` from PASS to FAIL
with the old bare `... is out_of_scope` message.
@Tonited
Tonited force-pushed the fix/repair-scope-conflict branch from ebb3641 to 931e0a9 Compare September 17, 2026 02:39
@Tonited Tonited changed the title fix: a generated repair must not inherit an outOfScope that swallows its own inScope (#173) fix: name the two colliding lists when a contract contradicts itself (#173) Sep 17, 2026
WhiteWh added a commit to WhiteWh/dsh-agent-teams that referenced this pull request Sep 19, 2026
…ontract message, event guard)

Transfers reviewed open PRs from NanmiCoder/dsh-agent-teams into this branch.
None of them was merged upstream; each was re-verified locally first.

NanmiCoder#186 (xwchris) Harness 0.1.5-rc.2 support:
- compatibility.json adds 0.1.5-rc.2 on the preview track; recommendedHost
  stays 0.1.5-rc.1, so the release toolchain and README pair are unchanged.
- package.json: 21 @deepseek-ai/* peer ranges gain 0.1.5-rc.2.
- docs/harness-0.1.5-rc.2-acceptance.md records the host diff and the scope
  the upstream author actually exercised.
- npm serves 0.1.5-rc.2 as latest; peer warnings disappear for those users.

NanmiCoder#169 (chenkai2) stop writing a bespoke message source kind (NanmiCoder#160):
- src/command.ts injected source { kind: 'agent-teams-command' } for the
  /agent-teams activation directive and the unknown-profile directive.
- The installed host keeps a closed whitelist in
  @deepseek-ai/dsh-session-format-v2-to-v3/lib/index.js: SOURCE_KINDS holds
  plugin but not agent-teams-command, and line 125 throws
  SessionFormatUnsupportedMigrationError("cannot safely transform unclassified
  message source"), so every historical session containing one became
  impossible to open after a host upgrade.
- Both directives now emit the plugin source shape the delivery paths already
  use: kind plugin, plugin dsh-agent-teams; the module augmentation that
  declared the removed kind is gone too.
- scripts/command-source.test.mjs pins all three cases (activation, unknown
  profile, untouched ordinary turn) and is wired as verify:command-source.

NanmiCoder#177 (Tonited) name the colliding lists when a contract contradicts itself:
- classifyChangedPath consults outOfScope before inScope, so a path listed in
  both was rejected with a bare "is out_of_scope", which blames the path and
  sends the member hunting for a scope violation that is really a contract
  defect. evaluateQualityCompletion now names both lists.
- The upstream test half was rewritten onto this branch's harness (the upstream
  file is 1233 lines, ours is 1791 and grew by this step) as section I.

NanmiCoder#140 (spacexun2) session event write-guard regression test (NanmiCoder#8):
- scripts/verify-events.mjs plus scripts/mock-dsh-session-loader.mjs pin the
  guard in src/events.ts: out-of-repo agent-teams/* types are never written to
  the session log, recognised types still are, append failures stay contained,
  and captain resolution prefers a live session over the fallback.
- Wired as verify:events, deliberately not inside the aggregate verify chain,
  matching the upstream PR.

NanmiCoder#141 (spacexun2) align the module export name with the package name:
- src/index.ts exported name = 'agent-teams' while package.json declares
  @nanmicoder/dsh-agent-teams and cordis.patch.yml mounts that package name.

Verification: tsc -p tsconfig.json and tsconfig.client.json --noEmit both
clean; full build (clean-build + tsc + tsdown) clean; every server-side suite
in the verify chain green, including quality-gates-tdd with the new section I
check, command-source (3/3), verify-events (7/7), lifecycle, stress,
harness-contract, stability, capabilities, member-spawn-recovery, compatibility
and doctor (231 package identities). scripts/verify.mjs and node --test files
cannot run in this confined pwsh sandbox (spawn EPERM on named pipes) - the
same failure reproduces on the untouched parent commit, verified in a throwaway
worktree, so it is an environment limit, not a regression.
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.

1 participant