Skip to content

πŸ› [v5] Knowledge: Clone & Index gives no visible error for missing required fields; no way to edit an existing git sourceΒ #17583

Closed
2 of 2 issues completed

Description

@clubanderson

Symptom

On the dashboard Knowledge panel, "Add Git Source" β†’ Clone & Index with an empty Display name (or URL) appears to do nothing. No error shows next to the form, no field is highlighted, the inputs keep their values.

Cause

kbAddGitSource (src/pkg/dashboard/static-src/js/knowledge.js ~L2051) does validate:

if (!url) { await hiveAlert('Repository URL is required'); return; }
if (!name) { await hiveAlert('Display name is required'); return; }

but hiveAlert (tooltips-dialogs.js ~L533) routes any message ≀220 chars with no newline to showToast(text, 'info') β€” a transient info toast in the toast container, far from the form, auto-dismissed. A validation failure on a button the user is looking at reads as "nothing happened".

The same pattern applies to kbAddSub ("URL is required").

Fix (part 1 β€” required-field feedback)

  • Mark the missing field inline: add a .field-invalid class (red border) and aria-invalid="true" on the offending <input>, focus it, and render the message in a <div class="field-error" role="alert"> directly under the input. Clear the state on input.
  • If a toast is kept, use showToast(msg, 'error') (sticky) rather than info so it does not vanish.
  • Mark required inputs visually (required attribute + label/placeholder marker) so users know before clicking.
  • Apply the same helper to kbAddSub and the hub-side "Import" form on the right of the Knowledge panel.

Fix (part 2 β€” edit an existing git source)

There is no way to correct a fat-fingered URL/name/subpath/branch/layer: the server exposes only GET/POST (connect) / DELETE (disconnect) on /api/knowledge/git-sources (api_knowledge.go handleGitSourcesList/Connect/Disconnect; knowledge/api.go ConnectGitSource/DisconnectGitSource). Today the only recourse is Remove + re-add, which re-clones and re-indexes.

  • Add an Edit button next to Remove on each git-source row that loads the row's values into the Add Git Source form (button label becomes Save; a Cancel link resets).
  • Server: PUT /api/knowledge/git-sources (or PATCH) taking {url, subpath} as the identity plus the new fields. Semantics:
    • name / layer change β†’ update metadata in place, no re-clone.
    • url / branch / subpath change β†’ disconnect the old source and connect the new one atomically from the caller's point of view (one request, one audit row).
  • Same validation + inline errors as part 1.
  • Owner-gated like connect/disconnect; audit row knowledge_git_source_update.
  • Tests: handler table test for metadata-only vs re-clone paths; JS validation helper test if there is a harness for knowledge.js.

Acceptance

  • Clicking Clone & Index with an empty required field highlights the field, focuses it, and shows the message under it.
  • Each existing git source row has Edit; saving a corrected display name does not re-clone; saving a corrected URL re-indexes and the row reflects the new values.

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Nov 10, 2026
  2. hivecommons-hive commented on Nov 10, 2026

    @hivecommons-hive
    Contributor

    Decomposed into two sub-issues so each lands as one focused PR (the two parts are independent concerns and together touch well over five files):

    This issue stays open as the tracker and closes when both children land.


    🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

    β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

  3. hivecommons-hive commented on Nov 10, 2026

    @hivecommons-hive
    Contributor

    PR #17589 covers this issue: #17589

    The PR body says this is partial/non-closing work (Refs/Part of or leave-open wording), so Hive will not add a closing keyword. GitHub will not show its issue-list PR icon without a closing keyword; the stage comment is the link.

  4. hivecommons-hive commented on Nov 10, 2026

    @hivecommons-hive
    Contributor

    PR #17596 covers this issue: #17596

    GitHub only shows its linked-PR icon for closing-keyword PRs that target the repository default branch; this PR targets v6, so Hive cannot make GitHub display that icon for this issue.

  5. clubanderson commented on Nov 10, 2026

    @clubanderson
    MemberAuthor

    Additional finding from a real repro: Branch left blank, Clone & Index clicked, nothing visible happened.

    Two more defects in the same handler (knowledge.js kbAddGitSource, ~L2051–2078):

    1. The busy state never shows. The button is wired with data-action="kbAddGitSource" (L1902) but the handler looks it up with document.querySelector('#kb-subs-content button[onclick="kbAddGitSource()"]') β€” a selector left over from the inline-onclick days. It matches nothing, so btn is null and the "Cloning..." label / disabled never apply. The user clicks and sees a dead button while the server runs a git clone --depth 1 (up to gitSourceCloneTimeout). Fix: document.querySelector('#kb-subs-content [data-action="kbAddGitSource"]'), or event.currentTarget passed through the dispatcher.

    2. Blank branch is silently sent as main. The client substitutes branch || 'main'; the server clones with --branch main. If the repo's default branch is anything else, ensureCloned fails (exit status 128 … Remote branch main not found), the handler returns 500, and the client passes the error to hiveAlert, which (per the issue body) becomes a transient info toast or, when the message is long, a modal β€” but only after the clone attempt has run to failure. Combined with (1) the user has no idea a request is in flight or that it failed.
      Fix: when branch is blank, do not guess β€” have the server resolve the remote default branch (git ls-remote --symref <url> HEAD) and clone that, recording the resolved branch in the saved config so the row shows what was actually indexed. Keep the placeholder honest: "Branch (blank = repo default)".

    3. Surface the result on the row, not only in a toast: after a failed connect, render the attempted source as a row with status error: <reason> and an Edit/Retry button (ties into part 2), so a failure is visible when the user returns to the panel.

    Acceptance addendum: clicking Clone & Index immediately disables the button and shows "Cloning…"; a repo whose default branch is not main indexes successfully with the branch field blank; a failed clone leaves a visible error row.

  6. clubanderson commented on Nov 10, 2026

    @clubanderson
    MemberAuthor

    Part 3 (busy state never shows, blank branch guessed as main, failed clone invisible) split out as #17610 so this tracker closes when #17587, #17588 and #17610 all land.

  7. hivecommons-hive commented on Nov 11, 2026

    @hivecommons-hive
    Contributor

    Fixed by #17596 (merged 087a692). Closing. Reply /reopen if the problem persists.

  8. github-actions commented on Nov 11, 2026

    @github-actions
    Contributor

    @clubanderson this issue was closed by @hivecommons-hive[bot] as completed.

    If this was closed by a merged PR, the fix only takes effect once it ships in a tagged release and your deployment updates to it β€” check your running version against the fix before concluding the fix failed.

    If you are still seeing the problem, comment /reopen and it will be reopened for you β€” you do not need write access. Please add what you are still observing (running version, logs, steps) so it is not closed the same way again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.hive/partially-addressedA merged PR addressed only part of this issue; remainder still actionable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions