refactor(background-task): consolidate ToolContextWithMetadata and resolveToolCallID#1860
Open
iyoda wants to merge 9 commits intocode-yeongyu:devfrom
Open
refactor(background-task): consolidate ToolContextWithMetadata and resolveToolCallID#1860iyoda wants to merge 9 commits intocode-yeongyu:devfrom
iyoda wants to merge 9 commits intocode-yeongyu:devfrom
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
There was a problem hiding this comment.
2 issues found across 59 files
Confidence score: 2/5
- High risk due to a severe package configuration problem:
package.jsonhas an invalid self-dependency with an unsatisfiable version constraint, which can break installs/builds. - There is some risk of runtime issues from missing error handling for malformed data types in
src/hooks/rules-injector/storage.ts. - Pay close attention to
package.jsonandsrc/hooks/rules-injector/storage.ts- dependency resolution failure and unhandled storage data types.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="package.json">
<violation number="1" location="package.json:65">
P0: Invalid self-dependency with unsatisfiable version constraint in package.json</violation>
</file>
<file name="src/hooks/rules-injector/storage.ts">
<violation number="1" location="src/hooks/rules-injector/storage.ts:23">
P2: Missing error handling for potentially malformed data types in storage file</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
package.json
Outdated
| "detect-libc": "^2.0.0", | ||
| "js-yaml": "^4.1.1", | ||
| "jsonc-parser": "^3.3.1", | ||
| "oh-my-opencode": "^3.5.5", |
There was a problem hiding this comment.
P0: Invalid self-dependency with unsatisfiable version constraint in package.json
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 65:
<comment>Invalid self-dependency with unsatisfiable version constraint in package.json</comment>
<file context>
@@ -62,6 +62,7 @@
"detect-libc": "^2.0.0",
"js-yaml": "^4.1.1",
"jsonc-parser": "^3.3.1",
+ "oh-my-opencode": "^3.5.5",
"picocolors": "^1.1.1",
"picomatch": "^4.0.2",
</file context>
bd05332 to
bd4c4cd
Compare
- Make model-name-matcher.ts the canonical source for fuzzyMatchModel and normalizeModelName - Export normalizeModelName from model-name-matcher.ts (was internal) - Remove duplicate implementations from model-availability.ts - Add re-exports in model-availability.ts for backward compatibility - All existing consumers continue to work via their import paths - Tests pass, typecheck clean, build succeeds
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Replace inline existsSync + readFileSync + JSON.parse + try/catch patterns with readJsonFile<T>(), and replace writeFileSync(path, JSON.stringify(data, null, 2)) with writeJsonFile(path, data, { ensureDir: true }). Consumers retain domain-specific logging and type conversions. Removes ensureCacheDir() helper from connected-providers-cache.ts as writeJsonFile handles directory creation.
Affected modules:
- src/shared/connected-providers-cache.ts (4 functions refactored)
- src/hooks/rules-injector/storage.ts (2 functions refactored)
- src/hooks/agent-usage-reminder/storage.ts (2 functions refactored)
- src/hooks/interactive-bash-session/storage.ts (2 functions refactored)
- src/shared/index.ts (added json-cache barrel export)
Net: -64 lines (removed 112, added 48)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Replace mkdirSync(path, { recursive: true }) with ensureDirectory(path)
- Remove redundant existsSync guards before directory creation
- Add barrel export to src/shared/index.ts
- Updated 13 production files across shared/, features/, cli/, and hooks/
- All tests, typecheck, and build pass
…solveToolCallID Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
bd4c4cd to
049c751
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consolidate duplicated
ToolContextWithMetadatatype definitions and extract a sharedresolveToolCallIDfunction withinsrc/tools/background-task/.Changes
src/tools/background-task/types.ts— AddedcallIDandtoolCallIdfields toToolContextWithMetadatasrc/tools/background-task/resolve-tool-call-id.ts(8 lines) — ExtractedresolveToolCallIDhelpercreate-background-task.ts— Removed inline type extension and duplicate resolution logiccreate-background-output.ts— Removed inline type extension and duplicate resolution logicNet: -12 lines (removed 26, added 14)
Verification
bun run typecheck✅bun test✅ (2693 pass, 0 fail)bun run build✅PR Stack
This is PR 9 of 9 (final) in the code deduplication refactor series. Depends on #1859.
Series Total Impact
Summary by cubic
Consolidates background-task tool context typing and call ID resolution, removes legacy modules, and centralizes shared utilities for duration formatting, message directory lookup, JSON I/O, and model matching. This removes duplicates and keeps behavior unchanged.
Written for commit 049c751. Summary will update on new commits.