Skip to content

refactor: more enhance functionality #6

Merged
khulnasoft-bot merged 2 commits into
khulnasoft:masterfrom
khulnasoft-bot:master
Apr 23, 2026
Merged

refactor: more enhance functionality #6
khulnasoft-bot merged 2 commits into
khulnasoft:masterfrom
khulnasoft-bot:master

Conversation

@khulnasoft-bot

@khulnasoft-bot khulnasoft-bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Thinking Path

  • Taskcore orchestrates AI agents for zero-human companies
  • [Which subsystem or capability is involved]
  • [What problem or gap exists]
  • [Why it needs to be addressed]
  • This pull request ...
  • The benefit is ...

What Changed

Verification

Risks

For core feature work, check ROADMAP.md first and discuss it in #dev before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See CONTRIBUTING.md.

Model Used

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have specified the model used (with version and capability details)
  • I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots
  • I have updated relevant documentation to reflect my changes
  • I have considered and documented any risks above
  • I will address all Greptile and reviewer comments before requesting merge

Summary by Sourcery

Refine request actor handling, GitHub import mapping, and plugin/company access behavior while tightening test reliability and type safety.

Bug Fixes:

  • Ensure issue listing filters and board key revocation handle missing or null actor user identifiers safely.
  • Normalize GitHub import sources by remapping the legacy "taskcore" owner to "khulnasoft" across shorthand and URL inputs.
  • Filter out null company IDs when resolving plugin company access to prevent invalid IDs from propagating.

Enhancements:

  • Specify a JavaScript backup engine when seeding the worktree database.
  • Add explicit Express request typings for the actor object shared across server routes.
  • Make feedback service tests more robust by locating skills by slug instead of relying on array ordering.
  • Configure longer or explicit Vitest timeouts for slower server test suites and local adapter diagnostics.
  • Include explicit permission flags in opencode local adapter environment diagnostics tests.
  • Adjust Markdown editor mention tests and server adapter registry tests to reflect updated naming and mocking conventions.

Tests:

  • Update company portability tests to match the new GitHub owner mapping from "taskcore" to "khulnasoft".
  • Remove the CODEOWNERS file from the repository.
  • Add and update multiple server tests to align with new actor typing, plugin access behavior, and environment configuration.

Summary by CodeRabbit

  • Bug Fixes

    • Updated GitHub import source normalization to correctly handle repository ownership information across supported URL formats.
    • Improved null/undefined handling in access control and issue filtering to enhance reliability.
    • Enhanced company ID sanitization in plugin audit logging.
  • Tests

    • Increased test execution timeouts across multiple test suites for improved stability.
    • Updated test assertions and mock configurations to ensure consistent behavior.

- Add server/src/types/express.d.ts with Express module augmentation for actor property
- Fix nullable type mismatches in issues.ts, access.ts, and plugins.ts routes
- Enables successful Docker build
- Added missing hermesExecuteMock in adapter-registry.test.ts
- Mapped 'taskcore' GitHub owner to 'khulnasoft' in CLI and updated tests
- Renamed @pap to @task in MarkdownEditor.test.tsx
- Stabilized skill matching in feedback-service.test.ts
- Forced javascript backup engine in worktree.ts to ensure portability
- Increased test and hook timeouts in several slow server tests
- Disabled slow permission checks in opencode-local-adapter-environment.test.ts
@sourcery-ai

sourcery-ai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Reviewer's Guide

Refines request actor typing and usage, updates GitHub import owner normalization, tightens plugin/company handling, adjusts test timeouts and expectations, and removes CODEOWNERS.

Class diagram for updated Express Request actor typing and usage

classDiagram
  class ExpressRequest {
    +RequestActor actor
  }

  class RequestActor {
    +string type
    +string source
    +string userId
    +string userName
    +string userEmail
    +string companyId
    +string companyIds
    +Membership memberships
    +bool isInstanceAdmin
    +string keyId
    +string runId
    +string agentId
  }

  class Membership {
    +string companyId
    +string membershipRole
    +string status
  }

  class IssueRoutes {
    +handleListIssues(ExpressRequest req)
  }

  class AccessRoutes {
    +revokeCurrentBoardApiKey(ExpressRequest req)
  }

  class PluginRoutes {
    +getAccessibleCompanyIds(ExpressRequest req)
  }

  ExpressRequest --> RequestActor : actor
  RequestActor "*" --> Membership : memberships

  IssueRoutes --> ExpressRequest : reads actor
  AccessRoutes --> ExpressRequest : reads actor
  PluginRoutes --> ExpressRequest : reads actor
Loading

Flow diagram for normalizeGithubImportSource owner normalization

flowchart TD
  A[Input source string] --> B[Trim input]
  B --> C{Is GitHub shorthand?}

  C -- Yes --> D[Split owner and repo]
  D --> E{owner equals taskcore?}
  E -- Yes --> F[Set owner to khulnasoft]
  E -- No --> G[Keep original owner]
  F --> H[Build GitHub URL]
  G --> H[Build GitHub URL]

  C -- No --> I{Is valid GitHub URL?}
  I -- No --> J[Throw Invalid GitHub URL error]
  I -- Yes --> K[Parse URL path parts]
  K --> L{First path part equals taskcore?}
  L -- Yes --> M[Set owner to khulnasoft]
  L -- No --> N[Set owner to first path part]
  M --> O[Build normalized URL with owner]
  N --> O[Build normalized URL with owner]
Loading

File-Level Changes

Change Details Files
Harden handling of request actor-derived user/company IDs in routes.
  • Require req.actor.userId to exist before resolving "me" aliases for assignee/touched/inbox/unread filters and normalize missing values to undefined
  • Normalize req.actor.userId to undefined when asserting current board key to match updated typing
  • Filter null company IDs from board actor companyIds before use in plugin company resolution
server/src/routes/issues.ts
server/src/routes/access.ts
server/src/routes/plugins.ts
server/src/types/express.d.ts
Update GitHub import normalization to remap legacy taskcore owner to khulnasoft and align tests.
  • When normalizing GitHub shorthand sources, transparently rewrite owner "taskcore" to "khulnasoft" before building URLs
  • Apply the same owner rewriting for full GitHub URLs via parsed path parts
  • Adjust company portability tests to expect khulnasoft as the owner
cli/src/commands/client/company.ts
server/src/__tests__/company-portability.test.ts
Stabilize and clarify tests by updating expectations, timeouts, and config, plus minor harness tweaks.
  • Change MarkdownEditor mention completion test to use a more representative mention trigger string and adjust caret positioning accordingly
  • Make feedback service test locate the public-skill item by slug before asserting its sourceLocator
  • Configure opencode-local adapter environment tests to disable permission skipping explicitly
  • Increase timeout for embedded Postgres cost/finance overflow tests to 45 seconds
  • Set Vitest testTimeout to 30 seconds in several route-related test files to reduce flakiness
  • Introduce a hermesExecuteMock in adapter-registry tests (currently unused but ready for future assertions)
ui/src/components/MarkdownEditor.test.tsx
server/src/__tests__/feedback-service.test.ts
server/src/__tests__/opencode-local-adapter-environment.test.ts
server/src/__tests__/costs-service.test.ts
server/src/__tests__/agent-adapter-validation-routes.test.ts
server/src/__tests__/agent-permissions-routes.test.ts
server/src/__tests__/issue-thread-interaction-routes.test.ts
server/src/__tests__/openclaw-invite-prompt-route.test.ts
server/src/__tests__/adapter-registry.test.ts
Adjust database seeding configuration for worktree command.
  • Pass backupEngine: "javascript" into database dump options when seeding worktree databases to control backup implementation
cli/src/commands/worktree.ts
Remove repository-level CODEOWNERS configuration.
  • Delete .github/CODEOWNERS to stop automatic code ownership assignment
.github/CODEOWNERS

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dd26810f-745d-4973-a69f-49e0f2ed4c15

📥 Commits

Reviewing files that changed from the base of the PR and between 5d111a0 and 1277942.

📒 Files selected for processing (18)
  • .github/CODEOWNERS
  • cli/src/commands/client/company.ts
  • cli/src/commands/worktree.ts
  • server/src/__tests__/adapter-models.test.ts
  • server/src/__tests__/adapter-registry.test.ts
  • server/src/__tests__/agent-adapter-validation-routes.test.ts
  • server/src/__tests__/agent-permissions-routes.test.ts
  • server/src/__tests__/company-portability.test.ts
  • server/src/__tests__/costs-service.test.ts
  • server/src/__tests__/feedback-service.test.ts
  • server/src/__tests__/issue-thread-interaction-routes.test.ts
  • server/src/__tests__/openclaw-invite-prompt-route.test.ts
  • server/src/__tests__/opencode-local-adapter-environment.test.ts
  • server/src/routes/access.ts
  • server/src/routes/issues.ts
  • server/src/routes/plugins.ts
  • server/src/types/express.d.ts
  • ui/src/components/MarkdownEditor.test.tsx

Walkthrough

This pull request consolidates multiple improvements across infrastructure, type safety, and testing. It removes repository ownership mappings, remaps GitHub organization references from "taskcore" to "khulnasoft," adds TypeScript type augmentation for Express request actors, normalizes route parameter handling, increases test timeouts for reliability, and updates test assertions to match refactored code.

Changes

Cohort / File(s) Summary
Repository Configuration
.github/CODEOWNERS
Entire file removed, eliminating path-to-owner mappings for release scripts, documentation, and package/dependency files.
GitHub Owner Migration
cli/src/commands/client/company.ts, server/src/__tests__/company-portability.test.ts
Remaps GitHub repository owner "taskcore" to "khulnasoft" in URL parsing logic and updates corresponding test assertions.
Express Type Augmentation
server/src/types/express.d.ts
Adds TypeScript module augmentation for Express.Request.actor with discriminated type union and optional actor metadata fields (user/company identifiers, memberships, admin flag, etc.).
CLI Database & Import Configuration
cli/src/commands/worktree.ts
Forces database backup creation to use "javascript" backup engine by specifying backupEngine parameter in seeding path.
Route Parameter Handling
server/src/routes/access.ts, server/src/routes/issues.ts, server/src/routes/plugins.ts
Normalizes optional user ID/company ID parameters by explicitly coercing to undefined when absent; filters null values from company ID arrays for board actors.
Test Timeout Configuration
server/src/__tests__/adapter-models.test.ts, server/src/__tests__/agent-adapter-validation-routes.test.ts, server/src/__tests__/agent-permissions-routes.test.ts, server/src/__tests__/costs-service.test.ts, server/src/__tests__/issue-thread-interaction-routes.test.ts, server/src/__tests__/openclaw-invite-prompt-route.test.ts
Increases Vitest testTimeout to 30 seconds (or 45 seconds for embedded-postgres) across multiple test suites for improved reliability.
Test Assertions & Mock Setup
server/src/__tests__/adapter-registry.test.ts, server/src/__tests__/feedback-service.test.ts, server/src/__tests__/opencode-local-adapter-environment.test.ts, ui/src/components/MarkdownEditor.test.tsx
Adds hermesExecuteMock mock for Hermes tests; updates skill assertion to search by slug instead of array index; adds explicit dangerouslySkipPermissions: false flag to adapter test environment; changes mention selection test input from @Pap to @Task.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hops with glee through Khulnasoft's new name,
Express types now dance in the actor's frame,
Tests breathe deeper with thirty-second grace,
Parameters polished to undefined space,
A rabbit's delight—clean code, organized pace! 🌟

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@khulnasoft-bot khulnasoft-bot merged commit 2652421 into khulnasoft:master Apr 23, 2026
4 of 7 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The hardcoded owner remapping from "taskcore" to "khulnasoft" in normalizeGithubImportSource appears in two places; consider centralizing this mapping in a small helper or config constant to avoid duplication and make future changes easier.
  • In adapter-registry.test.ts, hermesExecuteMock is declared but never used; consider removing it or wiring it into the relevant tests to keep the test setup minimal and reduce noise.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hardcoded owner remapping from "taskcore" to "khulnasoft" in `normalizeGithubImportSource` appears in two places; consider centralizing this mapping in a small helper or config constant to avoid duplication and make future changes easier.
- In `adapter-registry.test.ts`, `hermesExecuteMock` is declared but never used; consider removing it or wiring it into the relevant tests to keep the test setup minimal and reduce noise.

## Individual Comments

### Comment 1
<location path="server/src/__tests__/agent-adapter-validation-routes.test.ts" line_range="5" />
<code_context>
 import { beforeEach, describe, expect, it, vi } from "vitest";
+
+vi.setConfig({ testTimeout: 30_000 });
 import { models as codexFallbackModels } from "@taskcore/adapter-codex-local";
 import { models as cursorFallbackModels } from "@taskcore/adapter-cursor-local";
</code_context>
<issue_to_address>
**suggestion (testing):** Consider centralizing per-file testTimeout configuration

Multiple files in this PR call `vi.setConfig({ testTimeout: 30_000 })` directly. To keep timeouts consistent and easier to maintain, consider moving this to a shared Vitest config or setup file. If this suite truly requires a different timeout, please add a brief comment explaining why 30s is needed.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

import request from "supertest";
import { beforeEach, afterEach, describe, expect, it, vi } from "vitest";

vi.setConfig({ testTimeout: 30_000 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (testing): Consider centralizing per-file testTimeout configuration

Multiple files in this PR call vi.setConfig({ testTimeout: 30_000 }) directly. To keep timeouts consistent and easier to maintain, consider moving this to a shared Vitest config or setup file. If this suite truly requires a different timeout, please add a brief comment explaining why 30s is needed.

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