Skip to content

fix(service): reuse existing Git marketplace clones - #4093

Merged
jujn merged 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/4092-git-marketplace-cache
Nov 10, 2026
Merged

jujn merged 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/4092-git-marketplace-cache

Conversation

@logicwu0

Copy link
Copy Markdown
Contributor

Summary

Fixes #4092

The shared fileExists helper intentionally excludes directories, so a normal clone's .git directory was not recognized. A subsequent browse or install attempted another clone into the non-empty cache and failed with exit status 128.

  • Check .git existence directly, accepting both directories and gitfiles without changing the shared helper.
  • Keep the existing fast-forward refresh behavior and preserve cache contents on failure.
  • Add local Git regression tests for initial cloning, repeated browsing, installation-source reading, remote updates, gitfile compatibility, and invalid cache preservation.
  • Document cache refresh behavior in the English and Chinese workspace guides.

Validation

  • Before the fix, the repeated-browse regression reproduced exit status 128.
  • After the fix, all new regression cases pass.
  • make build and make test in agentscope-service/service-controlplane pass.
  • go vet ./internal/product passes.
  • Documentation npm test, npm run validate, and npm run broken-links pass.

Database- and envtest-dependent integration tests were skipped where their required local infrastructure was unavailable. The new tests use real local Git repositories and exercise installation-source reading, not the full HTTP/database installation workflow.

@mintlify

mintlify Bot commented Nov 10, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit f4b4010.

Approve preview

@jujn
jujn merged commit 874c9cb into agentscope-ai:main Nov 10, 2026
8 of 9 checks passed
xzxiaoshan added a commit that referenced this pull request Nov 12, 2026
#4149)

## Summary

Scanned the last 5 pages of PRs (#3941–#4147, 125 PRs): 14 had red CI,
and 9 of those failed on exactly one OS while the other OS stayed green
on the same commit — the classic `-T1C` parallel-build starvation
signature (the both-OS failures were compile/spotless issues and are out
of scope). This PR fixes every distinct flaky test class found that way,
plus two narrowly-scoped hardenings the fixes depend on.

| Test / class | Failed OS | Victim PRs | Evidence | Fix |
|---|---|---|---|---|
| `AguiMvcControllerTest#eventStreamSignals…` | ubuntu ×2 | #4112, #4143
| 5s latch deadline hit while sibling tests in the class ran 5–9s under
the same load | shared 30s await constant (all waits in the class share
the same executor starvation exposure) |
| `SubagentRunIdChainTest` (both methods) | windows ×3 | #4091, #4025,
#4142 | blocking read starved just past 10s (10.04–10.84s elapsed); same
test 0.414s on ubuntu | block budget 10s → 30s |
| `InboxMiddlewareTest#notificationReaches…` | ubuntu ×2 | #3991, #4093
| assertion matched the memory-consolidation prompt instead of the
reasoning request | `MockModel` recordings made thread-safe (see below)
|
| `GatewayEventsWebSocketTest#sameOrigin…` | windows ×2 | #4072, #4094 |
~0.1s clean close with no frames; job log shows the preceding 403'd
upstream upgrade left a dying pooled socket (`Connection prematurely
closed BEFORE opening handshake is complete`) that the next proxied
socket reused | stand-in control plane now answers rejected upgrades
with `Connection: close` so the gateway pool discards the socket |
| `TurnLeaseServiceTest#heartbeatErrors…` | windows | #4075 |
`await(70ms) isFalse` anchored to when the starved test thread resumes,
not to lease acquisition | bounds re-anchored to
elapsed-time-since-acquisition (fires within 2s, not before 120ms;
deadline 150ms, ticks 50ms) |
| `SandboxConnectorRedirectTest#commandWaits…` | windows | #4058 |
capability probe inherited the 200ms command-transport budget and died
at 199ms before any command was submitted | probe budget floor (see
CommandExecutor below) |
| `GracefulShutdownManager` singleton leak | local | found during
verification | `resetForTesting()` reset every field except `config`, so
a `PT0.1S` config leaked across tests and failed `defaultConfig`
whenever filesystem class order placed it after `shutdownTimeoutSignal`
| reset now also restores `GracefulShutdownConfig.DEFAULT` |

## Shared test-util fix

`MockModel` recorded calls from whichever thread drives the agent — the
turn thread and background memory maintenance — into a plain `ArrayList`
plus unsynchronized `int`/`last*` fields. Two concurrent adds race the
`elementData[size] / size++` update and can silently drop an entry; that
is exactly the #4093/#3991 signature (the reasoning request vanished,
only the post-call consolidation request survived). Recordings are now a
`CopyOnWriteArrayList` with `AtomicInteger`/`volatile` siblings —
order-preserving, atomic per add, stable to iterate while a call is in
flight. Complements the iteration fix proposed in #4133.

## Non-test changes (called out explicitly)

- **`CommandExecutor`** — the `/capabilities` pre-flight probe now uses
`max(configured per-attempt, 2s)` for its budgets. Strictly a widening:
identical for default (60s) and ≥2s configurations; only sub-2s configs
change, and only for the probe — command exchanges keep the configured
budget. Side benefit: the old code passed the same 200ms as the shared
exchange deadline, which made the intended `CAPABILITY_MAX_ATTEMPTS = 3`
retry dead code; the floor lets the retry actually run. The test-only
alternative (raising the test's 200ms config and the server delays to
match) would add ~1.5–2s of real test wall time, so the 2-line
production fix is the smaller change.
- **`GracefulShutdownManager.resetForTesting`** — one added line
restoring `config` to default, inside a method documented "Intended for
testing and demo purposes only" (no production callers; production code
never calls `setConfig`).

## Constraint compliance

- **No happy-path slowdown:** every widened number is a failure-path
deadline only; all awaits/latches return the moment the signal arrives,
and no sleeps were added (`TurnLeaseServiceTest` actually drops a forced
70ms wait).
- **Minimal widenings, anchored to measurements:** 5s→30s (deadline hit
twice; repo precedent from #3726 for CI-starvation waits), 10s→30s (3×
the observed 10.04–10.84s), probe floor 2s (10× the 199ms miss),
TurnLease window [120ms, 2s] (bug population ~50ms vs legitimate
≥150ms).

## Test plan

- [x] Full reactor `mvn -B -T2C clean verify` green locally (4m38s wall
clock; all seven fixed areas' suites green)
- [x] `JsonFileAgentStateStoreTest` (8 symlink cases) excluded locally
only — pre-existing Windows-symlink-privilege limitation, reproduced
identically on a pristine `main` baseline, unrelated to this diff
- [ ] CI on both OSes

Follow-up noted during review: the production control-plane hub behind
`/api/v1/events` lives outside this repo; if it also answers rejected
upgrades with a keep-alive 403 and closes, the gateway can still poison
a subsequent proxied socket in production — worth checking against the
real hub separately.
xzxiaoshan added a commit that referenced this pull request Nov 20, 2026
…#4274)

## Background

Swept the last 125 PRs (#4272→#4075) for single-OS CI failures under
`mvn -B -T1C clean verify` (one build OS red, the other green on the
same commit = flake suspect). Cross-PR repeats and main's own red run on
2026-11-19 (ubuntu, run 44516464414) pinpoints four still-broken test
classes; all fixes are test-side only (no `src/main` changes).

## Fixes and evidence

| Test class | Victims | Signature | Fix |
|---|---|---|---|
| `RocketMqExecutionTest` | #4182, #4192, #4103 + main run 44516464414
(2026-11-19, ubuntu) | `turn reaches SUCCEEDED did not become true
within 10s` while the turn kept progressing (modelCalls complete, acks
climbing, lastFailure=none) — deadline breakthrough under starvation,
not a lost turn | shared `waitUntil` deadline 10s→30s (repo tier
#3726/#3774) |
| `AgentScopeAdapterTest` | #4204 (same-commit re-run green = confirmed
flake), #4191, #4246 | `Timed out observing Turn` at 6.7–8.5s elapsed;
resume/recovery one step from terminal | `turn.await(5s)`→30s at all 3
sibling sites via `TURN_DEADLINE`, outer `get` budgets +5s margin |
| `WorkerRuntimeTest` | #4219, #4224, #4255 (windows) | (a) `Worker
lease lost` after 2.4s — 1s claim leases expired between claim and
release; (b) `renewed.await(5s)` missed at 6.5s while the recovery lane
was healthy; (c) `Interrupted sleep interrupted` —
`WorkerRuntime.process()` interrupts the calling thread on lease-renewal
failure and manual `tick()` runs it on the test thread | (a) claim
leases 1s→30s (staleness under test still comes from `release(ZERO)` +
re-claim); (b) latches 5s→30s; (c) raw `Thread.sleep`→interrupt-proof
`pause()` at 5 sites, mirroring the #4176 fix for the same signature in
`ProcessRecoveryTest` |
| `ChatSessionsTest.await` (shared with `ChatControllerTest`) | #4233,
#4182 (stuck-RUNNING at 40.8s/46.4s), #4268, #4163 (poll threw `Durable
database transaction failed`) | two surfaces of one cause: every
snapshot poll opens a writing sqlite transaction contending with the
runtime's own writes, and windows runners starve turns past 30s (same
file already measured 56.6s starvation and uses 120s elsewhere, #3726) |
deadline 30s→120s (aligned tier) + tolerate transient `UNAVAILABLE`
store exceptions while polling; persistent failure rethrows at the
deadline, FAILED-turn fast-fail unchanged |
| `CommandExecutorTest.missingExitCodeIsUnknown` | local -T2C full-repo
stress (2026-11-19; pristine-main baseline of the same class green) |
the 2s network budget fired on scheduler starvation before the instant
fake response was processed, misclassifying the failure as a deadline
miss instead of a missing exit code (2.97s elapsed) | budget 2s→30s for
this non-deadline-semantics test; the two deadline-semantics tests keep
their tight budgets |

## Constraint compliance

- Happy path zero cost: every change only extends failure-path deadlines
or hardens helpers; no new sleeps, no weakened assertions.
- Minimal widening anchored to measured data (each comment cites victims
+ measured values); 30s follows the repo's established deflake tier,
120s follows this file's own previously measured starvation tier.
- Structural hardening preferred: `pause()` helper, transient-lock
retry, lease decoupling from the tested invariant.
- No `src/main` changes.

## Observed but deliberately not fixed here

-
`ProcessRecoveryTest.replacementCollectsOriginalResultWithoutRepeatingEffect`
(#4214: `expected: 2 but was: 3`): recovery-semantics race (model re-run
without effect re-run after abrupt halt) — a product question for the
durable recovery work, not a deadline flake.
-
`JevEvidenceProcessorTest.filterFailureIsWithheldButRankFailureFollowsScoredEvidence`
(#4265: delivered `[]` on a 25×-slowed runner): root cause not
established; single occurrence.
- Already fixed upstream, victims predate the fix:
`AgentScopeAgentExecutorInputRequiredTest` (#4157/#4187/#4152 all
predate #4176's `BaseReActAgentRunner` change), `InboxMiddlewareTest`
(#4093 predates #3738), `HarnessAgentSubagentStreamEventsTest` (#4183
predates #2917).
- `SkillBoxTest$UploadContainment` quartet (#4201/#4202/#4212/#4229):
test does not exist on main (fork stack only); deterministic cross-drive
path bug, not load flakiness.
- #4184/#4185: both-OS compile breaks from dependency major bumps
(dependabot), out of scope.

Also applied during review: sibling sites with the identical measured
mechanism were widened in the same pass — the remaining 1s fixture claim
leases in `WorkerRuntimeTest` (fenced begin/update/release sequences,
same #4219 signature), the start/PAUSED 5s budgets in the same
`AgentScopeAdapterTest` method as the victims, and the 5s/4s observe
budgets in
`completeLocalBackendRunsNativeAgentWhileManagedObserverIsBlocked`.

## Test plan

- [x] Full local `mvn -B -T2C clean verify` green (stricter than CI's
-T1C). Locally excluded, each verified to fail identically on pristine
main on this machine (Windows/git-bash) while passing on CI:
`JsonFileAgentStateStoreTest` (symlink permissions), the
`agentscope-extensions-durable-sandbox` trio plus
`ToolInSandboxExampleTest`/`SandboxRoundTripTest` (sandbox shell heredoc
incompatible with local git-bash python3), and the
`AgentScopeAdapterTest`/`ProcessRecoveryTest`/`HarnessExternalToolProcessRecoveryTest`
trio (durable-adapter classes whose Windows runs are skipped on CI; the
same named tests fail on pristine main locally).
- [ ] CI green on both OS.
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.

[Bug]: Git Skill Marketplace fails to install skills due to incorrect .git directory detection

2 participants