Repository navigation
fix: stabilize web ui startup and reduce usage load #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
977dc0e
fix: stabilize web ui startup and reduce usage load
ymkiux 587d12d
test: align web ui vue asset assertion with production build
ymkiux dd17660
fix: keep startup probe from consuming init notice
ymkiux 4ebd49b
fix: harden session browsing and startup gating
ymkiux 53b5a0c
fix: resume session detail hydration after list load
awsldev 0259829
fix: fallback preview for huge session lines
awsldev c4970ac
fix(web-ui): unstick large session browser pagination
awsldev 96af1f5
fix(cli): preserve clipped fast session previews
awsldev 3ccc855
fix(web-ui): keep session loads lightweight and safe
awsldev 9784ee6
fix(cli): avoid shelling out with web ui urls
awsldev 744cf45
fix(cli): normalize full-scan fast previews
awsldev 32cdd35
test(e2e): cover session tab entry hydration path
awsldev 605723a
fix(web-ui): cap huge-line session previews
awsldev 57b45c0
fix(web-ui): stop session tab preview from freezing
awsldev f298304
fix(web-ui): add native session load debug alerts
awsldev dc6d587
fix(web-ui): add lightweight usage totals
awsldev 74fc765
fix(web-ui): compact usage summary totals
awsldev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import assert from 'assert'; | ||
| import path from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
| import { createRequire } from 'module'; | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
| const require = createRequire(import.meta.url); | ||
| const fs = require('fs'); | ||
|
|
||
| const cliPath = path.join(__dirname, '..', '..', 'cli.js'); | ||
| const cliContent = fs.readFileSync(cliPath, 'utf-8'); | ||
|
|
||
| function extractFunction(content, funcName) { | ||
| const regex = new RegExp(`async function ${funcName}\\([^)]*\\)\\s*\\{[\\s\\S]*?^\\}`, 'm'); | ||
| const match = content.match(regex); | ||
| if (!match) { | ||
| throw new Error(`Function ${funcName} not found`); | ||
| } | ||
| return match[0]; | ||
| } | ||
|
|
||
| const listSessionUsageSrc = extractFunction(cliContent, 'listSessionUsage'); | ||
|
|
||
| function instantiateListSessionUsage(bindings = {}) { | ||
| const bindingNames = Object.keys(bindings); | ||
| const bindingValues = Object.values(bindings); | ||
| return Function(...bindingNames, `${listSessionUsageSrc}\nreturn listSessionUsage;`)(...bindingValues); | ||
| } | ||
|
|
||
| test('listSessionUsage uses lightweight session listing without exact hydration', async () => { | ||
| const calls = []; | ||
| const listAllSessions = async (params) => { | ||
| calls.push({ type: 'listAllSessions', params }); | ||
| return [ | ||
| { | ||
| source: 'codex', | ||
| sessionId: 'sess-1', | ||
| messageCount: 12, | ||
| __messageCountExact: false | ||
| } | ||
| ]; | ||
| }; | ||
| const listAllSessionsData = async () => { | ||
| calls.push({ type: 'listAllSessionsData' }); | ||
| throw new Error('should not call listAllSessionsData'); | ||
| }; | ||
| const listSessionUsage = instantiateListSessionUsage({ | ||
| MAX_SESSION_LIST_SIZE: 300, | ||
| listAllSessions, | ||
| listAllSessionsData | ||
| }); | ||
|
|
||
| const result = await listSessionUsage({ | ||
| source: 'all', | ||
| limit: 200, | ||
| forceRefresh: true | ||
| }); | ||
|
|
||
| assert.deepStrictEqual( | ||
| calls, | ||
| [ | ||
| { | ||
| type: 'listAllSessions', | ||
| params: { | ||
| source: 'all', | ||
| limit: 200, | ||
| forceRefresh: true | ||
| } | ||
| } | ||
| ] | ||
| ); | ||
| assert.deepStrictEqual(result, [ | ||
| { | ||
| source: 'codex', | ||
| sessionId: 'sess-1', | ||
| messageCount: 12 | ||
| } | ||
| ]); | ||
| }); | ||
|
|
||
| test('listSessionUsage normalizes source and default limit for lightweight usage aggregation', async () => { | ||
| const calls = []; | ||
| const listAllSessions = async (params) => { | ||
| calls.push(params); | ||
| return []; | ||
| }; | ||
| const listSessionUsage = instantiateListSessionUsage({ | ||
| MAX_SESSION_LIST_SIZE: 300, | ||
| listAllSessions, | ||
| listAllSessionsData: async () => { | ||
| throw new Error('should not call listAllSessionsData'); | ||
| } | ||
| }); | ||
|
|
||
| await listSessionUsage({ | ||
| source: 'invalid', | ||
| limit: '9999', | ||
| forceRefresh: 1 | ||
| }); | ||
| await listSessionUsage({}); | ||
|
|
||
| assert.deepStrictEqual(calls, [ | ||
| { | ||
| source: 'all', | ||
| limit: 300, | ||
| forceRefresh: true | ||
| }, | ||
| { | ||
| source: 'all', | ||
| limit: 200, | ||
| forceRefresh: false | ||
| } | ||
| ]); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.