Skip to content

fix(context): invalidate selections when workflow intent changes - #3916

Merged
haelyra merged 1 commit into
affaan-m:mainfrom
Afloat16:ecc/fix-context-workflow-intent-20261111
Nov 16, 2026
Merged

haelyra merged 1 commit into
affaan-m:mainfrom
Afloat16:ecc/fix-context-workflow-intent-20261111

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

Record normalized workflow intent in task-context receipts and their selection digests. Reuse a receipt only when it records the same enabled-workflow intent; resolve legacy receipts without an intent field again. Keep the task/source binding stable for the launcher's existing source-change checks.

Why

An opted-out task creates a valid empty receipt. Previously, clearing noWorkflow without changing the task identity or query reused that empty receipt, so an explicit request to use a named skill returned no context. Clearing the opt-out now causes a fresh selection and loads the requested resources; stale load-preview digests are rejected. Omitted and false flags still reuse the same selection. A provider's explicit empty proposal continues to launch the task without injected context.

Testing

  • The new clearing-intent and legacy-receipt regressions fail on the base implementation and pass after the fix.
  • Existing admission, context-selection, and context-profile-launch suites plus five new regressions: 330/330 passed, including decline handling and source-change rejection.
  • Updated the existing admission characterization to expect fresh resolution when noWorkflow is cleared; it still distinguishes the completed none decision from the next pending proposal. The prior assertion reproduced one failure before this test-only follow-up.
  • c8 thresholds passed: 98.64% lines/statements, 93.35% branches, 100% functions for context-selection.js.
  • ESLint reported no errors (existing complexity warnings only); git diff --check passed.

@Afloat16
Afloat16 requested a review from affaan-m as a code owner November 11, 2026 13:27
@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Security Evidence

Commit: 386b285452e7059a10e4a6938ff09085c405ce3c

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 2 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / PR Risk Taxonomy

Commit: 386b285452e7059a10e4a6938ff09085c405ce3c

PR taxonomy review recommended (neutral)

Detected 1 PR taxonomy bucket(s): CI/CD Recommendation.

Scanned 2 changed file(s).

Roadmap taxonomy buckets:

CI/CD Recommendation

CI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work.

Signals:

  • 1 CI or workflow path(s) changed

Paths:

  • tests/lib/context-workflow-intent.test.js

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Reference Set Readiness

Commit: 386b285452e7059a10e4a6938ff09085c405ce3c

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 2 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Hosted Promotion Readiness

Commit: 386b285452e7059a10e4a6938ff09085c405ce3c

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 2 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Tasks that skip workflows no longer load skills, and changing a task’s workflow setting refreshes its selection when needed.
    • Prior selections are reused only when the workflow setting and selection details remain compatible.

Context selection now records noWorkflow in selection digests and receipts. Receipt reuse requires matching workflow intent. Tests cover workflow skips, rerouting, legacy receipts, and empty agent selections.

Changes: Workflow intent and receipt reuse

Layer / File(s) Summary
Record workflow intent in selection receipts
scripts/lib/context-selection.js
noWorkflow is normalized, included in selection digests, and recorded in receipts. Receipt reuse now requires the current task to enable workflow and the prior receipt to record noWorkflow: false.
Verify selection and launcher behavior
tests/lib/context-workflow-intent.test.js
Tests cover rerouting and stale digests when workflow intent changes, reuse when intent is omitted or false, resolution of legacy receipts, workflow skips, and task completion after an empty agent selection.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • affaan-m/ECC issue 3458: Its receipt-invalidation follow-up overlaps with this change’s handling of receipts when workflow intent differs.
Merge Risk: Minimal · up to 386b2

Clearing the workflow-skip flag now triggers a fresh context selection instead of reusing a stale one. Regression tests cover this and the legacy-receipt case. No actionable merge risk was identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title accurately and concisely describes the main change: invalidating selections when workflow intent changes.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description directly explains the workflow-intent receipt and selection-digest changes, reuse rules, legacy receipt handling, and related tests. It matches the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: affaan-m/ECC
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: d2ef268
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 12572330-a937-4f39-ba71-54804f33fddd
Commits

Reviewing files that changed from the base of the PR and between d2ef268 and 386b285.

Files selected for processing: 2

  • scripts/lib/context-selection.js
  • tests/lib/context-workflow-intent.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Recent review details

Context from checks skipped due to timeout: 1

  • GitHub Check: CodeRabbit
Additional context used

Code guidelines: 8

.cursor/rules/typescript-security.md — auto-discovered
.claude/rules/node.md — auto-discovered
.cursor/rules/typescript-coding-style.md — auto-discovered
.cursor/rules/common-patterns.md — auto-discovered
.cursor/rules/kotlin-testing.md — auto-discovered
.cursor/rules/python-coding-style.md — auto-discovered
.cursor/rules/swift-patterns.md — auto-discovered
.cursor/rules/common-testing.md — auto-discovered
Path-based instructions: 11

Focus on command injection, unsafe subprocess usage, path traversal, SSRF, secret exposure, and missing tests for new CLI behavior.

CodeRabbit configuration file

Files:

  • scripts/lib/context-selection.js
Source excerpt:

CodeRabbit inference engine (.cursor/rules/typescript-security.md)

Files:

  • tests/lib/context-workflow-intent.test.js
  • scripts/lib/context-selection.js
Source excerpt: New scripts in `scripts/lib/` require a matching test in `tests/lib/`

CodeRabbit inference engine (.claude/rules/node.md)

Files:

  • scripts/lib/context-selection.js
Source excerpt: Use spread operator for immutable updates: Source excerpt: Use async/await with try-catch: Source excerpt: Use Zod for schema-based validation: Source excerpt: No `console.log` statements in production code Source excerpt: U...

CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

Files:

  • tests/lib/context-workflow-intent.test.js
  • scripts/lib/context-selection.js
Source excerpt: `scripts/` — Node.js utilities, hooks.

CodeRabbit inference engine (.claude/rules/node.md)

Files:

  • scripts/lib/context-selection.js
Source excerpt: `tests/` — Mirror the `scripts/` structure.

CodeRabbit inference engine (.claude/rules/node.md)

Files:

  • tests/lib/context-workflow-intent.test.js
Source excerpt: Encapsulate data access behind a consistent interface: Define standard operations: findAll, findById, create, update, delete Concrete implementations handle storage details (database, API, file, etc.) Business logic depends...

CodeRabbit inference engine (.cursor/rules/common-patterns.md)

Files:

  • tests/lib/context-workflow-intent.test.js
  • scripts/lib/context-selection.js
Source excerpt: Use **Kotest** with spec styles (StringSpec, FunSpec, BehaviorSpec) and **MockK** for mocking.

CodeRabbit inference engine (.cursor/rules/kotlin-testing.md)

Files:

  • tests/lib/context-workflow-intent.test.js
  • scripts/lib/context-selection.js
Source excerpt: Follow **PEP 8** conventions Source excerpt: Use **type annotations** on all function signatures Source excerpt: Prefer immutable data structures: Source excerpt: **black** for code formatting Source excerpt: **isort** for i...

CodeRabbit inference engine (.cursor/rules/python-coding-style.md)

Files:

  • tests/lib/context-workflow-intent.test.js
  • scripts/lib/context-selection.js
Source excerpt: Define small, focused protocols.

CodeRabbit inference engine (.cursor/rules/swift-patterns.md)

Files:

  • tests/lib/context-workflow-intent.test.js
  • scripts/lib/context-selection.js
Source excerpt: Test Types (ALL required): **Unit Tests** - Individual functions, utilities, components **Integration Tests** - API endpoints, database operations **E2E Tests** - Critical user flows (framework chosen per language)

CodeRabbit inference engine (.cursor/rules/common-testing.md)

Files:

  • tests/lib/context-workflow-intent.test.js
  • scripts/lib/context-selection.js
Additional comments: 2

scripts/lib/context-selection.js: 1

354-355: LGTM!

Also applies to: 402-402, 413-413

tests/lib/context-workflow-intent.test.js: 1

1-67: LGTM!

@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Records normalized noWorkflow intent in receipts and selection digests.

  • Task context is resolved again when workflow intent changes.

No actionable issues were found in the changes since the previous review or the full-PR rule check.

Reviews (3) · Last reviewed commit: "fix(context): invalidate selections when..." · Reviewed by Greptile

Afloat16 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

The latest CI run on current head 8d0e5809 is marked action_required, with no jobs started. Could a maintainer approve the run when convenient?

@Afloat16
Afloat16 force-pushed the ecc/fix-context-workflow-intent-20261111 branch from 386b285 to 8d0e580 Compare November 11, 2026 14:03
@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Security Evidence

Commit: 8d0e58094cf72278dd61768210a42c46d2f1d836

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 3 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / PR Risk Taxonomy

Commit: 8d0e58094cf72278dd61768210a42c46d2f1d836

PR taxonomy review recommended (neutral)

Detected 1 PR taxonomy bucket(s): CI/CD Recommendation.

Scanned 3 changed file(s).

Roadmap taxonomy buckets:

CI/CD Recommendation

CI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work.

Signals:

  • 2 CI or workflow path(s) changed

Paths:

  • tests/lib/context-selection-admission.test.js
  • tests/lib/context-workflow-intent.test.js

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Reference Set Readiness

Commit: 8d0e58094cf72278dd61768210a42c46d2f1d836

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 3 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Hosted Promotion Readiness

Commit: 8d0e58094cf72278dd61768210a42c46d2f1d836

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 3 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@haelyra

haelyra commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thank you for binding context-selection reuse to the workflow intent recorded in its receipt, and for following through on the review findings. All five workflow-intent regressions passed, including clearing noWorkflow and conservatively re-resolving legacy receipts.

Regarding the CI approval question: we are validating these related fixes together in the maintainer integration. The local results above do not replace hosted checks, which still need to pass before merge. No further revision is requested from you at this point; thank you for your patience while we finish that verification.

@haelyra
haelyra merged commit 4789eb1 into affaan-m:main Nov 16, 2026
3 checks passed
@haelyra

haelyra commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thank you for contributing fix(context): invalidate selections when workflow intent changes. Your complete reviewed head is preserved with attribution in maintainer integration #3945.

The delivered main commit now passes CI, CodeQL and a fresh Supply-Chain Watch after the focused coverage-report and dependency recovery in #3947. We appreciate your patience and your help improving ECC.

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