• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

KusionStack / karpor
65%

Build:
DEFAULT BRANCH: main
Repo Added 20 May 2024 03:33AM UTC
Files 68
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH main
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • 02-22-demo_fb33d3ef_add_activity_feed_api
  • add-auto-milestone-summary-action
  • add-community-plan-and-task-updater
  • add-growth-to-planning-updater-ci
  • add-ingress-watch
  • add-japanese-readme-security
  • add-missing-version-bump-in-badge
  • add-new-contributor-Cookiery
  • add-new-contributor-Cookiery-for-doc
  • add-new-contributor-eltociear
  • add-new-contributor-jinjiaKarl-for-code
  • add-new-contributor-rajp152k
  • add-new-contributor-wujunwei
  • add-new-contributor-wujunwei-for-code
  • add-yes-to-updater-ci
  • addClusterLatency
  • addPodStatus
  • addPodStatusInSummary
  • adjust-ai-panel-style
  • adjust-milestone-planning-action
  • adjust-milestone-planning-action-categories
  • adjust-readonly-middleware-logic
  • ai-analysis-dialog-show
  • ai-analysis-pretty
  • all-contributors/add-LeoSofl
  • all-contributors/add-jinjiaKarl
  • all-contributors/add-nueavv
  • all-contributors/add-rajp152k
  • auto/issue-735
  • auto/issue-767
  • chart-version-updater
  • chore/optimize-makefile
  • codex/karpor-796-ai-panel
  • cursor/fix-markdown-link-check-c618
  • cursor/fix-nilnil-search-test-5171
  • dependabot/go_modules/github.com/go-chi/chi/v5-5.2.2
  • dependabot/go_modules/github.com/sirupsen/logrus-1.9.1
  • dependabot/go_modules/golang.org/x/crypto-0.31.0
  • dependabot/go_modules/golang.org/x/net-0.33.0
  • dependabot/go_modules/golang.org/x/oauth2-0.27.0
  • enhance-metrics-exp-with-trend-charts
  • event-ai-style
  • event-ai-style-pretty
  • feat-connect-control
  • feat-ha-push
  • feat-karpor-agent
  • feat-karpor-agent-highversion
  • feat/i18n-hindi
  • feat/karpor-llm-api-proxy
  • feat/locale-parity
  • feat/status-cluster-syncregistry
  • feat/support-wildcard-sync-strategy
  • feat/yaml-refresh-sofl
  • fix-404-username
  • fix-event-tab
  • fix-frontend-runtime-bug
  • fix-golangci-lint-issues-again
  • fix-jitter-when-log-reconnecting
  • fix-md-lint
  • fix-mk-lint
  • fix-redundant-code-block
  • fix-topology-graph-interactive
  • fix-topology-interactive-1223
  • fix-upgrading-nodeV23-build-error
  • fix-wrong-app-version-when-update-chart
  • fix/ai-default-model
  • fix/ai-stream-goroutine-leak
  • fix/huggingface-empty-response
  • fixNLSearch
  • fixStreamRbac
  • korean
  • main
  • mcp-support
  • misc-optimize
  • optiServerConfig
  • optimize-seo
  • optimizeServerConfig
  • pretty-ai-interpret-style
  • pretty-ai-panel-style
  • pretty-insight-add-mothod
  • pretty-podlogs-style
  • pretty-topology-graph
  • refine-log-aggregator
  • refine-readme
  • remove-dry-run
  • remove-internal-resources
  • rename-community-planning-updater-action
  • standardize-event-log-tab-names
  • support-ai-based-event-dignosis
  • support-ai-based-issue-interpret
  • support-ai-based-log-dignosis
  • support-ai-based-yaml-interpret
  • support-default-model-when-backend-is-deepseek
  • support-go-alias-in-makefile
  • test/ui-playwright-e2e
  • translate-readme-ko
  • unify-isAIEnabled-usage
  • update-demo-video
  • update-milestone-summary-action
  • update-planning-action-triggers
  • update-readme-iter-instru
  • update-zh-readme
  • use-default-version-when-occur-error

21 Oct 2026 09:44AM UTC coverage: 65.213% (+1.2%) from 64.035%
39579317773

push

github

web-flow
fix(ai): stop the stream goroutine when the context is cancelled (#866)

## What type of PR is this?

/kind bug

## What this PR does / why we need it:

`GenerateStream` of the OpenAI, Azure OpenAI and DeepSeek clients
(`pkg/infra/ai`) starts a goroutine that sends every chunk, and the
final `ERROR: ...` message, to a buffered channel (size 100) without
looking at `ctx`. If the consumer stops reading and cancels the context
(for example the HTTP client disconnected), the goroutine blocks forever
on the full channel and keeps the upstream HTTP response open.

This wraps the sends in a `select` on `ctx.Done()`, the same way the
Hugging Face client already does.

## Tests

New `pkg/infra/ai/stream_cancel_test.go`: a server streams 300 chunks
(more than the buffer), the consumer reads nothing and cancels the
context, and the test checks that the `GenerateStream` goroutine exits.
It runs for the three clients, fails on `main` for all three and passes
with the change. `gofmt`, `go vet` and `go test ./pkg/infra/ai/` are
clean (golang:1.26 container).

## Special notes for your reviewer:

This change was made with Claude Code.

Co-authored-by: elliotxx <951376975@qq.com>

12 of 21 new or added lines in 3 files covered. (57.14%)

5 existing lines in 4 files now uncovered.

4501 of 6902 relevant lines covered (65.21%)

0.72 hits per line

Relevant lines Covered
Build:
Build:
6902 RELEVANT LINES 4501 COVERED LINES
0.72 HITS PER LINE
Source Files on main
  • Tree
  • List 68
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
39579317773 main fix(ai): stop the stream goroutine when the context is cancelled (#866) ## What type of PR is this? /kind bug ## What this PR does / why we need it: `GenerateStream` of the OpenAI, Azure OpenAI and DeepSeek clients (`pkg/infra/ai`) starts a go... push 21 Oct 2026 09:45AM UTC web-flow github
65.21
39578596672 fix/ai-stream-goroutine-leak Merge branch 'main' into fix/ai-stream-goroutine-leak Pull #866 21 Oct 2026 09:39AM UTC web-flow github
65.24
39578577111 main fix(ai): don't panic on an empty or short Hugging Face response (#865) ## What type of PR is this? /kind bug ## What this PR does / why we need it: `HuggingfaceClient.Generate` returns `resp[0].GeneratedText[len(prompt):]`. That expression pan... push 21 Oct 2026 09:39AM UTC web-flow github
64.03
39414195351 fix/ai-default-model fix(ai): default the OpenAI model to gpt-5.6-terra gpt-3.5-turbo is shut down by OpenAI on 2026-10-23, so the --ai-model default would make every AI request fail for users who leave it unset. gpt-5.6-terra is the replacement OpenAI names on its d... Pull #864 21 Oct 2026 02:02AM UTC pcbeingused333 github
63.83
39439732479 fix/huggingface-empty-response fix(ai): don't panic on an empty or short Hugging Face response HuggingfaceClient.Generate returned resp[0].GeneratedText[len(prompt):], which panics when the Inference API answers with an empty list or with a generated_text shorter than the prom... Pull #865 21 Oct 2026 02:02AM UTC pcbeingused333 github
64.01
39505938223 fix/ai-stream-goroutine-leak fix(ai): stop the stream goroutine when the context is cancelled GenerateStream of the OpenAI, Azure OpenAI and DeepSeek clients sent every chunk, and the final error message, to the result channel without looking at ctx. A consumer that stops re... Pull #866 21 Oct 2026 02:02AM UTC pcbeingused333 github
65.01
39356401477 main fix(i18n): fill missing keys in de, pt and zh locales (#861) ## What type of PR is this? /kind bug ## What this PR does / why we need it: Follow-up to #859, as offered on #468. `de.json` and `pt.json` each miss 7 keys that `en.json` has, and `... push 20 Oct 2026 01:59AM UTC web-flow github
63.8
39356395367 main test(ui): add a Playwright e2e prototype for login and search (#862) ## What type of PR is this? /kind test ## What this PR does / why we need it: A small Playwright prototype for the UI e2e suite in #460, as suggested there: login and search ... push 20 Oct 2026 01:59AM UTC web-flow github
63.8
38828637665 test/ui-playwright-e2e test(ui): add a Playwright e2e prototype for login and search Start the UI e2e suite discussed in #460 with a small prototype. It runs the dev server and stubs every backend call with page.route, so it needs no karpor server, Elasticsearch or clu... Pull #862 16 Oct 2026 12:18AM UTC Iamrushabhshahh github
63.8
38735507313 feat/locale-parity fix(i18n): fill missing keys in de, pt and zh locales de.json and pt.json each miss 7 keys that en.json has, and zh.json misses YAML.Refresh, so those strings show the raw key. Add them, and drop the old keys that the UI no longer uses (Exception... Pull #861 15 Oct 2026 12:33PM UTC Iamrushabhshahh github
63.8
See All Builds (715)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc